gitlab-org--gitlab-foss/app/assets/javascripts/boards/components/board_blank_state.js.es6

52 lines
1.4 KiB
JavaScript
Raw Normal View History

(() => {
2016-08-02 04:58:09 -04:00
const BoardBlankState = Vue.extend({
data: function () {
return {
predefinedLabels: [
2016-08-10 16:41:30 -04:00
new ListLabel({ title: 'Development', color: '#5CB85C' }),
new ListLabel({ title: 'Testing', color: '#F0AD4E' }),
new ListLabel({ title: 'Production', color: '#FF5F00' }),
new ListLabel({ title: 'Ready', color: '#FF0000' })
]
}
},
2016-08-02 04:58:09 -04:00
methods: {
addDefaultLists: function (e) {
e.stopImmediatePropagation();
BoardsStore.removeBlankState();
2016-08-09 05:25:07 -04:00
_.each(this.predefinedLabels, (label, i) => {
BoardsStore.addList({
title: label.title,
position: i,
type: 'label',
label: {
title: label.title,
color: label.color
}
});
});
// Save the labels
gl.boardService
.generateDefaultLists()
.then((resp) => {
const data = resp.json();
_.each(data, (listObj) => {
const list = BoardsStore.findList('title', listObj.title);
list.id = listObj.id;
list.label.id = listObj.label.id;
list.getIssues();
});
});
2016-08-02 04:58:09 -04:00
},
clearBlankState: function () {
BoardsStore.removeBlankState();
2016-08-02 04:58:09 -04:00
}
}
});
Vue.component('board-blank-state', BoardBlankState);
})();