Improve naming

- Rename CODE_SNIPPET_SOURCE_PATH to CODE_SNIPPET_SOURCE_SETTINGS
- Rename pathsSettings to settings
parent 4e6a3461
<script> <script>
import { GlAlert } from '@gitlab/ui'; 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 { export default {
name: 'CodeSnippetAlert', name: 'CodeSnippetAlert',
components: { components: {
GlAlert, GlAlert,
}, },
inject: Object.values(CODE_SNIPPET_SOURCE_PATH).map( inject: Object.values(CODE_SNIPPET_SOURCE_SETTINGS).map(
({ configurationPathInjectKey }) => configurationPathInjectKey, ({ configurationPathInjectKey }) => configurationPathInjectKey,
), ),
props: { props: {
...@@ -18,11 +18,11 @@ export default { ...@@ -18,11 +18,11 @@ export default {
}, },
}, },
computed: { computed: {
pathsSettings() { settings() {
return CODE_SNIPPET_SOURCE_PATH[this.source]; return CODE_SNIPPET_SOURCE_SETTINGS[this.source];
}, },
configurationPath() { configurationPath() {
const injectKey = this.pathsSettings.configurationPathInjectKey; const injectKey = this.settings.configurationPathInjectKey;
return this[injectKey]; return this[injectKey];
}, },
}, },
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
variant="tip" variant="tip"
:title="__('Code snippet copied. Insert it in the correct location in the YAML file.')" :title="__('Code snippet copied. Insert it in the correct location in the YAML file.')"
:dismiss-label="__('Dismiss')" :dismiss-label="__('Dismiss')"
:primary-button-link="pathsSettings.docsPath" :primary-button-link="settings.docsPath"
:primary-button-text="__('Read documentation')" :primary-button-text="__('Read documentation')"
:secondary-button-link="configurationPath" :secondary-button-link="configurationPath"
:secondary-button-text="__('Go back to configuration')" :secondary-button-text="__('Go back to configuration')"
......
...@@ -3,7 +3,7 @@ import { helpPagePath } from '~/helpers/help_page_helper'; ...@@ -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_URL_PARAM = 'code_snippet_copied_from';
export const CODE_SNIPPET_SOURCE_API_FUZZING = 'api_fuzzing'; export const CODE_SNIPPET_SOURCE_API_FUZZING = 'api_fuzzing';
export const CODE_SNIPPET_SOURCES = [CODE_SNIPPET_SOURCE_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]: { [CODE_SNIPPET_SOURCE_API_FUZZING]: {
configurationPathInjectKey: 'apiFuzzingConfigurationPath', configurationPathInjectKey: 'apiFuzzingConfigurationPath',
docsPath: helpPagePath('user/application_security/api_fuzzing/index'), 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