diff --git a/src/portal/lib/src/inline-alert/inline-alert.component.ts b/src/portal/lib/src/inline-alert/inline-alert.component.ts index ba7bc99c4..fc9cdafc4 100644 --- a/src/portal/lib/src/inline-alert/inline-alert.component.ts +++ b/src/portal/lib/src/inline-alert/inline-alert.component.ts @@ -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; diff --git a/src/portal/src/app/global-message/message.ts b/src/portal/src/app/global-message/message.ts index 9addac618..5e6635e50 100644 --- a/src/portal/src/app/global-message/message.ts +++ b/src/portal/src/app/global-message/message.ts @@ -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'; } } diff --git a/src/portal/src/app/project/create-project/create-project.component.ts b/src/portal/src/app/project/create-project/create-project.component.ts index 55f8cb431..03df13263 100644 --- a/src/portal/src/app/project/create-project/create-project.component.ts +++ b/src/portal/src/app/project/create-project/create-project.component.ts @@ -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); }); } diff --git a/src/portal/src/app/shared/inline-alert/inline-alert.component.ts b/src/portal/src/app/shared/inline-alert/inline-alert.component.ts index 219f1bbc4..008b51646 100644 --- a/src/portal/src/app/shared/inline-alert/inline-alert.component.ts +++ b/src/portal/src/app/shared/inline-alert/inline-alert.component.ts @@ -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;