From 29cf632de8557f23ae8b306e8ab0732215db68fd Mon Sep 17 00:00:00 2001 From: "Fuhui Peng (c)" Date: Tue, 31 Oct 2017 19:39:07 +0800 Subject: [PATCH 1/3] modify the remote cert checkbox value --- .../create-edit-endpoint.component.html.ts | 7 ++++++- .../create-edit-endpoint.component.ts | 5 +++++ .../create-edit-rule.component.html.ts | 9 +++++++++ .../create-edit-rule.component.ts | 16 ++++++++++++++-- .../lib/src/endpoint/endpoint.component.html.ts | 2 +- src/ui_ng/package.json | 2 +- .../app/config/email/config-email.component.html | 2 +- .../app/config/email/config-email.component.ts | 6 +++++- src/ui_ng/src/i18n/lang/en-us-lang.json | 2 +- src/ui_ng/src/i18n/lang/es-es-lang.json | 2 +- src/ui_ng/src/i18n/lang/zh-cn-lang.json | 2 +- 11 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.html.ts b/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.html.ts index 382a71905..8f9dfd10c 100644 --- a/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.html.ts +++ b/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.html.ts @@ -40,7 +40,12 @@ export const CREATE_EDIT_ENDPOINT_TEMPLATE: string = `
- + + + + {{'TOOLTIP.VERIFY_REMOTE_CERT' | translate}} + +
diff --git a/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.ts b/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.ts index d71f8e730..49e00d741 100644 --- a/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.ts +++ b/src/ui_ng/lib/src/create-edit-endpoint/create-edit-endpoint.component.ts @@ -115,6 +115,11 @@ export class CreateEditEndpointComponent implements AfterViewChecked, OnDestroy public get checkboxHasChanged(): boolean { return (this.target.insecure !== this.initVal.insecure) ? true : false; } + + setInsecureValue($event: any) { + this.target.insecure = !$event; + } + ngOnDestroy(): void { if (this.valueChangesSub) { this.valueChangesSub.unsubscribe(); diff --git a/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.html.ts b/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.html.ts index 43eb0daa9..e7bcaf757 100644 --- a/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.html.ts +++ b/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.html.ts @@ -72,6 +72,15 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
+
+ + + + + {{'TOOLTIP.VERIFY_REMOTE_CERT' | translate}} + + +
diff --git a/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.ts b/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.ts index 61e037094..602828011 100644 --- a/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.ts +++ b/src/ui_ng/lib/src/create-edit-rule/create-edit-rule.component.ts @@ -46,6 +46,7 @@ export interface CreateEditRule { endpointUrl?: string; username?: string; password?: string; + insecure?: boolean; } const FAKE_PASSWORD: string = 'ywJZnDTM'; @@ -99,7 +100,8 @@ export class CreateEditRuleComponent implements AfterViewChecked { endpointName: '', endpointUrl: '', username: '', - password: '' + password: '', + insecure: false }; } @@ -169,12 +171,14 @@ export class CreateEditRuleComponent implements AfterViewChecked { this.createEditRule.endpointName = initialEndpoint.name; this.createEditRule.endpointUrl = initialEndpoint.endpoint; this.createEditRule.username = initialEndpoint.username; + this.createEditRule.insecure = initialEndpoint.insecure; this.createEditRule.password = FAKE_PASSWORD; this.initVal.endpointId = this.createEditRule.endpointId; this.initVal.endpointUrl = this.createEditRule.endpointUrl; this.initVal.username = this.createEditRule.username; this.initVal.password = this.createEditRule.password; + this.initVal.insecure = this.createEditRule.insecure; } }) .catch(error=>{ @@ -234,6 +238,7 @@ export class CreateEditRuleComponent implements AfterViewChecked { this.createEditRule.endpointUrl = ''; this.createEditRule.username = ''; this.createEditRule.password = ''; + this.createEditRule.insecure = false; } else { this.prepareTargets(); } @@ -245,6 +250,7 @@ export class CreateEditRuleComponent implements AfterViewChecked { this.createEditRule.endpointId = result.id; this.createEditRule.endpointUrl = result.endpoint; this.createEditRule.username = result.username; + this.createEditRule.insecure = result.insecure; this.createEditRule.password = FAKE_PASSWORD; } } @@ -267,6 +273,7 @@ export class CreateEditRuleComponent implements AfterViewChecked { endpoint.endpoint = this.createEditRule.endpointUrl || ''; endpoint.username = this.createEditRule.username; endpoint.password = this.createEditRule.password; + endpoint.insecure = this.createEditRule.insecure; return endpoint; } @@ -362,6 +369,10 @@ export class CreateEditRuleComponent implements AfterViewChecked { } } + setInsecureValue($event: any) { + this.createEditRule.insecure = !$event; + } + confirmCancel(confirmed: boolean) { this.createEditRuleOpened = false; this.inlineAlert.close(); @@ -379,7 +390,8 @@ export class CreateEditRuleComponent implements AfterViewChecked { targetName: this.initVal.name, endpointUrl: this.initVal.endpointUrl, username: this.initVal.username, - password: this.initVal.password + password: this.initVal.password, + insecure: this.initVal.insecure }; let self: CreateEditRuleComponent | any = this; if(self) { diff --git a/src/ui_ng/lib/src/endpoint/endpoint.component.html.ts b/src/ui_ng/lib/src/endpoint/endpoint.component.html.ts index 9b54f93b3..e5b3cd606 100644 --- a/src/ui_ng/lib/src/endpoint/endpoint.component.html.ts +++ b/src/ui_ng/lib/src/endpoint/endpoint.component.html.ts @@ -30,7 +30,7 @@ export const ENDPOINT_TEMPLATE: string = ` {{t.name}} {{t.endpoint}} - + {{!t.insecure}} {{t.creation_time | date: 'short'}} diff --git a/src/ui_ng/package.json b/src/ui_ng/package.json index 971f2c857..511b7f317 100644 --- a/src/ui_ng/package.json +++ b/src/ui_ng/package.json @@ -31,7 +31,7 @@ "clarity-icons": "^0.9.8", "clarity-ui": "^0.9.8", "core-js": "^2.4.1", - "harbor-ui": "0.4.92", + "harbor-ui": "0.4.95", "intl": "^1.2.5", "mutationobserver-shim": "^0.3.2", "ngx-cookie": "^1.0.0", diff --git a/src/ui_ng/src/app/config/email/config-email.component.html b/src/ui_ng/src/app/config/email/config-email.component.html index 86726034c..8e26db59d 100644 --- a/src/ui_ng/src/app/config/email/config-email.component.html +++ b/src/ui_ng/src/app/config/email/config-email.component.html @@ -70,7 +70,7 @@
- + {{'CONFIG.INSECURE_TOOLTIP' | translate}} diff --git a/src/ui_ng/src/app/config/email/config-email.component.ts b/src/ui_ng/src/app/config/email/config-email.component.ts index 93f18921c..5f709fca3 100644 --- a/src/ui_ng/src/app/config/email/config-email.component.ts +++ b/src/ui_ng/src/app/config/email/config-email.component.ts @@ -23,7 +23,7 @@ import { Configuration } from 'harbor-ui'; }) export class ConfigurationEmailComponent { @Input("mailConfig") currentConfig: Configuration = new Configuration(); - + @ViewChild("mailConfigFrom") mailForm: NgForm; constructor() { } @@ -32,6 +32,10 @@ export class ConfigurationEmailComponent { return !(prop && prop.editable); } + setInsecureValue($event: any) { + this.currentConfig.email_insecure.value = !$event; + } + public isValid(): boolean { return this.mailForm && this.mailForm.valid; } diff --git a/src/ui_ng/src/i18n/lang/en-us-lang.json b/src/ui_ng/src/i18n/lang/en-us-lang.json index c5d2ca74b..35f2d4851 100644 --- a/src/ui_ng/src/i18n/lang/en-us-lang.json +++ b/src/ui_ng/src/i18n/lang/en-us-lang.json @@ -396,7 +396,7 @@ "MAIL_FROM": "Email From", "MAIL_SSL": "Email SSL", "MAIL_INSECURE": "Verify Certificate", - "INSECURE_TOOLTIP": "Determine whether should verify the certificate of a remote Harbor registry. Uncheck this box when the remote registry uses a self-signed or untrusted certificate.", + "INSECURE_TOOLTIP": "Determine whether to verify the certificate of the Email server. Uncheck this box when the Email server uses a self-signed or untrusted certificate.", "SSL_TOOLTIP": "Enable SSL for email server connection", "VERIFY_REMOTE_CERT": "Verify Remote Cert", "TOKEN_EXPIRATION": "Token Expiration (Minutes)", diff --git a/src/ui_ng/src/i18n/lang/es-es-lang.json b/src/ui_ng/src/i18n/lang/es-es-lang.json index 4812095ac..433111e19 100644 --- a/src/ui_ng/src/i18n/lang/es-es-lang.json +++ b/src/ui_ng/src/i18n/lang/es-es-lang.json @@ -397,7 +397,7 @@ "MAIL_FROM": "Email De", "MAIL_SSL": "Email SSL", "MAIL_INSECURE": "Verify Certificate", - "INSECURE_TOOLTIP": "Determina si la verificar el certificado de un registro Harbor remoto. Desmarque esta opción cuando el registro remoto use un certificado de confianza o autofirmado.", + "INSECURE_TOOLTIP": "Determine whether to verify the certificate of the Email server. Uncheck this box when the Email server uses a self-signed or untrusted certificate.", "SSL_TOOLTIP": "Activar SSL en conexiones al servidor de correo", "VERIFY_REMOTE_CERT": "Verificar Certificado Remoto", "TOKEN_EXPIRATION": "Expiración del Token (Minutos)", diff --git a/src/ui_ng/src/i18n/lang/zh-cn-lang.json b/src/ui_ng/src/i18n/lang/zh-cn-lang.json index afaa86f7b..4d4f18bd9 100644 --- a/src/ui_ng/src/i18n/lang/zh-cn-lang.json +++ b/src/ui_ng/src/i18n/lang/zh-cn-lang.json @@ -396,7 +396,7 @@ "MAIL_FROM": "邮件来源", "MAIL_SSL": "邮件 SSL", "MAIL_INSECURE": "验证证书", - "INSECURE_TOOLTIP": "确定是否要验证远程Harbor实例的证书。如果远程实例使用的是自签或者非信任证书,不要勾选此项。", + "INSECURE_TOOLTIP": "确定是否要验证邮件服务器的证书。如果邮件服务器使用的是自签或者非信任证书,不要勾选此项。", "SSL_TOOLTIP": "启用SSL到邮件服务器连接。", "VERIFY_REMOTE_CERT": "验证远程证书", "TOKEN_EXPIRATION": "令牌过期时间(分钟)", From bcfba78615c9985cada874a940b657d286e96b5c Mon Sep 17 00:00:00 2001 From: "Fuhui Peng (c)" Date: Wed, 1 Nov 2017 17:29:02 +0800 Subject: [PATCH 2/3] modify test case about email config --- tests/resources/Harbor-Pages/Configuration.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index c870c5602..584d0ac37 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -159,7 +159,7 @@ Verify Email Textfield Value Should Be xpath=//*[@id="emailUsername"] example@vmware.com Textfield Value Should Be xpath=//*[@id="emailFrom"] example Checkbox Should Be Selected xpath=//*[@id="clr-checkbox-emailSSL"] - Checkbox Should Be Selected xpath=//*[@id="clr-checkbox-emailInsecure"] + Checkbox Should Not Be Selected xpath=//*[@id="clr-checkbox-emailInsecure"] Set Scan All To None click element //vulnerability-config//select From 48cbdcbb08acbd31519c9b5c62d8e7f69c0a6e80 Mon Sep 17 00:00:00 2001 From: "Fuhui Peng (c)" Date: Wed, 1 Nov 2017 18:45:11 +0800 Subject: [PATCH 3/3] change package version --- src/ui_ng/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui_ng/package.json b/src/ui_ng/package.json index 6b48801c1..e690d16d1 100644 --- a/src/ui_ng/package.json +++ b/src/ui_ng/package.json @@ -31,7 +31,7 @@ "clarity-icons": "^0.9.8", "clarity-ui": "^0.9.8", "core-js": "^2.4.1", - "harbor-ui": "0.4.96", + "harbor-ui": "0.4.97", "intl": "^1.2.5", "mutationobserver-shim": "^0.3.2", "ngx-cookie": "^1.0.0",