Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 24x 7x 13x 2x 2x 2x 1x 4x 4x 4x 4x 4x 3x 3x 1x 2x 1x | <script> import * as Sentry from '~/sentry/sentry_browser_wrapper'; import { s__ } from '~/locale'; import getComplianceFrameworkQuery from 'ee/graphql_shared/queries/get_compliance_framework.query.graphql'; import { SAVE_ERROR } from '../constants'; import createComplianceFrameworkMutation from '../graphql/queries/create_compliance_framework.mutation.graphql'; import { getSubmissionParams, initialiseFormData } from '../utils'; import FormStatus from './form_status.vue'; import SharedForm from './shared_form.vue'; export default { components: { FormStatus, SharedForm, }, inject: ['groupPath', 'pipelineConfigurationFullPathEnabled'], data() { return { errorMessage: '', formData: initialiseFormData(), saving: false, }; }, computed: { isLoading() { return this.$apollo.loading || this.saving; }, }, methods: { setError(error, userFriendlyText) { this.saving = false; this.errorMessage = userFriendlyText; Sentry.captureException(error); }, onCancel() { this.$emit('cancel'); }, async onSubmit() { this.saving = true; this.errorMessage = ''; try { const params = getSubmissionParams( this.formData, this.pipelineConfigurationFullPathEnabled, ); const { data } = await this.$apollo.mutate({ mutation: createComplianceFrameworkMutation, variables: { input: { namespacePath: this.groupPath, params, }, }, awaitRefetchQueries: true, refetchQueries: [ { query: getComplianceFrameworkQuery, variables: { fullPath: this.groupPath, }, }, ], }); const [error] = data?.createComplianceFramework?.errors || []; if (error) { this.setError(new Error(error), error); } else { this.$emit('success', { message: this.$options.i18n.successMessageText, framework: data.createComplianceFramework.framework, }); } } catch (e) { this.setError(e, SAVE_ERROR); } }, }, i18n: { submitButtonText: s__('ComplianceFrameworks|Add framework'), successMessageText: s__('ComplianceFrameworks|Compliance framework created'), }, }; </script> <template> <form-status :loading="isLoading" :error="errorMessage"> <shared-form :name.sync="formData.name" :description.sync="formData.description" :pipeline-configuration-full-path.sync="formData.pipelineConfigurationFullPath" :color.sync="formData.color" :submit-button-text="$options.i18n.submitButtonText" @cancel="onCancel" @submit="onSubmit" /> </form-status> </template> |