diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-28 21:06:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-28 21:06:24 +0000 |
commit | ef326e805ac99222c55e1efd9867045800f01a4b (patch) | |
tree | 201d39fb90a1422cc1f523d95b30b93e95f973f5 /app/assets | |
parent | 7515ec41c527c62bfd56f46e388cf6d9fe06479f (diff) | |
download | gitlab-ce-ef326e805ac99222c55e1efd9867045800f01a4b.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
5 files changed, 64 insertions, 15 deletions
diff --git a/app/assets/javascripts/filtered_search/available_dropdown_mappings.js b/app/assets/javascripts/filtered_search/available_dropdown_mappings.js index f280f3cd26c..5fa07045d5e 100644 --- a/app/assets/javascripts/filtered_search/available_dropdown_mappings.js +++ b/app/assets/javascripts/filtered_search/available_dropdown_mappings.js @@ -13,6 +13,7 @@ export default class AvailableDropdownMappings { runnerTagsEndpoint, labelsEndpoint, milestonesEndpoint, + releasesEndpoint, groupsOnly, includeAncestorGroups, includeDescendantGroups, @@ -21,6 +22,7 @@ export default class AvailableDropdownMappings { this.runnerTagsEndpoint = runnerTagsEndpoint; this.labelsEndpoint = labelsEndpoint; this.milestonesEndpoint = milestonesEndpoint; + this.releasesEndpoint = releasesEndpoint; this.groupsOnly = groupsOnly; this.includeAncestorGroups = includeAncestorGroups; this.includeDescendantGroups = includeDescendantGroups; @@ -70,6 +72,19 @@ export default class AvailableDropdownMappings { }, element: this.container.querySelector('#js-dropdown-milestone'), }, + release: { + reference: null, + gl: DropdownNonUser, + extraArguments: { + endpoint: this.getReleasesEndpoint(), + symbol: '', + + // The DropdownNonUser class is hardcoded to look for and display a + // "title" property, so we need to add this property to each release object + preprocessing: releases => releases.map(r => ({ ...r, title: r.tag })), + }, + element: this.container.querySelector('#js-dropdown-release'), + }, label: { reference: null, gl: DropdownNonUser, @@ -130,6 +145,10 @@ export default class AvailableDropdownMappings { return `${this.milestonesEndpoint}.json`; } + getReleasesEndpoint() { + return `${this.releasesEndpoint}.json`; + } + getLabelsEndpoint() { let endpoint = `${this.labelsEndpoint}.json?`; diff --git a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js index 835d3bf8a53..5ff95f45be4 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js @@ -11,6 +11,7 @@ export default class FilteredSearchDropdownManager { runnerTagsEndpoint = '', labelsEndpoint = '', milestonesEndpoint = '', + releasesEndpoint = '', tokenizer, page, isGroup, @@ -18,10 +19,13 @@ export default class FilteredSearchDropdownManager { isGroupDecendent, filteredSearchTokenKeys, }) { + const removeTrailingSlash = url => url.replace(/\/$/, ''); + this.container = FilteredSearchContainer.container; - this.runnerTagsEndpoint = runnerTagsEndpoint.replace(/\/$/, ''); - this.labelsEndpoint = labelsEndpoint.replace(/\/$/, ''); - this.milestonesEndpoint = milestonesEndpoint.replace(/\/$/, ''); + this.runnerTagsEndpoint = removeTrailingSlash(runnerTagsEndpoint); + this.labelsEndpoint = removeTrailingSlash(labelsEndpoint); + this.milestonesEndpoint = removeTrailingSlash(milestonesEndpoint); + this.releasesEndpoint = removeTrailingSlash(releasesEndpoint); this.tokenizer = tokenizer; this.filteredSearchTokenKeys = filteredSearchTokenKeys || FilteredSearchTokenKeys; this.filteredSearchInput = this.container.querySelector('.filtered-search'); @@ -54,6 +58,7 @@ export default class FilteredSearchDropdownManager { this.runnerTagsEndpoint, this.labelsEndpoint, this.milestonesEndpoint, + this.releasesEndpoint, this.groupsOnly, this.includeAncestorGroups, this.includeDescendantGroups, diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js b/app/assets/javascripts/filtered_search/filtered_search_manager.js index fd335362e5b..5c2d32f4e85 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js @@ -89,6 +89,7 @@ export default class FilteredSearchManager { this.filteredSearchInput.getAttribute('data-runner-tags-endpoint') || '', labelsEndpoint: this.filteredSearchInput.getAttribute('data-labels-endpoint') || '', milestonesEndpoint: this.filteredSearchInput.getAttribute('data-milestones-endpoint') || '', + releasesEndpoint: this.filteredSearchInput.getAttribute('data-releases-endpoint') || '', tokenizer: this.tokenizer, page: this.page, isGroup: this.isGroup, diff --git a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js index 6c3d9e33420..414bcf186a3 100644 --- a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js +++ b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js @@ -1,7 +1,9 @@ import FilteredSearchTokenKeys from './filtered_search_token_keys'; import { __ } from '~/locale'; -export const tokenKeys = [ +export const tokenKeys = []; + +tokenKeys.push( { key: 'author', type: 'string', @@ -26,15 +28,27 @@ export const tokenKeys = [ icon: 'clock', tag: '%milestone', }, - { - key: 'label', - type: 'array', - param: 'name[]', - symbol: '~', - icon: 'labels', - tag: '~label', - }, -]; +); + +if (gon && gon.features && gon.features.releaseSearchFilter) { + tokenKeys.push({ + key: 'release', + type: 'string', + param: 'tag', + symbol: '', + icon: 'rocket', + tag: __('tag name'), + }); +} + +tokenKeys.push({ + key: 'label', + type: 'array', + param: 'name[]', + symbol: '~', + icon: 'labels', + tag: '~label', +}); if (gon.current_user_id) { // Appending tokenkeys only logged-in @@ -89,6 +103,16 @@ export const conditions = [ value: __('Started'), }, { + url: 'release_tag=None', + tokenKey: 'release', + value: __('None'), + }, + { + url: 'release_tag=Any', + tokenKey: 'release', + value: __('Any'), + }, + { url: 'label_name[]=None', tokenKey: 'label', value: __('None'), diff --git a/app/assets/javascripts/releases/list/components/release_block.vue b/app/assets/javascripts/releases/list/components/release_block.vue index 8d4b32e9dc0..1b78901d771 100644 --- a/app/assets/javascripts/releases/list/components/release_block.vue +++ b/app/assets/javascripts/releases/list/components/release_block.vue @@ -76,7 +76,7 @@ export default { }, shouldShowEditButton() { return Boolean( - this.glFeatures.releaseEditPage && this.release._links && this.release._links.edit, + this.glFeatures.releaseEditPage && this.release._links && this.release._links.edit_url, ); }, }, @@ -108,7 +108,7 @@ export default { v-gl-tooltip class="btn btn-default js-edit-button ml-2" :title="__('Edit this release')" - :href="release._links.edit" + :href="release._links.edit_url" > <icon name="pencil" /> </gl-link> |