Skip to content
代码片段 群组 项目
未验证 提交 748a876c 编辑于 作者: Enrique Alcántara's avatar Enrique Alcántara 提交者: GitLab
浏览文件

Merge branch...

Merge branch '437860-orphaned-properties-in-label-filter-on-the-advanced-search-page' into 'master' 

Orphaned properties in label filter

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/142407



Merged-by: default avatarEnrique Alcántara <ealcantara@gitlab.com>
Approved-by: default avatarElwyn Benson <ebenson@gitlab.com>
Approved-by: default avatarEnrique Alcántara <ealcantara@gitlab.com>
Co-authored-by: default avatarTomas Bulva <tbulva@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -15,8 +15,6 @@ import { mapActions, mapState, mapGetters } from 'vuex'; ...@@ -15,8 +15,6 @@ import { mapActions, mapState, mapGetters } from 'vuex';
import { uniq } from 'lodash'; import { uniq } from 'lodash';
import { rgbFromHex } from '@gitlab/ui/dist/utils/utils'; import { rgbFromHex } from '@gitlab/ui/dist/utils/utils';
import { slugify } from '~/lib/utils/text_utility'; import { slugify } from '~/lib/utils/text_utility';
import { isLoggedIn } from '~/lib/utils/common_utils';
import { sprintf } from '~/locale';
import DropdownKeyboardNavigation from '~/vue_shared/components/dropdown_keyboard_navigation.vue'; import DropdownKeyboardNavigation from '~/vue_shared/components/dropdown_keyboard_navigation.vue';
...@@ -52,7 +50,6 @@ export default { ...@@ -52,7 +50,6 @@ export default {
return { return {
currentFocusIndex: SEARCH_BOX_INDEX, currentFocusIndex: SEARCH_BOX_INDEX,
isFocused: false, isFocused: false,
isLoggedIn: isLoggedIn(),
}; };
}, },
i18n: I18N, i18n: I18N,
...@@ -65,31 +62,7 @@ export default { ...@@ -65,31 +62,7 @@ export default {
'appliedSelectedLabels', 'appliedSelectedLabels',
'unselectedLabels', 'unselectedLabels',
'unappliedNewLabels', 'unappliedNewLabels',
'labelAggregationBuckets',
]), ]),
searchInputDescribeBy() {
if (this.isLoggedIn) {
return this.$options.i18n.SEARCH_INPUT_DESCRIBE_BY_WITH_DROPDOWN;
}
return this.$options.i18n.SEARCH_INPUT_DESCRIBE_BY_NO_DROPDOWN;
},
dropdownResultsDescription() {
if (!('showSearchDropdown' in this)) {
return ''; // This allows aria-live to see register an update when the dropdown is shown
}
if ('showDefaultItems' in this) {
return sprintf(this.$options.i18n.SEARCH_DESCRIBED_BY_DEFAULT, {
count: this.filteredLabels.length,
});
}
return 'loading' in this
? this.$options.i18n.SEARCH_RESULTS_LOADING
: sprintf(this.$options.i18n.SEARCH_DESCRIBED_BY_UPDATED, {
count: this.filteredLabels.length,
});
},
currentFocusedOption() { currentFocusedOption() {
return this.filteredLabels[this.currentFocusIndex] || null; return this.filteredLabels[this.currentFocusIndex] || null;
}, },
...@@ -98,12 +71,6 @@ export default { ...@@ -98,12 +71,6 @@ export default {
this.currentFocusedOption?.title || 'undefined-title', this.currentFocusedOption?.title || 'undefined-title',
)}`; )}`;
}, },
defaultIndex() {
if ('showDefaultItems' in this) {
return SEARCH_BOX_INDEX;
}
return FIRST_DROPDOWN_INDEX;
},
hasSelectedLabels() { hasSelectedLabels() {
return this.filteredAppliedSelectedLabels?.length > 0; return this.filteredAppliedSelectedLabels?.length > 0;
}, },
...@@ -217,6 +184,9 @@ export default { ...@@ -217,6 +184,9 @@ export default {
@close="onLabelClose" @close="onLabelClose"
/> />
</div> </div>
<span :id="$options.SEARCH_INPUT_DESCRIPTION" role="region" class="gl-sr-only">{{
$options.i18n.DESCRIBE_LABEL_FILTER_INPUT
}}</span>
<gl-search-box-by-type <gl-search-box-by-type
ref="searchLabelInputBox" ref="searchLabelInputBox"
v-model="searchLabels" v-model="searchLabels"
...@@ -228,9 +198,6 @@ export default { ...@@ -228,9 +198,6 @@ export default {
@focusin="openDropdown" @focusin="openDropdown"
@keydown.esc="closeDropdown" @keydown.esc="closeDropdown"
/> />
<span :id="$options.SEARCH_INPUT_DESCRIPTION" role="region" class="gl-sr-only">{{
searchInputDescribeBy
}}</span>
<span <span
role="region" role="region"
:data-testid="$options.SEARCH_RESULTS_DESCRIPTION" :data-testid="$options.SEARCH_RESULTS_DESCRIPTION"
...@@ -238,7 +205,7 @@ export default { ...@@ -238,7 +205,7 @@ export default {
aria-live="polite" aria-live="polite"
aria-atomic="true" aria-atomic="true"
> >
{{ dropdownResultsDescription }} {{ $options.i18n.DESCRIBE_LABEL_FILTER }}
</span> </span>
<div <div
v-if="isFocused" v-if="isFocused"
...@@ -251,7 +218,7 @@ export default { ...@@ -251,7 +218,7 @@ export default {
v-model="currentFocusIndex" v-model="currentFocusIndex"
:max="filteredLabels.length - 1" :max="filteredLabels.length - 1"
:min="$options.FIRST_DROPDOWN_INDEX" :min="$options.FIRST_DROPDOWN_INDEX"
:default-index="defaultIndex" :default-index="$options.FIRST_DROPDOWN_INDEX"
:enable-cycle="true" :enable-cycle="true"
/> />
<div v-if="!aggregations.error && filteredLabels.length > 0"> <div v-if="!aggregations.error && filteredLabels.length > 0">
......
...@@ -12,16 +12,14 @@ export const ALL_GITLAB = __('All GitLab'); ...@@ -12,16 +12,14 @@ export const ALL_GITLAB = __('All GitLab');
export const PLACES = s__('GlobalSearch|Places'); export const PLACES = s__('GlobalSearch|Places');
export const COMMAND_PALETTE = s__('GlobalSearch|Command palette'); export const COMMAND_PALETTE = s__('GlobalSearch|Command palette');
export const DESCRIBE_LABEL_FILTER = s__('GlobalSearch|List of filtered labels.');
export const DESCRIBE_LABEL_FILTER_INPUT = s__('GlobalSearch|Type to filter labels.');
export const SEARCH_DESCRIBED_BY_DEFAULT = s__( export const SEARCH_DESCRIBED_BY_DEFAULT = s__(
'GlobalSearch|%{count} default results provided. Use the up and down arrow keys to navigate search results list.', 'GlobalSearch|%{count} default results provided. Use the up and down arrow keys to navigate search results list.',
); );
export const SEARCH_DESCRIBED_BY_WITH_RESULTS = s__( export const SEARCH_DESCRIBED_BY_WITH_RESULTS = s__(
'GlobalSearch|Type for new suggestions to appear below.', 'GlobalSearch|Type for new suggestions to appear below.',
); );
export const SEARCH_INPUT_DESCRIBE_BY_NO_DROPDOWN = s__(
'GlobalSearch|Type and press the enter key to submit search.',
);
export const SEARCH_INPUT_DESCRIBE_BY_WITH_DROPDOWN = SEARCH_DESCRIBED_BY_WITH_RESULTS;
export const SEARCH_DESCRIBED_BY_UPDATED = s__( export const SEARCH_DESCRIBED_BY_UPDATED = s__(
'GlobalSearch|Results updated. %{count} results available. Use the up and down arrow keys to navigate search results list, or ENTER to submit.', 'GlobalSearch|Results updated. %{count} results available. Use the up and down arrow keys to navigate search results list, or ENTER to submit.',
); );
...@@ -114,10 +112,10 @@ export const I18N = { ...@@ -114,10 +112,10 @@ export const I18N = {
SEARCH_DESCRIBED_BY_DEFAULT, SEARCH_DESCRIBED_BY_DEFAULT,
SEARCH_RESULTS_LOADING, SEARCH_RESULTS_LOADING,
SEARCH_DESCRIBED_BY_UPDATED, SEARCH_DESCRIBED_BY_UPDATED,
SEARCH_INPUT_DESCRIBE_BY_WITH_DROPDOWN,
SEARCH_INPUT_DESCRIBE_BY_NO_DROPDOWN,
SEARCH_LABELS, SEARCH_LABELS,
DROPDOWN_HEADER, DROPDOWN_HEADER,
AGGREGATIONS_ERROR_MESSAGE, AGGREGATIONS_ERROR_MESSAGE,
NO_LABELS_FOUND, NO_LABELS_FOUND,
DESCRIBE_LABEL_FILTER,
DESCRIBE_LABEL_FILTER_INPUT,
}; };
...@@ -22961,6 +22961,9 @@ msgstr "" ...@@ -22961,6 +22961,9 @@ msgstr ""
msgid "GlobalSearch|Language" msgid "GlobalSearch|Language"
msgstr "" msgstr ""
   
msgid "GlobalSearch|List of filtered labels."
msgstr ""
msgid "GlobalSearch|Merge requests I've created" msgid "GlobalSearch|Merge requests I've created"
msgstr "" msgstr ""
   
...@@ -23063,10 +23066,10 @@ msgstr "" ...@@ -23063,10 +23066,10 @@ msgstr ""
msgid "GlobalSearch|Type %{kbdOpen}/%{kbdClose} to search" msgid "GlobalSearch|Type %{kbdOpen}/%{kbdClose} to search"
msgstr "" msgstr ""
   
msgid "GlobalSearch|Type and press the enter key to submit search." msgid "GlobalSearch|Type for new suggestions to appear below."
msgstr "" msgstr ""
   
msgid "GlobalSearch|Type for new suggestions to appear below." msgid "GlobalSearch|Type to filter labels."
msgstr "" msgstr ""
   
msgid "GlobalSearch|Users" msgid "GlobalSearch|Users"
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册