diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /app/assets/javascripts/snippets/components/edit.vue | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/assets/javascripts/snippets/components/edit.vue')
-rw-r--r-- | app/assets/javascripts/snippets/components/edit.vue | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/app/assets/javascripts/snippets/components/edit.vue b/app/assets/javascripts/snippets/components/edit.vue index dd77d49803f..08683f25651 100644 --- a/app/assets/javascripts/snippets/components/edit.vue +++ b/app/assets/javascripts/snippets/components/edit.vue @@ -9,19 +9,14 @@ import FormFooterActions from '~/vue_shared/components/form/form_footer_actions. import { SNIPPET_MARK_EDIT_APP_START, SNIPPET_MEASURE_BLOBS_CONTENT, -} from '~/performance_constants'; +} from '~/performance/constants'; import eventHub from '~/blob/components/eventhub'; -import { performanceMarkAndMeasure } from '~/performance_utils'; +import { performanceMarkAndMeasure } from '~/performance/utils'; import UpdateSnippetMutation from '../mutations/updateSnippet.mutation.graphql'; import CreateSnippetMutation from '../mutations/createSnippet.mutation.graphql'; import { getSnippetMixin } from '../mixins/snippets'; -import { - SNIPPET_CREATE_MUTATION_ERROR, - SNIPPET_UPDATE_MUTATION_ERROR, - SNIPPET_VISIBILITY_PRIVATE, -} from '../constants'; -import defaultVisibilityQuery from '../queries/snippet_visibility.query.graphql'; +import { SNIPPET_CREATE_MUTATION_ERROR, SNIPPET_UPDATE_MUTATION_ERROR } from '../constants'; import { markBlobPerformance } from '../utils/blob'; import SnippetBlobActionsEdit from './snippet_blob_actions_edit.vue'; @@ -41,15 +36,7 @@ export default { GlLoadingIcon, }, mixins: [getSnippetMixin], - apollo: { - defaultVisibility: { - query: defaultVisibilityQuery, - manual: true, - result({ data: { selectedLevel } }) { - this.selectedLevelDefault = selectedLevel; - }, - }, - }, + inject: ['selectedLevel'], props: { markdownPreviewPath: { type: String, @@ -73,9 +60,12 @@ export default { data() { return { isUpdating: false, - newSnippet: false, actions: [], - selectedLevelDefault: SNIPPET_VISIBILITY_PRIVATE, + snippet: { + title: '', + description: '', + visibilityLevel: this.selectedLevel, + }, }; }, computed: { @@ -112,13 +102,6 @@ export default { } return this.snippet.webUrl; }, - newSnippetSchema() { - return { - title: '', - description: '', - visibilityLevel: this.selectedLevelDefault, - }; - }, }, beforeCreate() { performanceMarkAndMeasure({ mark: SNIPPET_MARK_EDIT_APP_START }); @@ -145,20 +128,6 @@ export default { Flash(sprintf(defaultErrorMsg, { err })); this.isUpdating = false; }, - onNewSnippetFetched() { - this.newSnippet = true; - this.snippet = this.newSnippetSchema; - }, - onExistingSnippetFetched() { - this.newSnippet = false; - }, - onSnippetFetch(snippetRes) { - if (snippetRes.data.snippets.nodes.length === 0) { - this.onNewSnippetFetched(); - } else { - this.onExistingSnippetFetched(); - } - }, getAttachedFiles() { const fileInputs = Array.from(this.$el.querySelectorAll('[name="files[]"]')); return fileInputs.map(node => node.value); @@ -209,7 +178,7 @@ export default { </script> <template> <form - class="snippet-form js-requires-input js-quick-submit common-note-form" + class="snippet-form js-quick-submit common-note-form" :data-snippet-type="isProjectSnippet ? 'project' : 'personal'" data-testid="snippet-edit-form" @submit.prevent="handleFormSubmit" |