diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:14:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:14:34 +0300 |
commit | c8512eb431a82f6de7c3d6e5114d280f2d36df99 (patch) | |
tree | d4071aef8c829ed4d69cd72eacc1e6f5f7ea9323 /app/assets/javascripts/boards | |
parent | 20b517258a70b3bd1cb0d17cb77565a82ce098b5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/boards')
5 files changed, 21 insertions, 102 deletions
diff --git a/app/assets/javascripts/boards/components/board_filtered_search.vue b/app/assets/javascripts/boards/components/board_filtered_search.vue index 45192b5304a..95d4fd5bc0a 100644 --- a/app/assets/javascripts/boards/components/board_filtered_search.vue +++ b/app/assets/javascripts/boards/components/board_filtered_search.vue @@ -151,10 +151,10 @@ export default { }); } - if (this.filterParams['not[iteration_id]']) { + if (this.filterParams['not[iterationId]']) { filteredSearchValue.push({ - type: 'iteration_id', - value: { data: this.filterParams['not[iteration_id]'], operator: '!=' }, + type: 'iteration', + value: { data: this.filterParams['not[iterationId]'], operator: '!=' }, }); } diff --git a/app/assets/javascripts/boards/filtered_search_boards.js b/app/assets/javascripts/boards/filtered_search_boards.js deleted file mode 100644 index 72586970008..00000000000 --- a/app/assets/javascripts/boards/filtered_search_boards.js +++ /dev/null @@ -1,81 +0,0 @@ -import { transformBoardConfig } from 'ee_else_ce/boards/boards_util'; -import FilteredSearchManager from 'ee_else_ce/filtered_search/filtered_search_manager'; -import IssuableFilteredSearchTokenKeys from 'ee_else_ce/filtered_search/issuable_filtered_search_token_keys'; -import { updateHistory } from '~/lib/utils/url_utility'; -import FilteredSearchContainer from '../filtered_search/container'; -import vuexstore from './stores'; - -export default class FilteredSearchBoards extends FilteredSearchManager { - constructor(store, updateUrl = false, cantEdit = []) { - super({ - page: 'boards', - isGroupDecendent: true, - stateFiltersSelector: '.issues-state-filters', - isGroup: IS_EE, - useDefaultState: false, - filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, - }); - - this.store = store; - this.updateUrl = updateUrl; - - // Issue boards is slightly different, we handle all the requests async - // instead or reloading the page, we just re-fire the list ajax requests - this.isHandledAsync = true; - this.cantEdit = cantEdit.filter((i) => typeof i === 'string'); - this.cantEditWithValue = cantEdit.filter((i) => typeof i === 'object'); - - if (vuexstore.state.boardConfig) { - const boardConfigPath = transformBoardConfig(vuexstore.state.boardConfig); - // TODO Refactor: https://gitlab.com/gitlab-org/gitlab/-/issues/329274 - // here we are using "window.location.search" as a temporary store - // only to unpack the params and do another validation inside - // 'performSearch' and 'setFilter' vuex actions. - if (boardConfigPath !== '') { - const filterPath = window.location.search ? `${window.location.search}&` : '?'; - updateHistory({ - url: `${filterPath}${transformBoardConfig(vuexstore.state.boardConfig)}`, - }); - } - } - } - - updateObject(path) { - const groupByParam = new URLSearchParams(window.location.search).get('group_by'); - this.store.path = `${path.substr(1)}${groupByParam ? `&group_by=${groupByParam}` : ''}`; - - updateHistory({ - url: `?${path.substr(1)}${groupByParam ? `&group_by=${groupByParam}` : ''}`, - }); - vuexstore.dispatch('performSearch'); - } - - removeTokens() { - const tokens = FilteredSearchContainer.container.querySelectorAll('.js-visual-token'); - - // Remove all the tokens as they will be replaced by the search manager - [].forEach.call(tokens, (el) => { - el.parentNode.removeChild(el); - }); - - this.filteredSearchInput.value = ''; - } - - updateTokens() { - this.removeTokens(); - - this.loadSearchParamsFromURL(); - - // Get the placeholder back if search is empty - this.filteredSearchInput.dispatchEvent(new Event('input')); - } - - canEdit(tokenName, tokenValue) { - if (this.cantEdit.includes(tokenName)) return false; - return ( - this.cantEditWithValue.findIndex( - (token) => token.name === tokenName && token.value === tokenValue, - ) === -1 - ); - } -} diff --git a/app/assets/javascripts/boards/graphql.js b/app/assets/javascripts/boards/graphql.js index 95863d4d5ac..d066a5d002e 100644 --- a/app/assets/javascripts/boards/graphql.js +++ b/app/assets/javascripts/boards/graphql.js @@ -10,5 +10,6 @@ export const gqlClient = createDefaultClient( return object.__typename === 'BoardList' ? object.iid : defaultDataIdFromObject(object); }, }, + batchMax: 2, }, ); diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index f6073f9d981..d2a64246aa7 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -8,8 +8,6 @@ import BoardAddNewColumnTrigger from '~/boards/components/board_add_new_column_t import BoardApp from '~/boards/components/board_app.vue'; import '~/boards/filters/due_date_filters'; import { issuableTypes } from '~/boards/constants'; -import eventHub from '~/boards/eventhub'; -import FilteredSearchBoards from '~/boards/filtered_search_boards'; import initBoardsFilteredSearch from '~/boards/mount_filtered_search_issue_boards'; import store from '~/boards/stores'; import toggleFocusMode from '~/boards/toggle_focus'; @@ -50,17 +48,6 @@ function mountBoardApp(el) { }, }); - if (!gon?.features?.issueBoardsFilteredSearch) { - // Warning: FilteredSearchBoards has an implicit dependency on the Vuex state 'boardConfig' - // Improve this situation in the future. - const filterManager = new FilteredSearchBoards({ path: '' }, true, []); - filterManager.setup(); - - eventHub.$on('updateTokens', () => { - filterManager.updateTokens(); - }); - } - // eslint-disable-next-line no-new new Vue({ el, @@ -110,10 +97,14 @@ export default () => { } }); - if (gon?.features?.issueBoardsFilteredSearch) { - const { releasesFetchPath } = $boardApp.dataset; - initBoardsFilteredSearch(apolloProvider, isLoggedIn(), releasesFetchPath); - } + const { releasesFetchPath, epicFeatureAvailable, iterationFeatureAvailable } = $boardApp.dataset; + initBoardsFilteredSearch( + apolloProvider, + isLoggedIn(), + releasesFetchPath, + parseBoolean(epicFeatureAvailable), + parseBoolean(iterationFeatureAvailable), + ); mountBoardApp($boardApp); diff --git a/app/assets/javascripts/boards/mount_filtered_search_issue_boards.js b/app/assets/javascripts/boards/mount_filtered_search_issue_boards.js index 327fb9ba8d7..bb659eb075a 100644 --- a/app/assets/javascripts/boards/mount_filtered_search_issue_boards.js +++ b/app/assets/javascripts/boards/mount_filtered_search_issue_boards.js @@ -4,7 +4,13 @@ import store from '~/boards/stores'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { queryToObject } from '~/lib/utils/url_utility'; -export default (apolloProvider, isSignedIn, releasesFetchPath) => { +export default ( + apolloProvider, + isSignedIn, + releasesFetchPath, + epicFeatureAvailable, + iterationFeatureAvailable, +) => { const el = document.getElementById('js-issue-board-filtered-search'); const rawFilterParams = queryToObject(window.location.search, { gatherArrays: true }); @@ -23,6 +29,8 @@ export default (apolloProvider, isSignedIn, releasesFetchPath) => { initialFilterParams, isSignedIn, releasesFetchPath, + epicFeatureAvailable, + iterationFeatureAvailable, }, store, // TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/324094 apolloProvider, |