2016-08-09 05:12:32 -04:00
|
|
|
(() => {
|
2016-08-02 04:58:09 -04:00
|
|
|
const BoardBlankState = Vue.extend({
|
2016-08-11 04:51:52 -04:00
|
|
|
data () {
|
2016-08-09 05:12:32 -04:00
|
|
|
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-09 05:12:32 -04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2016-08-02 04:58:09 -04:00
|
|
|
methods: {
|
2016-08-15 03:36:37 -04:00
|
|
|
addDefaultLists () {
|
2016-08-15 04:57:01 -04:00
|
|
|
gl.issueBoards.BoardsStore.removeBlankState();
|
2016-08-09 05:25:07 -04:00
|
|
|
|
2016-08-11 04:51:52 -04:00
|
|
|
for (let i = 0, labelsLength = this.predefinedLabels.length; i < labelsLength; i++) {
|
|
|
|
const label = this.predefinedLabels[i];
|
|
|
|
|
2016-08-15 04:57:01 -04:00
|
|
|
gl.issueBoards.BoardsStore.addList({
|
2016-08-09 05:12:32 -04:00
|
|
|
title: label.title,
|
|
|
|
position: i,
|
2016-08-15 04:41:06 -04:00
|
|
|
list_type: 'label',
|
2016-08-09 05:12:32 -04:00
|
|
|
label: {
|
|
|
|
title: label.title,
|
|
|
|
color: label.color
|
|
|
|
}
|
|
|
|
});
|
2016-08-11 04:51:52 -04:00
|
|
|
}
|
2016-08-09 05:12:32 -04:00
|
|
|
|
|
|
|
// Save the labels
|
|
|
|
gl.boardService
|
|
|
|
.generateDefaultLists()
|
|
|
|
.then((resp) => {
|
|
|
|
const data = resp.json();
|
2016-08-05 09:00:06 -04:00
|
|
|
|
2016-08-11 04:51:52 -04:00
|
|
|
for (let i = 0, dataLength = data.length; i < dataLength; i++) {
|
|
|
|
const listObj = data[i],
|
2016-08-15 04:57:01 -04:00
|
|
|
list = gl.issueBoards.BoardsStore.findList('title', listObj.title);
|
2016-08-15 04:41:06 -04:00
|
|
|
|
2016-08-09 05:12:32 -04:00
|
|
|
list.id = listObj.id;
|
|
|
|
list.label.id = listObj.label.id;
|
|
|
|
list.getIssues();
|
2016-08-11 04:51:52 -04:00
|
|
|
}
|
2016-08-09 05:12:32 -04:00
|
|
|
});
|
2016-08-02 04:58:09 -04:00
|
|
|
},
|
2016-08-11 04:51:52 -04:00
|
|
|
clearBlankState () {
|
2016-08-15 04:57:01 -04:00
|
|
|
gl.issueBoards.BoardsStore.removeBlankState();
|
2016-08-02 04:58:09 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Vue.component('board-blank-state', BoardBlankState);
|
|
|
|
})();
|