From 82716d492d61472304a24f5fbdcf90ee3165c03e Mon Sep 17 00:00:00 2001 From: FangyuanCheng Date: Thu, 28 Mar 2019 20:36:44 +0800 Subject: [PATCH] move vulnerability and gc ui Signed-off-by: FangyuanCheng --- .../gc/gc-history/gc-history.component.html | 20 ++++++++ .../gc/gc-history/gc-history.component.scss | 4 ++ .../gc/gc-history/gc-history.component.ts | 28 +++++++++++ .../lib/src/config/gc/gc.component.html | 24 +--------- .../lib/src/config/gc/gc.component.scss | 41 ++-------------- src/portal/lib/src/config/gc/index.ts | 2 + src/portal/lib/src/config/index.ts | 3 +- .../src/config/registry-config.component.html | 1 + .../config/registry-config.component.spec.ts | 2 + .../vulnerability-config.component.html | 14 +++--- .../vulnerability-config.component.scss | 24 ++++++---- .../cron-schedule.component.html | 48 ++++++++++--------- .../cron-schedule.component.scss | 19 +++++--- src/portal/src/app/app.module.ts | 6 ++- .../harbor-shell/harbor-shell.component.html | 13 +++++ .../src/app/config/config.component.html | 16 ------- src/portal/src/app/config/config.component.ts | 12 +---- .../src/app/gc-page/gc-page.component.html | 23 +++++++++ .../src/app/gc-page/gc-page.component.scss | 3 ++ .../src/app/gc-page/gc-page.component.spec.ts | 25 ++++++++++ .../src/app/gc-page/gc-page.component.ts | 19 ++++++++ src/portal/src/app/harbor-routing.module.ts | 12 +++++ .../vulnerability-page.component.html | 15 ++++++ .../vulnerability-page.component.scss | 3 ++ .../vulnerability-page.component.spec.ts | 25 ++++++++++ .../vulnerability-page.component.ts | 17 +++++++ src/portal/src/i18n/lang/en-us-lang.json | 8 +++- src/portal/src/i18n/lang/es-es-lang.json | 7 ++- src/portal/src/i18n/lang/fr-fr-lang.json | 7 ++- src/portal/src/i18n/lang/pt-br-lang.json | 6 ++- src/portal/src/i18n/lang/zh-cn-lang.json | 5 +- .../Harbor-Pages/Configuration.robot | 7 ++- .../Harbor-Pages/Configuration_Elements.robot | 4 +- tests/resources/Harbor-Pages/Verify.robot | 2 +- .../Harbor-Pages/Vulnerability.robot | 13 +++-- tests/robot-cases/Group1-Nightly/Common.robot | 15 +++--- .../robot-cases/Group1-Nightly/Nightly.robot | 12 ++--- 37 files changed, 341 insertions(+), 164 deletions(-) create mode 100644 src/portal/lib/src/config/gc/gc-history/gc-history.component.html create mode 100644 src/portal/lib/src/config/gc/gc-history/gc-history.component.scss create mode 100644 src/portal/lib/src/config/gc/gc-history/gc-history.component.ts create mode 100644 src/portal/src/app/gc-page/gc-page.component.html create mode 100644 src/portal/src/app/gc-page/gc-page.component.scss create mode 100644 src/portal/src/app/gc-page/gc-page.component.spec.ts create mode 100644 src/portal/src/app/gc-page/gc-page.component.ts create mode 100644 src/portal/src/app/vulnerability-page/vulnerability-page.component.html create mode 100644 src/portal/src/app/vulnerability-page/vulnerability-page.component.scss create mode 100644 src/portal/src/app/vulnerability-page/vulnerability-page.component.spec.ts create mode 100644 src/portal/src/app/vulnerability-page/vulnerability-page.component.ts diff --git a/src/portal/lib/src/config/gc/gc-history/gc-history.component.html b/src/portal/lib/src/config/gc/gc-history/gc-history.component.html new file mode 100644 index 000000000..d71057e4d --- /dev/null +++ b/src/portal/lib/src/config/gc/gc-history/gc-history.component.html @@ -0,0 +1,20 @@ +
{{'GC.JOB_HISTORY' | translate}}
+ + {{'GC.JOB_ID' | translate}} + {{'GC.TRIGGER_TYPE' | translate}} + {{'STATUS' | translate}} + {{'START_TIME' | translate}} + {{'UPDATE_TIME' | translate}} + {{'LOGS' | translate}} + + {{job.id }} + {{(job.type ? 'SCHEDULE.'+ job.type.toUpperCase() : '') | translate }} + {{job.status.toUpperCase() | translate}} + {{job.createTime | date:'medium'}} + {{job.updateTime | date:'medium'}} + + + + + {{'GC.LATEST_JOBS' | translate :{param: jobs.length} }} + \ No newline at end of file diff --git a/src/portal/lib/src/config/gc/gc-history/gc-history.component.scss b/src/portal/lib/src/config/gc/gc-history/gc-history.component.scss new file mode 100644 index 000000000..1499c64dd --- /dev/null +++ b/src/portal/lib/src/config/gc/gc-history/gc-history.component.scss @@ -0,0 +1,4 @@ +.history-header { + color: #000; + margin:20px 0 6px 0; +} \ No newline at end of file diff --git a/src/portal/lib/src/config/gc/gc-history/gc-history.component.ts b/src/portal/lib/src/config/gc/gc-history/gc-history.component.ts new file mode 100644 index 000000000..29df7c888 --- /dev/null +++ b/src/portal/lib/src/config/gc/gc-history/gc-history.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from '@angular/core'; +import { GcRepoService } from "../gc.service"; +import { GcJobViewModel } from "../gcLog"; +import { GcViewModelFactory } from "../gc.viewmodel.factory"; + +@Component({ + selector: 'gc-history', + templateUrl: './gc-history.component.html', + styleUrls: ['./gc-history.component.scss'] +}) +export class GcHistoryComponent implements OnInit { + jobs: Array = []; + constructor( + private gcRepoService: GcRepoService, + private gcViewModelFactory: GcViewModelFactory, + ) { } + + ngOnInit() { + this.getJobs(); + } + + getJobs() { + this.gcRepoService.getJobs().subscribe(jobs => { + this.jobs = this.gcViewModelFactory.createJobViewModel(jobs); + }); + } + +} diff --git a/src/portal/lib/src/config/gc/gc.component.html b/src/portal/lib/src/config/gc/gc.component.html index 1b2d5803c..5947b7551 100644 --- a/src/portal/lib/src/config/gc/gc.component.html +++ b/src/portal/lib/src/config/gc/gc.component.html @@ -1,24 +1,4 @@
-
- -
{{'GC.JOB_HISTORY' | translate}}
- - {{'GC.JOB_ID' | translate}} - {{'GC.TRIGGER_TYPE' | translate}} - {{'STATUS' | translate}} - {{'START_TIME' | translate}} - {{'UPDATE_TIME' | translate}} - {{'LOGS' | translate}} - - {{job.id }} - {{(job.type ? 'SCHEDULE.'+ job.type.toUpperCase() : '') | translate }} - {{job.status.toUpperCase() | translate}} - {{job.createTime | date:'medium'}} - {{job.updateTime | date:'medium'}} - - - - - {{'GC.LATEST_JOBS' | translate :{param: jobs.length} }} - \ No newline at end of file + + \ No newline at end of file diff --git a/src/portal/lib/src/config/gc/gc.component.scss b/src/portal/lib/src/config/gc/gc.component.scss index 217f9d3ea..55c10060d 100644 --- a/src/portal/lib/src/config/gc/gc.component.scss +++ b/src/portal/lib/src/config/gc/gc.component.scss @@ -1,45 +1,10 @@ -.flex-layout { - display: flex; - align-items: center; - margin:20px 0; - font-size: .541667rem; -} - -.font-style { - color: #000; - font-size: .541667rem; -} - .cron-selection { margin-top: 20px; -} - -.setting-wrapper { - label { - width: 228px; - } - *:not(:first-child), span { - margin-right: 18px; - } -} - -.normal-wrapper { - > span:first-child { - width: 228px; - } - > span:not(:first-child){ - margin-right: 18px; - } + display: flex; + align-items: center; } .gc-start-btn { width:150px; -} - -.job-header { - margin:20px 0 -10px 0; -} - -.day-selector-wrapper { - display: flex; + margin-top: 47px; } \ No newline at end of file diff --git a/src/portal/lib/src/config/gc/index.ts b/src/portal/lib/src/config/gc/index.ts index b80853d74..8f2b987c0 100644 --- a/src/portal/lib/src/config/gc/index.ts +++ b/src/portal/lib/src/config/gc/index.ts @@ -4,3 +4,5 @@ export * from "./gc.api.repository"; export * from "./gc.service"; export * from "./gc.viewmodel.factory"; export * from "./gcLog"; +export * from "./gc-history/gc-history.component"; + diff --git a/src/portal/lib/src/config/index.ts b/src/portal/lib/src/config/index.ts index af469edc3..5ecae2c6e 100644 --- a/src/portal/lib/src/config/index.ts +++ b/src/portal/lib/src/config/index.ts @@ -5,7 +5,7 @@ import { SystemSettingsComponent } from './system/system-settings.component'; import { VulnerabilityConfigComponent } from './vulnerability/vulnerability-config.component'; import { RegistryConfigComponent } from './registry-config.component'; import { GcComponent } from './gc/gc.component'; - +import { GcHistoryComponent } from './gc/gc-history/gc-history.component'; export * from './config'; export * from './replication/replication-config.component'; @@ -16,6 +16,7 @@ export * from './gc/index'; export const CONFIGURATION_DIRECTIVES: Type[] = [ ReplicationConfigComponent, + GcHistoryComponent, GcComponent, SystemSettingsComponent, VulnerabilityConfigComponent, diff --git a/src/portal/lib/src/config/registry-config.component.html b/src/portal/lib/src/config/registry-config.component.html index 0cd7784ce..ad31cc66c 100644 --- a/src/portal/lib/src/config/registry-config.component.html +++ b/src/portal/lib/src/config/registry-config.component.html @@ -17,6 +17,7 @@ + diff --git a/src/portal/lib/src/config/registry-config.component.spec.ts b/src/portal/lib/src/config/registry-config.component.spec.ts index 79b8eaba0..f08055e2e 100644 --- a/src/portal/lib/src/config/registry-config.component.spec.ts +++ b/src/portal/lib/src/config/registry-config.component.spec.ts @@ -9,6 +9,7 @@ import { VulnerabilityConfigComponent } from './vulnerability/vulnerability-conf import { RegistryConfigComponent } from './registry-config.component'; import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component'; import { GcComponent } from './gc/gc.component'; +import { GcHistoryComponent } from './gc/gc-history/gc-history.component'; import { CronScheduleComponent } from '../cron-schedule/cron-schedule.component'; import { @@ -67,6 +68,7 @@ describe('RegistryConfigComponent (inline template)', () => { RegistryConfigComponent, ConfirmationDialogComponent, GcComponent, + GcHistoryComponent, CronScheduleComponent ], providers: [ 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 f6279a82f..a50cec049 100644 --- a/src/portal/lib/src/config/vulnerability/vulnerability-config.component.html +++ b/src/portal/lib/src/config/vulnerability/vulnerability-config.component.html @@ -1,8 +1,8 @@
-
- +
+ @@ -23,9 +23,11 @@ {{ updatedTimestamp | date:'MM/dd/y HH:mm:ss' }} AM
- -
-
-
+
+ +
+
+
+
\ No newline at end of file diff --git a/src/portal/lib/src/config/vulnerability/vulnerability-config.component.scss b/src/portal/lib/src/config/vulnerability/vulnerability-config.component.scss index 6db9a3c4b..49f76c1c1 100644 --- a/src/portal/lib/src/config/vulnerability/vulnerability-config.component.scss +++ b/src/portal/lib/src/config/vulnerability/vulnerability-config.component.scss @@ -31,12 +31,20 @@ } } } +.button-group { + display: flex; + align-items: center; + .btn-scan-right { + button{ + width: 160px; + margin-bottom: 0px; + margin-top: 41px; + } + } +} -.btn-scan-right button{ - width: 160px; - margin-bottom: 0px; - margin-top: 5px; -} -.btn-scan-right span{ - margin-top: 4px; -} +.update-time { + color: #000; + font-size: .541667rem; + width: 200px; +} \ No newline at end of file diff --git a/src/portal/lib/src/cron-schedule/cron-schedule.component.html b/src/portal/lib/src/cron-schedule/cron-schedule.component.html index 13fd1c83b..9f6fcdbe9 100644 --- a/src/portal/lib/src/cron-schedule/cron-schedule.component.html +++ b/src/portal/lib/src/cron-schedule/cron-schedule.component.html @@ -1,21 +1,23 @@
- {{ labelCurrent | translate }} - {{(originScheduleType ? 'SCHEDULE.'+ originScheduleType.toUpperCase(): "") | translate}} - - - {{'CONFIG.TOOLTIP.HOURLY_CRON' | translate}} - - - - {{'CONFIG.TOOLTIP.WEEKLY_CRON' | translate}} - - - - {{'CONFIG.TOOLTIP.DAILY_CRON' | translate}} - - {{ "SCHEDULE.CRON" | translate }} : - {{ oriCron }} -
@@ -40,11 +42,13 @@ - - + + + \ No newline at end of file diff --git a/src/portal/lib/src/cron-schedule/cron-schedule.component.scss b/src/portal/lib/src/cron-schedule/cron-schedule.component.scss index 469a6e609..0600f58c5 100644 --- a/src/portal/lib/src/cron-schedule/cron-schedule.component.scss +++ b/src/portal/lib/src/cron-schedule/cron-schedule.component.scss @@ -1,13 +1,11 @@ .flex-layout { - display: flex; - align-items: center; margin: 20px 0; font-size: .541667rem; - } +} .normal-wrapper { > span:first-child { - width: 228px; + width: 200px; } > span:not(:first-child) { @@ -17,13 +15,17 @@ margin-left: -10px; } button { - margin-left: 10px; + margin: 20px 20px 0 200px; } } .setting-wrapper { > span:first-child { - width: 228px; + width: 200px; + } + + .confirm-button { + margin: 20px 0px 0 200px; } *:not(:first-child) { @@ -39,7 +41,10 @@ width: 195px; } } + .font-style { + display: inline-block; color: #000; font-size: .541667rem; - } \ No newline at end of file + width: 200px; + } diff --git a/src/portal/src/app/app.module.ts b/src/portal/src/app/app.module.ts index 497ada531..885855e4b 100644 --- a/src/portal/src/app/app.module.ts +++ b/src/portal/src/app/app.module.ts @@ -32,6 +32,8 @@ import zh from '@angular/common/locales/zh-Hans'; import es from '@angular/common/locales/es'; import localeFr from '@angular/common/locales/fr'; import { DevCenterComponent } from './dev-center/dev-center.component'; +import { VulnerabilityPageComponent } from './vulnerability-page/vulnerability-page.component'; +import { GcPageComponent } from './gc-page/gc-page.component'; registerLocaleData(zh, 'zh-cn'); registerLocaleData(es, 'es-es'); registerLocaleData(localeFr, 'fr-fr'); @@ -51,7 +53,9 @@ export function getCurrentLanguage(translateService: TranslateService) { @NgModule({ declarations: [ AppComponent, - ProjectConfigComponent + ProjectConfigComponent, + VulnerabilityPageComponent, + GcPageComponent ], imports: [ BrowserModule, diff --git a/src/portal/src/app/base/harbor-shell/harbor-shell.component.html b/src/portal/src/app/base/harbor-shell/harbor-shell.component.html index f943a4e36..db1997e19 100644 --- a/src/portal/src/app/base/harbor-shell/harbor-shell.component.html +++ b/src/portal/src/app/base/harbor-shell/harbor-shell.component.html @@ -46,6 +46,19 @@ + + + {{'SIDE_NAV.TASKS' | translate}} + + + + {{'SIDE_NAV.SYSTEM_MGMT.VULNERABILITY' | translate}} + + + {{'SIDE_NAV.SYSTEM_MGMT.GARBAGE_COLLECTION' | translate}} + + + \ No newline at end of file diff --git a/src/portal/src/app/config/config.component.ts b/src/portal/src/app/config/config.component.ts index 5937bd123..cca18cf06 100644 --- a/src/portal/src/app/config/config.component.ts +++ b/src/portal/src/app/config/config.component.ts @@ -14,8 +14,8 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; import { Subscription } from "rxjs"; import { - Configuration, StringValueItem, SystemSettingsComponent, VulnerabilityConfigComponent, - isEmpty, clone, getChanges, GcComponent, GcRepoService } from '@harbor/ui'; + Configuration, StringValueItem, SystemSettingsComponent, + isEmpty, clone, getChanges, GcRepoService } from '@harbor/ui'; import { ConfirmationTargets, ConfirmationState } from '../shared/shared.const'; import { SessionService } from '../shared/session.service'; @@ -34,8 +34,6 @@ const TabLinkContentMap = { 'config-replication': 'replication', 'config-email': 'email', 'config-system': 'system_settings', - 'config-vulnerability': 'vulnerability', - 'config-gc': 'gc', 'config-label': 'system_label', }; @@ -52,8 +50,6 @@ export class ConfigurationComponent implements OnInit, OnDestroy { confirmSub: Subscription; @ViewChild(SystemSettingsComponent) systemSettingsConfig: SystemSettingsComponent; - @ViewChild(VulnerabilityConfigComponent) vulnerabilityConfig: VulnerabilityConfigComponent; - @ViewChild(GcComponent) gcConfig: GcComponent; @ViewChild(ConfigurationEmailComponent) mailConfig: ConfigurationEmailComponent; @ViewChild(ConfigurationAuthComponent) authConfig: ConfigurationAuthComponent; @@ -73,10 +69,6 @@ export class ConfigurationComponent implements OnInit, OnDestroy { return this.appConfigService.getConfig().has_ca_root; } - public get withClair(): boolean { - return this.appConfigService.getConfig().with_clair; - } - public get withAdmiral(): boolean { return this.appConfigService.getConfig().with_admiral; } diff --git a/src/portal/src/app/gc-page/gc-page.component.html b/src/portal/src/app/gc-page/gc-page.component.html new file mode 100644 index 000000000..85dd3f092 --- /dev/null +++ b/src/portal/src/app/gc-page/gc-page.component.html @@ -0,0 +1,23 @@ +
+
+

{{'CONFIG.GC' | translate }}

+ + + + + + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/src/portal/src/app/gc-page/gc-page.component.scss b/src/portal/src/app/gc-page/gc-page.component.scss new file mode 100644 index 000000000..638f7dcb7 --- /dev/null +++ b/src/portal/src/app/gc-page/gc-page.component.scss @@ -0,0 +1,3 @@ +.gc-title { + display: inline-block; +} \ No newline at end of file diff --git a/src/portal/src/app/gc-page/gc-page.component.spec.ts b/src/portal/src/app/gc-page/gc-page.component.spec.ts new file mode 100644 index 000000000..a5af4e8f1 --- /dev/null +++ b/src/portal/src/app/gc-page/gc-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { GcPageComponent } from './gc-page.component'; + +describe('GcPageComponent', () => { + let component: GcPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ GcPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(GcPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/portal/src/app/gc-page/gc-page.component.ts b/src/portal/src/app/gc-page/gc-page.component.ts new file mode 100644 index 000000000..11d69c7b0 --- /dev/null +++ b/src/portal/src/app/gc-page/gc-page.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit } from "@angular/core"; +import { SessionService } from "../shared/session.service"; + +@Component({ + selector: "app-gc-page", + templateUrl: "./gc-page.component.html", + styleUrls: ["./gc-page.component.scss"] +}) +export class GcPageComponent implements OnInit { + constructor(private session: SessionService) {} + + ngOnInit() {} + public get hasAdminRole(): boolean { + return ( + this.session.getCurrentUser() && + this.session.getCurrentUser().has_admin_role + ); + } +} diff --git a/src/portal/src/app/harbor-routing.module.ts b/src/portal/src/app/harbor-routing.module.ts index 166f58364..84df28376 100644 --- a/src/portal/src/app/harbor-routing.module.ts +++ b/src/portal/src/app/harbor-routing.module.ts @@ -23,6 +23,8 @@ import { PageNotFoundComponent } from './shared/not-found/not-found.component'; import { HarborShellComponent } from './base/harbor-shell/harbor-shell.component'; import { ConfigurationComponent } from './config/config.component'; import { DevCenterComponent } from './dev-center/dev-center.component'; +import { GcPageComponent } from './gc-page/gc-page.component'; +import { VulnerabilityPageComponent } from './vulnerability-page/vulnerability-page.component'; import { UserComponent } from './user/user.component'; import { SignInComponent } from './account/sign-in/sign-in.component'; @@ -191,6 +193,16 @@ const harborRoutes: Routes = [ component: ConfigurationComponent, canActivate: [SystemAdminGuard] }, + { + path: 'vulnerability', + component: VulnerabilityPageComponent, + canActivate: [SystemAdminGuard] + }, + { + path: 'gc', + component: GcPageComponent, + canActivate: [SystemAdminGuard] + }, { path: 'registry', component: DestinationPageComponent, diff --git a/src/portal/src/app/vulnerability-page/vulnerability-page.component.html b/src/portal/src/app/vulnerability-page/vulnerability-page.component.html new file mode 100644 index 000000000..9318b9dd4 --- /dev/null +++ b/src/portal/src/app/vulnerability-page/vulnerability-page.component.html @@ -0,0 +1,15 @@ +
+
+

{{'VULNERABILITY.SINGULAR' | translate }}

+ + + + + + + + + + +
+
\ No newline at end of file diff --git a/src/portal/src/app/vulnerability-page/vulnerability-page.component.scss b/src/portal/src/app/vulnerability-page/vulnerability-page.component.scss new file mode 100644 index 000000000..c82d47991 --- /dev/null +++ b/src/portal/src/app/vulnerability-page/vulnerability-page.component.scss @@ -0,0 +1,3 @@ +.vul-title { + display: inline-block; +} \ No newline at end of file diff --git a/src/portal/src/app/vulnerability-page/vulnerability-page.component.spec.ts b/src/portal/src/app/vulnerability-page/vulnerability-page.component.spec.ts new file mode 100644 index 000000000..8aafe4947 --- /dev/null +++ b/src/portal/src/app/vulnerability-page/vulnerability-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { VulnerabilityPageComponent } from './vulnerability-page.component'; + +describe('VulnerabilityPageComponent', () => { + let component: VulnerabilityPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ VulnerabilityPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(VulnerabilityPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/portal/src/app/vulnerability-page/vulnerability-page.component.ts b/src/portal/src/app/vulnerability-page/vulnerability-page.component.ts new file mode 100644 index 000000000..618ed513f --- /dev/null +++ b/src/portal/src/app/vulnerability-page/vulnerability-page.component.ts @@ -0,0 +1,17 @@ +import { Component, OnInit } from "@angular/core"; +import { AppConfigService } from "../app-config.service"; + +@Component({ + selector: "vulnerability-page", + templateUrl: "./vulnerability-page.component.html", + styleUrls: ["./vulnerability-page.component.scss"] +}) +export class VulnerabilityPageComponent implements OnInit { + constructor(private appConfigService: AppConfigService) {} + + ngOnInit() {} + + public get withClair(): boolean { + return this.appConfigService.getConfig().with_clair; + } +} diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index ad5b69ca3..a72936643 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -129,9 +129,12 @@ "GROUP": "Groups", "REGISTRY": "Registries", "REPLICATION": "Replications", - "CONFIG": "Configuration" + "CONFIG": "Configuration", + "VULNERABILITY": "Vulnerability", + "GARBAGE_COLLECTION": "Garbage Collection" }, "LOGS": "Logs", + "TASKS": "Tasks", "API_EXPLORER": "API EXPLORER" }, "USER": { @@ -595,6 +598,7 @@ "SUB_TITLE_SUFIX": "logs" }, "CONFIG": { + "HISTORY": "History", "TITLE": "Configuration", "AUTH": "Authentication", "REPLICATION": "Replication", @@ -913,7 +917,7 @@ "GC": { "CURRENT_SCHEDULE": "Current Schedule", "GC_NOW": "GC NOW", - "JOB_HISTORY": "GC Jobs History", + "JOB_HISTORY": "GC History", "JOB_ID": "Job ID", "TRIGGER_TYPE": "Trigger Type", "LATEST_JOBS": "Latest {{param}} Jobs", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index fa508e16b..1dd0ee0d0 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -129,9 +129,12 @@ "REGISTRY": "Registries", "GROUP": "Groups", "REPLICATION": "Replicacións", - "CONFIG": "Configuración" + "CONFIG": "Configuración", + "VULNERABILITY": "Vulnerability", + "GARBAGE_COLLECTION": "Garbage Collection" }, "LOGS": "Logs", + "TASKS": "Tasks", "API_EXPLORER": "API EXPLORER" }, "USER": { @@ -911,7 +914,7 @@ "GC": { "CURRENT_SCHEDULE": "Current Schedule", "GC_NOW": "GC NOW", - "JOB_HISTORY": "GC Jobs History", + "JOB_HISTORY": "GC History", "JOB_ID": "Job ID", "TRIGGER_TYPE": "Trigger Type", "LATEST_JOBS": "Latest {{param}} Jobs", diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index fe962848d..3fa197f00 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -115,9 +115,12 @@ "USER": "Utilisateurs", "GROUP": "Groups", "REPLICATION": "Réplication", - "CONFIG": "Configuration" + "CONFIG": "Configuration", + "VULNERABILITY": "Vulnerability", + "GARBAGE_COLLECTION": "Garbage Collection" }, "LOGS": "Logs", + "TASKS": "Tasks", "API_EXPLORER": "API EXPLORER" }, "USER": { @@ -874,7 +877,7 @@ "GC": { "CURRENT_SCHEDULE": "Current Schedule", "GC_NOW": "GC NOW", - "JOB_HISTORY": "GC Jobs History", + "JOB_HISTORY": "GC History", "JOB_ID": "Job ID", "TRIGGER_TYPE": "Trigger Type", "LATEST_JOBS": "Latest {{param}} Jobs", diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index f58fdb8bb..1ae79cf42 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -127,9 +127,12 @@ "GROUP": "Grupos", "REGISTRY": "Registros", "REPLICATION": "Replicações", - "CONFIG": "Configuração" + "CONFIG": "Configuração", + "VULNERABILITY": "Vulnerability", + "GARBAGE_COLLECTION": "Garbage Collection" }, "LOGS": "Logs", + "TASKS": "Tasks", "API_EXPLORER": "API EXPLORER" }, "USER": { @@ -905,6 +908,7 @@ "ON": "em", "AT": "em", "GC_NOW": "GC AGORA", + "JOB_HISTORY": "GC History", "JOB_LIST":"Lista de tarefas de Limpeza", "JOB_ID":"ID DA TAREFA", "TRIGGER_TYPE": "TIPO DE DISPARO", diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index 6c53a89ca..4157eeb49 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -128,9 +128,12 @@ "GROUP": "组管理", "REGISTRY": "仓库管理", "REPLICATION": "复制管理", - "CONFIG": "配置管理" + "CONFIG": "配置管理", + "VULNERABILITY": "漏洞", + "GARBAGE_COLLECTION": "垃圾清理" }, "LOGS": "日志", + "TASKS": "任务", "API_EXPLORER": "API控制中心" }, "USER": { diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index a443c3ae3..2d6042296 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -278,7 +278,7 @@ Delete A Label ## Garbage Collection Switch To Garbage Collection Sleep 1 - Click Element xpath=${configuration_xpath} + Retry Element Click xpath=${gc_config_page} Wait Until Page Contains Element ${garbage_collection_xpath} Click Element xpath=${garbage_collection_xpath} @@ -290,3 +290,8 @@ Click GC Now View GC Details Click Element xpath=${gc_log_details_xpath} Sleep 2 + +Switch To GC History + Retry Element Click xpath=${gc_log_xpath} + Retry Wait Until Page Contains Job + diff --git a/tests/resources/Harbor-Pages/Configuration_Elements.robot b/tests/resources/Harbor-Pages/Configuration_Elements.robot index 1639b865b..ae9718178 100644 --- a/tests/resources/Harbor-Pages/Configuration_Elements.robot +++ b/tests/resources/Harbor-Pages/Configuration_Elements.robot @@ -27,5 +27,7 @@ ${vulnerbility_save_button_xpath} //*[@id='config-save'] ${configuration_xpath} //clr-vertical-nav-group-children/a[contains(.,'Configuration')] ${system_config_xpath} //*[@id='config-system'] ${garbage_collection_xpath} //*[@id='config-gc'] -${gc_now_xpath} //*[@id='gc']/gc-config/button +${gc_log_xpath} //*[@id='gc-log'] +${gc_config_page} //clr-vertical-nav-group-children/a[contains(.,'Garbage')] +${gc_now_xpath} //*[@id='gc']/gc-config//button[contains(.,'GC')] ${gc_log_details_xpath} //*[@id='clr-dg-row26']/clr-dg-cell[6]/a \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Verify.robot b/tests/resources/Harbor-Pages/Verify.robot index 10ed04229..f47184fbc 100644 --- a/tests/resources/Harbor-Pages/Verify.robot +++ b/tests/resources/Harbor-Pages/Verify.robot @@ -173,7 +173,7 @@ Verify System Setting Switch To System Settings Page Should Contain @{creation}[0] Token Must Be Match @{token}[0] - Go To Vulnerability Config + Switch To Vulnerability Page Page Should Contain None Close Browser diff --git a/tests/resources/Harbor-Pages/Vulnerability.robot b/tests/resources/Harbor-Pages/Vulnerability.robot index a40303121..8f739a1ba 100644 --- a/tests/resources/Harbor-Pages/Vulnerability.robot +++ b/tests/resources/Harbor-Pages/Vulnerability.robot @@ -4,7 +4,8 @@ Resource ../../resources/Util.robot *** Variables *** ${HARBOR_VERSION} v1.1.1 - + ${scan_now_button} //vulnerability-page//button[contains(.,'NOW')] + ${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')] *** Keywords *** Disable Scan Schedule Retry Element Click //vulnerability-config//cron-selection//button[contains(.,'EDIT')] @@ -12,13 +13,15 @@ Disable Scan Schedule Retry Element Click //vulnerability-config//cron-selection//select[@id='selectPolicy']//option[contains(.,'None')] Retry Element Click //cron-selection//button[contains(.,'SAVE')] -Go To Vulnerability Config - Retry Element Click //config//button[contains(.,'Vulnerability')] - Trigger Scan Now - Retry Element Click //config//button[contains(.,'NOW')] + Retry Element Click xpath=${scan_now_button} Sleep 10 +Switch To Vulnerability Page + Retry Element Click xpath=${vulnerability_page} + Retry Wait Element ${scan_now_button} + + Set Vulnerabilty Serverity #0 is high 1 is medium 2 is low 3 is negligible [Arguments] ${level} diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index e92862da9..fa36e2dc3 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -34,8 +34,7 @@ Test Case - Vulnerability Data Not Ready Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Go Into Project library has_image=${false} Vulnerability Not Ready Project Hint - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Vulnerability Not Ready Config Hint Test Case - Garbage Collection @@ -56,7 +55,8 @@ Test Case - Garbage Collection Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Switch To Garbage Collection Sleep 1 - Wait Until Page Contains Finished + Switch To GC History + Retry Wait Until Page Contains Finished ${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -i --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/system/gc/1/log" Log To Console ${output} @@ -265,13 +265,11 @@ Test Case - Delete Label Test Case - Disable Scan Schedule Init Chrome Driver Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Disable Scan Schedule Logout Harbor Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Retry Wait Until Page Contains None Close Browser @@ -545,8 +543,7 @@ Test Case - Manual Scan All Init Chrome Driver Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Trigger Scan Now Navigate To Projects Go Into Project library diff --git a/tests/robot-cases/Group1-Nightly/Nightly.robot b/tests/robot-cases/Group1-Nightly/Nightly.robot index 0e011df79..b2677bcf0 100644 --- a/tests/robot-cases/Group1-Nightly/Nightly.robot +++ b/tests/robot-cases/Group1-Nightly/Nightly.robot @@ -35,8 +35,7 @@ Test Case - Vulnerability Data Not Ready Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Go Into Project library has_image=${false} Vulnerability Not Ready Project Hint - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Vulnerability Not Ready Config Hint Test Case - Read Only Mode @@ -438,13 +437,11 @@ Test Case - Scan Image With Empty Vul Test Case - Disable Scan Schedule Init Chrome Driver Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Disable Scan Schedule Logout Harbor Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Page Should Contain None Close Browser ### @@ -452,8 +449,7 @@ Test Case - Manual Scan All Init Chrome Driver Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Configure - Go To Vulnerability Config + Switch To Vulnerability Page Trigger Scan Now Navigate To Projects Go Into Project library