Commit 8516e113 authored by Mike Greiling's avatar Mike Greiling

fix MR widget approvals bundle

parent 40e3494d
/* global Vue */
/* global Flash */ /* global Flash */
window.Vue = require('vue');
window.Vue.use(require('vue-resource'));
const Vue = window.Vue;
require('./approvals_store'); require('./approvals_store');
(() => { class ApprovalsApi {
class ApprovalsApi {
constructor(endpoint) { constructor(endpoint) {
gl.ApprovalsApi = this; gl.ApprovalsApi = this;
this.init(endpoint); this.init(endpoint);
...@@ -32,7 +34,7 @@ require('./approvals_store'); ...@@ -32,7 +34,7 @@ require('./approvals_store');
return Vue.http.delete(this.baseEndpoint).catch(() => new Flash(flashErrorMessage)); return Vue.http.delete(this.baseEndpoint).catch(() => new Flash(flashErrorMessage));
} }
} }
gl.ApprovalsApi = ApprovalsApi; window.gl = window.gl || {};
})(); window.gl.ApprovalsApi = ApprovalsApi;
function requireAll(context) { return context.keys().map(context); }
require('./approvals_store'); require('./approvals_store');
require('./approvals_api'); require('./approvals_api');
require('./components/approvals_body');
requireAll(require.context('./components', true, /^\.\/.*\.(js|es6)$/)); require('./components/approvals_footer');
/* global Vue */
require('./approvals_api'); require('./approvals_api');
(() => { let singleton;
let singleton;
class MergeRequestApprovalsStore { class MergeRequestApprovalsStore {
constructor(rootStore) { constructor(rootStore) {
if (!singleton) { if (!singleton) {
singleton = this; singleton = this;
...@@ -60,6 +57,7 @@ require('./approvals_api'); ...@@ -60,6 +57,7 @@ require('./approvals_api');
assignToRootStore(key, data) { assignToRootStore(key, data) {
return this.rootStore.assignToData(key, data); return this.rootStore.assignToData(key, data);
} }
} }
gl.MergeRequestApprovalsStore = MergeRequestApprovalsStore;
})(window.gl || (window.gl = {})); window.gl = window.gl || {};
window.gl.MergeRequestApprovalsStore = MergeRequestApprovalsStore;
/* global Vue */ /* global Vue */
const Vue = require('vue');
require('../approvals_store'); require('../approvals_store');
require('../approvals_api'); require('../approvals_api');
(() => { Vue.component('approvals-body', {
Vue.component('approvals-body', {
name: 'approvals-body', name: 'approvals-body',
props: { props: {
approvedBy: { approvedBy: {
...@@ -91,5 +91,4 @@ require('../approvals_api'); ...@@ -91,5 +91,4 @@ require('../approvals_api');
</div> </div>
</div> </div>
`, `,
}); });
})();
/* global Vue */ /* global Vue */
const Vue = require('vue');
require('../approvals_store'); require('../approvals_store');
require('../../../vue_common_component/link_to_member_avatar'); require('../../../vue_common_component/link_to_member_avatar');
(() => { Vue.component('approvals-footer', {
Vue.component('approvals-footer', {
name: 'approvals-footer', name: 'approvals-footer',
props: { props: {
approvedBy: { approvedBy: {
...@@ -89,5 +89,4 @@ require('../../../vue_common_component/link_to_member_avatar'); ...@@ -89,5 +89,4 @@ require('../../../vue_common_component/link_to_member_avatar');
</span> </span>
</div> </div>
`, `,
}); });
})();
/* global Vue */ const Vue = require('vue');
require('./widget_store'); require('./widget_store');
require('./approvals/approvals_bundle'); require('./approvals/approvals_bundle');
(() => { window.gl = window.gl || {};
$(() => {
$(() => {
const rootEl = document.getElementById('merge-request-widget-app'); const rootEl = document.getElementById('merge-request-widget-app');
const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl); const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl);
...@@ -12,5 +12,4 @@ require('./approvals/approvals_bundle'); ...@@ -12,5 +12,4 @@ require('./approvals/approvals_bundle');
el: rootEl, el: rootEl,
data: widgetSharedStore.data, data: widgetSharedStore.data,
}); });
}); });
})(window.gl || (window.gl = {}));
require('./approvals/approvals_store'); require('./approvals/approvals_store');
(() => { let singleton;
let singleton;
class MergeRequestWidgetStore { class MergeRequestWidgetStore {
constructor(rootEl) { constructor(rootEl) {
if (!singleton) { if (!singleton) {
singleton = gl.MergeRequestWidget.Store = this; singleton = gl.MergeRequestWidget.Store = this;
...@@ -35,6 +34,7 @@ require('./approvals/approvals_store'); ...@@ -35,6 +34,7 @@ require('./approvals/approvals_store');
this.data[key] = val; this.data[key] = val;
return val; return val;
} }
} }
gl.MergeRequestWidgetStore = MergeRequestWidgetStore;
})(window.gl || (window.gl = {})); window.gl = window.gl || {};
window.gl.MergeRequestWidgetStore = MergeRequestWidgetStore;
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