mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-25 01:58:35 +01:00
Merge pull request #2779 from pengpengshui/master
Fix the issue #2564,#2552 and #2758
This commit is contained in:
commit
b69083ecd1
@ -81,8 +81,8 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<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)="testConnection()" [disabled]="testOngoing || endpointUrl.errors || connectAbled">{{'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" [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>
|
<button type="submit" class="btn btn-primary" [disabled]="!ruleForm.form.valid || testOngoing || !editable" (click)="onSubmit()">{{'BUTTON.OK' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
</clr-modal>`;
|
</clr-modal>`;
|
||||||
|
@ -75,6 +75,9 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
|||||||
testOngoing: boolean;
|
testOngoing: boolean;
|
||||||
pingStatus: boolean;
|
pingStatus: boolean;
|
||||||
|
|
||||||
|
btnAbled:boolean;
|
||||||
|
|
||||||
|
|
||||||
ruleForm: NgForm;
|
ruleForm: NgForm;
|
||||||
|
|
||||||
staticBackdrop: boolean = true;
|
staticBackdrop: boolean = true;
|
||||||
@ -135,9 +138,14 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
|||||||
return this.actionType === ActionType.EDIT && (this.initVal.enable || false);
|
return this.actionType === ActionType.EDIT && (this.initVal.enable || false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
get showNewDestination(): boolean {
|
get showNewDestination(): boolean {
|
||||||
return this.actionType === ActionType.ADD_NEW || (!this.createEditRule.enable || false);
|
return this.actionType === ActionType.ADD_NEW || (!this.createEditRule.enable || false);
|
||||||
}
|
}
|
||||||
|
get connectAbled():boolean{
|
||||||
|
return !this.createEditRule.endpointId && !this.isCreateEndpoint;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private replicationService: ReplicationService,
|
private replicationService: ReplicationService,
|
||||||
@ -393,6 +401,7 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
|||||||
|
|
||||||
testConnection() {
|
testConnection() {
|
||||||
this.pingStatus = true;
|
this.pingStatus = true;
|
||||||
|
this.btnAbled=true;
|
||||||
this.translateService.get('REPLICATION.TESTING_CONNECTION').subscribe(res=>this.pingTestMessage=res);
|
this.translateService.get('REPLICATION.TESTING_CONNECTION').subscribe(res=>this.pingTestMessage=res);
|
||||||
this.testOngoing = !this.testOngoing;
|
this.testOngoing = !this.testOngoing;
|
||||||
let pingTarget: Endpoint = this.initEndpoint;
|
let pingTarget: Endpoint = this.initEndpoint;
|
||||||
@ -409,11 +418,13 @@ export class CreateEditRuleComponent implements AfterViewChecked {
|
|||||||
this.testOngoing = !this.testOngoing;
|
this.testOngoing = !this.testOngoing;
|
||||||
this.translateService.get('REPLICATION.TEST_CONNECTION_SUCCESS').subscribe(res=>this.pingTestMessage=res);
|
this.translateService.get('REPLICATION.TEST_CONNECTION_SUCCESS').subscribe(res=>this.pingTestMessage=res);
|
||||||
this.pingStatus = true;
|
this.pingStatus = true;
|
||||||
|
this.btnAbled=false;
|
||||||
})
|
})
|
||||||
.catch(error=>{
|
.catch(error=>{
|
||||||
this.testOngoing = !this.testOngoing;
|
this.testOngoing = !this.testOngoing;
|
||||||
this.translateService.get('REPLICATION.TEST_CONNECTION_FAILURE').subscribe(res=>this.pingTestMessage=res);
|
this.translateService.get('REPLICATION.TEST_CONNECTION_FAILURE').subscribe(res=>this.pingTestMessage=res);
|
||||||
this.pingStatus = false;
|
this.pingStatus = false;
|
||||||
|
this.btnAbled=false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -54,6 +54,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
|
|||||||
createProjectOpened: boolean;
|
createProjectOpened: boolean;
|
||||||
|
|
||||||
hasChanged: boolean;
|
hasChanged: boolean;
|
||||||
|
btnIsOk:boolean=false;
|
||||||
|
|
||||||
staticBackdrop: boolean = true;
|
staticBackdrop: boolean = true;
|
||||||
closable: boolean = false;
|
closable: boolean = false;
|
||||||
@ -90,6 +91,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
|
|||||||
.checkProjectExists(cont.value).toPromise()
|
.checkProjectExists(cont.value).toPromise()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
//Project existing
|
//Project existing
|
||||||
|
this.btnIsOk=true;
|
||||||
this.isNameValid = false;
|
this.isNameValid = false;
|
||||||
this.nameTooltipText = 'PROJECT.NAME_ALREADY_EXISTS';
|
this.nameTooltipText = 'PROJECT.NAME_ALREADY_EXISTS';
|
||||||
this.checkOnGoing = false;
|
this.checkOnGoing = false;
|
||||||
@ -109,6 +111,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.btnIsOk=false;
|
||||||
this.projectService
|
this.projectService
|
||||||
.createProject(this.project.name, this.project.public ? 1 : 0)
|
.createProject(this.project.name, this.project.public ? 1 : 0)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
@ -184,6 +187,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
|
|||||||
public get isValid(): boolean {
|
public get isValid(): boolean {
|
||||||
return this.currentForm &&
|
return this.currentForm &&
|
||||||
this.currentForm.valid &&
|
this.currentForm.valid &&
|
||||||
|
this.btnIsOk&&
|
||||||
this.isNameValid &&
|
this.isNameValid &&
|
||||||
!this.checkOnGoing;
|
!this.checkOnGoing;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,6 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
getProjects(name?: string, isPublic?: number, page?: number, pageSize?: number): void {
|
getProjects(name?: string, isPublic?: number, page?: number, pageSize?: number): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
this.projectService
|
this.projectService
|
||||||
.listProjects(name, isPublic, page, pageSize)
|
.listProjects(name, isPublic, page, pageSize)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
@ -184,7 +183,11 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
|||||||
response => {
|
response => {
|
||||||
this.messageHandlerService.showSuccess('PROJECT.TOGGLED_SUCCESS');
|
this.messageHandlerService.showSuccess('PROJECT.TOGGLED_SUCCESS');
|
||||||
this.statisticHandler.refresh();
|
this.statisticHandler.refresh();
|
||||||
this.getProjects("", this.currentFilteredType - 1);
|
if (this.currentFilteredType === 0) {
|
||||||
|
this.getProjects();
|
||||||
|
} else {
|
||||||
|
this.getProjects("", this.currentFilteredType - 1);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error => this.messageHandlerService.handleError(error)
|
error => this.messageHandlerService.handleError(error)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user