Commit d9d288bf authored by Simon Knox's avatar Simon Knox

Merge branches '2518-saved-configuration-for-issue-board' and...

Merge branches '2518-saved-configuration-for-issue-board' and '2518-saved-configuration-for-issue-board' of gitlab.com:gitlab-org/gitlab-ee into 2518-saved-configuration-for-issue-board
parents 5fb3b644 d5ab9895
......@@ -82,13 +82,12 @@ $(() => {
},
},
created () {
const updateFilterPath = (key, value, tokenName) => {
const updateFilterPath = (key, value) => {
if (!value) return;
const querystring = `${key}=${value}`;
Store.filter.path = [querystring].concat(
Store.filter.path.split('&').filter(param => param.match(new RegExp(`^${key}=(.*)$`, 'g')) === null)
).join('&');
this.cantEdit.push(tokenName);
};
if (this.milestoneId !== -1) {
......@@ -96,7 +95,8 @@ $(() => {
if (this.milestoneId === 0) {
milestoneTitle = 'No+Milestone';
}
updateFilterPath('milestone_title', milestoneTitle, 'milestone');
updateFilterPath('milestone_title', milestoneTitle);
this.cantEdit.push('milestone');
}
let weight = this.weight;
......@@ -104,9 +104,13 @@ $(() => {
if (weight === 0) {
weight = 'No+Weight';
}
updateFilterPath('weight', weight, 'weight');
updateFilterPath('weight', weight);
this.cantEdit.push('weight');
}
updateFilterPath('assignee_username', this.assigneeUsername);
if (this.assigneeUsername) {
this.cantEdit.push('assignee');
}
updateFilterPath('assignee_username', this.assigneeUsername, 'assignee');
const filterPath = gl.issueBoards.BoardsStore.filter.path.split('&');
this.labels.forEach((label) => {
......
......@@ -45,6 +45,7 @@ export default class FilteredSearchBoards extends gl.FilteredSearchManager {
canEdit(tokenName, tokenValue) {
if (this.cantEdit.includes(tokenName)) return false;
return this.cantEditWithValue.findIndex(t => t.name === tokenName && t.value === tokenValue) === -1;
return this.cantEditWithValue.findIndex(token => token.name === tokenName &&
token.value === tokenValue) === -1;
}
}
......@@ -181,7 +181,7 @@ describe 'issue board config', :js do
end
it 'can filter by additional labels' do
label_title = issue.labels.first.title
label_2_title = issue_2.labels.first.title
visit project_boards_path(project)
......@@ -268,9 +268,6 @@ describe 'issue board config', :js do
context 'add issue' do
it 'adds assignee' do
visit boards_path(filtered_board)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment