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

board.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: 3e75469af5cfc198ec9a6d0b25e76cceb45ab932 (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
51
52
53
54
55
56
57
(() => {
  const Board = Vue.extend({
    props: {
      board: Object
    },
    data: function () {
      return {
        filters: BoardsStore.state.filters
      };
    },
    watch: {
      'query': function () {
        if (this.board.canSearch()) {
          this.board.filters = this.getFilterData();
          this.board.getIssues(true);
        }
      },
      'filters': {
        handler: function () {
          this.board.filters = this.getFilterData();
          this.board.getIssues(true);
        },
        deep: true
      }
    },
    methods: {
      clearSearch: function () {
        this.query = '';
      },
      getFilterData: function () {
        const queryData = this.board.canSearch() ? { search: this.query } : {};

        return _.extend(queryData, this.filters);
      }
    },
    computed: {
      isPreset: function () {
        return this.board.type === 'backlog' || this.board.type === 'done' || this.board.type === 'blank';
      }
    },
    ready: function () {
      const options = _.extend({
        group: 'boards',
        draggable: '.is-draggable',
        handle: '.js-board-handle',
        filter: '.board-delete',
        onUpdate: function (e) {
          BoardsStore.moveList(e.oldIndex, e.newIndex);
        }
      }, gl.boardSortableDefaultOptions);

      Sortable.create(this.$el.parentNode, options);
    }
  });

  Vue.component('board', Board)
})();