Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Replaced to notification component (#273)

jagadeeswaran-zipstack901f441ae226
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index a80a41874..68d13c054 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -1,4 +1,4 @@
-import { ConfigProvider, message, theme } from "antd";
+import { ConfigProvider, notification, theme } from "antd";
import { BrowserRouter } from "react-router-dom";
import { THEME } from "./helpers/GetStaticData.js";
@@ -8,12 +8,17 @@ import { useSessionStore } from "./store/session-store.js";
import PostHogPageviewTracker from "./PostHogPageviewTracker.js";
function App() {
- const [messageApi, contextHolder] = message.useMessage();
+ const [notificationAPI, contextHolder] = notification.useNotification();
const { defaultAlgorithm, darkAlgorithm } = theme;
const { sessionDetails } = useSessionStore();
- const { AlertDetails } = useAlertStore();
+ const { alertDetails } = useAlertStore();
- AlertDetails.content && messageApi.open(AlertDetails);
+ alertDetails.content &&
+ notificationAPI.open({
+ message: alertDetails.title,
+ description: alertDetails.content,
+ type: alertDetails.type,
+ });
return (
<ConfigProvider
diff --git a/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx b/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx
index e2c114025..c85346381 100644
--- a/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx
+++ b/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx
@@ -98,6 +98,7 @@ function AddSourceModal({
.catch((err) => {
setAlertDetails(handleException(err));
setOpen(false);
+ setEditItemId(null);
});
};
diff --git a/frontend/src/hooks/useExceptionHandler.jsx b/frontend/src/hooks/useExceptionHandler.jsx
index c87ea1a92..b9de44de3 100644
--- a/frontend/src/hooks/useExceptionHandler.jsx
+++ b/frontend/src/hooks/useExceptionHandler.jsx
@@ -6,12 +6,14 @@ const useExceptionHandler = () => {
const handleException = (
err,
errMessage = "Something went wrong",
- setBackendErrors = undefined
+ setBackendErrors = undefined,
+ title = "Failed"
) => {
if (!err) {
return {
type: "error",
content: errMessage,
+ title: title,
};
}
@@ -27,6 +29,7 @@ const useExceptionHandler = () => {
case "subscription_error":
navigate("/trial-expired");
return {
+ title: title,
type: "error",
content:
errors && errors[0]?.detail ? errors[0].detail : errMessage,
@@ -34,18 +37,21 @@ const useExceptionHandler = () => {
case "client_error":
case "server_error":
return {
+ title: title,
type: "error",
content:
errors && errors[0]?.detail ? errors[0].detail : errMessage,
};
default:
return {
+ title: title,
type: "error",
content: errMessage,
};
}
} else {
return {
+ title: title,
type: "error",
content: errMessage,
};
diff --git a/frontend/src/store/alert-store.js b/frontend/src/store/alert-store.js
index bd286aee5..0ed6f0bc2 100644
--- a/frontend/src/store/alert-store.js
+++ b/frontend/src/store/alert-store.js
@@ -1,16 +1,20 @@
import { create } from "zustand";
const STORE_VARIABLES = {
- AlertDetails: {
+ alertDetails: {
type: "",
content: "",
+ title: "",
},
};
const useAlertStore = create((setState) => ({
...STORE_VARIABLES,
setAlertDetails: (details) => {
setState(() => {
- return { AlertDetails: { ...details, duration: 5 } };
+ const title = details.title;
+ const notificationTitle =
+ title || (details.type === "error" ? "Failed" : "Success");
+ return { alertDetails: { ...details, title: notificationTitle } };
});
},
}));