Welcome to mirror list, hosted at ThFree Co, Russian Federation.

board_blank_state.js.es6 « components « boards « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 691487b272ac8ed00df06b13ae3f6f86a5d55521 (plain)
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
/* eslint-disable */
(() => {
  const Store = gl.issueBoards.BoardsStore;

  window.gl = window.gl || {};
  window.gl.issueBoards = window.gl.issueBoards || {};

  gl.issueBoards.BoardBlankState = Vue.extend({
    data () {
      return {
        predefinedLabels: [
          new ListLabel({ title: 'To Do', color: '#F0AD4E' }),
          new ListLabel({ title: 'Doing', color: '#5CB85C' })
        ]
      }
    },
    methods: {
      addDefaultLists () {
        this.clearBlankState();

        this.predefinedLabels.forEach((label, i) => {
          Store.addList({
            title: label.title,
            position: i,
            list_type: 'label',
            label: {
              title: label.title,
              color: label.color
            }
          });
        });

        Store.state.lists = _.sortBy(Store.state.lists, 'position');

        // Save the labels
        gl.boardService.generateDefaultLists()
          .then((resp) => {
            resp.json().forEach((listObj) => {
              const list = Store.findList('title', listObj.title);

              list.id = listObj.id;
              list.label.id = listObj.label.id;
              list.getIssues();
            });
          });
      },
      clearBlankState: Store.removeBlankState.bind(Store)
    }
  });
})();