From 8b6e72e56e009ac17dcd35865992dc15b0e3fe38 Mon Sep 17 00:00:00 2001 From: Cheng Fangyuan Date: Fri, 19 Oct 2018 13:14:43 +0800 Subject: [PATCH] Vulnerability scan cancel editing to make UI into orginal status Signed-off-by: Cheng Fangyuan --- .../vulnerability/vulnerability-config.component.html | 2 +- .../config/vulnerability/vulnerability-config.component.ts | 6 +++--- tests/resources/Harbor-Pages/Vulnerability.robot | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/portal/lib/src/config/vulnerability/vulnerability-config.component.html b/src/portal/lib/src/config/vulnerability/vulnerability-config.component.html index 5c823f569..67e701128 100644 --- a/src/portal/lib/src/config/vulnerability/vulnerability-config.component.html +++ b/src/portal/lib/src/config/vulnerability/vulnerability-config.component.html @@ -28,7 +28,7 @@ {{ (scanningType ? 'SCHEDULE.'+ scanningType.toUpperCase(): "") | translate }} {{'SCHEDULE.AT' | translate}} {{ dailyTime | translate }} - +
diff --git a/src/portal/lib/src/config/vulnerability/vulnerability-config.component.ts b/src/portal/lib/src/config/vulnerability/vulnerability-config.component.ts index 4425fcc9c..7b2865fd0 100644 --- a/src/portal/lib/src/config/vulnerability/vulnerability-config.component.ts +++ b/src/portal/lib/src/config/vulnerability/vulnerability-config.component.ts @@ -9,7 +9,7 @@ import { ConfigurationService } from '../../service/index'; import { ErrorHandler } from '../../error-handler/index'; -import { toPromise, isEmptyObject } from '../../utils'; +import { toPromise, isEmptyObject, clone} from '../../utils'; import { TranslateService } from '@ngx-translate/core'; import { ClairDetail } from '../../service/interface'; const ONE_HOUR_SECONDS: number = 3600; @@ -252,7 +252,7 @@ export class VulnerabilityConfigComponent implements OnInit { getConfigurations(): void { toPromise(this.configService.getConfigurations()) .then((config: Configuration) => { - this.configCopy = Object.assign({}, config); + this.configCopy = clone(config); this.config = config; }) .catch(error => { @@ -346,7 +346,7 @@ export class VulnerabilityConfigComponent implements OnInit { let getchanges = this.config.scan_all_policy.value; let changes = {"scan_all_policy": getchanges}; for (let prop of Object.keys(changes)) { - this.config[prop] = Object.assign({}, this.configCopy[prop]); + this.config[prop] = clone(this.configCopy[prop]); } } } diff --git a/tests/resources/Harbor-Pages/Vulnerability.robot b/tests/resources/Harbor-Pages/Vulnerability.robot index 0ddc7e57c..5a482c95e 100644 --- a/tests/resources/Harbor-Pages/Vulnerability.robot +++ b/tests/resources/Harbor-Pages/Vulnerability.robot @@ -7,6 +7,7 @@ Resource ../../resources/Util.robot *** Keywords *** Disable Scan Schedule + Click Element //vulnerability-config//button[@id="editSchedule"] Click Element //vulnerability-config//select[@id="scanAllPolicy"] Click Element //vulnerability-config//select[@id="scanAllPolicy"]//option[contains(.,'None')] Click Element //button[contains(.,'SAVE')]