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-03-04 18:16:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-04 18:16:11 +0300
commit73e15fde38825a490903ef88933d8896585f3008 (patch)
tree9540de3751be70a2f101185c8f830452d3a2ad1d /app/assets/javascripts/header_search
parent7150920cea6cdd82b9409d5757fa26dac66876d1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/header_search')
-rw-r--r--app/assets/javascripts/header_search/components/header_search_default_items.vue4
-rw-r--r--app/assets/javascripts/header_search/store/getters.js26
2 files changed, 17 insertions, 13 deletions
diff --git a/app/assets/javascripts/header_search/components/header_search_default_items.vue b/app/assets/javascripts/header_search/components/header_search_default_items.vue
index 53e63bc6cca..04deaba7b0f 100644
--- a/app/assets/javascripts/header_search/components/header_search_default_items.vue
+++ b/app/assets/javascripts/header_search/components/header_search_default_items.vue
@@ -24,8 +24,8 @@ export default {
...mapGetters(['defaultSearchOptions']),
sectionHeader() {
return (
- this.searchContext.project?.name ||
- this.searchContext.group?.name ||
+ this.searchContext?.project?.name ||
+ this.searchContext?.group?.name ||
this.$options.i18n.allGitLab
);
},
diff --git a/app/assets/javascripts/header_search/store/getters.js b/app/assets/javascripts/header_search/store/getters.js
index a1348a8aa3f..adaacc6ecf0 100644
--- a/app/assets/javascripts/header_search/store/getters.js
+++ b/app/assets/javascripts/header_search/store/getters.js
@@ -17,9 +17,10 @@ export const searchQuery = (state) => {
{
search: state.search,
nav_source: 'navbar',
- project_id: state.searchContext.project?.id,
- group_id: state.searchContext.group?.id,
+ project_id: state.searchContext?.project?.id,
+ group_id: state.searchContext?.group?.id,
scope: state.searchContext?.scope,
+ snippets: state.searchContext?.for_snippets ? true : null,
},
isNil,
);
@@ -31,7 +32,7 @@ export const autocompleteQuery = (state) => {
const query = omitBy(
{
term: state.search,
- project_id: state.searchContext.project?.id,
+ project_id: state.searchContext?.project?.id,
project_ref: state.searchContext?.ref,
},
isNil,
@@ -42,16 +43,16 @@ export const autocompleteQuery = (state) => {
export const scopedIssuesPath = (state) => {
return (
- state.searchContext.project_metadata?.issues_path ||
- state.searchContext.group_metadata?.issues_path ||
+ state.searchContext?.project_metadata?.issues_path ||
+ state.searchContext?.group_metadata?.issues_path ||
state.issuesPath
);
};
export const scopedMRPath = (state) => {
return (
- state.searchContext.project_metadata?.mr_path ||
- state.searchContext.group_metadata?.mr_path ||
+ state.searchContext?.project_metadata?.mr_path ||
+ state.searchContext?.group_metadata?.mr_path ||
state.mrPath
);
};
@@ -96,6 +97,7 @@ export const projectUrl = (state) => {
project_id: state.searchContext?.project?.id,
group_id: state.searchContext?.group?.id,
scope: state.searchContext?.scope,
+ snippets: state.searchContext?.for_snippets ? true : null,
},
isNil,
);
@@ -110,6 +112,7 @@ export const groupUrl = (state) => {
nav_source: 'navbar',
group_id: state.searchContext?.group?.id,
scope: state.searchContext?.scope,
+ snippets: state.searchContext?.for_snippets ? true : null,
},
isNil,
);
@@ -123,6 +126,7 @@ export const allUrl = (state) => {
search: state.search,
nav_source: 'navbar',
scope: state.searchContext?.scope,
+ snippets: state.searchContext?.for_snippets ? true : null,
},
isNil,
);
@@ -133,19 +137,19 @@ export const allUrl = (state) => {
export const scopedSearchOptions = (state, getters) => {
const options = [];
- if (state.searchContext.project) {
+ if (state.searchContext?.project) {
options.push({
html_id: 'scoped-in-project',
- scope: state.searchContext.project.name,
+ scope: state.searchContext?.project.name,
description: MSG_IN_PROJECT,
url: getters.projectUrl,
});
}
- if (state.searchContext.group) {
+ if (state.searchContext?.group) {
options.push({
html_id: 'scoped-in-group',
- scope: state.searchContext.group.name,
+ scope: state.searchContext?.group.name,
description: MSG_IN_GROUP,
url: getters.groupUrl,
});