Commit 3a108f26 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '234014-refactor-on-demand-scans' into 'master'

Replace static props with provide/inject

See merge request gitlab-org/gitlab!68760
parents 15c42390 b875ac69
...@@ -98,23 +98,8 @@ export default { ...@@ -98,23 +98,8 @@ export default {
SITE_PROFILES_QUERY, SITE_PROFILES_QUERY,
), ),
}, },
inject: { inject: ['projectPath', 'helpPagePath', 'dastSiteValidationDocsPath', 'profilesLibraryPath'],
dastSiteValidationDocsPath: {
default: '',
},
profilesLibraryPath: {
default: '',
},
},
props: { props: {
helpPagePath: {
type: String,
required: true,
},
projectPath: {
type: String,
required: true,
},
defaultBranch: { defaultBranch: {
type: String, type: String,
required: false, required: false,
......
...@@ -26,6 +26,8 @@ export default () => { ...@@ -26,6 +26,8 @@ export default () => {
el, el,
apolloProvider, apolloProvider,
provide: { provide: {
projectPath,
helpPagePath,
profilesLibraryPath, profilesLibraryPath,
scannerProfilesLibraryPath, scannerProfilesLibraryPath,
siteProfilesLibraryPath, siteProfilesLibraryPath,
...@@ -36,8 +38,6 @@ export default () => { ...@@ -36,8 +38,6 @@ export default () => {
render(h) { render(h) {
return h(OnDemandScansForm, { return h(OnDemandScansForm, {
props: { props: {
helpPagePath,
projectPath,
defaultBranch, defaultBranch,
dastScan: dastScan ? convertObjectPropsToCamelCase(JSON.parse(dastScan)) : null, dastScan: dastScan ? convertObjectPropsToCamelCase(JSON.parse(dastScan)) : null,
}, },
......
...@@ -21,6 +21,7 @@ import * as responses from '../mocks/apollo_mocks'; ...@@ -21,6 +21,7 @@ import * as responses from '../mocks/apollo_mocks';
import { scannerProfiles, siteProfiles } from '../mocks/mock_data'; import { scannerProfiles, siteProfiles } from '../mocks/mock_data';
const helpPagePath = '/application_security/dast/index#on-demand-scans'; const helpPagePath = '/application_security/dast/index#on-demand-scans';
const dastSiteValidationDocsPath = '/application_security/dast/index#dast-site-validation';
const projectPath = 'group/project'; const projectPath = 'group/project';
const defaultBranch = 'main'; const defaultBranch = 'main';
const selectedBranch = 'some-other-branch'; const selectedBranch = 'some-other-branch';
...@@ -29,13 +30,6 @@ const scannerProfilesLibraryPath = '/security/configuration/dast_scans#scanner-p ...@@ -29,13 +30,6 @@ const scannerProfilesLibraryPath = '/security/configuration/dast_scans#scanner-p
const siteProfilesLibraryPath = '/security/configuration/dast_scans#site-profiles'; const siteProfilesLibraryPath = '/security/configuration/dast_scans#site-profiles';
const newScannerProfilePath = '/security/configuration/dast_scans/dast_scanner_profile/new'; const newScannerProfilePath = '/security/configuration/dast_scans/dast_scanner_profile/new';
const newSiteProfilePath = `/${projectPath}/-/security/configuration/dast_scans`; const newSiteProfilePath = `/${projectPath}/-/security/configuration/dast_scans`;
const defaultProps = {
helpPagePath,
projectPath,
defaultBranch,
};
const pipelineUrl = `/${projectPath}/pipelines/123`; const pipelineUrl = `/${projectPath}/pipelines/123`;
const editPath = `/${projectPath}/on_demand_scans/1/edit`; const editPath = `/${projectPath}/on_demand_scans/1/edit`;
const [passiveScannerProfile, activeScannerProfile] = scannerProfiles; const [passiveScannerProfile, activeScannerProfile] = scannerProfiles;
...@@ -154,14 +148,19 @@ describe('OnDemandScansForm', () => { ...@@ -154,14 +148,19 @@ describe('OnDemandScansForm', () => {
merge( merge(
{}, {},
{ {
propsData: defaultProps, propsData: {
defaultBranch,
},
mocks: defaultMocks, mocks: defaultMocks,
provide: { provide: {
projectPath,
helpPagePath,
profilesLibraryPath, profilesLibraryPath,
scannerProfilesLibraryPath, scannerProfilesLibraryPath,
siteProfilesLibraryPath, siteProfilesLibraryPath,
newScannerProfilePath, newScannerProfilePath,
newSiteProfilePath, newSiteProfilePath,
dastSiteValidationDocsPath,
}, },
stubs: { stubs: {
GlFormInput: GlFormInputStub, GlFormInput: GlFormInputStub,
......
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