Commit f8463f77 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'ee-44224-remove-gl' into 'master'

Remove modal store and mixins from global scope

See merge request gitlab-org/gitlab-ee!5273
parents d87a9904 3128fece
import Vue from 'vue';
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../../stores/modal_store';
import modalMixin from '../../mixins/modal_mixins';
gl.issueBoards.ModalEmptyState = Vue.extend({
mixins: [gl.issueBoards.ModalMixins],
mixins: [modalMixin],
data() {
return ModalStore.store;
},
......
......@@ -3,11 +3,11 @@ import Flash from '../../../flash';
import { __ } from '../../../locale';
import './lists_dropdown';
import { pluralize } from '../../../lib/utils/text_utility';
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../../stores/modal_store';
import modalMixin from '../../mixins/modal_mixins';
gl.issueBoards.ModalFooter = Vue.extend({
mixins: [gl.issueBoards.ModalMixins],
mixins: [modalMixin],
data() {
return {
modal: ModalStore.store,
......
import Vue from 'vue';
import modalFilters from './filters';
import './tabs';
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../../stores/modal_store';
import modalMixin from '../../mixins/modal_mixins';
gl.issueBoards.ModalHeader = Vue.extend({
mixins: [gl.issueBoards.ModalMixins],
mixins: [modalMixin],
props: {
projectId: {
type: Number,
......
......@@ -7,8 +7,7 @@ import './header';
import './list';
import './footer';
import './empty_state';
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../../stores/modal_store';
gl.issueBoards.IssuesModal = Vue.extend({
props: {
......
......@@ -2,8 +2,7 @@
import Vue from 'vue';
import bp from '../../../breakpoints';
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../../stores/modal_store';
gl.issueBoards.ModalList = Vue.extend({
props: {
......
import Vue from 'vue';
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../../stores/modal_store';
gl.issueBoards.ModalFooterListsDropdown = Vue.extend({
data() {
......
import Vue from 'vue';
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../../stores/modal_store';
import modalMixin from '../../mixins/modal_mixins';
gl.issueBoards.ModalTabs = Vue.extend({
mixins: [gl.issueBoards.ModalMixins],
mixins: [modalMixin],
data() {
return ModalStore.store;
},
......
......@@ -17,9 +17,9 @@ import './models/milestone';
import './models/project';
import './models/assignee';
import './stores/boards_store';
import './stores/modal_store';
import ModalStore from './stores/modal_store';
import BoardService from './services/board_service';
import './mixins/modal_mixins';
import modalMixin from './mixins/modal_mixins';
import './mixins/sortable_default_options';
import './filters/due_date_filters';
import './components/board';
......@@ -37,7 +37,6 @@ import tooltip from '~/vue_shared/directives/tooltip'; // eslint-disable-line im
export default () => {
const $boardApp = document.getElementById('board-app');
const Store = gl.issueBoards.BoardsStore;
const ModalStore = gl.issueBoards.ModalStore;
const issueBoardsContent = document.querySelector('.content-wrapper > .js-focus-mode-board');
window.gl = window.gl || {};
......@@ -255,7 +254,7 @@ export default () => {
gl.IssueBoardsModalAddBtn = new Vue({
el: document.getElementById('js-add-issues-btn'),
mixins: [gl.issueBoards.ModalMixins],
mixins: [modalMixin],
data() {
return {
modal: ModalStore.store,
......
const ModalStore = gl.issueBoards.ModalStore;
import ModalStore from '../stores/modal_store';
gl.issueBoards.ModalMixins = {
export default {
methods: {
toggleModal(toggle) {
ModalStore.store.showAddIssuesModal = toggle;
......
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
class ModalStore {
constructor() {
this.store = {
......@@ -95,4 +92,4 @@ class ModalStore {
}
}
gl.issueBoards.ModalStore = new ModalStore();
export default new ModalStore();
......@@ -10,6 +10,7 @@ import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
import DropdownUtils from './filtered_search/dropdown_utils';
import CreateLabelDropdown from './create_label';
import flash from './flash';
import ModalStore from './boards/stores/modal_store';
export default class LabelsSelect {
constructor(els, options = {}) {
......@@ -350,7 +351,7 @@ export default class LabelsSelect {
}
if ($dropdown.closest('.add-issues-modal').length) {
boardsModel = gl.issueBoards.ModalStore.store.filter;
boardsModel = ModalStore.store.filter;
}
if (boardsModel) {
......
......@@ -6,6 +6,7 @@ import $ from 'jquery';
import _ from 'underscore';
import axios from './lib/utils/axios_utils';
import { timeFor } from './lib/utils/datetime_utility';
import ModalStore from './boards/stores/modal_store';
export default class MilestoneSelect {
constructor(currentProject, els, options = {}) {
......@@ -164,7 +165,7 @@ export default class MilestoneSelect {
}
if ($dropdown.closest('.add-issues-modal').length) {
boardsStore = gl.issueBoards.ModalStore.store.filter;
boardsStore = ModalStore.store.filter;
}
if (boardsStore) {
......
......@@ -5,6 +5,7 @@
import $ from 'jquery';
import _ from 'underscore';
import axios from './lib/utils/axios_utils';
import ModalStore from './boards/stores/modal_store';
// TODO: remove eventHub hack after code splitting refactor
window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
......@@ -441,7 +442,7 @@ function UsersSelect(currentUser, els, options = {}) {
return;
}
if ($el.closest('.add-issues-modal').length) {
gl.issueBoards.ModalStore.store.filter[$dropdown.data('fieldName')] = user.id;
ModalStore.store.filter[$dropdown.data('fieldName')] = user.id;
} else if (handleClick) {
e.preventDefault();
handleClick(user, isMarking);
......
---
title: Removes modal boards store and mixins from global scope
merge_request:
author:
type: other
......@@ -4,12 +4,11 @@ import '~/vue_shared/models/label';
import '~/boards/models/issue';
import '~/boards/models/list';
import '~/boards/models/assignee';
import '~/boards/stores/modal_store';
import Store from '~/boards/stores/modal_store';
describe('Modal store', () => {
let issue;
let issue2;
const Store = gl.issueBoards.ModalStore;
beforeEach(() => {
// Setup default state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment