Import help page path constant

Remove the help page path provide in favor of importing the constant
where it is needed.
parent aa89052f
<script>
import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
import { HELP_PAGE_PATH } from '../constants';
export default {
HELP_PAGE_PATH,
components: {
GlEmptyState,
GlSprintf,
GlLink,
},
inject: ['newDastScanPath', 'helpPagePath', 'emptyStateSvgPath'],
inject: ['newDastScanPath', 'emptyStateSvgPath'],
props: {
title: {
type: String,
......@@ -54,7 +56,7 @@ export default {
<template #description>
<gl-sprintf :message="text">
<template #learnMoreLink="{ content }">
<gl-link :href="helpPagePath">{{ content }}</gl-link>
<gl-link :href="$options.HELP_PAGE_PATH">{{ content }}</gl-link>
</template>
</gl-sprintf>
</template>
......
......@@ -2,6 +2,7 @@
import { GlButton, GlLink, GlSprintf, GlTabs } from '@gitlab/ui';
import { s__ } from '~/locale';
import ConfigurationPageLayout from 'ee/security_configuration/components/configuration_page_layout.vue';
import { HELP_PAGE_PATH } from '../constants';
import AllTab from './tabs/all.vue';
import RunningTab from './tabs/running.vue';
import FinishedTab from './tabs/finished.vue';
......@@ -25,6 +26,7 @@ const TABS = {
export default {
TABS,
HELP_PAGE_PATH,
components: {
GlButton,
GlLink,
......@@ -37,7 +39,7 @@ export default {
ScheduledTab,
EmptyState,
},
inject: ['newDastScanPath', 'helpPagePath'],
inject: ['newDastScanPath'],
data() {
return {
activeTabIndex: 0,
......@@ -87,7 +89,9 @@ export default {
<template #description>
<gl-sprintf :message="$options.i18n.description">
<template #learnMoreLink="{ content }">
<gl-link :href="helpPagePath" data-testid="help-page-link">{{ content }}</gl-link>
<gl-link :href="$options.HELP_PAGE_PATH" data-testid="help-page-link">{{
content
}}</gl-link>
</template>
</gl-sprintf>
</template>
......
import Vue from 'vue';
import { createRouter } from './router';
import OnDemandScans from './components/on_demand_scans.vue';
import { HELP_PAGE_PATH } from './constants';
export default () => {
const el = document.querySelector('#js-on-demand-scans');
......@@ -16,7 +15,6 @@ export default () => {
router: createRouter(),
provide: {
newDastScanPath,
helpPagePath: HELP_PAGE_PATH,
emptyStateSvgPath,
},
render(h) {
......
......@@ -35,7 +35,7 @@ exports[`EmptyState renders properly 1`] = `
On-demand scans run outside of DevOps cycle and find vulnerabilities in your projects.
<a
class="gl-link"
href="/help/page/path"
href="/help/user/application_security/dast/index#on-demand-scans"
>
Learn more
</a>
......
......@@ -15,7 +15,6 @@ describe('EmptyState', () => {
wrapper = mount(EmptyState, {
provide: {
newDastScanPath: '/on_demand_scans/new',
helpPagePath: '/help/page/path',
emptyStateSvgPath: '/empty/state/svg/path',
},
propsData,
......
......@@ -15,7 +15,6 @@ describe('OnDemandScans', () => {
// Props
const newDastScanPath = '/on_demand_scans/new';
const helpPagePath = '/help/page/path';
// Finders
const findNewScanLink = () => wrapper.findByTestId('new-scan-link');
......@@ -32,7 +31,6 @@ describe('OnDemandScans', () => {
router,
provide: {
newDastScanPath,
helpPagePath,
},
stubs: {
ConfigurationPageLayout,
......@@ -65,7 +63,9 @@ describe('OnDemandScans', () => {
const link = findHelpPageLink();
expect(link.exists()).toBe(true);
expect(link.attributes('href')).toBe(helpPagePath);
expect(link.attributes('href')).toBe(
'/help/user/application_security/dast/index#on-demand-scans',
);
});
it('renders a link to create a new scan', () => {
......
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