diff --git a/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html b/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html index 74b36c447..efe767bf4 100644 --- a/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html +++ b/src/ui_ng/src/app/base/harbor-shell/harbor-shell.component.html @@ -17,7 +17,7 @@ diff --git a/src/ui_ng/src/app/harbor-routing.module.ts b/src/ui_ng/src/app/harbor-routing.module.ts index 75fd020ab..750b2b6e2 100644 --- a/src/ui_ng/src/app/harbor-routing.module.ts +++ b/src/ui_ng/src/app/harbor-routing.module.ts @@ -90,6 +90,10 @@ const harborRoutes: Routes = [ { path: 'endpoints', component: DestinationPageComponent + }, + { + path: '**', + redirectTo: 'endpoints' } ] }, diff --git a/src/ui_ng/src/app/project/create-project/create-project.component.ts b/src/ui_ng/src/app/project/create-project/create-project.component.ts index 26155780c..1a332bd81 100644 --- a/src/ui_ng/src/app/project/create-project/create-project.component.ts +++ b/src/ui_ng/src/app/project/create-project/create-project.component.ts @@ -54,7 +54,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr createProjectOpened: boolean; hasChanged: boolean; - btnIsOk:boolean=false; + isSubmitOnGoing:boolean=false; staticBackdrop: boolean = true; closable: boolean = false; @@ -86,12 +86,10 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr this.isNameValid = cont.valid; if (this.isNameValid) { //Check exiting from backend - this.checkOnGoing = true; this.projectService .checkProjectExists(cont.value).toPromise() .then(() => { //Project existing - this.btnIsOk=true; this.isNameValid = false; this.nameTooltipText = 'PROJECT.NAME_ALREADY_EXISTS'; this.checkOnGoing = false; @@ -111,16 +109,24 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr } onSubmit() { - this.btnIsOk=false; + if (this.isSubmitOnGoing){ + return ; + } + + this.isSubmitOnGoing=true; this.projectService .createProject(this.project.name, this.project.public ? 1 : 0) .subscribe( status => { + this.isSubmitOnGoing=false; + this.create.emit(true); this.messageHandlerService.showSuccess('PROJECT.CREATED_SUCCESS'); this.createProjectOpened = false; }, error => { + this.isSubmitOnGoing=false; + let errorMessage: string; if (error instanceof Response) { switch (error.status) { @@ -187,7 +193,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr public get isValid(): boolean { return this.currentForm && this.currentForm.valid && - this.btnIsOk&& + !this.isSubmitOnGoing&& this.isNameValid && !this.checkOnGoing; } @@ -198,6 +204,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr if (cont) { this.proNameChecker.next(cont.value); } + } }