Commit 15c4fdd2 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'dpisek-dast-site-profile-fix-inprogress-to-failed-transition' into 'master'

DAST scans site profile: Fix inprogress transition

See merge request gitlab-org/gitlab!44865
parents 9d2a9f8a a9b07fae
...@@ -176,9 +176,7 @@ export default { ...@@ -176,9 +176,7 @@ export default {
if (this.glFeatures.securityOnDemandScansSiteValidation) { if (this.glFeatures.securityOnDemandScansSiteValidation) {
await this.fetchValidationStatus(); await this.fetchValidationStatus();
if ([PASSED, INPROGRESS].some(this.validationStatusMatches)) { this.isSiteValidationActive = this.validationStatusMatches(PASSED);
this.isSiteValidationActive = true;
}
} }
} }
}, },
...@@ -247,10 +245,10 @@ export default { ...@@ -247,10 +245,10 @@ export default {
this.validationStatus = status; this.validationStatus = status;
if (this.validationStatusMatches(INPROGRESS)) { if (this.validationStatusMatches(INPROGRESS)) {
this.fetchValidationTimeout = setTimeout( await new Promise(resolve => {
this.fetchValidationStatus, this.fetchValidationTimeout = setTimeout(resolve, DAST_SITE_VALIDATION_POLL_INTERVAL);
DAST_SITE_VALIDATION_POLL_INTERVAL, });
); await this.fetchValidationStatus();
} }
} catch (exception) { } catch (exception) {
this.showErrors({ this.showErrors({
......
...@@ -443,7 +443,7 @@ describe('DastSiteProfileForm', () => { ...@@ -443,7 +443,7 @@ describe('DastSiteProfileForm', () => {
describe.each` describe.each`
givenValidationStatus | expectedDescription | shouldShowDefaultDescriptionAfterToggle | shouldHaveSiteValidationActivated | shouldHaveSiteValidationDisabled | shouldPoll givenValidationStatus | expectedDescription | shouldShowDefaultDescriptionAfterToggle | shouldHaveSiteValidationActivated | shouldHaveSiteValidationDisabled | shouldPoll
${DAST_SITE_VALIDATION_STATUS.PENDING} | ${'Site must be validated to run an active scan.'} | ${false} | ${false} | ${false} | ${false} ${DAST_SITE_VALIDATION_STATUS.PENDING} | ${'Site must be validated to run an active scan.'} | ${false} | ${false} | ${false} | ${false}
${DAST_SITE_VALIDATION_STATUS.INPROGRESS} | ${'Validation is in progress...'} | ${false} | ${true} | ${true} | ${true} ${DAST_SITE_VALIDATION_STATUS.INPROGRESS} | ${'Validation is in progress...'} | ${false} | ${false} | ${true} | ${true}
${DAST_SITE_VALIDATION_STATUS.PASSED} | ${'Validation succeeded. Both active and passive scans can be run against the target site.'} | ${false} | ${true} | ${false} | ${false} ${DAST_SITE_VALIDATION_STATUS.PASSED} | ${'Validation succeeded. Both active and passive scans can be run against the target site.'} | ${false} | ${true} | ${false} | ${false}
${DAST_SITE_VALIDATION_STATUS.FAILED} | ${'Validation failed. Please try again.'} | ${true} | ${false} | ${false} | ${false} ${DAST_SITE_VALIDATION_STATUS.FAILED} | ${'Validation failed. Please try again.'} | ${true} | ${false} | ${false} | ${false}
`( `(
......
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