From e2c2632be88fd0b8ed6afb85eb8887b065eead98 Mon Sep 17 00:00:00 2001
From: Nico Hoffmann
Closes the current notification
Used to show a deprecation warning in the console.
Displays an error notification.
Displays a fatal error in an iframe overlay for better isolation
Open a custom notification
+Displays a success notification
Displays an info notification
+
diff --git a/panel/src/panel/modal.test.js b/panel/src/panel/modal.test.js
index 7a8a50e5e5..f2eb71a252 100644
--- a/panel/src/panel/modal.test.js
+++ b/panel/src/panel/modal.test.js
@@ -147,8 +147,8 @@ describe.concurrent("panel/modal.js", () => {
message: "Test"
});
- expect(panel.notification.type).toStrictEqual("success");
expect(panel.notification.message).toStrictEqual("Test");
+ expect(panel.notification.theme).toStrictEqual("positive");
});
it("should emit panel events after submit", async () => {
diff --git a/panel/src/panel/notification.js b/panel/src/panel/notification.js
index a118491a4f..b99811626b 100644
--- a/panel/src/panel/notification.js
+++ b/panel/src/panel/notification.js
@@ -118,6 +118,26 @@ export default (panel = {}) => {
});
},
+ /**
+ * Shortcut to create an info
+ * notification. You can pass a simple
+ * string or a state object.
+ *
+ * @param {Object|String} info
+ * @returns {Object} The notification state
+ */
+ info(info = {}) {
+ if (typeof info === "string") {
+ info = { message: info };
+ }
+
+ return this.open({
+ icon: "info",
+ theme: "info",
+ ...info
+ });
+ },
+
/**
* Checks if the notification is a fatal
* error. Those are displayed in the