Merge pull request #2797 from pengpengshui/master

fix #2662,#2795
This commit is contained in:
Steven Zou 2017-07-17 17:56:26 +08:00 committed by GitHub
commit a9a79736b4
3 changed files with 17 additions and 6 deletions

View File

@ -17,7 +17,7 @@
<label for="tabsystem">{{'SIDE_NAV.SYSTEM_MGMT.NAME' | translate}}</label> <label for="tabsystem">{{'SIDE_NAV.SYSTEM_MGMT.NAME' | translate}}</label>
<ul class="nav-list"> <ul class="nav-list">
<li><a class="nav-link nav-link-override" routerLink="/harbor/users" routerLinkActive="active">{{'SIDE_NAV.SYSTEM_MGMT.USER' | translate}}</a></li> <li><a class="nav-link nav-link-override" routerLink="/harbor/users" routerLinkActive="active">{{'SIDE_NAV.SYSTEM_MGMT.USER' | translate}}</a></li>
<li><a class="nav-link nav-link-override" routerLink="/harbor/replications/endpoints" routerLinkActive="active">{{'SIDE_NAV.SYSTEM_MGMT.REPLICATION' | translate}}</a></li> <li><a class="nav-link nav-link-override" routerLink="/harbor/replications" routerLinkActive="active">{{'SIDE_NAV.SYSTEM_MGMT.REPLICATION' | translate}}</a></li>
<li><a class="nav-link nav-link-override" routerLink="/harbor/configs" routerLinkActive="active">{{'SIDE_NAV.SYSTEM_MGMT.CONFIG' | translate}}</a></li> <li><a class="nav-link nav-link-override" routerLink="/harbor/configs" routerLinkActive="active">{{'SIDE_NAV.SYSTEM_MGMT.CONFIG' | translate}}</a></li>
</ul> </ul>
</section> </section>

View File

@ -90,6 +90,10 @@ const harborRoutes: Routes = [
{ {
path: 'endpoints', path: 'endpoints',
component: DestinationPageComponent component: DestinationPageComponent
},
{
path: '**',
redirectTo: 'endpoints'
} }
] ]
}, },

View File

@ -54,7 +54,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
createProjectOpened: boolean; createProjectOpened: boolean;
hasChanged: boolean; hasChanged: boolean;
btnIsOk:boolean=false; isSubmitOnGoing:boolean=false;
staticBackdrop: boolean = true; staticBackdrop: boolean = true;
closable: boolean = false; closable: boolean = false;
@ -86,12 +86,10 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
this.isNameValid = cont.valid; this.isNameValid = cont.valid;
if (this.isNameValid) { if (this.isNameValid) {
//Check exiting from backend //Check exiting from backend
this.checkOnGoing = true;
this.projectService this.projectService
.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;
@ -111,16 +109,24 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
} }
onSubmit() { onSubmit() {
this.btnIsOk=false; if (this.isSubmitOnGoing){
return ;
}
this.isSubmitOnGoing=true;
this.projectService this.projectService
.createProject(this.project.name, this.project.public ? 1 : 0) .createProject(this.project.name, this.project.public ? 1 : 0)
.subscribe( .subscribe(
status => { status => {
this.isSubmitOnGoing=false;
this.create.emit(true); this.create.emit(true);
this.messageHandlerService.showSuccess('PROJECT.CREATED_SUCCESS'); this.messageHandlerService.showSuccess('PROJECT.CREATED_SUCCESS');
this.createProjectOpened = false; this.createProjectOpened = false;
}, },
error => { error => {
this.isSubmitOnGoing=false;
let errorMessage: string; let errorMessage: string;
if (error instanceof Response) { if (error instanceof Response) {
switch (error.status) { switch (error.status) {
@ -187,7 +193,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.isSubmitOnGoing&&
this.isNameValid && this.isNameValid &&
!this.checkOnGoing; !this.checkOnGoing;
} }
@ -198,6 +204,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
if (cont) { if (cont) {
this.proNameChecker.next(cont.value); this.proNameChecker.next(cont.value);
} }
} }
} }