From b406611a3df1b19660c9449bb459259eacf81136 Mon Sep 17 00:00:00 2001 From: sshijun Date: Fri, 18 Oct 2019 10:46:24 +0800 Subject: [PATCH] Improve scanner UI Signed-off-by: sshijun --- .../src/config/registry-config.component.html | 4 ++-- .../src/config/registry-config.component.scss | 5 ++++- .../system/system-settings.component.html | 4 ++-- .../project-policy-config.component.html | 10 +++++----- .../src/repository/repository.component.html | 5 ++--- src/portal/lib/src/tag/tag.component.html | 6 +++--- src/portal/lib/src/tag/tag.component.ts | 4 +--- .../harbor-shell/harbor-shell.component.html | 4 ++-- .../scanner/config-scanner.component.html | 20 +++++++++++++------ .../scanner/config-scanner.component.scss | 9 +++++++++ .../scanner/config-scanner.component.ts | 6 +++--- .../new-scanner-form.component.html | 16 +++++++-------- .../new-scanner-form.component.scss | 7 +++++-- .../new-scanner-form.component.ts | 16 +++++++-------- .../project/scanner/scanner.component.html | 5 +++-- .../project/scanner/scanner.component.scss | 3 +++ .../tag-detail/tag-detail-page.component.html | 3 +-- src/portal/src/i18n/lang/en-us-lang.json | 10 +++++++--- src/portal/src/i18n/lang/es-es-lang.json | 10 +++++++--- src/portal/src/i18n/lang/fr-fr-lang.json | 10 +++++++--- src/portal/src/i18n/lang/pt-br-lang.json | 10 +++++++--- src/portal/src/i18n/lang/tr-tr-lang.json | 10 +++++++--- src/portal/src/i18n/lang/zh-cn-lang.json | 6 +++++- 23 files changed, 115 insertions(+), 68 deletions(-) diff --git a/src/portal/lib/src/config/registry-config.component.html b/src/portal/lib/src/config/registry-config.component.html index ad31cc66c..a36fcb4ac 100644 --- a/src/portal/lib/src/config/registry-config.component.html +++ b/src/portal/lib/src/config/registry-config.component.html @@ -10,7 +10,7 @@ - + @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/src/portal/lib/src/config/registry-config.component.scss b/src/portal/lib/src/config/registry-config.component.scss index 609b59702..84f2aa105 100644 --- a/src/portal/lib/src/config/registry-config.component.scss +++ b/src/portal/lib/src/config/registry-config.component.scss @@ -18,4 +18,7 @@ .replication-tooltip { top: -8px; -} \ No newline at end of file +} +.margin-top-3px { + margin-top: 3px; +} diff --git a/src/portal/lib/src/config/system/system-settings.component.html b/src/portal/lib/src/config/system/system-settings.component.html index 109c1d2d1..23ef9a0a5 100644 --- a/src/portal/lib/src/config/system/system-settings.component.html +++ b/src/portal/lib/src/config/system/system-settings.component.html @@ -73,7 +73,7 @@ -
+
@@ -172,4 +172,4 @@ [disabled]="(!isValid() || !hasChanges()) && (!hasWhitelistChanged) || inProgress">{{'BUTTON.CANCEL' | translate}}
- \ No newline at end of file + diff --git a/src/portal/lib/src/project-policy-config/project-policy-config.component.html b/src/portal/lib/src/project-policy-config/project-policy-config.component.html index e9b32c99b..d63471ffb 100644 --- a/src/portal/lib/src/project-policy-config/project-policy-config.component.html +++ b/src/portal/lib/src/project-policy-config/project-policy-config.component.html @@ -10,7 +10,7 @@ {{ 'PROJECT_CONFIG.PUBLIC_POLICY' | translate }} - + {{ 'PROJECT_CONFIG.CONTENT_TRUST_POLCIY' | translate }} - + - + @@ -46,7 +46,7 @@
- + {{ 'PROJECT_CONFIG.AUTOSCAN_POLICY' | translate }} -
+
diff --git a/src/portal/lib/src/repository/repository.component.html b/src/portal/lib/src/repository/repository.component.html index c2ef10c67..32f208f65 100644 --- a/src/portal/lib/src/repository/repository.component.html +++ b/src/portal/lib/src/repository/repository.component.html @@ -55,10 +55,9 @@
- \ No newline at end of file + diff --git a/src/portal/lib/src/tag/tag.component.html b/src/portal/lib/src/tag/tag.component.html index e269582a2..89ad13d5c 100644 --- a/src/portal/lib/src/tag/tag.component.html +++ b/src/portal/lib/src/tag/tag.component.html @@ -85,7 +85,7 @@ {{'REPOSITORY.SIGNED' | translate}} {{'REPOSITORY.AUTHOR' | translate}} {{'REPOSITORY.CREATED' | translate}} - {{'REPOSITORY.DOCKER_VERSION' | translate}} + {{'REPOSITORY.DOCKER_VERSION' | translate}} {{'REPOSITORY.LABELS' | translate}} {{'REPOSITORY.PUSH_TIME' | translate}} {{'REPOSITORY.PULL_TIME' | translate}} @@ -111,7 +111,7 @@ {{t.author}} {{t.created | date: 'short'}} - {{t.docker_version}} + {{t.docker_version}}
@@ -136,4 +136,4 @@
-
\ No newline at end of file +
diff --git a/src/portal/lib/src/tag/tag.component.ts b/src/portal/lib/src/tag/tag.component.ts index e8204532a..2024c3fc0 100644 --- a/src/portal/lib/src/tag/tag.component.ts +++ b/src/portal/lib/src/tag/tag.component.ts @@ -723,9 +723,7 @@ export class TagComponent implements OnInit, AfterViewInit { canScanNow(t: Tag[]): boolean { if (!this.hasScanImagePermission) { return false; } let st: string = this.scanStatus(t[0]); - - return st !== VULNERABILITY_SCAN_STATUS.PENDING && - st !== VULNERABILITY_SCAN_STATUS.RUNNING; + return st !== VULNERABILITY_SCAN_STATUS.RUNNING; } getImagePermissionRule(projectId: number): void { let hasAddLabelImagePermission = this.userPermissionService.getPermission(projectId, USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.KEY, 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 796b68bef..f15c1e941 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 @@ -43,12 +43,12 @@ - + {{'SIDE_NAV.TASKS' | translate}} - {{'SIDE_NAV.SYSTEM_MGMT.VULNERABILITY' | translate}} diff --git a/src/portal/src/app/config/scanner/config-scanner.component.html b/src/portal/src/app/config/scanner/config-scanner.component.html index ace2429fd..5f9be35e3 100644 --- a/src/portal/src/app/config/scanner/config-scanner.component.html +++ b/src/portal/src/app/config/scanner/config-scanner.component.html @@ -17,18 +17,26 @@ @@ -45,7 +53,7 @@ {{'SCANNER.NAME' | translate}} {{'SCANNER.ENDPOINT' | translate}} {{'SCANNER.HEALTH' | translate}} - {{'SCANNER.DISABLED' | translate}} + {{'SCANNER.ENABLED' | translate}} {{'SCANNER.AUTH' | translate}} {{'SCANNER.NO_SCANNER' | translate}} @@ -62,7 +70,7 @@ {{'SCANNER.UNHEALTHY' | translate}} - {{scanner.disabled}} + {{!scanner.disabled}} {{scanner.auth?scanner.auth:'None'}} diff --git a/src/portal/src/app/config/scanner/config-scanner.component.scss b/src/portal/src/app/config/scanner/config-scanner.component.scss index d0dbac951..f6c8b3ff9 100644 --- a/src/portal/src/app/config/scanner/config-scanner.component.scss +++ b/src/portal/src/app/config/scanner/config-scanner.component.scss @@ -22,3 +22,12 @@ .width-240 { min-width: 240px !important; } +.margin-top-0 { + margin-top: 0; +} +.margin-top-2 { + margin-top: 2px; +} +.margin-left-10 { + margin-left: 10px; +} diff --git a/src/portal/src/app/config/scanner/config-scanner.component.ts b/src/portal/src/app/config/scanner/config-scanner.component.ts index 43f82e03f..dd2e58562 100644 --- a/src/portal/src/app/config/scanner/config-scanner.component.ts +++ b/src/portal/src/app/config/scanner/config-scanner.component.ts @@ -35,7 +35,7 @@ export class ConfigurationScannerComponent implements OnInit, OnDestroy { confirmed.state === ConfirmationState.CONFIRMED) { this.configScannerService.deleteScanners(confirmed.data) .subscribe(response => { - this.msgHandler.showSuccess("Delete Success"); + this.msgHandler.showSuccess("SCANNER.DELETE_SUCCESS"); this.getScanners(); }, error => { this.errorHandler.error(error); @@ -76,7 +76,7 @@ export class ConfigurationScannerComponent implements OnInit, OnDestroy { scanner.disabled = !scanner.disabled; this.configScannerService.updateScanner(scanner) .subscribe(response => { - this.msgHandler.showSuccess("Update Success"); + this.msgHandler.showSuccess("SCANNER.UPDATE_SUCCESS"); this.getScanners(); }, error => { this.errorHandler.error(error); @@ -87,7 +87,7 @@ export class ConfigurationScannerComponent implements OnInit, OnDestroy { if (this.selectedRow) { this.configScannerService.setAsDefault(this.selectedRow.uuid) .subscribe(response => { - this.msgHandler.showSuccess("Update Success"); + this.msgHandler.showSuccess("SCANNER.UPDATE_SUCCESS"); this.getScanners(); }, error => { this.errorHandler.error(error); diff --git a/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.html b/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.html index cd00d6f6a..f80424f30 100644 --- a/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.html +++ b/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.html @@ -4,7 +4,7 @@
- @@ -18,7 +18,7 @@
-
@@ -28,7 +28,7 @@
+ class="clr-input width-280" type="text" id="scanner-endpoint">
@@ -41,7 +41,7 @@
- @@ -56,7 +56,7 @@
+ class="clr-input width-280" type="text" id="scanner-username">
@@ -69,7 +69,7 @@
+ class="clr-input width-280" type="password" id="scanner-password">
@@ -82,7 +82,7 @@
+ class="clr-input width-280" type="text" id="scanner-token">
@@ -95,7 +95,7 @@
+ class="clr-input width-280" type="text" id="scanner-apiKey">
diff --git a/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.scss b/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.scss index e996b3e08..16b0eeefd 100644 --- a/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.scss +++ b/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.scss @@ -1,6 +1,9 @@ -.width-312 { - width: 312px; +.width-280 { + width: 280px; } .padding-top-3 { padding-top: 3px; } +.clr-control-label { + width: 9rem !important; +} diff --git a/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.ts b/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.ts index c073d140c..fcc223279 100644 --- a/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.ts +++ b/src/portal/src/app/config/scanner/new-scanner-form/new-scanner-form.component.ts @@ -21,7 +21,7 @@ export class NewScannerFormComponent implements OnInit, AfterViewInit, OnDestro checkOnGoing: boolean = false; newScannerForm: FormGroup = this.fb.group({ name: this.fb.control("", - [Validators.required, Validators.pattern(/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/)]), + [Validators.required]), description: this.fb.control(""), url: this.fb.control("", [Validators.required, @@ -57,7 +57,7 @@ export class NewScannerFormComponent implements OnInit, AfterViewInit, OnDestro if (this.isEdit && this.originValue && this.originValue.name === name) { return false; } - return this.newScannerForm.get('name').valid && name.length > 1; + return this.newScannerForm.get('name').valid && name.length > 0; }), debounceTime(500), distinctUntilChanged(), @@ -130,15 +130,15 @@ export class NewScannerFormComponent implements OnInit, AfterViewInit, OnDestro return true; } if (this.isNameExisting) { - this.nameTooltip = 'NAME_EXISTS'; + this.nameTooltip = 'SCANNER.NAME_EXISTS'; return false; } if (this.newScannerForm.get('name').errors && this.newScannerForm.get('name').errors.required) { - this.nameTooltip = 'NAME_REQUIRED'; + this.nameTooltip = 'SCANNER.NAME_REQUIRED'; return false; } if (this.newScannerForm.get('name').errors && this.newScannerForm.get('name').errors.pattern) { - this.nameTooltip = 'NAME_REX'; + this.nameTooltip = 'SCANNER.NAME_REX'; return false; } return true; @@ -151,11 +151,11 @@ export class NewScannerFormComponent implements OnInit, AfterViewInit, OnDestro return true; } if (this.isEndpointUrlExisting) { - this.endpointTooltip = 'ENDPOINT_EXISTS'; + this.endpointTooltip = 'SCANNER.ENDPOINT_EXISTS'; return false; } if (this.newScannerForm.get('url').errors && this.newScannerForm.get('url').errors.required) { - this.endpointTooltip = 'ENDPOINT_REQUIRED'; + this.endpointTooltip = 'SCANNER.ENDPOINT_REQUIRED'; return false; } // skip here, validate when onblur @@ -167,7 +167,7 @@ export class NewScannerFormComponent implements OnInit, AfterViewInit, OnDestro // validate endpointUrl when onblur checkEndpointUrl() { if (this.newScannerForm.get('url').errors && this.newScannerForm.get('url').errors.pattern) { - this.endpointTooltip = "ILLEGAL_ENDPOINT"; + this.endpointTooltip = "SCANNER.ILLEGAL_ENDPOINT"; this.showEndpointError = true; } } diff --git a/src/portal/src/app/project/scanner/scanner.component.html b/src/portal/src/app/project/scanner/scanner.component.html index b926ebd33..d9d772105 100644 --- a/src/portal/src/app/project/scanner/scanner.component.html +++ b/src/portal/src/app/project/scanner/scanner.component.html @@ -5,7 +5,7 @@
- +
@@ -16,9 +16,10 @@
{{scanner?.name}} + {{'SCANNER.DISABLED' | translate}} {{'SCANNER.HEALTHY' | translate}} - {{'SCANNER.Unhealthy' | translate}} + {{'SCANNER.UNHEALTHY' | translate}}
diff --git a/src/portal/src/app/project/scanner/scanner.component.scss b/src/portal/src/app/project/scanner/scanner.component.scss index 1a531ebec..c2f5a0d72 100644 --- a/src/portal/src/app/project/scanner/scanner.component.scss +++ b/src/portal/src/app/project/scanner/scanner.component.scss @@ -18,3 +18,6 @@ justify-content: center; align-items: center; } +.clr-form-control { + margin-top: 0.75rem !important; +} diff --git a/src/portal/src/app/repository/tag-detail/tag-detail-page.component.html b/src/portal/src/app/repository/tag-detail/tag-detail-page.component.html index 6eb680c31..0e46a7c50 100644 --- a/src/portal/src/app/repository/tag-detail/tag-detail-page.component.html +++ b/src/portal/src/app/repository/tag-detail/tag-detail-page.component.html @@ -6,8 +6,7 @@
-
\ No newline at end of file +
diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index 347c91c05..4f8951504 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -1257,10 +1257,10 @@ "ADD_SCANNER": "Add Scanner", "EDIT_SCANNER": "Edit Scanner", "TEST_CONNECTION": "TEST CONNECTION", - "ADD_SUCCESS": "Added successfully", + "ADD_SUCCESS": "Successfully added ", "TEST_PASS": "Test passed", "TEST_FAILED": "Test failed", - "UPDATE_SUCCESS": "Updated successfully", + "UPDATE_SUCCESS": "Successfully updated", "SCANNER_COLON": "Scanner:", "NAME_COLON": "Name:", "VENDOR_COLON": "Vendor:", @@ -1284,6 +1284,10 @@ "ADAPTER": "Adapter", "VENDOR": "Vendor", "VERSION": "Version", - "SELECT_SCANNER": "Select Scanner" + "SELECT_SCANNER": "Select Scanner", + "ENABLED": "Enabled", + "ENABLE": "Enable", + "DISABLE": "Disable", + "DELETE_SUCCESS": "Successfully deleted" } } diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index d21c621d6..69614a2be 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -1254,10 +1254,10 @@ "ADD_SCANNER": "Add Scanner", "EDIT_SCANNER": "Edit Scanner", "TEST_CONNECTION": "TEST CONNECTION", - "ADD_SUCCESS": "Added successfully", + "ADD_SUCCESS": "Successfully added ", "TEST_PASS": "Test passed", "TEST_FAILED": "Test failed", - "UPDATE_SUCCESS": "Updated successfully", + "UPDATE_SUCCESS": "Successfully updated", "SCANNER_COLON": "Scanner:", "NAME_COLON": "Name:", "VENDOR_COLON": "Vendor:", @@ -1281,6 +1281,10 @@ "ADAPTER": "Adapter", "VENDOR": "Vendor", "VERSION": "Version", - "SELECT_SCANNER": "Select Scanner" + "SELECT_SCANNER": "Select Scanner", + "ENABLED": "Enabled", + "ENABLE": "Enable", + "DISABLE": "Disable", + "DELETE_SUCCESS": "Successfully deleted" } } diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index a76d9dabd..f73cfd102 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -1226,10 +1226,10 @@ "ADD_SCANNER": "Add Scanner", "EDIT_SCANNER": "Edit Scanner", "TEST_CONNECTION": "TEST CONNECTION", - "ADD_SUCCESS": "Added successfully", + "ADD_SUCCESS": "Successfully added ", "TEST_PASS": "Test passed", "TEST_FAILED": "Test failed", - "UPDATE_SUCCESS": "Updated successfully", + "UPDATE_SUCCESS": "Successfully updated", "SCANNER_COLON": "Scanner:", "NAME_COLON": "Name:", "VENDOR_COLON": "Vendor:", @@ -1253,6 +1253,10 @@ "ADAPTER": "Adapter", "VENDOR": "Vendor", "VERSION": "Version", - "SELECT_SCANNER": "Select Scanner" + "SELECT_SCANNER": "Select Scanner", + "ENABLED": "Enabled", + "ENABLE": "Enable", + "DISABLE": "Disable", + "DELETE_SUCCESS": "Successfully deleted" } } diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index 4d211d9db..c9124fb90 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -1251,10 +1251,10 @@ "ADD_SCANNER": "Add Scanner", "EDIT_SCANNER": "Edit Scanner", "TEST_CONNECTION": "TEST CONNECTION", - "ADD_SUCCESS": "Added successfully", + "ADD_SUCCESS": "Successfully added ", "TEST_PASS": "Test passed", "TEST_FAILED": "Test failed", - "UPDATE_SUCCESS": "Updated successfully", + "UPDATE_SUCCESS": "Successfully updated", "SCANNER_COLON": "Scanner:", "NAME_COLON": "Name:", "VENDOR_COLON": "Vendor:", @@ -1278,7 +1278,11 @@ "ADAPTER": "Adapter", "VENDOR": "Vendor", "VERSION": "Version", - "SELECT_SCANNER": "Select Scanner" + "SELECT_SCANNER": "Select Scanner", + "ENABLED": "Enabled", + "ENABLE": "Enable", + "DISABLE": "Disable", + "DELETE_SUCCESS": "Successfully deleted" } } diff --git a/src/portal/src/i18n/lang/tr-tr-lang.json b/src/portal/src/i18n/lang/tr-tr-lang.json index 28b8b9222..8b46aff40 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -1256,10 +1256,10 @@ "ADD_SCANNER": "Add Scanner", "EDIT_SCANNER": "Edit Scanner", "TEST_CONNECTION": "TEST CONNECTION", - "ADD_SUCCESS": "Added successfully", + "ADD_SUCCESS": "Successfully added ", "TEST_PASS": "Test passed", "TEST_FAILED": "Test failed", - "UPDATE_SUCCESS": "Updated successfully", + "UPDATE_SUCCESS": "Successfully updated", "SCANNER_COLON": "Scanner:", "NAME_COLON": "Name:", "VENDOR_COLON": "Vendor:", @@ -1283,6 +1283,10 @@ "ADAPTER": "Adapter", "VENDOR": "Vendor", "VERSION": "Version", - "SELECT_SCANNER": "Select Scanner" + "SELECT_SCANNER": "Select Scanner", + "ENABLED": "Enabled", + "ENABLE": "Enable", + "DISABLE": "Disable", + "DELETE_SUCCESS": "Successfully deleted" } } diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index e82e3ed55..a67a885fa 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -1280,6 +1280,10 @@ "ADAPTER": "适配器", "VENDOR": "供应商", "VERSION": "版本", - "SELECT_SCANNER": "选择扫描器" + "SELECT_SCANNER": "选择扫描器", + "ENABLED": "启用", + "ENABLE": "启用", + "DISABLE": "禁用", + "DELETE_SUCCESS": "删除成功" } }