2021-12-10 22:13:45 -05:00
|
|
|
import { GlToast } from '@gitlab/ui';
|
|
|
|
import Vue from 'vue';
|
|
|
|
import IssuableContext from '~/issuable/issuable_context';
|
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
import Sidebar from '~/right_sidebar';
|
|
|
|
import { getSidebarOptions } from '~/sidebar/mount_sidebar';
|
|
|
|
import CsvImportExportButtons from './components/csv_import_export_buttons.vue';
|
|
|
|
import IssuableByEmail from './components/issuable_by_email.vue';
|
|
|
|
import IssuableHeaderWarnings from './components/issuable_header_warnings.vue';
|
|
|
|
|
|
|
|
export function initCsvImportExportButtons() {
|
|
|
|
const el = document.querySelector('.js-csv-import-export-buttons');
|
|
|
|
|
2021-12-22 04:13:51 -05:00
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-12-10 22:13:45 -05:00
|
|
|
|
|
|
|
const {
|
|
|
|
showExportButton,
|
|
|
|
showImportButton,
|
|
|
|
issuableType,
|
|
|
|
issuableCount,
|
|
|
|
email,
|
|
|
|
exportCsvPath,
|
|
|
|
importCsvIssuesPath,
|
|
|
|
containerClass,
|
|
|
|
canEdit,
|
|
|
|
projectImportJiraPath,
|
|
|
|
maxAttachmentSize,
|
|
|
|
showLabel,
|
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-02-16 16:12:25 -05:00
|
|
|
name: 'CsvImportExportButtonsRoot',
|
2021-12-10 22:13:45 -05:00
|
|
|
provide: {
|
|
|
|
showExportButton: parseBoolean(showExportButton),
|
|
|
|
showImportButton: parseBoolean(showImportButton),
|
|
|
|
issuableType,
|
|
|
|
email,
|
|
|
|
importCsvIssuesPath,
|
|
|
|
containerClass,
|
|
|
|
canEdit: parseBoolean(canEdit),
|
|
|
|
projectImportJiraPath,
|
|
|
|
maxAttachmentSize,
|
|
|
|
showLabel,
|
|
|
|
},
|
2021-12-22 04:13:51 -05:00
|
|
|
render: (createElement) =>
|
|
|
|
createElement(CsvImportExportButtons, {
|
2021-12-10 22:13:45 -05:00
|
|
|
props: {
|
|
|
|
exportCsvPath,
|
|
|
|
issuableCount: parseInt(issuableCount, 10),
|
|
|
|
},
|
2021-12-22 04:13:51 -05:00
|
|
|
}),
|
2021-12-10 22:13:45 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function initIssuableByEmail() {
|
2021-12-13 13:15:18 -05:00
|
|
|
const el = document.querySelector('.js-issuable-by-email');
|
2021-12-10 22:13:45 -05:00
|
|
|
|
2021-12-22 04:13:51 -05:00
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.use(GlToast);
|
2021-12-10 22:13:45 -05:00
|
|
|
|
|
|
|
const {
|
|
|
|
initialEmail,
|
|
|
|
issuableType,
|
|
|
|
emailsHelpPagePath,
|
|
|
|
quickActionsHelpPath,
|
|
|
|
markdownHelpPath,
|
|
|
|
resetPath,
|
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-02-16 16:12:25 -05:00
|
|
|
name: 'IssuableByEmailRoot',
|
2021-12-10 22:13:45 -05:00
|
|
|
provide: {
|
|
|
|
initialEmail,
|
|
|
|
issuableType,
|
|
|
|
emailsHelpPagePath,
|
|
|
|
quickActionsHelpPath,
|
|
|
|
markdownHelpPath,
|
|
|
|
resetPath,
|
|
|
|
},
|
2021-12-22 04:13:51 -05:00
|
|
|
render: (createElement) => createElement(IssuableByEmail),
|
2021-12-10 22:13:45 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function initIssuableHeaderWarnings(store) {
|
|
|
|
const el = document.getElementById('js-issuable-header-warnings');
|
|
|
|
|
|
|
|
if (!el) {
|
2021-12-22 04:13:51 -05:00
|
|
|
return null;
|
2021-12-10 22:13:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const { hidden } = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-02-16 01:12:24 -05:00
|
|
|
name: 'IssuableHeaderWarningsRoot',
|
2021-12-10 22:13:45 -05:00
|
|
|
store,
|
|
|
|
provide: { hidden: parseBoolean(hidden) },
|
2021-12-22 04:13:51 -05:00
|
|
|
render: (createElement) => createElement(IssuableHeaderWarnings),
|
2021-12-10 22:13:45 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function initIssuableSidebar() {
|
2021-12-22 04:13:51 -05:00
|
|
|
const el = document.querySelector('.js-sidebar-options');
|
2021-12-10 22:13:45 -05:00
|
|
|
|
2021-12-22 04:13:51 -05:00
|
|
|
if (!el) {
|
|
|
|
return;
|
|
|
|
}
|
2021-12-10 22:13:45 -05:00
|
|
|
|
2021-12-22 04:13:51 -05:00
|
|
|
const sidebarOptions = getSidebarOptions(el);
|
2021-12-10 22:13:45 -05:00
|
|
|
|
|
|
|
new IssuableContext(sidebarOptions.currentUser); // eslint-disable-line no-new
|
|
|
|
Sidebar.initialize();
|
|
|
|
}
|