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

85 lines
2.1 KiB
JavaScript
Raw Normal View History

/* eslint-disable one-var, indent, quote-props, comma-dangle, space-before-function-paren */
/* global Vue */
/* global BoardService */
2016-07-28 07:33:04 -04:00
//= require vue
//= require vue-resource
//= require Sortable
2016-08-01 09:18:30 -04:00
//= require_tree ./models
2016-07-28 07:33:04 -04:00
//= require_tree ./stores
//= require_tree ./services
//= require_tree ./mixins
//= require_tree ./filters
//= require ./components/board
2016-10-04 10:27:02 -04:00
//= require ./components/board_sidebar
//= require ./components/new_list_dropdown
2016-08-16 06:34:32 -04:00
//= require ./vue_resource_interceptor
2016-07-28 07:33:04 -04:00
$(() => {
const $boardApp = document.getElementById('board-app'),
Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
2016-07-28 07:33:04 -04:00
if (gl.IssueBoardsApp) {
gl.IssueBoardsApp.$destroy(true);
}
Store.create();
gl.IssueBoardsApp = new Vue({
el: $boardApp,
components: {
2016-10-04 10:27:02 -04:00
'board': gl.issueBoards.Board,
'board-sidebar': gl.issueBoards.BoardSidebar
},
2016-07-28 07:33:04 -04:00
data: {
state: Store.state,
loading: true,
endpoint: $boardApp.dataset.endpoint,
boardId: $boardApp.dataset.boardId,
disabled: $boardApp.dataset.disabled === 'true',
issueLinkBase: $boardApp.dataset.issueLinkBase,
detailIssue: Store.detail
2016-07-28 07:33:04 -04:00
},
computed: {
detailIssueVisible () {
return Object.keys(this.detailIssue.issue).length;
},
},
created () {
gl.boardService = new BoardService(this.endpoint, this.boardId);
2016-08-08 11:15:05 -04:00
},
2016-11-02 20:37:33 -04:00
mounted () {
Store.disabled = this.disabled;
gl.boardService.all()
2016-08-19 09:16:07 -04:00
.then((resp) => {
2016-08-17 08:57:36 -04:00
resp.json().forEach((board) => {
const list = Store.addList(board);
if (list.type === 'done') {
list.position = Infinity;
2016-08-05 12:01:34 -04:00
} else if (list.type === 'backlog') {
list.position = -1;
}
2016-08-17 08:57:36 -04:00
});
2016-11-09 04:23:48 -05:00
this.state.lists = _.sortBy(this.state.lists, 'position');
Store.addBlankState();
2016-08-08 11:15:05 -04:00
this.loading = false;
2016-07-28 07:33:04 -04:00
});
}
});
gl.IssueBoardsSearch = new Vue({
el: '#js-boards-seach',
data: {
filters: Store.state.filters
},
mounted () {
gl.issueBoards.newListDropdownInit();
}
});
2016-07-28 07:33:04 -04:00
});