Skip to content
Snippets Groups Projects

WIP: Improve management of artifacts

Closed Matija Čupić requested to merge mc/feature/improve-management-of-artifacts into master
1 unresolved thread
20 files
+ 869
26
Compare changes
  • Side-by-side
  • Inline
Files
20
@@ -58,6 +58,99 @@ export default class FilteredSearchDropdownManager {
@@ -58,6 +58,99 @@ export default class FilteredSearchDropdownManager {
this.includeAncestorGroups,
this.includeAncestorGroups,
this.includeDescendantGroups,
this.includeDescendantGroups,
);
);
 
const allowedMappings = {
 
hint: {
 
reference: null,
 
gl: DropdownHint,
 
element: this.container.querySelector('#js-dropdown-hint'),
 
},
 
};
 
const availableMappings = {
 
author: {
 
reference: null,
 
gl: DropdownUser,
 
element: this.container.querySelector('#js-dropdown-author'),
 
},
 
assignee: {
 
reference: null,
 
gl: DropdownUser,
 
element: this.container.querySelector('#js-dropdown-assignee'),
 
},
 
milestone: {
 
reference: null,
 
gl: DropdownNonUser,
 
extraArguments: {
 
endpoint: this.getMilestoneEndpoint(),
 
symbol: '%',
 
},
 
element: this.container.querySelector('#js-dropdown-milestone'),
 
},
 
label: {
 
reference: null,
 
gl: DropdownNonUser,
 
extraArguments: {
 
endpoint: this.getLabelsEndpoint(),
 
symbol: '~',
 
preprocessing: DropdownUtils.duplicateLabelPreprocessing,
 
},
 
element: this.container.querySelector('#js-dropdown-label'),
 
},
 
'my-reaction': {
 
reference: null,
 
gl: DropdownEmoji,
 
element: this.container.querySelector('#js-dropdown-my-reaction'),
 
},
 
wip: {
 
reference: null,
 
gl: DropdownNonUser,
 
element: this.container.querySelector('#js-dropdown-wip'),
 
},
 
status: {
 
reference: null,
 
gl: NullDropdown,
 
element: this.container.querySelector('#js-dropdown-admin-runner-status'),
 
},
 
type: {
 
reference: null,
 
gl: NullDropdown,
 
element: this.container.querySelector('#js-dropdown-admin-runner-type'),
 
},
 
'deleted-branches': {
 
reference: null,
 
gl: NullDropdown,
 
element: this.container.querySelector('#js-dropdown-project-artifact-deleted-branches'),
 
},
 
};
 
 
supportedTokens.forEach(type => {
 
if (availableMappings[type]) {
 
allowedMappings[type] = availableMappings[type];
 
}
 
});
 
 
this.mapping = allowedMappings;
 
}
 
 
getMilestoneEndpoint() {
 
const endpoint = `${this.baseEndpoint}/milestones.json`;
 
 
return endpoint;
 
}
 
 
getLabelsEndpoint() {
 
let endpoint = `${this.baseEndpoint}/labels.json?`;
 
 
if (this.groupsOnly) {
 
endpoint = `${endpoint}only_group_labels=true&`;
 
}
 
 
if (this.includeAncestorGroups) {
 
endpoint = `${endpoint}include_ancestor_groups=true&`;
 
}
 
 
if (this.includeDescendantGroups) {
 
endpoint = `${endpoint}include_descendant_groups=true`;
 
}
this.mapping = availableMappings.getAllowedMappings(supportedTokens);
this.mapping = availableMappings.getAllowedMappings(supportedTokens);
}
}
Loading