fix issue about endpontUrl,username,password should have data when connent-test button could click #2435

This commit is contained in:
pengpengshui 2017-07-18 14:00:17 -07:00
parent 8236e0358e
commit 34f9a3b911
4 changed files with 9 additions and 3 deletions

View File

@ -45,7 +45,7 @@ export const CREATE_EDIT_ENDPOINT_TEMPLATE: string = `<clr-modal [(clrModalOpen)
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline" (click)="testConnection()" [disabled]="testOngoing || targetEndpoint.errors">{{ 'DESTINATION.TEST_CONNECTION' | translate }}</button>
<button type="button" class="btn btn-outline" (click)="testConnection()" [disabled]="testOngoing || hasConnectData">{{ 'DESTINATION.TEST_CONNECTION' | translate }}</button>
<button type="button" class="btn btn-outline" (click)="onCancel()" [disabled]="testOngoing">{{ 'BUTTON.CANCEL' | translate }}</button>
<button type="submit" class="btn btn-primary" (click)="onSubmit()" [disabled]="testOngoing || targetForm.form.invalid || !editable">{{ 'BUTTON.OK' | translate }}</button>
</div>

View File

@ -83,6 +83,10 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
};
}
get hasConnectData():boolean{
return !this.target.endpoint || !this.target.username || !this.target.password;
}
constructor(
private endpointService: EndpointService,
private errorHandler: ErrorHandler,

View File

@ -81,7 +81,7 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
</form>
</div>
<div class="modal-footer">
<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" (click)="testConnection()" [disabled]="testOngoing || hasConnectData || 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>

View File

@ -144,7 +144,9 @@ export class CreateEditRuleComponent implements AfterViewChecked {
}
get connectAbled():boolean{
return !this.createEditRule.endpointId && !this.isCreateEndpoint;
}
get hasConnectData():boolean{
return !this.createEditRule.endpointUrl || !this.createEditRule.username || !this.createEditRule.password;
}
constructor(