diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /app/assets/javascripts/pages/admin | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'app/assets/javascripts/pages/admin')
26 files changed, 105 insertions, 344 deletions
diff --git a/app/assets/javascripts/pages/admin/abuse_reports/index.js b/app/assets/javascripts/pages/admin/abuse_reports/index.js index a88d35796f7..ab29f9149f7 100644 --- a/app/assets/javascripts/pages/admin/abuse_reports/index.js +++ b/app/assets/javascripts/pages/admin/abuse_reports/index.js @@ -5,4 +5,4 @@ import AbuseReports from './abuse_reports'; new AbuseReports(); /* eslint-disable-line no-new */ new UsersSelect(); /* eslint-disable-line no-new */ -document.addEventListener('DOMContentLoaded', initDeprecatedRemoveRowBehavior); +initDeprecatedRemoveRowBehavior(); diff --git a/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js b/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js index a2fca238613..a5305777dd5 100644 --- a/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js +++ b/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js @@ -1,3 +1,3 @@ import setup from '~/admin/application_settings/setup_metrics_and_profiling'; -document.addEventListener('DOMContentLoaded', setup); +setup(); diff --git a/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/usage_statistics.js b/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/usage_statistics.js new file mode 100644 index 00000000000..bf27b1a81ff --- /dev/null +++ b/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/usage_statistics.js @@ -0,0 +1,41 @@ +import { __ } from '~/locale'; + +export const HELPER_TEXT_SERVICE_PING_DISABLED = __( + 'To enable Registration Features, make sure "Enable service ping" is checked.', +); + +export const HELPER_TEXT_SERVICE_PING_ENABLED = __( + 'You can enable Registration Features because Service Ping is enabled. To continue using Registration Features in the future, you will also need to register with GitLab via a new cloud licensing service.', +); + +function setHelperText(usagePingCheckbox) { + const helperTextId = document.getElementById('service_ping_features_helper_text'); + + const usagePingFeaturesLabel = document.getElementById('service_ping_features_label'); + + const usagePingFeaturesCheckbox = document.getElementById( + 'application_setting_usage_ping_features_enabled', + ); + + helperTextId.textContent = usagePingCheckbox.checked + ? HELPER_TEXT_SERVICE_PING_ENABLED + : HELPER_TEXT_SERVICE_PING_DISABLED; + + usagePingFeaturesLabel.classList.toggle('gl-cursor-not-allowed', !usagePingCheckbox.checked); + + usagePingFeaturesCheckbox.disabled = !usagePingCheckbox.checked; + + if (!usagePingCheckbox.checked) { + usagePingFeaturesCheckbox.disabled = true; + usagePingFeaturesCheckbox.checked = false; + } +} + +export default function initSetHelperText() { + const usagePingCheckbox = document.getElementById('application_setting_usage_ping_enabled'); + + setHelperText(usagePingCheckbox); + usagePingCheckbox.addEventListener('change', () => { + setHelperText(usagePingCheckbox); + }); +} diff --git a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js index bc1d4dd6122..08f6633f424 100644 --- a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js +++ b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js @@ -1,4 +1,4 @@ -import { deprecatedCreateFlash as flash } from '../../../flash'; +import createFlash from '~/flash'; import axios from '../../../lib/utils/axios_utils'; import { __ } from '../../../locale'; @@ -38,7 +38,9 @@ export default class PayloadPreviewer { }) .catch(() => { this.spinner.classList.remove('d-inline-flex'); - flash(__('Error fetching payload data.')); + createFlash({ + message: __('Error fetching payload data.'), + }); }); } diff --git a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js index 5a16716fe2d..2a7e6a45cdd 100644 --- a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js +++ b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js @@ -1,8 +1,9 @@ import $ from 'jquery'; import { debounce } from 'lodash'; -import { deprecatedCreateFlash as flash } from '~/flash'; +import createFlash from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { textColorForBackground } from '~/lib/utils/color_utils'; +import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants'; import { __ } from '~/locale'; export default () => { @@ -30,7 +31,11 @@ export default () => { .then(({ data }) => { $jsBroadcastMessagePreview.html(data.message); }) - .catch(() => flash(__('An error occurred while rendering preview broadcast message'))); + .catch(() => + createFlash({ + message: __('An error occurred while rendering preview broadcast message'), + }), + ); } }; @@ -61,7 +66,7 @@ export default () => { 'input', debounce(() => { reloadPreview(); - }, 250), + }, DEFAULT_DEBOUNCE_AND_THROTTLE_MS), ); const updateColorPreview = () => { diff --git a/app/assets/javascripts/pages/admin/broadcast_messages/index.js b/app/assets/javascripts/pages/admin/broadcast_messages/index.js index b7db6443658..f687423594d 100644 --- a/app/assets/javascripts/pages/admin/broadcast_messages/index.js +++ b/app/assets/javascripts/pages/admin/broadcast_messages/index.js @@ -1,7 +1,5 @@ import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior'; import initBroadcastMessagesForm from './broadcast_message'; -document.addEventListener('DOMContentLoaded', () => { - initBroadcastMessagesForm(); - initDeprecatedRemoveRowBehavior(); -}); +initBroadcastMessagesForm(); +initDeprecatedRemoveRowBehavior(); diff --git a/app/assets/javascripts/pages/admin/clusters/destroy/index.js b/app/assets/javascripts/pages/admin/clusters/destroy/index.js index 8001d2dd1da..487e7a14a16 100644 --- a/app/assets/javascripts/pages/admin/clusters/destroy/index.js +++ b/app/assets/javascripts/pages/admin/clusters/destroy/index.js @@ -1,5 +1,3 @@ import ClustersBundle from '~/clusters/clusters_bundle'; -document.addEventListener('DOMContentLoaded', () => { - new ClustersBundle(); // eslint-disable-line no-new -}); +new ClustersBundle(); // eslint-disable-line no-new diff --git a/app/assets/javascripts/pages/admin/clusters/edit/index.js b/app/assets/javascripts/pages/admin/clusters/edit/index.js index 8001d2dd1da..487e7a14a16 100644 --- a/app/assets/javascripts/pages/admin/clusters/edit/index.js +++ b/app/assets/javascripts/pages/admin/clusters/edit/index.js @@ -1,5 +1,3 @@ import ClustersBundle from '~/clusters/clusters_bundle'; -document.addEventListener('DOMContentLoaded', () => { - new ClustersBundle(); // eslint-disable-line no-new -}); +new ClustersBundle(); // eslint-disable-line no-new diff --git a/app/assets/javascripts/pages/admin/clusters/index.js b/app/assets/javascripts/pages/admin/clusters/index.js index 4d04c37caa7..f398b1cee82 100644 --- a/app/assets/javascripts/pages/admin/clusters/index.js +++ b/app/assets/javascripts/pages/admin/clusters/index.js @@ -1,5 +1,3 @@ import initCreateCluster from '~/create_cluster/init_create_cluster'; -document.addEventListener('DOMContentLoaded', () => { - initCreateCluster(document, gon); -}); +initCreateCluster(document, gon); diff --git a/app/assets/javascripts/pages/admin/clusters/index/index.js b/app/assets/javascripts/pages/admin/clusters/index/index.js index a99e0dfa4f0..a1ba920b322 100644 --- a/app/assets/javascripts/pages/admin/clusters/index/index.js +++ b/app/assets/javascripts/pages/admin/clusters/index/index.js @@ -1,8 +1,6 @@ import initClustersListApp from '~/clusters_list'; import PersistentUserCallout from '~/persistent_user_callout'; -document.addEventListener('DOMContentLoaded', () => { - const callout = document.querySelector('.gcp-signup-offer'); - PersistentUserCallout.factory(callout); - initClustersListApp(); -}); +const callout = document.querySelector('.gcp-signup-offer'); +PersistentUserCallout.factory(callout); +initClustersListApp(); diff --git a/app/assets/javascripts/pages/admin/clusters/new/index.js b/app/assets/javascripts/pages/admin/clusters/new/index.js index 876bab0b339..de9ded87ef3 100644 --- a/app/assets/javascripts/pages/admin/clusters/new/index.js +++ b/app/assets/javascripts/pages/admin/clusters/new/index.js @@ -1,5 +1,3 @@ import initNewCluster from '~/clusters/new_cluster'; -document.addEventListener('DOMContentLoaded', () => { - initNewCluster(); -}); +initNewCluster(); diff --git a/app/assets/javascripts/pages/admin/clusters/show/index.js b/app/assets/javascripts/pages/admin/clusters/show/index.js index 9d94973af0d..524b2c6f66a 100644 --- a/app/assets/javascripts/pages/admin/clusters/show/index.js +++ b/app/assets/javascripts/pages/admin/clusters/show/index.js @@ -2,8 +2,6 @@ import ClustersBundle from '~/clusters/clusters_bundle'; import initIntegrationForm from '~/clusters/forms/show'; import initClusterHealth from '~/pages/projects/clusters/show/cluster_health'; -document.addEventListener('DOMContentLoaded', () => { - new ClustersBundle(); // eslint-disable-line no-new - initClusterHealth(); - initIntegrationForm(); -}); +new ClustersBundle(); // eslint-disable-line no-new +initClusterHealth(); +initIntegrationForm(); diff --git a/app/assets/javascripts/pages/admin/dev_ops_report/index.js b/app/assets/javascripts/pages/admin/dev_ops_report/index.js index d6fa1be29b0..a94a60af7ff 100644 --- a/app/assets/javascripts/pages/admin/dev_ops_report/index.js +++ b/app/assets/javascripts/pages/admin/dev_ops_report/index.js @@ -1,5 +1,5 @@ import initDevOpsScore from '~/analytics/devops_report/devops_score'; -import initDevOpsScoreDisabledUsagePing from '~/analytics/devops_report/devops_score_disabled_usage_ping'; +import initDevOpsScoreDisabledServicePing from '~/analytics/devops_report/devops_score_disabled_service_ping'; -initDevOpsScoreDisabledUsagePing(); +initDevOpsScoreDisabledServicePing(); initDevOpsScore(); diff --git a/app/assets/javascripts/pages/admin/identities/index.js b/app/assets/javascripts/pages/admin/identities/index.js new file mode 100644 index 00000000000..a9f5f00cb9b --- /dev/null +++ b/app/assets/javascripts/pages/admin/identities/index.js @@ -0,0 +1,6 @@ +import { initAdminUserActions, initDeleteUserModals } from '~/admin/users'; +import initConfirmModal from '~/confirm_modal'; + +initAdminUserActions(); +initDeleteUserModals(); +initConfirmModal(); diff --git a/app/assets/javascripts/pages/admin/impersonation_tokens/index.js b/app/assets/javascripts/pages/admin/impersonation_tokens/index.js index dc1bb88bf4b..8fbc8dc17bc 100644 --- a/app/assets/javascripts/pages/admin/impersonation_tokens/index.js +++ b/app/assets/javascripts/pages/admin/impersonation_tokens/index.js @@ -1,3 +1,8 @@ import { initExpiresAtField } from '~/access_tokens'; +import { initAdminUserActions, initDeleteUserModals } from '~/admin/users'; +import initConfirmModal from '~/confirm_modal'; +initAdminUserActions(); +initDeleteUserModals(); initExpiresAtField(); +initConfirmModal(); diff --git a/app/assets/javascripts/pages/admin/integrations/edit/index.js b/app/assets/javascripts/pages/admin/integrations/edit/index.js index ba4b271f09e..8002fa8bf78 100644 --- a/app/assets/javascripts/pages/admin/integrations/edit/index.js +++ b/app/assets/javascripts/pages/admin/integrations/edit/index.js @@ -1,7 +1,7 @@ import IntegrationSettingsForm from '~/integrations/integration_settings_form'; import PrometheusMetrics from '~/prometheus_metrics/prometheus_metrics'; -document.addEventListener('DOMContentLoaded', () => { +function initIntegrations() { const prometheusSettingsWrapper = document.querySelector('.js-prometheus-metrics-monitoring'); const integrationSettingsForm = new IntegrationSettingsForm('.js-integration-settings-form'); integrationSettingsForm.init(); @@ -10,4 +10,6 @@ document.addEventListener('DOMContentLoaded', () => { const prometheusMetrics = new PrometheusMetrics('.js-prometheus-metrics-monitoring'); prometheusMetrics.loadActiveMetrics(); } -}); +} + +initIntegrations(); diff --git a/app/assets/javascripts/pages/admin/jobs/index/index.js b/app/assets/javascripts/pages/admin/jobs/index/index.js index 46ddb95299d..a4d89889d57 100644 --- a/app/assets/javascripts/pages/admin/jobs/index/index.js +++ b/app/assets/javascripts/pages/admin/jobs/index/index.js @@ -5,7 +5,7 @@ import stopJobsModal from './components/stop_jobs_modal.vue'; Vue.use(Translate); -document.addEventListener('DOMContentLoaded', () => { +function initJobs() { const buttonId = 'js-stop-jobs-button'; const modalId = 'stop-jobs-modal'; const stopJobsButton = document.getElementById(buttonId); @@ -31,4 +31,6 @@ document.addEventListener('DOMContentLoaded', () => { }, }); } -}); +} + +initJobs(); diff --git a/app/assets/javascripts/pages/admin/keys/index.js b/app/assets/javascripts/pages/admin/keys/index.js index 45b83ffcd67..868c8e33077 100644 --- a/app/assets/javascripts/pages/admin/keys/index.js +++ b/app/assets/javascripts/pages/admin/keys/index.js @@ -1,5 +1,3 @@ import initConfirmModal from '~/confirm_modal'; -document.addEventListener('DOMContentLoaded', () => { - initConfirmModal(); -}); +initConfirmModal(); diff --git a/app/assets/javascripts/pages/admin/labels/index/index.js b/app/assets/javascripts/pages/admin/labels/index/index.js index 17ee7c03ed6..0ceab3b922f 100644 --- a/app/assets/javascripts/pages/admin/labels/index/index.js +++ b/app/assets/javascripts/pages/admin/labels/index/index.js @@ -1,4 +1,4 @@ -document.addEventListener('DOMContentLoaded', () => { +function initLabels() { const pagination = document.querySelector('.labels .gl-pagination'); const emptyState = document.querySelector('.labels .nothing-here-block.hidden'); @@ -18,4 +18,6 @@ document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('.js-remove-label').forEach((row) => { row.addEventListener('ajax:success', removeLabelSuccessCallback); }); -}); +} + +initLabels(); diff --git a/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue b/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue index b92fc8d125d..055d6f40c14 100644 --- a/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue +++ b/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue @@ -46,7 +46,7 @@ export default { return sprintf( s__(`AdminProjects| You’re about to permanently delete the project %{projectName}, its repository, - and all related resources including issues, merge requests, etc.. Once you confirm and press + and all related resources, including issues and merge requests. Once you confirm and press %{strong_start}Delete project%{strong_end}, it cannot be undone or recovered.`), { projectName: `<strong>${escape(this.projectName)}</strong>`, diff --git a/app/assets/javascripts/pages/admin/projects/index/index.js b/app/assets/javascripts/pages/admin/projects/index/index.js index cc9a9b6cc38..c6cf4a46dba 100644 --- a/app/assets/javascripts/pages/admin/projects/index/index.js +++ b/app/assets/javascripts/pages/admin/projects/index/index.js @@ -13,9 +13,11 @@ import deleteProjectModal from './components/delete_project_modal.vue'; const deleteModal = new Vue({ el: deleteProjectModalEl, - data: { - deleteProjectUrl: '', - projectName: '', + data() { + return { + deleteProjectUrl: '', + projectName: '', + }; }, mounted() { const deleteProjectButtons = document.querySelectorAll('.delete-project-button'); diff --git a/app/assets/javascripts/pages/admin/spam_logs/index.js b/app/assets/javascripts/pages/admin/spam_logs/index.js index e5ab5d43bbf..ac850a6467b 100644 --- a/app/assets/javascripts/pages/admin/spam_logs/index.js +++ b/app/assets/javascripts/pages/admin/spam_logs/index.js @@ -1,3 +1,3 @@ import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior'; -document.addEventListener('DOMContentLoaded', initDeprecatedRemoveRowBehavior); +initDeprecatedRemoveRowBehavior(); diff --git a/app/assets/javascripts/pages/admin/users/components/delete_user_modal.vue b/app/assets/javascripts/pages/admin/users/components/delete_user_modal.vue deleted file mode 100644 index a3b78da6ef5..00000000000 --- a/app/assets/javascripts/pages/admin/users/components/delete_user_modal.vue +++ /dev/null @@ -1,151 +0,0 @@ -<script> -import { GlModal, GlButton, GlFormInput, GlSprintf } from '@gitlab/ui'; -import * as Sentry from '@sentry/browser'; -import { s__, sprintf } from '~/locale'; -import OncallSchedulesList from '~/vue_shared/components/oncall_schedules_list.vue'; - -export default { - components: { - GlModal, - GlButton, - GlFormInput, - GlSprintf, - OncallSchedulesList, - }, - props: { - title: { - type: String, - required: true, - }, - content: { - type: String, - required: true, - }, - action: { - type: String, - required: true, - }, - secondaryAction: { - type: String, - required: true, - }, - deleteUserUrl: { - type: String, - required: true, - }, - blockUserUrl: { - type: String, - required: true, - }, - username: { - type: String, - required: true, - }, - csrfToken: { - type: String, - required: true, - }, - oncallSchedules: { - type: String, - required: false, - default: '[]', - }, - }, - data() { - return { - enteredUsername: '', - }; - }, - computed: { - modalTitle() { - return sprintf(this.title, { username: this.username }); - }, - secondaryButtonLabel() { - return s__('AdminUsers|Block user'); - }, - canSubmit() { - return this.enteredUsername === this.username; - }, - schedules() { - try { - return JSON.parse(this.oncallSchedules); - } catch (e) { - Sentry.captureException(e); - } - return []; - }, - }, - methods: { - show() { - this.$refs.modal.show(); - }, - onCancel() { - this.enteredUsername = ''; - this.$refs.modal.hide(); - }, - onSecondaryAction() { - const { form } = this.$refs; - - form.action = this.blockUserUrl; - this.$refs.method.value = 'put'; - - form.submit(); - }, - onSubmit() { - this.$refs.form.submit(); - this.enteredUsername = ''; - }, - }, -}; -</script> - -<template> - <gl-modal ref="modal" modal-id="delete-user-modal" :title="modalTitle" kind="danger"> - <p> - <gl-sprintf :message="content"> - <template #username> - <strong>{{ username }}</strong> - </template> - <template #strong="props"> - <strong>{{ props.content }}</strong> - </template> - </gl-sprintf> - </p> - - <oncall-schedules-list v-if="schedules.length" :schedules="schedules" /> - - <p> - <gl-sprintf :message="s__('AdminUsers|To confirm, type %{username}')"> - <template #username> - <code>{{ username }}</code> - </template> - </gl-sprintf> - </p> - - <form ref="form" :action="deleteUserUrl" method="post" @submit.prevent> - <input ref="method" type="hidden" name="_method" value="delete" /> - <input :value="csrfToken" type="hidden" name="authenticity_token" /> - <gl-form-input - v-model="enteredUsername" - autofocus - type="text" - name="username" - autocomplete="off" - /> - </form> - <template #modal-footer> - <gl-button @click="onCancel">{{ s__('Cancel') }}</gl-button> - <gl-button - :disabled="!canSubmit" - category="secondary" - variant="danger" - @click="onSecondaryAction" - > - {{ secondaryAction }} - </gl-button> - <gl-button :disabled="!canSubmit" category="primary" variant="danger" @click="onSubmit">{{ - action - }}</gl-button> - </template> - </gl-modal> -</template> diff --git a/app/assets/javascripts/pages/admin/users/components/user_modal_manager.vue b/app/assets/javascripts/pages/admin/users/components/user_modal_manager.vue deleted file mode 100644 index 1dfea3f1e7b..00000000000 --- a/app/assets/javascripts/pages/admin/users/components/user_modal_manager.vue +++ /dev/null @@ -1,77 +0,0 @@ -<script> -import DeleteUserModal from './delete_user_modal.vue'; - -export default { - components: { DeleteUserModal }, - props: { - modalConfiguration: { - required: true, - type: Object, - }, - csrfToken: { - required: true, - type: String, - }, - selector: { - required: true, - type: String, - }, - }, - data() { - return { - currentModalData: null, - }; - }, - computed: { - activeModal() { - return Boolean(this.currentModalData); - }, - - modalProps() { - const { glModalAction: requestedAction } = this.currentModalData; - return { - ...this.modalConfiguration[requestedAction], - ...this.currentModalData, - csrfToken: this.csrfToken, - }; - }, - }, - - mounted() { - /* - * Here we're looking for every button that needs to launch a modal - * on click, and then attaching a click event handler to show the modal - * if it's correctly configured. - * - * TODO: Replace this with integrated modal components https://gitlab.com/gitlab-org/gitlab/-/issues/320922 - */ - document.querySelectorAll(this.selector).forEach((button) => { - button.addEventListener('click', (e) => { - if (!button.dataset.glModalAction) return; - - e.preventDefault(); - this.show(button.dataset); - }); - }); - }, - - methods: { - show(modalData) { - const { glModalAction: requestedAction } = modalData; - - if (!this.modalConfiguration[requestedAction]) { - throw new Error(`Modal action ${requestedAction} has no configuration in HTML`); - } - - this.currentModalData = modalData; - - return this.$nextTick().then(() => { - this.$refs.modal.show(); - }); - }, - }, -}; -</script> -<template> - <delete-user-modal v-if="activeModal" ref="modal" v-bind="modalProps" /> -</template> diff --git a/app/assets/javascripts/pages/admin/users/index.js b/app/assets/javascripts/pages/admin/users/index.js index 9a8b0c9990f..41e99a3baf5 100644 --- a/app/assets/javascripts/pages/admin/users/index.js +++ b/app/assets/javascripts/pages/admin/users/index.js @@ -1,64 +1,7 @@ -import Vue from 'vue'; - -import { initAdminUsersApp } from '~/admin/users'; +import { initAdminUsersApp, initDeleteUserModals, initAdminUserActions } from '~/admin/users'; import initConfirmModal from '~/confirm_modal'; -import csrf from '~/lib/utils/csrf'; -import Translate from '~/vue_shared/translate'; -import ModalManager from './components/user_modal_manager.vue'; - -const CONFIRM_DELETE_BUTTON_SELECTOR = '.js-delete-user-modal-button'; -const MODAL_TEXTS_CONTAINER_SELECTOR = '#js-modal-texts'; -const MODAL_MANAGER_SELECTOR = '#js-delete-user-modal'; - -function loadModalsConfigurationFromHtml(modalsElement) { - const modalsConfiguration = {}; - - if (!modalsElement) { - /* eslint-disable-next-line @gitlab/require-i18n-strings */ - throw new Error('Modals content element not found!'); - } - - Array.from(modalsElement.children).forEach((node) => { - const { modal, ...config } = node.dataset; - modalsConfiguration[modal] = { - title: node.dataset.title, - ...config, - content: node.innerHTML, - }; - }); - - return modalsConfiguration; -} - -document.addEventListener('DOMContentLoaded', () => { - Vue.use(Translate); - - initAdminUsersApp(); - - const modalConfiguration = loadModalsConfigurationFromHtml( - document.querySelector(MODAL_TEXTS_CONTAINER_SELECTOR), - ); - - // eslint-disable-next-line no-new - new Vue({ - el: MODAL_MANAGER_SELECTOR, - functional: true, - methods: { - show(...args) { - this.$refs.manager.show(...args); - }, - }, - render(h) { - return h(ModalManager, { - ref: 'manager', - props: { - selector: CONFIRM_DELETE_BUTTON_SELECTOR, - modalConfiguration, - csrfToken: csrf.token, - }, - }); - }, - }); - initConfirmModal(); -}); +initAdminUsersApp(); +initAdminUserActions(); +initDeleteUserModals(); +initConfirmModal(); diff --git a/app/assets/javascripts/pages/admin/users/keys/index.js b/app/assets/javascripts/pages/admin/users/keys/index.js deleted file mode 100644 index 45b83ffcd67..00000000000 --- a/app/assets/javascripts/pages/admin/users/keys/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import initConfirmModal from '~/confirm_modal'; - -document.addEventListener('DOMContentLoaded', () => { - initConfirmModal(); -}); |