2020-11-24 15:15:51 +05:30
|
|
|
import loadAwardsHandler from '~/awards_handler';
|
2021-03-11 19:13:27 +05:30
|
|
|
import ShortcutsIssuable from '~/behaviors/shortcuts/shortcuts_issuable';
|
2018-03-27 19:54:05 +05:30
|
|
|
import initIssuableSidebar from '~/init_issuable_sidebar';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { IssuableType } from '~/issuable_show/constants';
|
2018-03-27 19:54:05 +05:30
|
|
|
import Issue from '~/issue';
|
|
|
|
import '~/notes/index';
|
2020-11-24 15:15:51 +05:30
|
|
|
import initIncidentApp from '~/issue_show/incident';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { initIssuableApp, initIssueHeaderActions } from '~/issue_show/issue';
|
2020-11-24 15:15:51 +05:30
|
|
|
import { parseIssuableData } from '~/issue_show/utils/parse_data';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { store } from '~/notes/stores';
|
|
|
|
import initRelatedMergeRequestsApp from '~/related_merge_requests';
|
|
|
|
import initSentryErrorStackTraceApp from '~/sentry_error_stack_trace';
|
|
|
|
import initIssuableHeaderWarning from '~/vue_shared/components/issuable/init_issuable_header_warning';
|
|
|
|
import ZenMode from '~/zen_mode';
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
export default function initShowIssue() {
|
2021-02-22 17:27:13 +05:30
|
|
|
const initialDataEl = document.getElementById('js-issuable-app');
|
|
|
|
const { issueType, ...issuableData } = parseIssuableData(initialDataEl);
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
switch (issueType) {
|
|
|
|
case IssuableType.Incident:
|
|
|
|
initIncidentApp(issuableData);
|
|
|
|
break;
|
|
|
|
case IssuableType.Issue:
|
2021-01-29 00:20:46 +05:30
|
|
|
initIssuableApp(issuableData, store);
|
2021-01-03 14:25:43 +05:30
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2020-11-24 15:15:51 +05:30
|
|
|
}
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
initIssuableHeaderWarning(store);
|
2021-01-29 00:20:46 +05:30
|
|
|
initIssueHeaderActions(store);
|
2020-03-13 15:44:24 +05:30
|
|
|
initSentryErrorStackTraceApp();
|
2019-07-07 11:18:12 +05:30
|
|
|
initRelatedMergeRequestsApp();
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
import(/* webpackChunkName: 'design_management' */ '~/design_management')
|
2021-03-08 18:12:59 +05:30
|
|
|
.then((module) => module.default())
|
2020-07-28 23:09:34 +05:30
|
|
|
.catch(() => {});
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
new ZenMode(); // eslint-disable-line no-new
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
if (issueType !== IssuableType.TestCase) {
|
2021-04-29 21:17:54 +05:30
|
|
|
const awardEmojiEl = document.getElementById('js-vue-awards-block');
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
new Issue(); // eslint-disable-line no-new
|
|
|
|
new ShortcutsIssuable(); // eslint-disable-line no-new
|
2019-12-21 20:55:43 +05:30
|
|
|
initIssuableSidebar();
|
2021-04-29 21:17:54 +05:30
|
|
|
if (awardEmojiEl) {
|
|
|
|
import('~/emoji/awards_app')
|
|
|
|
.then((m) => m.default(awardEmojiEl))
|
|
|
|
.catch(() => {});
|
|
|
|
} else {
|
|
|
|
loadAwardsHandler();
|
|
|
|
}
|
2019-12-21 20:55:43 +05:30
|
|
|
}
|
2018-03-27 19:54:05 +05:30
|
|
|
}
|