Commit d37f1f1c authored by Alfredo Sumaran's avatar Alfredo Sumaran

Merge branch '30151-fix-vue-production-warnings' into 'master'

Remove Vue from main bundle and disable production warnings

Closes #30151

See merge request !10458
parents 3ded903d 4bdbccfc
...@@ -38,6 +38,10 @@ $(() => { ...@@ -38,6 +38,10 @@ $(() => {
Store.create(); 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);
gl.IssueBoardsApp = new Vue({ gl.IssueBoardsApp = new Vue({
el: $boardApp, el: $boardApp,
components: { components: {
......
...@@ -12,20 +12,18 @@ Vue.use(VueResource); ...@@ -12,20 +12,18 @@ Vue.use(VueResource);
* Renders Pipelines table in pipelines tab in the commits show view. * Renders Pipelines table in pipelines tab in the commits show view.
*/ */
// export for use in merge_request_tabs.js (TODO: remove this hack)
window.gl = window.gl || {};
window.gl.CommitPipelinesTable = CommitPipelinesTable;
$(() => { $(() => {
window.gl = window.gl || {};
gl.commits = gl.commits || {}; gl.commits = gl.commits || {};
gl.commits.pipelines = gl.commits.pipelines || {}; gl.commits.pipelines = gl.commits.pipelines || {};
if (gl.commits.PipelinesTableBundle) {
document.querySelector('#commit-pipeline-table-view').removeChild(this.pipelinesTableBundle.$el);
gl.commits.PipelinesTableBundle.$destroy(true);
}
const pipelineTableViewEl = document.querySelector('#commit-pipeline-table-view'); const pipelineTableViewEl = document.querySelector('#commit-pipeline-table-view');
if (pipelineTableViewEl && pipelineTableViewEl.dataset.disableInitialization === undefined) { if (pipelineTableViewEl && pipelineTableViewEl.dataset.disableInitialization === undefined) {
gl.commits.pipelines.PipelinesTableBundle = new CommitPipelinesTable().$mount(); gl.commits.pipelines.PipelinesTableBundle = new CommitPipelinesTable().$mount();
document.querySelector('#commit-pipeline-table-view').appendChild(gl.commits.pipelines.PipelinesTableBundle.$el); pipelineTableViewEl.appendChild(gl.commits.pipelines.PipelinesTableBundle.$el);
} }
}); });
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
/* global Flash */ /* global Flash */
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import CommitPipelinesTable from './commit/pipelines/pipelines_table';
import './breakpoints'; import './breakpoints';
import './flash'; import './flash';
...@@ -234,7 +231,7 @@ import './flash'; ...@@ -234,7 +231,7 @@ import './flash';
} }
mountPipelinesView() { mountPipelinesView() {
this.commitPipelinesTable = new CommitPipelinesTable().$mount(); this.commitPipelinesTable = new gl.CommitPipelinesTable().$mount();
// $mount(el) replaces the el with the new rendered component. We need it in order to mount // $mount(el) replaces the el with the new rendered component. We need it in order to mount
// it everytime this tab is clicked - https://vuejs.org/v2/api/#vm-mount // it everytime this tab is clicked - https://vuejs.org/v2/api/#vm-mount
document.querySelector('#commit-pipeline-table-view') document.querySelector('#commit-pipeline-table-view')
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* global Issuable */ /* global Issuable */
/* global ListMilestone */ /* global ListMilestone */
import Vue from 'vue';
(function() { (function() {
this.MilestoneSelect = (function() { this.MilestoneSelect = (function() {
function MilestoneSelect(currentProject, els) { function MilestoneSelect(currentProject, els) {
...@@ -151,12 +149,12 @@ import Vue from 'vue'; ...@@ -151,12 +149,12 @@ import Vue from 'vue';
return $dropdown.closest('form').submit(); return $dropdown.closest('form').submit();
} else if ($dropdown.hasClass('js-issue-board-sidebar')) { } else if ($dropdown.hasClass('js-issue-board-sidebar')) {
if (selected.id !== -1) { if (selected.id !== -1) {
Vue.set(gl.issueBoards.BoardsStore.detail.issue, 'milestone', new ListMilestone({ gl.issueBoards.boardStoreIssueSet('milestone', new ListMilestone({
id: selected.id, id: selected.id,
title: selected.name title: selected.name
})); }));
} else { } else {
Vue.delete(gl.issueBoards.BoardsStore.detail.issue, 'milestone'); gl.issueBoards.boardStoreIssueDelete('milestone');
} }
$dropdown.trigger('loading.gl.dropdown'); $dropdown.trigger('loading.gl.dropdown');
......
import Vue from 'vue';
(() => { (() => {
class Subscription { class Subscription {
constructor(containerElm) { constructor(containerElm) {
...@@ -29,8 +27,7 @@ import Vue from 'vue'; ...@@ -29,8 +27,7 @@ import Vue from 'vue';
// hack to allow this to work with the issue boards Vue object // hack to allow this to work with the issue boards Vue object
if (document.querySelector('html').classList.contains('issue-boards-page')) { if (document.querySelector('html').classList.contains('issue-boards-page')) {
Vue.set( gl.issueBoards.boardStoreIssueSet(
gl.issueBoards.BoardsStore.detail.issue,
'subscribed', 'subscribed',
!gl.issueBoards.BoardsStore.detail.issue.subscribed, !gl.issueBoards.BoardsStore.detail.issue.subscribed,
); );
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* global Issuable */ /* global Issuable */
/* global ListUser */ /* global ListUser */
import Vue from 'vue';
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }, var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; },
slice = [].slice; slice = [].slice;
...@@ -74,7 +72,7 @@ import Vue from 'vue'; ...@@ -74,7 +72,7 @@ import Vue from 'vue';
e.preventDefault(); e.preventDefault();
if ($dropdown.hasClass('js-issue-board-sidebar')) { if ($dropdown.hasClass('js-issue-board-sidebar')) {
Vue.set(gl.issueBoards.BoardsStore.detail.issue, 'assignee', new ListUser({ gl.issueBoards.boardStoreIssueSet('assignee', new ListUser({
id: _this.currentUser.id, id: _this.currentUser.id,
username: _this.currentUser.username, username: _this.currentUser.username,
name: _this.currentUser.name, name: _this.currentUser.name,
...@@ -225,14 +223,14 @@ import Vue from 'vue'; ...@@ -225,14 +223,14 @@ import Vue from 'vue';
return $dropdown.closest('form').submit(); return $dropdown.closest('form').submit();
} else if ($dropdown.hasClass('js-issue-board-sidebar')) { } else if ($dropdown.hasClass('js-issue-board-sidebar')) {
if (user.id) { if (user.id) {
Vue.set(gl.issueBoards.BoardsStore.detail.issue, 'assignee', new ListUser({ gl.issueBoards.boardStoreIssueSet('assignee', new ListUser({
id: user.id, id: user.id,
username: user.username, username: user.username,
name: user.name, name: user.name,
avatar_url: user.avatar_url avatar_url: user.avatar_url
})); }));
} else { } else {
Vue.delete(gl.issueBoards.BoardsStore.detail.issue, 'assignee'); gl.issueBoards.boardStoreIssueDelete('assignee');
} }
updateIssueBoardsIssue(); updateIssueBoardsIssue();
......
/* eslint-disable no-var, comma-dangle, object-shorthand */ /* eslint-disable no-var, comma-dangle, object-shorthand */
require('~/merge_request_tabs'); require('~/merge_request_tabs');
require('~/commit/pipelines/pipelines_bundle.js');
require('~/breakpoints'); require('~/breakpoints');
require('~/lib/utils/common_utils'); require('~/lib/utils/common_utils');
require('~/diff'); require('~/diff');
......
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