Merge pull request #7714 from jwangyangls/fix_error_message_bug

Fix create project error show in modal;resolve the different color of notification in UI.
This commit is contained in:
jwangyangls 2019-05-08 10:55:00 +08:00 committed by GitHub
commit e510e5062b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 29 deletions

View File

@ -24,7 +24,7 @@ import { Observable, Subscription } from "rxjs";
styleUrls: ["./inline-alert.component.scss"]
})
export class InlineAlertComponent {
inlineAlertType: string = "alert-danger";
inlineAlertType: string = "danger";
inlineAlertClosable: boolean = false;
alertClose: boolean = true;
displayedText: string = "";
@ -51,7 +51,7 @@ export class InlineAlertComponent {
.subscribe((res: string) => (this.displayedText = res));
}
this.inlineAlertType = "alert-danger";
this.inlineAlertType = "danger";
this.showCancelAction = false;
this.inlineAlertClosable = true;
this.alertClose = false;
@ -66,7 +66,7 @@ export class InlineAlertComponent {
.get(warning.message)
.subscribe((res: string) => (this.displayedText = res));
}
this.inlineAlertType = "alert-warning";
this.inlineAlertType = "warning";
this.showCancelAction = true;
this.inlineAlertClosable = false;
this.alertClose = false;
@ -81,7 +81,7 @@ export class InlineAlertComponent {
.get(info.message)
.subscribe((res: string) => (this.displayedText = res));
}
this.inlineAlertType = "alert-success";
this.inlineAlertType = "success";
this.showCancelAction = false;
this.inlineAlertClosable = true;
this.alertClose = false;

View File

@ -22,15 +22,15 @@ export class Message {
get type(): string {
switch (this.alertType) {
case AlertType.DANGER:
return 'alert-danger';
return 'danger';
case AlertType.INFO:
return 'alert-info';
return 'info';
case AlertType.SUCCESS:
return 'alert-success';
return 'success';
case AlertType.WARNING:
return 'alert-warning';
return 'warning';
default:
return 'alert-warning';
return 'warning';
}
}

View File

@ -32,6 +32,7 @@ import { InlineAlertComponent } from "../../shared/inline-alert/inline-alert.com
import { Project } from "../project";
import { ProjectService } from "../project.service";
import { errorHandler } from '@angular/platform-browser/src/browser';
@ -119,21 +120,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy {
},
error => {
this.isSubmitOnGoing = false;
let errorMessage: string;
if (error instanceof Response) {
switch (error.status) {
case 409:
this.translateService.get("PROJECT.NAME_ALREADY_EXISTS").subscribe(res => errorMessage = res);
break;
case 400:
this.translateService.get("PROJECT.NAME_IS_ILLEGAL").subscribe(res => errorMessage = res);
break;
default:
this.translateService.get("PROJECT.UNKNOWN_ERROR").subscribe(res => errorMessage = res);
}
this.messageHandlerService.handleError(error);
}
this.inlineAlert.showInlineError(error);
});
}

View File

@ -23,7 +23,7 @@ import { Subscription } from "rxjs";
styleUrls: ['inline-alert.component.scss']
})
export class InlineAlertComponent {
inlineAlertType: string = 'alert-danger';
inlineAlertType: string = 'danger';
inlineAlertClosable: boolean = false;
alertClose: boolean = true;
displayedText: string = "";
@ -49,7 +49,7 @@ export class InlineAlertComponent {
this.translate.get(this.displayedText).subscribe((res: string) => this.displayedText = res);
}
this.inlineAlertType = 'alert-danger';
this.inlineAlertType = 'danger';
this.showCancelAction = false;
this.inlineAlertClosable = true;
this.alertClose = false;
@ -62,7 +62,7 @@ export class InlineAlertComponent {
if (warning && warning.message) {
this.translate.get(warning.message).subscribe((res: string) => this.displayedText = res);
}
this.inlineAlertType = 'alert-warning';
this.inlineAlertType = 'warning';
this.showCancelAction = true;
this.inlineAlertClosable = false;
this.alertClose = false;
@ -75,7 +75,7 @@ export class InlineAlertComponent {
if (warning && warning.message) {
this.translate.get(warning.message).subscribe((res: string) => this.displayedText = res);
}
this.inlineAlertType = 'alert-warning';
this.inlineAlertType = 'warning';
this.showCancelAction = false;
this.inlineAlertClosable = true;
this.alertClose = false;
@ -88,7 +88,7 @@ export class InlineAlertComponent {
if (info && info.message) {
this.translate.get(info.message).subscribe((res: string) => this.displayedText = res);
}
this.inlineAlertType = 'alert-success';
this.inlineAlertType = 'success';
this.showCancelAction = false;
this.inlineAlertClosable = true;
this.alertClose = false;