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.

87 lines
3.1 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';
2023-03-04 22:38:38 +05:30
import IssuableLabelSelector from '~/issuable/issuable_label_selector';
2022-03-02 08:16:31 +05:30
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-08-27 11:52:29 +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 initNotesApp from '~/notes';
import { store } from '~/notes/stores';
2023-01-13 00:05:48 +05:30
import { mountMilestoneDropdown } from '~/sidebar/mount_sidebar';
2022-03-02 08:16:31 +05:30
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
2023-03-04 22:38:38 +05:30
IssuableLabelSelector();
2022-03-02 08:16:31 +05:30
new IssuableTemplateSelectors({ warnTemplateOverride: true }); // eslint-disable-line no-new
new LabelsSelect(); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new
initTitleSuggestions();
initTypePopover();
2023-01-13 00:05:48 +05:30
mountMilestoneDropdown();
2022-03-02 08:16:31 +05:30
}
export function initShow() {
const el = document.getElementById('js-issuable-app');
if (!el) {
return;
}
const { issueType, ...issuableData } = parseIssuableData(el);
if (issueType === IssueType.Incident) {
2023-04-23 21:23:45 +05:30
initIncidentApp({ ...issuableData, issuableId: el.dataset.issuableId }, store);
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(() => {});
}