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>2022-04-20 13:00:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 13:00:54 +0300
commit3cccd102ba543e02725d247893729e5c73b38295 (patch)
treef36a04ec38517f5deaaacb5acc7d949688d1e187 /app/assets/javascripts/search
parent205943281328046ef7b4528031b90fbda70c75ac (diff)
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/assets/javascripts/search')
-rw-r--r--app/assets/javascripts/search/store/actions.js34
-rw-r--r--app/assets/javascripts/search/store/utils.js2
-rw-r--r--app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue4
3 files changed, 23 insertions, 17 deletions
diff --git a/app/assets/javascripts/search/store/actions.js b/app/assets/javascripts/search/store/actions.js
index a6af5644681..40513a7f363 100644
--- a/app/assets/javascripts/search/store/actions.js
+++ b/app/assets/javascripts/search/store/actions.js
@@ -18,31 +18,35 @@ export const fetchGroups = ({ commit }, search) => {
});
};
-export const fetchProjects = ({ commit, state }, search) => {
+export const fetchProjects = ({ commit, state }, search, emptyCallback = () => {}) => {
commit(types.REQUEST_PROJECTS);
const groupId = state.query?.group_id;
- const callback = (data) => {
- if (data) {
- commit(types.RECEIVE_PROJECTS_SUCCESS, data);
- } else {
- createFlash({ message: __('There was an error fetching projects') });
- commit(types.RECEIVE_PROJECTS_ERROR);
- }
+
+ const handleCatch = () => {
+ createFlash({ message: __('There was an error fetching projects') });
+ commit(types.RECEIVE_PROJECTS_ERROR);
+ };
+ const handleSuccess = ({ data }) => {
+ commit(types.RECEIVE_PROJECTS_SUCCESS, data);
};
if (groupId) {
- // TODO (https://gitlab.com/gitlab-org/gitlab/-/issues/323331): For errors `createFlash` is called twice; in `callback` and in `Api.groupProjects`
Api.groupProjects(
groupId,
search,
- { order_by: 'similarity', with_shared: false, include_subgroups: true },
- callback,
- );
+ {
+ order_by: 'similarity',
+ with_shared: false,
+ include_subgroups: true,
+ },
+ emptyCallback,
+ true,
+ )
+ .then(handleSuccess)
+ .catch(handleCatch);
} else {
// The .catch() is due to the API method not handling a rejection properly
- Api.projects(search, { order_by: 'similarity' }, callback).catch(() => {
- callback();
- });
+ Api.projects(search, { order_by: 'similarity' }).then(handleSuccess).catch(handleCatch);
}
};
diff --git a/app/assets/javascripts/search/store/utils.js b/app/assets/javascripts/search/store/utils.js
index 6b56ff0b5e5..f8198017bf8 100644
--- a/app/assets/javascripts/search/store/utils.js
+++ b/app/assets/javascripts/search/store/utils.js
@@ -1,4 +1,4 @@
-import AccessorUtilities from '../../lib/utils/accessor';
+import AccessorUtilities from '~/lib/utils/accessor';
import { MAX_FREQUENT_ITEMS, MAX_FREQUENCY, SIDEBAR_PARAMS } from './constants';
function extractKeys(object, keyList) {
diff --git a/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue b/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue
index 42d6444e690..a4254a355a2 100644
--- a/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue
+++ b/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue
@@ -2,6 +2,7 @@
import { GlDropdownItem, GlAvatar, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import highlight from '~/lib/utils/highlight';
import { truncateNamespace } from '~/lib/utils/text_utility';
+import { AVATAR_SHAPE_OPTION_RECT } from '~/vue_shared/constants';
export default {
name: 'SearchableDropdownItem',
@@ -46,6 +47,7 @@ export default {
return highlight(this.item[this.name], this.searchText);
},
},
+ AVATAR_SHAPE_OPTION_RECT,
};
</script>
@@ -61,7 +63,7 @@ export default {
:src="item.avatar_url"
:entity-id="item.id"
:entity-name="item[name]"
- shape="rect"
+ :shape="$options.AVATAR_SHAPE_OPTION_RECT"
:size="32"
/>
<div class="gl-display-flex gl-flex-direction-column">