mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 10:45:45 +01:00
fix2552 connect button grayed out
This commit is contained in:
parent
be6e265890
commit
8ec00c479e
@ -81,8 +81,8 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline" (click)="testConnection()" [disabled]="testOngoing">{{'REPLICATION.TEST_CONNECTION' | translate}}</button>
|
||||
<button type="button" class="btn btn-outline" (click)="onCancel()">{{'BUTTON.CANCEL' | translate }}</button>
|
||||
<button type="button" class="btn btn-outline" (click)="testConnection()" [disabled]="testOngoing || endpointUrl.errors || connectAbled">{{'REPLICATION.TEST_CONNECTION' | translate}}</button>
|
||||
<button type="button" class="btn btn-outline" [disabled]="btnAbled" (click)="onCancel()">{{'BUTTON.CANCEL' | translate }}</button>
|
||||
<button type="submit" class="btn btn-primary" [disabled]="!ruleForm.form.valid || testOngoing || !editable" (click)="onSubmit()">{{'BUTTON.OK' | translate}}</button>
|
||||
</div>
|
||||
</clr-modal>`;
|
||||
|
@ -75,6 +75,9 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
||||
testOngoing: boolean;
|
||||
pingStatus: boolean;
|
||||
|
||||
btnAbled:boolean;
|
||||
|
||||
|
||||
ruleForm: NgForm;
|
||||
|
||||
staticBackdrop: boolean = true;
|
||||
@ -135,9 +138,14 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
||||
return this.actionType === ActionType.EDIT && (this.initVal.enable || false);
|
||||
}
|
||||
|
||||
|
||||
get showNewDestination(): boolean {
|
||||
return this.actionType === ActionType.ADD_NEW || (!this.createEditRule.enable || false);
|
||||
}
|
||||
get connectAbled():boolean{
|
||||
return !this.createEditRule.endpointId && !this.isCreateEndpoint;
|
||||
|
||||
}
|
||||
|
||||
constructor(
|
||||
private replicationService: ReplicationService,
|
||||
@ -393,6 +401,7 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
||||
|
||||
testConnection() {
|
||||
this.pingStatus = true;
|
||||
this.btnAbled=true;
|
||||
this.translateService.get('REPLICATION.TESTING_CONNECTION').subscribe(res=>this.pingTestMessage=res);
|
||||
this.testOngoing = !this.testOngoing;
|
||||
let pingTarget: Endpoint = this.initEndpoint;
|
||||
@ -409,11 +418,13 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
||||
this.testOngoing = !this.testOngoing;
|
||||
this.translateService.get('REPLICATION.TEST_CONNECTION_SUCCESS').subscribe(res=>this.pingTestMessage=res);
|
||||
this.pingStatus = true;
|
||||
this.btnAbled=false;
|
||||
})
|
||||
.catch(error=>{
|
||||
this.testOngoing = !this.testOngoing;
|
||||
this.translateService.get('REPLICATION.TEST_CONNECTION_FAILURE').subscribe(res=>this.pingTestMessage=res);
|
||||
this.pingStatus = false;
|
||||
this.btnAbled=false;
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user