diff options
Diffstat (limited to 'app/assets/javascripts/search/sidebar/components')
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/confidentiality_filter/data.js | 36 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/confidentiality_filter/index.vue (renamed from app/assets/javascripts/search/sidebar/components/confidentiality_filter.vue) | 7 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/issues_filters.vue | 15 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/results_filters.vue | 10 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/status_filter.vue | 25 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/status_filter/data.js | 42 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/status_filter/index.vue | 24 |
7 files changed, 120 insertions, 39 deletions
diff --git a/app/assets/javascripts/search/sidebar/components/confidentiality_filter/data.js b/app/assets/javascripts/search/sidebar/components/confidentiality_filter/data.js new file mode 100644 index 00000000000..ecb63ed9eea --- /dev/null +++ b/app/assets/javascripts/search/sidebar/components/confidentiality_filter/data.js @@ -0,0 +1,36 @@ +import { __ } from '~/locale'; + +const header = __('Confidentiality'); + +const filters = { + ANY: { + label: __('Any'), + value: null, + }, + CONFIDENTIAL: { + label: __('Confidential'), + value: 'yes', + }, + NOT_CONFIDENTIAL: { + label: __('Not confidential'), + value: 'no', + }, +}; + +const scopes = { + ISSUES: 'issues', +}; + +const filterByScope = { + [scopes.ISSUES]: [filters.ANY, filters.CONFIDENTIAL, filters.NOT_CONFIDENTIAL], +}; + +const filterParam = 'confidential'; + +export const confidentialFilterData = { + header, + filters, + scopes, + filterByScope, + filterParam, +}; diff --git a/app/assets/javascripts/search/sidebar/components/confidentiality_filter.vue b/app/assets/javascripts/search/sidebar/components/confidentiality_filter/index.vue index 2a7988cd4c6..7909aa9234b 100644 --- a/app/assets/javascripts/search/sidebar/components/confidentiality_filter.vue +++ b/app/assets/javascripts/search/sidebar/components/confidentiality_filter/index.vue @@ -1,8 +1,8 @@ <script> import { mapState } from 'vuex'; -import { confidentialFilterData } from '../constants/confidential_filter_data'; -import { HR_DEFAULT_CLASSES } from '../constants'; -import RadioFilter from './radio_filter.vue'; +import { HR_DEFAULT_CLASSES } from '../../constants'; +import RadioFilter from '../radio_filter.vue'; +import { confidentialFilterData } from './data'; export default { name: 'ConfidentialityFilter', @@ -20,6 +20,5 @@ export default { <template> <div> <radio-filter :filter-data="$options.confidentialFilterData" /> - <hr v-if="!useNewNavigation" :class="$options.HR_DEFAULT_CLASSES" /> </div> </template> diff --git a/app/assets/javascripts/search/sidebar/components/issues_filters.vue b/app/assets/javascripts/search/sidebar/components/issues_filters.vue index 8928f80d83a..3eb025327a2 100644 --- a/app/assets/javascripts/search/sidebar/components/issues_filters.vue +++ b/app/assets/javascripts/search/sidebar/components/issues_filters.vue @@ -10,12 +10,12 @@ import { TRACKING_CATEGORY, TRACKING_LABEL_RESET, } from '../constants/index'; -import { confidentialFilterData } from '../constants/confidential_filter_data'; -import { stateFilterData } from '../constants/state_filter_data'; -import ConfidentialityFilter from './confidentiality_filter.vue'; +import { confidentialFilterData } from './confidentiality_filter/data'; +import { statusFilterData } from './status_filter/data'; +import ConfidentialityFilter from './confidentiality_filter/index.vue'; import { labelFilterData } from './label_filter/data'; import LabelFilter from './label_filter/index.vue'; -import StatusFilter from './status_filter.vue'; +import StatusFilter from './status_filter/index.vue'; export default { name: 'IssuesFilters', @@ -37,7 +37,7 @@ export default { return Object.values(confidentialFilterData.scopes).includes(this.currentScope); }, showStatusFilter() { - return Object.values(stateFilterData.scopes).includes(this.currentScope); + return Object.values(statusFilterData.scopes).includes(this.currentScope); }, showLabelFilter() { return ( @@ -71,7 +71,12 @@ export default { <form class="issue-filters gl-px-5 gl-pt-0" @submit.prevent="applyQueryWithTracking"> <hr v-if="!useNewNavigation" :class="hrClasses" /> <status-filter v-if="showStatusFilter" class="gl-mb-5" /> + <hr v-if="!useNewNavigation" :class="hrClasses" /> <confidentiality-filter v-if="showConfidentialityFilter" class="gl-mb-5" /> + <hr + v-if="!useNewNavigation && showConfidentialityFilter && showLabelFilter" + :class="hrClasses" + /> <label-filter v-if="showLabelFilter" /> <div class="gl-display-flex gl-align-items-center gl-mt-4"> <gl-button category="primary" variant="confirm" type="submit" :disabled="!sidebarDirty"> diff --git a/app/assets/javascripts/search/sidebar/components/results_filters.vue b/app/assets/javascripts/search/sidebar/components/results_filters.vue index 24804baef44..a9addb87f7b 100644 --- a/app/assets/javascripts/search/sidebar/components/results_filters.vue +++ b/app/assets/javascripts/search/sidebar/components/results_filters.vue @@ -2,10 +2,10 @@ import { GlButton, GlLink } from '@gitlab/ui'; import { mapActions, mapState, mapGetters } from 'vuex'; import { HR_DEFAULT_CLASSES } from '../constants/index'; -import { confidentialFilterData } from '../constants/confidential_filter_data'; -import { stateFilterData } from '../constants/state_filter_data'; -import ConfidentialityFilter from './confidentiality_filter.vue'; -import StatusFilter from './status_filter.vue'; +import { confidentialFilterData } from './confidentiality_filter/data'; +import { statusFilterData } from './status_filter/data'; +import ConfidentialityFilter from './confidentiality_filter/index.vue'; +import StatusFilter from './status_filter/index.vue'; export default { name: 'ResultsFilters', @@ -25,7 +25,7 @@ export default { return Object.values(confidentialFilterData.scopes).includes(this.currentScope); }, showStatusFilter() { - return Object.values(stateFilterData.scopes).includes(this.currentScope); + return Object.values(statusFilterData.scopes).includes(this.currentScope); }, hrClasses() { return [...HR_DEFAULT_CLASSES, 'gl-display-none', 'gl-md-display-block']; diff --git a/app/assets/javascripts/search/sidebar/components/status_filter.vue b/app/assets/javascripts/search/sidebar/components/status_filter.vue deleted file mode 100644 index 2a3d9ede982..00000000000 --- a/app/assets/javascripts/search/sidebar/components/status_filter.vue +++ /dev/null @@ -1,25 +0,0 @@ -<script> -import { mapState } from 'vuex'; -import { stateFilterData } from '../constants/state_filter_data'; -import { HR_DEFAULT_CLASSES } from '../constants'; -import RadioFilter from './radio_filter.vue'; - -export default { - name: 'StatusFilter', - components: { - RadioFilter, - }, - computed: { - ...mapState(['useNewNavigation']), - }, - stateFilterData, - HR_DEFAULT_CLASSES, -}; -</script> - -<template> - <div> - <radio-filter :filter-data="$options.stateFilterData" /> - <hr v-if="!useNewNavigation" :class="$options.HR_DEFAULT_CLASSES" /> - </div> -</template> diff --git a/app/assets/javascripts/search/sidebar/components/status_filter/data.js b/app/assets/javascripts/search/sidebar/components/status_filter/data.js new file mode 100644 index 00000000000..1e3cd59214b --- /dev/null +++ b/app/assets/javascripts/search/sidebar/components/status_filter/data.js @@ -0,0 +1,42 @@ +import { __ } from '~/locale'; + +const header = __('Status'); + +const filters = { + ANY: { + label: __('Any'), + value: null, + }, + OPEN: { + label: __('Open'), + value: 'opened', + }, + CLOSED: { + label: __('Closed'), + value: 'closed', + }, + MERGED: { + label: __('Merged'), + value: 'merged', + }, +}; + +const scopes = { + ISSUES: 'issues', + MERGE_REQUESTS: 'merge_requests', +}; + +const filterByScope = { + [scopes.ISSUES]: [filters.ANY, filters.OPEN, filters.CLOSED], + [scopes.MERGE_REQUESTS]: [filters.ANY, filters.OPEN, filters.MERGED, filters.CLOSED], +}; + +const filterParam = 'state'; + +export const statusFilterData = { + header, + filters, + scopes, + filterByScope, + filterParam, +}; diff --git a/app/assets/javascripts/search/sidebar/components/status_filter/index.vue b/app/assets/javascripts/search/sidebar/components/status_filter/index.vue new file mode 100644 index 00000000000..494d75db6ce --- /dev/null +++ b/app/assets/javascripts/search/sidebar/components/status_filter/index.vue @@ -0,0 +1,24 @@ +<script> +import { mapState } from 'vuex'; +import { HR_DEFAULT_CLASSES } from '../../constants'; +import RadioFilter from '../radio_filter.vue'; +import { statusFilterData } from './data'; + +export default { + name: 'StatusFilter', + components: { + RadioFilter, + }, + computed: { + ...mapState(['useNewNavigation']), + }, + statusFilterData, + HR_DEFAULT_CLASSES, +}; +</script> + +<template> + <div> + <radio-filter :filter-data="$options.statusFilterData" /> + </div> +</template> |