window.panel.notification.close();
Closes the current notification
@@ -136,7 +136,7 @@
>
Used to show a deprecation warning in the console.
@@ -149,7 +149,7 @@
>
Displays an error notification.
@@ -162,7 +162,7 @@
>
Displays a fatal error in an iframe overlay for better isolation
@@ -174,11 +174,18 @@
>window.panel.notification.open(notification);
Open a custom notification
+
+
+
@@ -190,7 +197,7 @@
>
Displays a success notification
@@ -198,3 +205,15 @@
+
+
diff --git a/panel/src/panel/notification.js b/panel/src/panel/notification.js
index 27639f93ef..e487929b81 100644
--- a/panel/src/panel/notification.js
+++ b/panel/src/panel/notification.js
@@ -11,6 +11,7 @@ export const defaults = () => {
icon: null,
isOpen: false,
message: null,
+ theme: null,
timeout: null,
type: null
};
@@ -89,8 +90,7 @@ export default (panel = {}) => {
// convert strings to full error objects
if (typeof error === "string") {
error = {
- message: error,
- type: "error"
+ message: error
};
}
@@ -105,16 +105,16 @@ export default (panel = {}) => {
if (panel.context === "view") {
panel.dialog.open({
component: "k-error-dialog",
- props: error,
- type: "error"
+ props: error
});
}
// show the error notification bar
return this.open({
message: error.message,
- type: "error",
- icon: "alert"
+ icon: "alert",
+ theme: "negative",
+ type: "error"
});
},
@@ -209,23 +209,13 @@ export default (panel = {}) => {
}
return this.open({
- timeout: 4000,
- type: "success",
icon: "check",
+ theme: "positive",
+ timeout: 4000,
...success
});
},
- /**
- * Getter that converts the notification type
- * into the matching notification component theme
- *
- * @returns {String}
- */
- get theme() {
- return this.type === "error" ? "negative" : "positive";
- },
-
/**
* Holds the timer object
*/
diff --git a/panel/src/panel/notification.test.js b/panel/src/panel/notification.test.js
index 44c3814e74..d286073d20 100644
--- a/panel/src/panel/notification.test.js
+++ b/panel/src/panel/notification.test.js
@@ -19,6 +19,7 @@ describe("panel.notification", () => {
icon: null,
isOpen: false,
message: null,
+ theme: null,
timeout: null,
type: null
};