diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-11 06:13:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-11 06:13:45 +0300 |
commit | 87f9516e78985eeb4c9d24716f13d4f9585af302 (patch) | |
tree | 2338dd74405abb866bd7877d29bd3f83a0af2b20 /app/assets/javascripts/issuable | |
parent | 3d414ac4da07ccd9199fe53728ca5f3884dc2bc1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/issuable')
6 files changed, 116 insertions, 128 deletions
diff --git a/app/assets/javascripts/issuable/index.js b/app/assets/javascripts/issuable/index.js new file mode 100644 index 00000000000..ad7c1942074 --- /dev/null +++ b/app/assets/javascripts/issuable/index.js @@ -0,0 +1,116 @@ +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'); + + if (!el) return null; + + const { + showExportButton, + showImportButton, + issuableType, + issuableCount, + email, + exportCsvPath, + importCsvIssuesPath, + containerClass, + canEdit, + projectImportJiraPath, + maxAttachmentSize, + showLabel, + } = el.dataset; + + return new Vue({ + el, + provide: { + showExportButton: parseBoolean(showExportButton), + showImportButton: parseBoolean(showImportButton), + issuableType, + email, + importCsvIssuesPath, + containerClass, + canEdit: parseBoolean(canEdit), + projectImportJiraPath, + maxAttachmentSize, + showLabel, + }, + render(h) { + return h(CsvImportExportButtons, { + props: { + exportCsvPath, + issuableCount: parseInt(issuableCount, 10), + }, + }); + }, + }); +} + +export function initIssuableByEmail() { + Vue.use(GlToast); + + const el = document.querySelector('.js-issueable-by-email'); + + if (!el) return null; + + const { + initialEmail, + issuableType, + emailsHelpPagePath, + quickActionsHelpPath, + markdownHelpPath, + resetPath, + } = el.dataset; + + return new Vue({ + el, + provide: { + initialEmail, + issuableType, + emailsHelpPagePath, + quickActionsHelpPath, + markdownHelpPath, + resetPath, + }, + render(h) { + return h(IssuableByEmail); + }, + }); +} + +export function initIssuableHeaderWarnings(store) { + const el = document.getElementById('js-issuable-header-warnings'); + + if (!el) { + return false; + } + + const { hidden } = el.dataset; + + return new Vue({ + el, + store, + provide: { hidden: parseBoolean(hidden) }, + render(createElement) { + return createElement(IssuableHeaderWarnings); + }, + }); +} + +export function initIssuableSidebar() { + const sidebarOptEl = document.querySelector('.js-sidebar-options'); + + if (!sidebarOptEl) return; + + const sidebarOptions = getSidebarOptions(sidebarOptEl); + + new IssuableContext(sidebarOptions.currentUser); // eslint-disable-line no-new + Sidebar.initialize(); +} diff --git a/app/assets/javascripts/issuable/init_csv_import_export_buttons.js b/app/assets/javascripts/issuable/init_csv_import_export_buttons.js deleted file mode 100644 index 83163e3c478..00000000000 --- a/app/assets/javascripts/issuable/init_csv_import_export_buttons.js +++ /dev/null @@ -1,48 +0,0 @@ -import Vue from 'vue'; -import { parseBoolean } from '~/lib/utils/common_utils'; -import CsvImportExportButtons from './components/csv_import_export_buttons.vue'; - -export default () => { - const el = document.querySelector('.js-csv-import-export-buttons'); - - if (!el) return null; - - const { - showExportButton, - showImportButton, - issuableType, - issuableCount, - email, - exportCsvPath, - importCsvIssuesPath, - containerClass, - canEdit, - projectImportJiraPath, - maxAttachmentSize, - showLabel, - } = el.dataset; - - return new Vue({ - el, - provide: { - showExportButton: parseBoolean(showExportButton), - showImportButton: parseBoolean(showImportButton), - issuableType, - email, - importCsvIssuesPath, - containerClass, - canEdit: parseBoolean(canEdit), - projectImportJiraPath, - maxAttachmentSize, - showLabel, - }, - render(h) { - return h(CsvImportExportButtons, { - props: { - exportCsvPath, - issuableCount: parseInt(issuableCount, 10), - }, - }); - }, - }); -}; diff --git a/app/assets/javascripts/issuable/init_issuable_by_email.js b/app/assets/javascripts/issuable/init_issuable_by_email.js deleted file mode 100644 index 984b826234c..00000000000 --- a/app/assets/javascripts/issuable/init_issuable_by_email.js +++ /dev/null @@ -1,35 +0,0 @@ -import { GlToast } from '@gitlab/ui'; -import Vue from 'vue'; -import IssuableByEmail from './components/issuable_by_email.vue'; - -Vue.use(GlToast); - -export default () => { - const el = document.querySelector('.js-issueable-by-email'); - - if (!el) return null; - - const { - initialEmail, - issuableType, - emailsHelpPagePath, - quickActionsHelpPath, - markdownHelpPath, - resetPath, - } = el.dataset; - - return new Vue({ - el, - provide: { - initialEmail, - issuableType, - emailsHelpPagePath, - quickActionsHelpPath, - markdownHelpPath, - resetPath, - }, - render(h) { - return h(IssuableByEmail); - }, - }); -}; diff --git a/app/assets/javascripts/issuable/init_issuable_header_warning.js b/app/assets/javascripts/issuable/init_issuable_header_warning.js deleted file mode 100644 index bf73615a4dd..00000000000 --- a/app/assets/javascripts/issuable/init_issuable_header_warning.js +++ /dev/null @@ -1,22 +0,0 @@ -import Vue from 'vue'; -import { parseBoolean } from '~/lib/utils/common_utils'; -import IssuableHeaderWarnings from './components/issuable_header_warnings.vue'; - -export default function issuableHeaderWarnings(store) { - const el = document.getElementById('js-issuable-header-warnings'); - - if (!el) { - return false; - } - - const { hidden } = el.dataset; - - return new Vue({ - el, - store, - provide: { hidden: parseBoolean(hidden) }, - render(createElement) { - return createElement(IssuableHeaderWarnings); - }, - }); -} diff --git a/app/assets/javascripts/issuable/init_issuable_sidebar.js b/app/assets/javascripts/issuable/init_issuable_sidebar.js deleted file mode 100644 index ec255439458..00000000000 --- a/app/assets/javascripts/issuable/init_issuable_sidebar.js +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable no-new */ - -import { getSidebarOptions } from '~/sidebar/mount_sidebar'; -import IssuableContext from '~/issuable/issuable_context'; -import Sidebar from '~/right_sidebar'; - -export default () => { - const sidebarOptEl = document.querySelector('.js-sidebar-options'); - - if (!sidebarOptEl) return; - - const sidebarOptions = getSidebarOptions(sidebarOptEl); - - new IssuableContext(sidebarOptions.currentUser); - Sidebar.initialize(); -}; diff --git a/app/assets/javascripts/issuable/issuable_index.js b/app/assets/javascripts/issuable/issuable_index.js deleted file mode 100644 index 407be7b39d5..00000000000 --- a/app/assets/javascripts/issuable/issuable_index.js +++ /dev/null @@ -1,7 +0,0 @@ -import issuableInitBulkUpdateSidebar from '~/issuable/bulk_update_sidebar/issuable_init_bulk_update_sidebar'; - -export default class IssuableIndex { - constructor(pagePrefix = 'issuable_') { - issuableInitBulkUpdateSidebar.init(pagePrefix); - } -} |