mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 14:47:38 +01:00
Fix create project error show in modal;resolve the different color of notification in UI.
fix create project error show in modal;resolve the different color of notification in UI. Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
parent
b0e3b65ade
commit
0fbc5af2c9
@ -24,7 +24,7 @@ import { Observable, Subscription } from "rxjs";
|
|||||||
styleUrls: ["./inline-alert.component.scss"]
|
styleUrls: ["./inline-alert.component.scss"]
|
||||||
})
|
})
|
||||||
export class InlineAlertComponent {
|
export class InlineAlertComponent {
|
||||||
inlineAlertType: string = "alert-danger";
|
inlineAlertType: string = "danger";
|
||||||
inlineAlertClosable: boolean = false;
|
inlineAlertClosable: boolean = false;
|
||||||
alertClose: boolean = true;
|
alertClose: boolean = true;
|
||||||
displayedText: string = "";
|
displayedText: string = "";
|
||||||
@ -51,7 +51,7 @@ export class InlineAlertComponent {
|
|||||||
.subscribe((res: string) => (this.displayedText = res));
|
.subscribe((res: string) => (this.displayedText = res));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inlineAlertType = "alert-danger";
|
this.inlineAlertType = "danger";
|
||||||
this.showCancelAction = false;
|
this.showCancelAction = false;
|
||||||
this.inlineAlertClosable = true;
|
this.inlineAlertClosable = true;
|
||||||
this.alertClose = false;
|
this.alertClose = false;
|
||||||
@ -66,7 +66,7 @@ export class InlineAlertComponent {
|
|||||||
.get(warning.message)
|
.get(warning.message)
|
||||||
.subscribe((res: string) => (this.displayedText = res));
|
.subscribe((res: string) => (this.displayedText = res));
|
||||||
}
|
}
|
||||||
this.inlineAlertType = "alert-warning";
|
this.inlineAlertType = "warning";
|
||||||
this.showCancelAction = true;
|
this.showCancelAction = true;
|
||||||
this.inlineAlertClosable = false;
|
this.inlineAlertClosable = false;
|
||||||
this.alertClose = false;
|
this.alertClose = false;
|
||||||
@ -81,7 +81,7 @@ export class InlineAlertComponent {
|
|||||||
.get(info.message)
|
.get(info.message)
|
||||||
.subscribe((res: string) => (this.displayedText = res));
|
.subscribe((res: string) => (this.displayedText = res));
|
||||||
}
|
}
|
||||||
this.inlineAlertType = "alert-success";
|
this.inlineAlertType = "success";
|
||||||
this.showCancelAction = false;
|
this.showCancelAction = false;
|
||||||
this.inlineAlertClosable = true;
|
this.inlineAlertClosable = true;
|
||||||
this.alertClose = false;
|
this.alertClose = false;
|
||||||
|
@ -22,15 +22,15 @@ export class Message {
|
|||||||
get type(): string {
|
get type(): string {
|
||||||
switch (this.alertType) {
|
switch (this.alertType) {
|
||||||
case AlertType.DANGER:
|
case AlertType.DANGER:
|
||||||
return 'alert-danger';
|
return 'danger';
|
||||||
case AlertType.INFO:
|
case AlertType.INFO:
|
||||||
return 'alert-info';
|
return 'info';
|
||||||
case AlertType.SUCCESS:
|
case AlertType.SUCCESS:
|
||||||
return 'alert-success';
|
return 'success';
|
||||||
case AlertType.WARNING:
|
case AlertType.WARNING:
|
||||||
return 'alert-warning';
|
return 'warning';
|
||||||
default:
|
default:
|
||||||
return 'alert-warning';
|
return 'warning';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import { InlineAlertComponent } from "../../shared/inline-alert/inline-alert.com
|
|||||||
|
|
||||||
import { Project } from "../project";
|
import { Project } from "../project";
|
||||||
import { ProjectService } from "../project.service";
|
import { ProjectService } from "../project.service";
|
||||||
|
import { errorHandler } from '@angular/platform-browser/src/browser';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -119,21 +120,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy {
|
|||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.isSubmitOnGoing = false;
|
this.isSubmitOnGoing = false;
|
||||||
|
this.inlineAlert.showInlineError(error);
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import { Subscription } from "rxjs";
|
|||||||
styleUrls: ['inline-alert.component.scss']
|
styleUrls: ['inline-alert.component.scss']
|
||||||
})
|
})
|
||||||
export class InlineAlertComponent {
|
export class InlineAlertComponent {
|
||||||
inlineAlertType: string = 'alert-danger';
|
inlineAlertType: string = 'danger';
|
||||||
inlineAlertClosable: boolean = false;
|
inlineAlertClosable: boolean = false;
|
||||||
alertClose: boolean = true;
|
alertClose: boolean = true;
|
||||||
displayedText: string = "";
|
displayedText: string = "";
|
||||||
@ -49,7 +49,7 @@ export class InlineAlertComponent {
|
|||||||
this.translate.get(this.displayedText).subscribe((res: string) => this.displayedText = res);
|
this.translate.get(this.displayedText).subscribe((res: string) => this.displayedText = res);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inlineAlertType = 'alert-danger';
|
this.inlineAlertType = 'danger';
|
||||||
this.showCancelAction = false;
|
this.showCancelAction = false;
|
||||||
this.inlineAlertClosable = true;
|
this.inlineAlertClosable = true;
|
||||||
this.alertClose = false;
|
this.alertClose = false;
|
||||||
@ -62,7 +62,7 @@ export class InlineAlertComponent {
|
|||||||
if (warning && warning.message) {
|
if (warning && warning.message) {
|
||||||
this.translate.get(warning.message).subscribe((res: string) => this.displayedText = res);
|
this.translate.get(warning.message).subscribe((res: string) => this.displayedText = res);
|
||||||
}
|
}
|
||||||
this.inlineAlertType = 'alert-warning';
|
this.inlineAlertType = 'warning';
|
||||||
this.showCancelAction = true;
|
this.showCancelAction = true;
|
||||||
this.inlineAlertClosable = false;
|
this.inlineAlertClosable = false;
|
||||||
this.alertClose = false;
|
this.alertClose = false;
|
||||||
@ -75,7 +75,7 @@ export class InlineAlertComponent {
|
|||||||
if (warning && warning.message) {
|
if (warning && warning.message) {
|
||||||
this.translate.get(warning.message).subscribe((res: string) => this.displayedText = res);
|
this.translate.get(warning.message).subscribe((res: string) => this.displayedText = res);
|
||||||
}
|
}
|
||||||
this.inlineAlertType = 'alert-warning';
|
this.inlineAlertType = 'warning';
|
||||||
this.showCancelAction = false;
|
this.showCancelAction = false;
|
||||||
this.inlineAlertClosable = true;
|
this.inlineAlertClosable = true;
|
||||||
this.alertClose = false;
|
this.alertClose = false;
|
||||||
@ -88,7 +88,7 @@ export class InlineAlertComponent {
|
|||||||
if (info && info.message) {
|
if (info && info.message) {
|
||||||
this.translate.get(info.message).subscribe((res: string) => this.displayedText = res);
|
this.translate.get(info.message).subscribe((res: string) => this.displayedText = res);
|
||||||
}
|
}
|
||||||
this.inlineAlertType = 'alert-success';
|
this.inlineAlertType = 'success';
|
||||||
this.showCancelAction = false;
|
this.showCancelAction = false;
|
||||||
this.inlineAlertClosable = true;
|
this.inlineAlertClosable = true;
|
||||||
this.alertClose = false;
|
this.alertClose = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user