Commit 1f42d324 authored by David O'Regan's avatar David O'Regan

Merge branch '293897-dast-input-types' into 'master'

Use input types in DAST mutations

See merge request gitlab-org/gitlab!50086
parents c930f24b b28b4f98
......@@ -175,9 +175,11 @@ export default {
.mutate({
mutation: dastOnDemandScanCreateMutation,
variables: {
fullPath: this.projectPath,
dastScannerProfileId: this.selectedScannerProfile.id,
dastSiteProfileId: this.selectedSiteProfile.id,
input: {
fullPath: this.projectPath,
dastScannerProfileId: this.selectedScannerProfile.id,
dastSiteProfileId: this.selectedSiteProfile.id,
},
},
})
.then(({ data: { dastOnDemandScanCreate: { pipelineUrl, errors } } }) => {
......
mutation dastOnDemandScanCreate(
$fullPath: ID!
$dastScannerProfileId: DastScannerProfileID
$dastSiteProfileId: DastSiteProfileID!
) {
dastOnDemandScanCreate(
input: {
fullPath: $fullPath
dastScannerProfileId: $dastScannerProfileId
dastSiteProfileId: $dastSiteProfileId
}
) {
mutation dastOnDemandScanCreate($input: DastOnDemandScanCreateInput!) {
dastOnDemandScanCreate(input: $input) {
pipelineUrl
errors
}
......
......@@ -172,8 +172,10 @@ export default {
.mutate({
mutation: deletion.mutation,
variables: {
projectFullPath,
profileId,
input: {
fullPath: projectFullPath,
profileId,
},
},
update(store, { data = {} }) {
const errors = data[`${profileType}Delete`]?.errors ?? [];
......
mutation dastScannerProfileDelete($projectFullPath: ID!, $profileId: DastScannerProfileID!) {
scannerProfilesDelete: dastScannerProfileDelete(
input: { fullPath: $projectFullPath, id: $profileId }
) {
mutation dastScannerProfileDelete($input: DastScannerProfileDeleteInput!) {
scannerProfilesDelete: dastScannerProfileDelete(input: $input) {
errors
}
}
mutation dastSiteProfileDelete($projectFullPath: ID!, $profileId: DastSiteProfileID!) {
siteProfilesDelete: dastSiteProfileDelete(input: { fullPath: $projectFullPath, id: $profileId }) {
mutation dastSiteProfileDelete($input: DastSiteProfileDeleteInput!) {
siteProfilesDelete: dastSiteProfileDelete(input: $input) {
errors
}
}
......@@ -171,9 +171,11 @@ export default {
this.hideErrors();
const variables = {
projectFullPath: this.projectFullPath,
...(this.isEdit ? { id: this.profile.id } : {}),
...serializeFormObject(this.form),
input: {
fullPath: this.projectFullPath,
...(this.isEdit ? { id: this.profile.id } : {}),
...serializeFormObject(this.form),
},
};
this.$apollo
......
mutation dastScannerProfileCreate(
$projectFullPath: ID!
$profileName: String!
$spiderTimeout: Int!
$targetTimeout: Int!
$scanType: DastScanTypeEnum!
$useAjaxSpider: Boolean!
$showDebugMessages: Boolean!
) {
dastScannerProfileCreate(
input: {
fullPath: $projectFullPath
profileName: $profileName
spiderTimeout: $spiderTimeout
targetTimeout: $targetTimeout
scanType: $scanType
useAjaxSpider: $useAjaxSpider
showDebugMessages: $showDebugMessages
}
) {
mutation dastScannerProfileCreate($input: DastScannerProfileCreateInput!) {
dastScannerProfileCreate(input: $input) {
errors
}
}
mutation dastScannerProfileUpdate(
$id: DastScannerProfileID!
$projectFullPath: ID!
$profileName: String!
$spiderTimeout: Int!
$targetTimeout: Int!
$scanType: DastScanTypeEnum!
$useAjaxSpider: Boolean!
$showDebugMessages: Boolean!
) {
dastScannerProfileUpdate(
input: {
id: $id
fullPath: $projectFullPath
profileName: $profileName
spiderTimeout: $spiderTimeout
targetTimeout: $targetTimeout
scanType: $scanType
useAjaxSpider: $useAjaxSpider
showDebugMessages: $showDebugMessages
}
) {
mutation dastScannerProfileUpdate($input: DastScannerProfileUpdateInput!) {
dastScannerProfileUpdate(input: $input) {
id
errors
}
......
......@@ -105,9 +105,11 @@ export default {
const { errorMessage } = this.i18n;
const variables = {
fullPath: this.fullPath,
...(this.isEdit ? { id: this.siteProfile.id } : {}),
...serializeFormObject(this.form.fields),
input: {
fullPath: this.fullPath,
...(this.isEdit ? { id: this.siteProfile.id } : {}),
...serializeFormObject(this.form.fields),
},
};
this.$apollo
......
mutation dastSiteProfileCreate($fullPath: ID!, $profileName: String!, $targetUrl: String) {
dastSiteProfileCreate(
input: { fullPath: $fullPath, profileName: $profileName, targetUrl: $targetUrl }
) {
mutation dastSiteProfileCreate($input: DastSiteProfileCreateInput!) {
dastSiteProfileCreate(input: $input) {
id
errors
}
......
mutation dastSiteProfileUpdate(
$id: DastSiteProfileID!
$fullPath: ID!
$profileName: String!
$targetUrl: String
) {
dastSiteProfileUpdate(
input: { id: $id, fullPath: $fullPath, profileName: $profileName, targetUrl: $targetUrl }
) {
mutation dastSiteProfileUpdate($input: DastSiteProfileUpdateInput!) {
dastSiteProfileUpdate(input: $input) {
id
errors
}
......
......@@ -200,9 +200,11 @@ describe('OnDemandScansForm', () => {
expect(subject.vm.$apollo.mutate).toHaveBeenCalledWith({
mutation: dastOnDemandScanCreate,
variables: {
dastScannerProfileId: passiveScannerProfile.id,
dastSiteProfileId: nonValidatedSiteProfile.id,
fullPath: projectPath,
input: {
dastScannerProfileId: passiveScannerProfile.id,
dastSiteProfileId: nonValidatedSiteProfile.id,
fullPath: projectPath,
},
},
});
});
......
......@@ -189,14 +189,16 @@ describe('DAST Scanner Profile', () => {
expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledWith({
mutation,
variables: {
profileName,
spiderTimeout,
targetTimeout,
projectFullPath,
scanType,
useAjaxSpider,
showDebugMessages,
...mutationVars,
input: {
profileName,
spiderTimeout,
targetTimeout,
fullPath: projectFullPath,
scanType,
useAjaxSpider,
showDebugMessages,
...mutationVars,
},
},
});
});
......
......@@ -173,10 +173,12 @@ describe('DastSiteProfileForm', () => {
it('triggers GraphQL mutation', () => {
expect(requestHandlers[mutationKind]).toHaveBeenCalledWith({
profileName,
targetUrl,
fullPath,
...mutationVars,
input: {
profileName,
targetUrl,
fullPath,
...mutationVars,
},
});
});
......
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