Improve naming

- Rename CODE_SNIPPET_SOURCE_PATH to CODE_SNIPPET_SOURCE_SETTINGS
- Rename pathsSettings to settings
parent 4e6a3461
<script>
import { GlAlert } from '@gitlab/ui';
import { CODE_SNIPPET_SOURCES, CODE_SNIPPET_SOURCE_PATH } from './constants';
import { CODE_SNIPPET_SOURCES, CODE_SNIPPET_SOURCE_SETTINGS } from './constants';
export default {
name: 'CodeSnippetAlert',
components: {
GlAlert,
},
inject: Object.values(CODE_SNIPPET_SOURCE_PATH).map(
inject: Object.values(CODE_SNIPPET_SOURCE_SETTINGS).map(
({ configurationPathInjectKey }) => configurationPathInjectKey,
),
props: {
......@@ -18,11 +18,11 @@ export default {
},
},
computed: {
pathsSettings() {
return CODE_SNIPPET_SOURCE_PATH[this.source];
settings() {
return CODE_SNIPPET_SOURCE_SETTINGS[this.source];
},
configurationPath() {
const injectKey = this.pathsSettings.configurationPathInjectKey;
const injectKey = this.settings.configurationPathInjectKey;
return this[injectKey];
},
},
......@@ -34,7 +34,7 @@ export default {
variant="tip"
:title="__('Code snippet copied. Insert it in the correct location in the YAML file.')"
:dismiss-label="__('Dismiss')"
:primary-button-link="pathsSettings.docsPath"
:primary-button-link="settings.docsPath"
:primary-button-text="__('Read documentation')"
:secondary-button-link="configurationPath"
:secondary-button-text="__('Go back to configuration')"
......
......@@ -3,7 +3,7 @@ import { helpPagePath } from '~/helpers/help_page_helper';
export const CODE_SNIPPET_SOURCE_URL_PARAM = 'code_snippet_copied_from';
export const CODE_SNIPPET_SOURCE_API_FUZZING = 'api_fuzzing';
export const CODE_SNIPPET_SOURCES = [CODE_SNIPPET_SOURCE_API_FUZZING];
export const CODE_SNIPPET_SOURCE_PATH = {
export const CODE_SNIPPET_SOURCE_SETTINGS = {
[CODE_SNIPPET_SOURCE_API_FUZZING]: {
configurationPathInjectKey: 'apiFuzzingConfigurationPath',
docsPath: helpPagePath('user/application_security/api_fuzzing/index'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment