Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-08-04 09:11:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-04 09:11:29 +0300
commitdebd8f45f8613aa1ac63362c86a7d8137df173a4 (patch)
tree4074b6c6ce1a6e09a486e553d9d985fa097004ae /app/assets/javascripts/vue_shared/components
parentf830a15de6991a6768990aab9a4457b06718d29e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/components')
-rw-r--r--app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js7
-rw-r--r--app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js6
2 files changed, 10 insertions, 3 deletions
diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js b/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js
index 39fd3d62c3b..2b3d1b2c1f5 100644
--- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js
+++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js
@@ -52,6 +52,13 @@ export const SORT_DIRECTION = {
export const FILTERED_SEARCH_TERM = 'filtered-search-term';
+export const TOKEN_EMPTY_SEARCH_TERM = {
+ type: FILTERED_SEARCH_TERM,
+ value: {
+ data: '',
+ },
+};
+
export const TOKEN_TITLE_APPROVED_BY = __('Approved-By');
export const TOKEN_TITLE_ASSIGNEE = s__('SearchToken|Assignee');
export const TOKEN_TITLE_AUTHOR = __('Author');
diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js
index c08dc13d242..96a0ca9eb01 100644
--- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js
+++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js
@@ -1,4 +1,4 @@
-import { isEmpty, uniqWith, isEqual } from 'lodash';
+import { isEmpty, uniqWith, isEqual, isString } from 'lodash';
import AccessorUtilities from '~/lib/utils/accessor';
import { queryToObject } from '~/lib/utils/url_utility';
@@ -159,7 +159,7 @@ function filteredSearchTermValue(value) {
* '?myFilterName=foo'
* gets translated into:
* { myFilterName: { value: 'foo', operator: '=' } }
- * @param {String} query URL query string, e.g. from `window.location.search`
+ * @param {String|Object} query URL query string or object, e.g. from `window.location.search` or `this.$route.query`
* @param {Object} options
* @param {Object} options
* @param {String} [options.filteredSearchTermKey] if set, a FILTERED_SEARCH_TERM filter is created to this parameter. `'search'` is suggested
@@ -167,7 +167,7 @@ function filteredSearchTermValue(value) {
* @return {Object} filter object with filter names and their values
*/
export function urlQueryToFilter(query = '', { filteredSearchTermKey, filterNamesAllowList } = {}) {
- const filters = queryToObject(query, { gatherArrays: true });
+ const filters = isString(query) ? queryToObject(query, { gatherArrays: true }) : query;
return Object.keys(filters).reduce((memo, key) => {
const value = filters[key];
if (!value) {