Skip to content
Snippets Groups Projects
Commit a0189744 authored by Mike Greiling's avatar Mike Greiling Committed by Fatih Acet
Browse files

Convert remaining issue board components into ES module syntax

parent 62bd3045
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Showing
with 170 additions and 170 deletions
Loading
Loading
@@ -4,20 +4,17 @@ import { n__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
import Tooltip from '~/vue_shared/directives/tooltip';
import AccessorUtilities from '../../lib/utils/accessor';
import boardList from './board_list.vue';
import BoardBlankState from './board_blank_state.vue';
import './board_delete';
import BoardDelete from './board_delete';
import BoardList from './board_list.vue';
import boardsStore from '../stores/boards_store';
import { getBoardSortableDefaultOptions, sortableEnd } from '../mixins/sortable_default_options';
 
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.Board = Vue.extend({
export default Vue.extend({
components: {
boardList,
'board-delete': gl.issueBoards.BoardDelete,
BoardBlankState,
BoardDelete,
BoardList,
Icon,
},
directives: {
Loading
Loading
@@ -47,8 +44,8 @@ gl.issueBoards.Board = Vue.extend({
},
data () {
return {
detailIssue: Store.detail,
filter: Store.filter,
detailIssue: boardsStore.detail,
filter: boardsStore.filter,
};
},
computed: {
Loading
Loading
@@ -70,20 +67,20 @@ gl.issueBoards.Board = Vue.extend({
}
},
mounted () {
this.sortableOptions = gl.issueBoards.getBoardSortableDefaultOptions({
this.sortableOptions = getBoardSortableDefaultOptions({
disabled: this.disabled,
group: 'boards',
draggable: '.is-draggable',
handle: '.js-board-handle',
onEnd: (e) => {
gl.issueBoards.onEnd();
sortableEnd();
 
if (e.newIndex !== undefined && e.oldIndex !== e.newIndex) {
const order = this.sortable.toArray();
const list = Store.findList('id', parseInt(e.item.dataset.id, 10));
const list = boardsStore.findList('id', parseInt(e.item.dataset.id, 10));
 
this.$nextTick(() => {
Store.moveList(list, order);
boardsStore.moveList(list, order);
});
}
}
Loading
Loading
Loading
Loading
@@ -2,8 +2,7 @@
/* global ListLabel */
import _ from 'underscore';
import Cookies from 'js-cookie';
const Store = gl.issueBoards.BoardsStore;
import boardsStore from '../stores/boards_store';
 
export default {
data() {
Loading
Loading
@@ -19,7 +18,7 @@ export default {
this.clearBlankState();
 
this.predefinedLabels.forEach((label, i) => {
Store.addList({
boardsStore.addList({
title: label.title,
position: i,
list_type: 'label',
Loading
Loading
@@ -30,14 +29,14 @@ export default {
});
});
 
Store.state.lists = _.sortBy(Store.state.lists, 'position');
boardsStore.state.lists = _.sortBy(boardsStore.state.lists, 'position');
 
// Save the labels
gl.boardService.generateDefaultLists()
.then(res => res.data)
.then((data) => {
data.forEach((listObj) => {
const list = Store.findList('title', listObj.title);
const list = boardsStore.findList('title', listObj.title);
 
list.id = listObj.id;
list.label.id = listObj.label.id;
Loading
Loading
@@ -48,14 +47,14 @@ export default {
});
})
.catch(() => {
Store.removeList(undefined, 'label');
boardsStore.removeList(undefined, 'label');
Cookies.remove('issue_board_welcome_hidden', {
path: '',
});
Store.addBlankState();
boardsStore.addBlankState();
});
},
clearBlankState: Store.removeBlankState.bind(Store),
clearBlankState: boardsStore.removeBlankState.bind(boardsStore),
},
};
 
Loading
Loading
Loading
Loading
@@ -2,8 +2,7 @@
/* eslint-disable vue/require-default-prop */
import IssueCardInner from './issue_card_inner.vue';
import eventHub from '../eventhub';
const Store = gl.issueBoards.BoardsStore;
import boardsStore from '../stores/boards_store';
 
export default {
name: 'BoardsIssueCard',
Loading
Loading
@@ -42,7 +41,7 @@
data() {
return {
showDetail: false,
detailIssue: Store.detail,
detailIssue: boardsStore.detail,
};
},
computed: {
Loading
Loading
@@ -63,11 +62,11 @@
if (this.showDetail) {
this.showDetail = false;
 
if (Store.detail.issue && Store.detail.issue.id === this.issue.id) {
if (boardsStore.detail.issue && boardsStore.detail.issue.id === this.issue.id) {
eventHub.$emit('clearDetailIssue');
} else {
eventHub.$emit('newDetailIssue', this.issue);
Store.detail.list = this.list;
boardsStore.detail.list = this.list;
}
}
},
Loading
Loading
/* eslint-disable no-alert */
import $ from 'jquery';
import Vue from 'vue';
 
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardDelete = Vue.extend({
export default Vue.extend({
props: {
list: {
type: Object,
Loading
Loading
@@ -14,12 +9,13 @@ gl.issueBoards.BoardDelete = Vue.extend({
},
},
methods: {
deleteBoard () {
deleteBoard() {
$(this.$el).tooltip('hide');
 
// eslint-disable-next-line no-alert
if (window.confirm('Are you sure you want to delete this list?')) {
this.list.destroy();
}
}
}
},
},
});
Loading
Loading
@@ -3,8 +3,8 @@ import Sortable from 'sortablejs';
import boardNewIssue from './board_new_issue.vue';
import boardCard from './board_card.vue';
import eventHub from '../eventhub';
const Store = gl.issueBoards.BoardsStore;
import boardsStore from '../stores/boards_store';
import { getBoardSortableDefaultOptions, sortableStart } from '../mixins/sortable_default_options';
 
export default {
name: 'BoardList',
Loading
Loading
@@ -46,7 +46,7 @@ export default {
data() {
return {
scrollOffset: 250,
filters: Store.state.filters,
filters: boardsStore.state.filters,
showCount: false,
showIssueForm: false,
};
Loading
Loading
@@ -61,13 +61,14 @@ export default {
},
issues() {
this.$nextTick(() => {
if (this.scrollHeight() <= this.listHeight() &&
this.list.issuesSize > this.list.issues.length) {
if (
this.scrollHeight() <= this.listHeight() &&
this.list.issuesSize > this.list.issues.length
) {
this.list.page += 1;
this.list.getIssues(false)
.catch(() => {
// TODO: handle request error
});
this.list.getIssues(false).catch(() => {
// TODO: handle request error
});
}
 
if (this.scrollHeight() > Math.ceil(this.listHeight())) {
Loading
Loading
@@ -83,7 +84,7 @@ export default {
eventHub.$on(`scroll-board-list-${this.list.id}`, this.scrollToTop);
},
mounted() {
const options = gl.issueBoards.getBoardSortableDefaultOptions({
const options = getBoardSortableDefaultOptions({
scroll: true,
disabled: this.disabled,
filter: '.board-list-count, .is-disabled',
Loading
Loading
@@ -108,7 +109,8 @@ export default {
// So from there, we can get reference to actual container
// and thus the container type to enable Copy or Move
if (e.target) {
const containerEl = e.target.closest('.js-board-list') || e.target.querySelector('.js-board-list');
const containerEl =
e.target.closest('.js-board-list') || e.target.querySelector('.js-board-list');
const toBoardType = containerEl.dataset.boardType;
const cloneActions = {
label: ['milestone', 'assignee'],
Loading
Loading
@@ -120,8 +122,9 @@ export default {
const fromBoardType = this.list.type;
// For each list we check if the destination list is
// a the list were we should clone the issue
const shouldClone = Object.entries(cloneActions).some(entry => (
fromBoardType === entry[0] && entry[1].includes(toBoardType)));
const shouldClone = Object.entries(cloneActions).some(
entry => fromBoardType === entry[0] && entry[1].includes(toBoardType),
);
 
if (shouldClone) {
return 'clone';
Loading
Loading
@@ -133,28 +136,36 @@ export default {
},
revertClone: true,
},
onStart: (e) => {
onStart: e => {
const card = this.$refs.issue[e.oldIndex];
 
card.showDetail = false;
Store.moving.list = card.list;
Store.moving.issue = Store.moving.list.findIssue(+e.item.dataset.issueId);
boardsStore.moving.list = card.list;
boardsStore.moving.issue = boardsStore.moving.list.findIssue(+e.item.dataset.issueId);
 
gl.issueBoards.onStart();
sortableStart();
},
onAdd: (e) => {
gl.issueBoards.BoardsStore
.moveIssueToList(Store.moving.list, this.list, Store.moving.issue, e.newIndex);
onAdd: e => {
boardsStore.moveIssueToList(
boardsStore.moving.list,
this.list,
boardsStore.moving.issue,
e.newIndex,
);
 
this.$nextTick(() => {
e.item.remove();
});
},
onUpdate: (e) => {
const sortedArray = this.sortable.toArray()
.filter(id => id !== '-1');
gl.issueBoards.BoardsStore
.moveIssueInList(this.list, Store.moving.issue, e.oldIndex, e.newIndex, sortedArray);
onUpdate: e => {
const sortedArray = this.sortable.toArray().filter(id => id !== '-1');
boardsStore.moveIssueInList(
this.list,
boardsStore.moving.issue,
e.oldIndex,
e.newIndex,
sortedArray,
);
},
onMove(e) {
return !e.related.classList.contains('board-list-count');
Loading
Loading
@@ -192,16 +203,14 @@ export default {
 
if (getIssues) {
this.list.loadingMore = true;
getIssues
.then(loadingDone)
.catch(loadingDone);
getIssues.then(loadingDone).catch(loadingDone);
}
},
toggleForm() {
this.showIssueForm = !this.showIssueForm;
},
onScroll() {
if (!this.list.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) {
if (!this.list.loadingMore && this.scrollTop() > this.scrollHeight() - this.scrollOffset) {
this.loadNextPage();
}
},
Loading
Loading
Loading
Loading
@@ -4,8 +4,7 @@ import { Button } from '@gitlab-org/gitlab-ui';
import eventHub from '../eventhub';
import ProjectSelect from './project_select.vue';
import ListIssue from '../models/issue';
const Store = gl.issueBoards.BoardsStore;
import boardsStore from '../stores/boards_store';
 
export default {
name: 'BoardNewIssue',
Loading
Loading
@@ -68,8 +67,8 @@ export default {
// Need this because our jQuery very kindly disables buttons on ALL form submissions
$(this.$refs.submitButton).enable();
 
Store.detail.issue = issue;
Store.detail.list = this.list;
boardsStore.detail.issue = issue;
boardsStore.detail.list = this.list;
})
.catch(() => {
// Need this because our jQuery very kindly disables buttons on ALL form submissions
Loading
Loading
Loading
Loading
@@ -14,13 +14,9 @@ import IssuableContext from '../../issuable_context';
import LabelsSelect from '../../labels_select';
import Subscriptions from '../../sidebar/components/subscriptions/subscriptions.vue';
import MilestoneSelect from '../../milestone_select';
import boardsStore from '../stores/boards_store';
 
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardSidebar = Vue.extend({
export default Vue.extend({
components: {
AssigneeTitle,
Assignees,
Loading
Loading
@@ -35,7 +31,7 @@ gl.issueBoards.BoardSidebar = Vue.extend({
},
data() {
return {
detail: Store.detail,
detail: boardsStore.detail,
issue: {},
list: {},
loadingAssignees: false,
Loading
Loading
@@ -117,18 +113,18 @@ gl.issueBoards.BoardSidebar = Vue.extend({
this.saveAssignees();
},
removeAssignee (a) {
gl.issueBoards.BoardsStore.detail.issue.removeAssignee(a);
boardsStore.detail.issue.removeAssignee(a);
},
addAssignee (a) {
gl.issueBoards.BoardsStore.detail.issue.addAssignee(a);
boardsStore.detail.issue.addAssignee(a);
},
removeAllAssignees () {
gl.issueBoards.BoardsStore.detail.issue.removeAllAssignees();
boardsStore.detail.issue.removeAllAssignees();
},
saveAssignees () {
this.loadingAssignees = true;
 
gl.issueBoards.BoardsStore.detail.issue.update()
boardsStore.detail.issue.update()
.then(() => {
this.loadingAssignees = false;
})
Loading
Loading
Loading
Loading
@@ -3,8 +3,7 @@
import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import eventHub from '../eventhub';
import tooltip from '../../vue_shared/directives/tooltip';
const Store = gl.issueBoards.BoardsStore;
import boardsStore from '../stores/boards_store';
 
export default {
components: {
Loading
Loading
@@ -110,7 +109,7 @@
filterByLabel(label, e) {
if (!this.updateFilters) return;
 
const filterPath = gl.issueBoards.BoardsStore.filter.path.split('&');
const filterPath = boardsStore.filter.path.split('&');
const labelTitle = encodeURIComponent(label.title);
const param = `label_name[]=${labelTitle}`;
const labelIndex = filterPath.indexOf(param);
Loading
Loading
@@ -122,9 +121,9 @@
filterPath.splice(labelIndex, 1);
}
 
gl.issueBoards.BoardsStore.filter.path = filterPath.join('&');
boardsStore.filter.path = filterPath.join('&');
 
Store.updateFiltersUrl();
boardsStore.updateFiltersUrl();
 
eventHub.$emit('updateTokens');
},
Loading
Loading
Loading
Loading
@@ -5,6 +5,7 @@ import ListsDropdown from './lists_dropdown.vue';
import { pluralize } from '../../../lib/utils/text_utility';
import ModalStore from '../../stores/modal_store';
import modalMixin from '../../mixins/modal_mixins';
import boardsStore from '../../stores/boards_store';
 
export default {
components: {
Loading
Loading
@@ -14,7 +15,7 @@ export default {
data() {
return {
modal: ModalStore.store,
state: gl.issueBoards.BoardsStore.state,
state: boardsStore.state,
};
},
computed: {
Loading
Loading
<script>
import { Link } from '@gitlab-org/gitlab-ui';
import ModalStore from '../../stores/modal_store';
import boardsStore from '../../stores/boards_store';
 
export default {
components: {
Loading
Loading
@@ -9,7 +10,7 @@ export default {
data() {
return {
modal: ModalStore.store,
state: gl.issueBoards.BoardsStore.state,
state: boardsStore.state,
};
},
computed: {
Loading
Loading
Loading
Loading
@@ -4,16 +4,12 @@ import $ from 'jquery';
import axios from '~/lib/utils/axios_utils';
import _ from 'underscore';
import CreateLabelDropdown from '../../create_label';
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
const Store = gl.issueBoards.BoardsStore;
import boardsStore from '../stores/boards_store';
 
$(document).off('created.label').on('created.label', (e, label) => {
Store.new({
boardsStore.new({
title: label.title,
position: Store.state.lists.length - 2,
position: boardsStore.state.lists.length - 2,
list_type: 'label',
label: {
id: label.id,
Loading
Loading
@@ -23,7 +19,7 @@ $(document).off('created.label').on('created.label', (e, label) => {
});
});
 
gl.issueBoards.newListDropdownInit = () => {
export default function initNewListDropdown() {
$('.js-new-board-list').each(function () {
const $this = $(this);
new CreateLabelDropdown($this.closest('.dropdown').find('.dropdown-new-label'), $this.data('namespacePath'), $this.data('projectPath'));
Loading
Loading
@@ -36,7 +32,7 @@ gl.issueBoards.newListDropdownInit = () => {
});
},
renderRow (label) {
const active = Store.findList('title', label.title);
const active = boardsStore.findList('title', label.title);
const $li = $('<li />');
const $a = $('<a />', {
class: (active ? `is-active js-board-list-${active.id}` : ''),
Loading
Loading
@@ -62,10 +58,10 @@ gl.issueBoards.newListDropdownInit = () => {
const label = options.selectedObj;
e.preventDefault();
 
if (!Store.findList('title', label.title)) {
Store.new({
if (!boardsStore.findList('title', label.title)) {
boardsStore.new({
title: label.title,
position: Store.state.lists.length - 2,
position: boardsStore.state.lists.length - 2,
list_type: 'label',
label: {
id: label.id,
Loading
Loading
@@ -74,9 +70,9 @@ gl.issueBoards.newListDropdownInit = () => {
},
});
 
Store.state.lists = _.sortBy(Store.state.lists, 'position');
boardsStore.state.lists = _.sortBy(boardsStore.state.lists, 'position');
}
},
});
});
};
}
Loading
Loading
@@ -2,8 +2,7 @@
import Vue from 'vue';
import Flash from '../../../flash';
import { __ } from '../../../locale';
const Store = gl.issueBoards.BoardsStore;
import boardsStore from '../../stores/boards_store';
 
export default Vue.extend({
props: {
Loading
Loading
@@ -49,7 +48,7 @@
list.removeIssue(issue);
});
 
Store.detail.issue = {};
boardsStore.detail.issue = {};
},
/**
* Build the default patch request.
Loading
Loading
import FilteredSearchContainer from '../filtered_search/container';
import FilteredSearchManager from '../filtered_search/filtered_search_manager';
import boardsStore from './stores/boards_store';
 
export default class FilteredSearchBoards extends FilteredSearchManager {
constructor(store, updateUrl = false, cantEdit = []) {
Loading
Loading
@@ -23,7 +24,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
this.store.path = path.substr(1);
 
if (this.updateUrl) {
gl.issueBoards.BoardsStore.updateFiltersUrl();
boardsStore.updateFiltersUrl();
}
}
 
Loading
Loading
Loading
Loading
@@ -14,24 +14,22 @@ import './models/issue';
import './models/list';
import './models/milestone';
import './models/project';
import './stores/boards_store';
import boardsStore from './stores/boards_store';
import ModalStore from './stores/modal_store';
import BoardService from './services/board_service';
import modalMixin from './mixins/modal_mixins';
import './mixins/sortable_default_options';
import './filters/due_date_filters';
import './components/board';
import './components/board_sidebar';
import './components/new_list_dropdown';
import Board from './components/board';
import BoardSidebar from './components/board_sidebar';
import initNewListDropdown from './components/new_list_dropdown';
import BoardAddIssuesModal from './components/modal/index.vue';
import '~/vue_shared/vue_resource_interceptor';
import { NavigationType } from '~/lib/utils/common_utils';
 
let issueBoardsApp;
export default () => {
const $boardApp = document.getElementById('board-app');
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
 
// check for browser back and trigger a hard reload to circumvent browser caching.
window.addEventListener('pageshow', (event) => {
Loading
Loading
@@ -43,25 +41,21 @@ export default () => {
}
});
 
if (gl.IssueBoardsApp) {
gl.IssueBoardsApp.$destroy(true);
if (issueBoardsApp) {
issueBoardsApp.$destroy(true);
}
 
Store.create();
// hack to allow sidebar scripts like milestone_select manipulate the BoardsStore
gl.issueBoards.boardStoreIssueSet = (...args) => Vue.set(Store.detail.issue, ...args);
gl.issueBoards.boardStoreIssueDelete = (...args) => Vue.delete(Store.detail.issue, ...args);
boardsStore.create();
 
gl.IssueBoardsApp = new Vue({
issueBoardsApp = new Vue({
el: $boardApp,
components: {
board: gl.issueBoards.Board,
'board-sidebar': gl.issueBoards.BoardSidebar,
Board,
BoardSidebar,
BoardAddIssuesModal,
},
data: {
state: Store.state,
state: boardsStore.state,
loading: true,
boardsEndpoint: $boardApp.dataset.boardsEndpoint,
listsEndpoint: $boardApp.dataset.listsEndpoint,
Loading
Loading
@@ -70,7 +64,7 @@ export default () => {
issueLinkBase: $boardApp.dataset.issueLinkBase,
rootPath: $boardApp.dataset.rootPath,
bulkUpdatePath: $boardApp.dataset.bulkUpdatePath,
detailIssue: Store.detail,
detailIssue: boardsStore.detail,
defaultAvatar: $boardApp.dataset.defaultAvatar,
},
computed: {
Loading
Loading
@@ -85,7 +79,7 @@ export default () => {
bulkUpdatePath: this.bulkUpdatePath,
boardId: this.boardId,
});
Store.rootPath = this.boardsEndpoint;
boardsStore.rootPath = this.boardsEndpoint;
 
eventHub.$on('updateTokens', this.updateTokens);
eventHub.$on('newDetailIssue', this.updateDetailIssue);
Loading
Loading
@@ -99,16 +93,16 @@ export default () => {
sidebarEventHub.$off('toggleSubscription', this.toggleSubscription);
},
mounted() {
this.filterManager = new FilteredSearchBoards(Store.filter, true, Store.cantEdit);
this.filterManager = new FilteredSearchBoards(boardsStore.filter, true, boardsStore.cantEdit);
this.filterManager.setup();
 
Store.disabled = this.disabled;
boardsStore.disabled = this.disabled;
gl.boardService
.all()
.then(res => res.data)
.then(data => {
data.forEach(board => {
const list = Store.addList(board, this.defaultAvatar);
const list = boardsStore.addList(board, this.defaultAvatar);
 
if (list.type === 'closed') {
list.position = Infinity;
Loading
Loading
@@ -119,7 +113,7 @@ export default () => {
 
this.state.lists = _.sortBy(this.state.lists, 'position');
 
Store.addBlankState();
boardsStore.addBlankState();
this.loading = false;
})
.catch(() => {
Loading
Loading
@@ -148,13 +142,13 @@ export default () => {
});
}
 
Store.detail.issue = newIssue;
boardsStore.detail.issue = newIssue;
},
clearDetailIssue() {
Store.detail.issue = {};
boardsStore.detail.issue = {};
},
toggleSubscription(id) {
const { issue } = Store.detail;
const { issue } = boardsStore.detail;
if (issue.id === id && issue.toggleSubscriptionEndpoint) {
issue.setFetchingState('subscriptions', true);
BoardService.toggleIssueSubscription(issue.toggleSubscriptionEndpoint)
Loading
Loading
@@ -173,26 +167,28 @@ export default () => {
},
});
 
gl.IssueBoardsSearch = new Vue({
// eslint-disable-next-line no-new
new Vue({
el: document.getElementById('js-add-list'),
data: {
filters: Store.state.filters,
filters: boardsStore.state.filters,
},
mounted() {
gl.issueBoards.newListDropdownInit();
initNewListDropdown();
},
});
 
const issueBoardsModal = document.getElementById('js-add-issues-btn');
 
if (issueBoardsModal) {
gl.IssueBoardsModalAddBtn = new Vue({
// eslint-disable-next-line no-new
new Vue({
el: issueBoardsModal,
mixins: [modalMixin],
data() {
return {
modal: ModalStore.store,
store: Store.state,
store: boardsStore.state,
canAdminList: this.$options.el.hasAttribute('data-can-admin-list'),
};
},
Loading
Loading
Loading
Loading
@@ -3,32 +3,29 @@
import $ from 'jquery';
import sortableConfig from '../../sortable/sortable_config';
 
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.onStart = () => {
export function sortableStart() {
$('.has-tooltip').tooltip('hide')
.tooltip('disable');
document.body.classList.add('is-dragging');
};
}
 
gl.issueBoards.onEnd = () => {
export function sortableEnd() {
$('.has-tooltip').tooltip('enable');
document.body.classList.remove('is-dragging');
};
}
 
gl.issueBoards.touchEnabled = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
export function getBoardSortableDefaultOptions(obj) {
const touchEnabled = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
 
gl.issueBoards.getBoardSortableDefaultOptions = (obj) => {
const defaultSortOptions = Object.assign({}, sortableConfig, {
filter: '.board-delete, .btn',
delay: gl.issueBoards.touchEnabled ? 100 : 0,
scrollSensitivity: gl.issueBoards.touchEnabled ? 60 : 100,
delay: touchEnabled ? 100 : 0,
scrollSensitivity: touchEnabled ? 60 : 100,
scrollSpeed: 20,
onStart: gl.issueBoards.onStart,
onEnd: gl.issueBoards.onEnd,
onStart: sortableStart,
onEnd: sortableEnd,
});
 
Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; });
return defaultSortOptions;
};
}
Loading
Loading
@@ -6,6 +6,7 @@
import Vue from 'vue';
import '~/vue_shared/models/label';
import IssueProject from './project';
import boardsStore from '../stores/boards_store';
 
class ListIssue {
constructor (obj, defaultAvatar) {
Loading
Loading
@@ -86,7 +87,7 @@ class ListIssue {
}
 
getLists () {
return gl.issueBoards.BoardsStore.state.lists.filter(list => list.findIssue(this.id));
return boardsStore.state.lists.filter(list => list.findIssue(this.id));
}
 
updateData(newData) {
Loading
Loading
Loading
Loading
@@ -5,6 +5,7 @@ import { __ } from '~/locale';
import ListLabel from '~/vue_shared/models/label';
import ListAssignee from '~/vue_shared/models/assignee';
import { urlParamsToObject } from '~/lib/utils/common_utils';
import boardsStore from '../stores/boards_store';
 
const PER_PAGE = 20;
 
Loading
Loading
@@ -89,9 +90,9 @@ class List {
}
 
destroy() {
const index = gl.issueBoards.BoardsStore.state.lists.indexOf(this);
gl.issueBoards.BoardsStore.state.lists.splice(index, 1);
gl.issueBoards.BoardsStore.updateNewListDropdown(this.id);
const index = boardsStore.state.lists.indexOf(this);
boardsStore.state.lists.splice(index, 1);
boardsStore.updateNewListDropdown(this.id);
 
gl.boardService.destroyList(this.id).catch(() => {
// TODO: handle request error
Loading
Loading
@@ -116,7 +117,7 @@ class List {
 
getIssues(emptyIssues = true) {
const data = {
...urlParamsToObject(gl.issueBoards.BoardsStore.filter.path),
...urlParamsToObject(boardsStore.filter.path),
page: this.page,
};
 
Loading
Loading
Loading
Loading
@@ -3,13 +3,11 @@
 
import $ from 'jquery';
import _ from 'underscore';
import Vue from 'vue';
import Cookies from 'js-cookie';
import { getUrlParamsArray } from '~/lib/utils/common_utils';
 
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardsStore = {
const boardsStore = {
disabled: false,
filter: {
path: '',
Loading
Loading
@@ -167,3 +165,16 @@ gl.issueBoards.BoardsStore = {
window.history.pushState(null, null, `?${this.filter.path}`);
}
};
// hacks added in order to allow milestone_select to function properly
// TODO: remove these
export function boardStoreIssueSet(...args) {
Vue.set(boardsStore.detail.issue, ...args);
}
export function boardStoreIssueDelete(...args) {
Vue.delete(boardsStore.detail.issue, ...args);
}
export default boardsStore;
Loading
Loading
@@ -5,6 +5,7 @@ import { __ } from '~/locale';
import axios from './lib/utils/axios_utils';
import { timeFor } from './lib/utils/datetime_utility';
import { parsePikadayDate, pikadayToString } from './lib/utils/datefix';
import boardsStore from './boards/stores/boards_store';
 
class DueDateSelect {
constructor({ $dropdown, $loading } = {}) {
Loading
Loading
@@ -58,7 +59,7 @@ class DueDateSelect {
$dueDateInput.val(calendar.toString(dateText));
 
if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
gl.issueBoards.BoardsStore.detail.issue.dueDate = $dueDateInput.val();
boardsStore.detail.issue.dueDate = $dueDateInput.val();
this.updateIssueBoardIssue();
} else {
this.saveDueDate(true);
Loading
Loading
@@ -79,7 +80,7 @@ class DueDateSelect {
calendar.setDate(null);
 
if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
gl.issueBoards.BoardsStore.detail.issue.dueDate = '';
boardsStore.detail.issue.dueDate = '';
this.updateIssueBoardIssue();
} else {
$(`input[name='${this.fieldName}']`).val('');
Loading
Loading
@@ -123,7 +124,7 @@ class DueDateSelect {
this.$loading.fadeOut();
};
 
gl.issueBoards.BoardsStore.detail.issue
boardsStore.detail.issue
.update(this.$dropdown.attr('data-issue-update'))
.then(fadeOutLoader)
.catch(fadeOutLoader);
Loading
Loading
Loading
Loading
@@ -11,6 +11,7 @@ import DropdownUtils from './filtered_search/dropdown_utils';
import CreateLabelDropdown from './create_label';
import flash from './flash';
import ModalStore from './boards/stores/modal_store';
import boardsStore from './boards/stores/boards_store';
 
export default class LabelsSelect {
constructor(els, options = {}) {
Loading
Loading
@@ -378,7 +379,7 @@ export default class LabelsSelect {
}
else if ($dropdown.hasClass('js-issue-board-sidebar')) {
if ($el.hasClass('is-active')) {
gl.issueBoards.BoardsStore.detail.issue.labels.push(new ListLabel({
boardsStore.detail.issue.labels.push(new ListLabel({
id: label.id,
title: label.title,
color: label.color[0],
Loading
Loading
@@ -386,16 +387,16 @@ export default class LabelsSelect {
}));
}
else {
var { labels } = gl.issueBoards.BoardsStore.detail.issue;
var { labels } = boardsStore.detail.issue;
labels = labels.filter(function (selectedLabel) {
return selectedLabel.id !== label.id;
});
gl.issueBoards.BoardsStore.detail.issue.labels = labels;
boardsStore.detail.issue.labels = labels;
}
 
$loading.fadeIn();
 
gl.issueBoards.BoardsStore.detail.issue.update($dropdown.attr('data-issue-update'))
boardsStore.detail.issue.update($dropdown.attr('data-issue-update'))
.then(fadeOutLoader)
.catch(fadeOutLoader);
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment