debian-mirror-gitlab/app/assets/javascripts/issues/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
3 KiB
JavaScript
Raw Normal View History

2022-03-02 08:16:31 +05:30
import $ from 'jquery';
import IssuableForm from 'ee_else_ce/issuable/issuable_form';
import ShortcutsIssuable from '~/behaviors/shortcuts/shortcuts_issuable';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import GLForm from '~/gl_form';
import { initIssuableHeaderWarnings, initIssuableSidebar } from '~/issuable';
import IssuableTemplateSelectors from '~/issuable/issuable_template_selectors';
import { IssueType } from '~/issues/constants';
import Issue from '~/issues/issue';
import { initTitleSuggestions, initTypePopover } from '~/issues/new';
import { initRelatedMergeRequests } from '~/issues/related_merge_requests';
2022-07-23 23:45:48 +05:30
import initRelatedIssues from '~/related_issues';
2022-03-02 08:16:31 +05:30
import {
initHeaderActions,
initIncidentApp,
initIssueApp,
initSentryErrorStackTrace,
} from '~/issues/show';
import { parseIssuableData } from '~/issues/show/utils/parse_data';
import LabelsSelect from '~/labels/labels_select';
import MilestoneSelect from '~/milestones/milestone_select';
import initNotesApp from '~/notes';
import { store } from '~/notes/stores';
import ZenMode from '~/zen_mode';
2022-06-21 17:19:12 +05:30
import initAwardsApp from '~/emoji/awards_app';
2022-08-13 15:12:31 +05:30
import initLinkedResources from '~/linked_resources';
2022-03-02 08:16:31 +05:30
import FilteredSearchServiceDesk from './filtered_search_service_desk';
export function initFilteredSearchServiceDesk() {
if (document.querySelector('.filtered-search')) {
const supportBotData = JSON.parse(
document.querySelector('.js-service-desk-issues').dataset.supportBot,
);
const filteredSearchManager = new FilteredSearchServiceDesk(supportBotData);
filteredSearchManager.setup();
}
}
export function initForm() {
new GLForm($('.issue-form')); // eslint-disable-line no-new
new IssuableForm($('.issue-form')); // eslint-disable-line no-new
new IssuableTemplateSelectors({ warnTemplateOverride: true }); // eslint-disable-line no-new
new LabelsSelect(); // eslint-disable-line no-new
new MilestoneSelect(); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new
initTitleSuggestions();
initTypePopover();
}
export function initShow() {
const el = document.getElementById('js-issuable-app');
if (!el) {
return;
}
const { issueType, ...issuableData } = parseIssuableData(el);
if (issueType === IssueType.Incident) {
2022-07-23 23:45:48 +05:30
initIncidentApp({ ...issuableData, issuableId: el.dataset.issuableId });
2022-03-02 08:16:31 +05:30
initHeaderActions(store, IssueType.Incident);
2022-08-13 15:12:31 +05:30
initLinkedResources();
2022-07-23 23:45:48 +05:30
initRelatedIssues(IssueType.Incident);
2022-03-02 08:16:31 +05:30
} else {
initIssueApp(issuableData, store);
initHeaderActions(store);
}
new Issue(); // eslint-disable-line no-new
new ShortcutsIssuable(); // eslint-disable-line no-new
new ZenMode(); // eslint-disable-line no-new
initIssuableHeaderWarnings(store);
initIssuableSidebar();
initNotesApp();
initRelatedMergeRequests();
initSentryErrorStackTrace();
2022-06-21 17:19:12 +05:30
initAwardsApp(document.getElementById('js-vue-awards-block'));
2022-03-02 08:16:31 +05:30
import(/* webpackChunkName: 'design_management' */ '~/design_management')
.then((module) => module.default())
.catch(() => {});
}