Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/static_site_editor/components/edit_meta_modal.vue')
-rw-r--r--app/assets/javascripts/static_site_editor/components/edit_meta_modal.vue126
1 files changed, 0 insertions, 126 deletions
diff --git a/app/assets/javascripts/static_site_editor/components/edit_meta_modal.vue b/app/assets/javascripts/static_site_editor/components/edit_meta_modal.vue
deleted file mode 100644
index e69a6b8cd69..00000000000
--- a/app/assets/javascripts/static_site_editor/components/edit_meta_modal.vue
+++ /dev/null
@@ -1,126 +0,0 @@
-<script>
-import { GlModal } from '@gitlab/ui';
-import Api from '~/api';
-import { __, s__, sprintf } from '~/locale';
-import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
-
-import { ISSUABLE_TYPE, MR_META_LOCAL_STORAGE_KEY } from '../constants';
-import EditMetaControls from './edit_meta_controls.vue';
-
-export default {
- components: {
- GlModal,
- EditMetaControls,
- LocalStorageSync,
- },
- props: {
- sourcePath: {
- type: String,
- required: true,
- },
- namespace: {
- type: String,
- required: true,
- },
- project: {
- type: String,
- required: true,
- },
- },
- data() {
- return {
- clearStorage: false,
- currentTemplate: null,
- mergeRequestTemplates: null,
- mergeRequestMeta: {
- title: sprintf(s__(`StaticSiteEditor|Update %{sourcePath} file`), {
- sourcePath: this.sourcePath,
- }),
- description: s__('StaticSiteEditor|Copy update'),
- },
- };
- },
- computed: {
- disabled() {
- return this.mergeRequestMeta.title === '';
- },
- primaryProps() {
- return {
- text: __('Submit changes'),
- attributes: [{ variant: 'success' }, { disabled: this.disabled }],
- };
- },
- secondaryProps() {
- return {
- text: __('Keep editing'),
- attributes: [{ variant: 'default' }],
- };
- },
- },
- mounted() {
- this.initTemplates();
- },
- methods: {
- hide() {
- this.$refs.modal.hide();
- },
- initTemplates() {
- const { namespace, project } = this;
- Api.issueTemplates(namespace, project, ISSUABLE_TYPE, (err, templates) => {
- if (err) return; // Error handled by global AJAX error handler
- this.mergeRequestTemplates = templates;
- });
- },
- show() {
- this.$refs.modal.show();
- },
- onPrimary() {
- this.$emit('primary', this.mergeRequestMeta);
- this.clearStorage = true;
- },
- onSecondary() {
- this.hide();
- },
- onChangeTemplate(template) {
- this.currentTemplate = template;
-
- const description = this.currentTemplate ? this.currentTemplate.content : '';
- const mergeRequestMeta = { ...this.mergeRequestMeta, description };
- this.onUpdateSettings(mergeRequestMeta);
- },
- onUpdateSettings(mergeRequestMeta) {
- this.mergeRequestMeta = { ...mergeRequestMeta };
- },
- },
- storageKey: MR_META_LOCAL_STORAGE_KEY,
-};
-</script>
-
-<template>
- <gl-modal
- ref="modal"
- modal-id="edit-meta-modal"
- :title="__('Submit your changes')"
- :action-primary="primaryProps"
- :action-secondary="secondaryProps"
- size="sm"
- @primary="onPrimary"
- @secondary="onSecondary"
- @hide="() => $emit('hide')"
- >
- <local-storage-sync
- v-model="mergeRequestMeta"
- :storage-key="$options.storageKey"
- :clear="clearStorage"
- />
- <edit-meta-controls
- ref="editMetaControls"
- :title="mergeRequestMeta.title"
- :description="mergeRequestMeta.description"
- :templates="mergeRequestTemplates"
- :current-template="currentTemplate"
- @updateSettings="onUpdateSettings"
- @changeTemplate="onChangeTemplate"
- />
- </gl-modal>
-</template>