Commit cd00bbae authored by Simon Knox's avatar Simon Knox Committed by Phil Hughes

Don't include mr_notes store on issue page

Async imports for both stores, so lint doesn't complain
about consistent return
parent 26dec3e5
...@@ -13,9 +13,9 @@ import sidebarSubscriptions from './components/subscriptions/sidebar_subscriptio ...@@ -13,9 +13,9 @@ import sidebarSubscriptions from './components/subscriptions/sidebar_subscriptio
import SidebarSeverity from './components/severity/sidebar_severity.vue'; import SidebarSeverity from './components/severity/sidebar_severity.vue';
import Translate from '../vue_shared/translate'; import Translate from '../vue_shared/translate';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import { store } from '~/notes/stores';
import { isInIssuePage, parseBoolean } from '~/lib/utils/common_utils'; import { isInIssuePage, parseBoolean } from '~/lib/utils/common_utils';
import mergeRequestStore from '~/mr_notes/stores'; import createFlash from '~/flash';
import { __ } from '~/locale';
import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vue/store'; import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vue/store';
Vue.use(Translate); Vue.use(Translate);
...@@ -89,47 +89,72 @@ function mountConfidentialComponent(mediator) { ...@@ -89,47 +89,72 @@ function mountConfidentialComponent(mediator) {
const dataNode = document.getElementById('js-confidential-issue-data'); const dataNode = document.getElementById('js-confidential-issue-data');
const initialData = JSON.parse(dataNode.innerHTML); const initialData = JSON.parse(dataNode.innerHTML);
// eslint-disable-next-line no-new import(/* webpackChunkName: 'notesStore' */ '~/notes/stores')
new Vue({ .then(
el, ({ store }) =>
store, new Vue({
components: { el,
ConfidentialIssueSidebar, store,
}, components: {
render: createElement => ConfidentialIssueSidebar,
createElement('confidential-issue-sidebar', { },
props: { render: createElement =>
iid: String(iid), createElement('confidential-issue-sidebar', {
fullPath, props: {
isEditable: initialData.is_editable, iid: String(iid),
service: mediator.service, fullPath,
}, isEditable: initialData.is_editable,
}), service: mediator.service,
}); },
}),
}),
)
.catch(() => {
createFlash({ message: __('Failed to load sidebar confidential toggle') });
});
} }
function mountLockComponent() { function mountLockComponent() {
const el = document.getElementById('js-lock-entry-point'); const el = document.getElementById('js-lock-entry-point');
if (!el) {
return;
}
const { fullPath } = getSidebarOptions(); const { fullPath } = getSidebarOptions();
const dataNode = document.getElementById('js-lock-issue-data'); const dataNode = document.getElementById('js-lock-issue-data');
const initialData = JSON.parse(dataNode.innerHTML); const initialData = JSON.parse(dataNode.innerHTML);
return el let importStore;
? new Vue({ if (isInIssuePage()) {
el, importStore = import(/* webpackChunkName: 'notesStore' */ '~/notes/stores').then(
store: isInIssuePage() ? store : mergeRequestStore, ({ store }) => store,
provide: { );
fullPath, } else {
}, importStore = import(/* webpackChunkName: 'mrNotesStore' */ '~/mr_notes/stores');
render: createElement => }
createElement(IssuableLockForm, {
props: { importStore
isEditable: initialData.is_editable, .then(
}, store =>
}), new Vue({
}) el,
: undefined; store,
provide: {
fullPath,
},
render: createElement =>
createElement(IssuableLockForm, {
props: {
isEditable: initialData.is_editable,
},
}),
}),
)
.catch(() => {
createFlash({ message: __('Failed to load sidebar lock status') });
});
} }
function mountParticipantsComponent(mediator) { function mountParticipantsComponent(mediator) {
...@@ -219,7 +244,7 @@ function mountSeverityComponent() { ...@@ -219,7 +244,7 @@ function mountSeverityComponent() {
export function mountSidebar(mediator) { export function mountSidebar(mediator) {
mountAssigneesComponent(mediator); mountAssigneesComponent(mediator);
mountConfidentialComponent(mediator); mountConfidentialComponent(mediator);
mountLockComponent(mediator); mountLockComponent();
mountParticipantsComponent(mediator); mountParticipantsComponent(mediator);
mountSubscriptionsComponent(mediator); mountSubscriptionsComponent(mediator);
......
...@@ -10623,6 +10623,12 @@ msgstr "" ...@@ -10623,6 +10623,12 @@ msgstr ""
msgid "Failed to load related branches" msgid "Failed to load related branches"
msgstr "" msgstr ""
msgid "Failed to load sidebar confidential toggle"
msgstr ""
msgid "Failed to load sidebar lock status"
msgstr ""
msgid "Failed to load stacktrace." msgid "Failed to load stacktrace."
msgstr "" msgstr ""
......
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