modify the remote cert checkbox value

This commit is contained in:
Fuhui Peng (c) 2017-10-31 19:39:07 +08:00
parent 5e54f793e1
commit 29cf632de8
11 changed files with 45 additions and 10 deletions

View File

@ -40,7 +40,12 @@ export const CREATE_EDIT_ENDPOINT_TEMPLATE: string = `
</div>
<div class="form-group">
<label for="destination_insecure" class="col-md-4 form-group-label-override">{{'CONFIG.VERIFY_REMOTE_CERT' | translate }}</label>
<clr-checkbox #insecure class="col-md-8" name="insecure" id="destination_insecure" [(ngModel)]="target.insecure"></clr-checkbox>
<clr-checkbox #insecure class="col-md-8" name="insecure" id="destination_insecure" [clrChecked]="!target.insecure" (clrCheckedChange)="setInsecureValue($event)">
<a href="javascript:void(0)" role="tooltip" aria-haspopup="true" class="tooltip tooltip-top-right" style="top:-7px;">
<clr-icon shape="info-circle" class="info-tips-icon" size="24"></clr-icon>
<span class="tooltip-content">{{'TOOLTIP.VERIFY_REMOTE_CERT' | translate}}</span>
</a>
</clr-checkbox>
</div>
<div class="form-group">
<label for="spin" class="col-md-4"></label>

View File

@ -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();

View File

@ -72,6 +72,15 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
<input type="password" class="col-md-8" id="destination_password" [disabled]="testOngoing" [readonly]="readonly || !isCreateEndpoint"
[(ngModel)]="createEditRule.password" size="20" name="password" #password="ngModel">
</div>
<div class="form-group">
<label for="destination_insecure" class="col-md-4 form-group-label-override">{{'CONFIG.VERIFY_REMOTE_CERT' | translate }}</label>
<clr-checkbox #insecure class="col-md-8" name="insecure" id="destination_insecure" [clrChecked]="!createEditRule.insecure" [clrDisabled]="readonly || !isCreateEndpoint" (clrCheckedChange)="setInsecureValue($event)">
<a href="javascript:void(0)" role="tooltip" aria-haspopup="true" class="tooltip tooltip-top-right" style="top:-7px;">
<clr-icon shape="info-circle" class="info-tips-icon" size="24"></clr-icon>
<span class="tooltip-content">{{'TOOLTIP.VERIFY_REMOTE_CERT' | translate}}</span>
</a>
</clr-checkbox>
</div>
<div class="form-group">
<label for="spin" class="col-md-4"></label>
<span class="col-md-8 spinner spinner-inline" [hidden]="!testOngoing"></span>

View File

@ -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) {

View File

@ -30,7 +30,7 @@ export const ENDPOINT_TEMPLATE: string = `
<clr-dg-cell>{{t.name}}</clr-dg-cell>
<clr-dg-cell>{{t.endpoint}}</clr-dg-cell>
<clr-dg-cell>
<clr-checkbox name="insecure" [clrChecked]="t.insecure"> </clr-checkbox>
{{!t.insecure}}
</clr-dg-cell>
<clr-dg-cell>{{t.creation_time | date: 'short'}}</clr-dg-cell>
</clr-dg-row>

View File

@ -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",

View File

@ -70,7 +70,7 @@
</div>
<div class="form-group">
<label for="insecure">{{'CONFIG.MAIL_INSECURE' | translate}}</label>
<clr-checkbox name="emaiInsecure" id="emailInsecure" [(ngModel)]="currentConfig.email_insecure.value" [disabled]="disabled(currentConfig.email_insecure)">
<clr-checkbox name="emaiInsecure" id="emailInsecure" [clrChecked]="!currentConfig.email_insecure.value" [clrDisabled]="disabled(currentConfig.email_insecure)" (clrCheckedChange)="setInsecureValue($event)">
<a href="javascript:void(0)" role="tooltip" aria-haspopup="true" class="tooltip tooltip-top-right" style="top:-7px;">
<clr-icon shape="info-circle" class="info-tips-icon" size="24"></clr-icon>
<span class="tooltip-content">{{'CONFIG.INSECURE_TOOLTIP' | translate}}</span>

View File

@ -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;
}

View File

@ -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)",

View File

@ -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)",

View File

@ -396,7 +396,7 @@
"MAIL_FROM": "邮件来源",
"MAIL_SSL": "邮件 SSL",
"MAIL_INSECURE": "验证证书",
"INSECURE_TOOLTIP": "确定是否要验证远程Harbor实例的证书。如果远程实例使用的是自签或者非信任证书,不要勾选此项。",
"INSECURE_TOOLTIP": "确定是否要验证邮件服务器的证书。如果邮件服务器使用的是自签或者非信任证书,不要勾选此项。",
"SSL_TOOLTIP": "启用SSL到邮件服务器连接。",
"VERIFY_REMOTE_CERT": "验证远程证书",
"TOKEN_EXPIRATION": "令牌过期时间(分钟)",