Commit b09c7648 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Merge branch '2518-saved-configuration-for-issue-board' of...

Merge branch '2518-saved-configuration-for-issue-board' of https://gitlab.com/gitlab-org/gitlab-ee into 2518-saved-configuration-for-issue-board
parents 9cd04e14 0d1472bf
......@@ -191,35 +191,39 @@ $(() => {
},
});
gl.boardConfigToggle = new Vue({
el: document.querySelector('.js-board-config'),
data() {
return {
canAdminList: convertPermissionToBoolean(
this.$options.el.dataset.canAdminList,
),
};
},
methods: {
showPage: page => gl.issueBoards.BoardsStore.showPage(page),
},
computed: {
buttonText() {
return this.canAdminList ? 'Edit board' : 'View scope';
const configEl = document.querySelector('.js-board-config');
if (configEl) {
gl.boardConfigToggle = new Vue({
el: configEl,
data() {
return {
canAdminList: convertPermissionToBoolean(
this.$options.el.dataset.canAdminList,
),
};
},
},
template: `
<div class="prepend-left-10">
<button
class="btn btn-inverted"
type="button"
@click.prevent="showPage('edit')"
>
{{ buttonText }}
</button>
</div>
`,
});
methods: {
showPage: page => gl.issueBoards.BoardsStore.showPage(page),
},
computed: {
buttonText() {
return this.canAdminList ? 'Edit board' : 'View scope';
},
},
template: `
<div class="prepend-left-10">
<button
class="btn btn-inverted"
type="button"
@click.prevent="showPage('edit')"
>
{{ buttonText }}
</button>
</div>
`,
});
}
gl.IssueBoardsModalAddBtn = new Vue({
mixins: [gl.issueBoards.ModalMixins],
......
<script>
/* global BoardService */
/* global Flash */
import Vue from 'vue';
import PopupDialog from '~/vue_shared/components/popup_dialog.vue';
import BoardMilestoneSelect from './milestone_select.vue';
import BoardWeightSelect from './weight_select.vue';
......@@ -120,7 +120,7 @@ export default {
},
weightsArray() {
return JSON.parse(this.weights);
}
},
},
methods: {
submit() {
......@@ -131,7 +131,7 @@ export default {
gl.utils.visitUrl(Store.rootPath);
})
.catch(() => {
Flash('Failed to delete board. Please try again.')
Flash('Failed to delete board. Please try again.');
this.submitDisabled = false;
});
} else {
......@@ -141,7 +141,7 @@ export default {
gl.utils.visitUrl(`${Store.rootPath}/${data.id}`);
})
.catch(() => {
Flash('Unable to save your changes. Please try again.')
Flash('Unable to save your changes. Please try again.');
});
}
},
......
<script>
/* global LabelsSelect */
/* global ListLabel */
import loadingIcon from '~/vue_shared/components/loading_icon.vue';
import eventHub from '../eventhub';
export default {
props: {
......@@ -32,7 +32,7 @@ export default {
},
},
mounted() {
new LabelsSelect(this.$refs.dropdownButton, {
this.labelsDropdown = new LabelsSelect(this.$refs.dropdownButton, {
handleClick: this.handleClick,
});
},
......@@ -58,7 +58,7 @@ export default {
labels = labels.filter(selected => selected.id !== label.id);
this.board.labels = labels;
}
}
},
},
};
</script>
......
......@@ -37,12 +37,12 @@ export default {
return this.board.milestone_id;
},
milestoneTitleClass() {
return this.milestoneTitle === ANY_MILESTONE ? 'text-secondary': 'bold';
return this.milestoneTitle === ANY_MILESTONE ? 'text-secondary' : 'bold';
},
selected() {
if (this.noMilestone) return NO_MILESTONE;
return this.board.milestone ? this.board.milestone.name : '';
}
},
},
methods: {
selectMilestone(milestone) {
......@@ -60,7 +60,7 @@ export default {
},
},
mounted() {
new MilestoneSelect(null, this.$refs.dropdownButton, {
this.milestoneDropdown = new MilestoneSelect(null, this.$refs.dropdownButton, {
handleClick: this.selectMilestone,
});
},
......
......@@ -69,7 +69,7 @@ export default {
},
methods: {
initSelect() {
new UsersSelect(null, this.$refs.dropdown, {
this.userDropdown = new UsersSelect(null, this.$refs.dropdown, {
handleClick: this.selectUser,
});
},
......
......@@ -3,7 +3,6 @@
import '~/weight_select';
import loadingIcon from '~/vue_shared/components/loading_icon.vue';
import eventHub from '../eventhub';
const ANY_WEIGHT = 'Any Weight';
const NO_WEIGHT = 'No Weight';
......@@ -45,9 +44,9 @@ export default {
},
valueText() {
if (this.value > 0) return this.value;
if (this.value == 0) return NO_WEIGHT;
if (this.value === 0) return NO_WEIGHT;
return ANY_WEIGHT;
}
},
},
methods: {
selectWeight(weight) {
......@@ -61,15 +60,15 @@ export default {
return 0;
}
return -1;
}
},
},
mounted() {
new WeightSelect(this.$refs.dropdownButton, {
this.weightDropdown = new WeightSelect(this.$refs.dropdownButton, {
handleClick: this.selectWeight,
selected: this.value,
fieldName: this.fieldName,
});
}
},
};
</script>
......
......@@ -18,8 +18,9 @@
%a{ ":href" => "'#{board_base_url}/' + board.id" }
{{ board.name }}
- if !multiple_boards_available? && current_board_parent.boards.size > 1
%li.small
Some of your boards are hidden, activate a license to see them again.
%li
.small.unclickable
Some of your boards are hidden, activate a license to see them again.
.dropdown-loading{ "v-if" => "loading" }
= icon("spin spinner")
......
......@@ -131,9 +131,8 @@ describe 'Service Desk Issue Tracker', js: true do
visit service_desk_project_issues_path(project)
end
it 'displays the support bot author token' do
author_token = find('.filtered-search-token .value')
expect(author_token).to have_content('Support Bot')
it 'adds hidden support bot author token' do
expect(page).to have_selector('.filtered-search-token .value', text: 'Support Bot', visible: false)
end
it 'support bot author token cannot be deleted' do
......
......@@ -153,10 +153,11 @@ describe 'Multiple Issue Boards', :js do
click_button board.name
page.within('.dropdown-menu') do
expect(page).to have_content('Edit board')
expect(page).not_to have_content('Create new board')
expect(page).not_to have_content('Delete board')
end
expect(page).to have_content('Edit board')
end
it 'shows a mention that boards are hidden when multiple boards are created' do
......
......@@ -39,11 +39,10 @@ describe('LabelsSelect', () => {
setFixtures('<div class="test-container"></div>');
const deferred = new jQuery.Deferred();
spyOn($, 'ajax').and.returnValue(deferred);
deferred.resolve([
spyOn($, 'ajax').and.returnValue(deferred.resolve([
label,
label2,
]);
]));
// eslint-disable-next-line no-new
new IssuableContext();
......@@ -64,13 +63,21 @@ describe('LabelsSelect', () => {
Vue.nextTick(done);
});
describe('canEdit false', () => {
});
describe('canEdit', () => {
it('shows edit link', () => {
it('hides Edit button', (done) => {
vm.canEdit = false;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeFalsy();
done();
});
});
it('shows Edit button if true', (done) => {
vm.canEdit = true;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeTruthy();
done();
});
});
});
......
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