1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
(() => {
const BoardBlankState = Vue.extend({
data () {
return {
predefinedLabels: [
new ListLabel({ title: 'Development', color: '#5CB85C' }),
new ListLabel({ title: 'Testing', color: '#F0AD4E' }),
new ListLabel({ title: 'Production', color: '#FF5F00' }),
new ListLabel({ title: 'Ready', color: '#FF0000' })
]
}
},
methods: {
addDefaultLists () {
gl.issueBoards.BoardsStore.removeBlankState();
for (let i = 0, labelsLength = this.predefinedLabels.length; i < labelsLength; i++) {
const label = this.predefinedLabels[i];
gl.issueBoards.BoardsStore.addList({
title: label.title,
position: i,
list_type: 'label',
label: {
title: label.title,
color: label.color
}
});
}
// Save the labels
gl.boardService
.generateDefaultLists()
.then((resp) => {
const data = resp.json();
for (let i = 0, dataLength = data.length; i < dataLength; i++) {
const listObj = data[i],
list = gl.issueBoards.BoardsStore.findList('title', listObj.title);
list.id = listObj.id;
list.label.id = listObj.label.id;
list.getIssues();
}
});
},
clearBlankState () {
gl.issueBoards.BoardsStore.removeBlankState();
}
}
});
Vue.component('board-blank-state', BoardBlankState);
})();
|