fix create-project modal submit button issue

This commit is contained in:
pengpengshui 2017-07-17 15:28:31 -07:00
parent 74169e3021
commit fc857a8928

View File

@ -54,7 +54,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
createProjectOpened: boolean; createProjectOpened: boolean;
hasChanged: boolean; hasChanged: boolean;
btnIsOk:boolean=false; isSubmitValid:boolean=false;
staticBackdrop: boolean = true; staticBackdrop: boolean = true;
closable: boolean = false; closable: boolean = false;
@ -87,11 +87,11 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
if (this.isNameValid) { if (this.isNameValid) {
//Check exiting from backend //Check exiting from backend
this.checkOnGoing = true; this.checkOnGoing = true;
this.isSubmitValid=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,7 +111,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
} }
onSubmit() { onSubmit() {
this.btnIsOk=false; this.isSubmitValid=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(
@ -187,7 +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.isSubmitValid&&
this.isNameValid && this.isNameValid &&
!this.checkOnGoing; !this.checkOnGoing;
} }
@ -198,6 +198,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
if (cont) { if (cont) {
this.proNameChecker.next(cont.value); this.proNameChecker.next(cont.value);
} }
} }
} }