Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: dashboard delete is fixed and toast message is added (#4050)

Palash Guptafc4cdea539d5
diff --git a/frontend/public/locales/en-GB/dashboard.json b/frontend/public/locales/en-GB/dashboard.json
index b69113483d..35e9b47b45 100644
--- a/frontend/public/locales/en-GB/dashboard.json
+++ b/frontend/public/locales/en-GB/dashboard.json
@@ -20,5 +20,6 @@
"variable_updated_successfully": "Variable updated successfully",
"error_while_updating_variable": "Error while updating variable",
"dashboard_has_been_updated": "Dashboard has been updated",
- "do_you_want_to_refresh_the_dashboard": "Do you want to refresh the dashboard?"
+ "do_you_want_to_refresh_the_dashboard": "Do you want to refresh the dashboard?",
+ "delete_dashboard_success": "{{name}} dashboard deleted successfully"
}
diff --git a/frontend/public/locales/en/dashboard.json b/frontend/public/locales/en/dashboard.json
index 5602ec5592..aa2454c3a3 100644
--- a/frontend/public/locales/en/dashboard.json
+++ b/frontend/public/locales/en/dashboard.json
@@ -22,6 +22,7 @@
"error_while_updating_variable": "Error while updating variable",
"dashboard_has_been_updated": "Dashboard has been updated",
"do_you_want_to_refresh_the_dashboard": "Do you want to refresh the dashboard?",
-"locked_dashboard_delete_tooltip_admin_author": "Dashboard is locked. Please unlock the dashboard to enable delete.",
-"locked_dashboard_delete_tooltip_editor": "Dashboard is locked. Please contact admin to delete the dashboard."
+ "locked_dashboard_delete_tooltip_admin_author": "Dashboard is locked. Please unlock the dashboard to enable delete.",
+ "locked_dashboard_delete_tooltip_editor": "Dashboard is locked. Please contact admin to delete the dashboard.",
+ "delete_dashboard_success": "{{name}} dashboard deleted successfully"
}
diff --git a/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx b/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx
index f6ee603cc2..33663b129d 100644
--- a/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx
+++ b/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx
@@ -2,6 +2,7 @@ import { DeleteOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { Modal, Tooltip, Typography } from 'antd';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { useDeleteDashboard } from 'hooks/dashboard/useDeleteDashboard';
+import { useNotifications } from 'hooks/useNotifications';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useQueryClient } from 'react-query';
@@ -32,6 +33,8 @@ function DeleteButton({
const queryClient = useQueryClient();
+ const { notifications } = useNotifications();
+
const { t } = useTranslation(['dashboard']);
const deleteDashboardMutation = useDeleteDashboard(id);
@@ -49,6 +52,11 @@ function DeleteButton({
onOk() {
deleteDashboardMutation.mutateAsync(undefined, {
onSuccess: () => {
+ notifications.success({
+ message: t('dashboard:delete_dashboard_success', {
+ name,
+ }),
+ });
queryClient.invalidateQueries([REACT_QUERY_KEY.GET_ALL_DASHBOARDS]);
},
});
@@ -57,7 +65,7 @@ function DeleteButton({
okButtonProps: { danger: true },
centered: true,
});
- }, [modal, name, deleteDashboardMutation, queryClient]);
+ }, [modal, name, deleteDashboardMutation, notifications, t, queryClient]);
const getDeleteTooltipContent = (): string => {
if (isLocked) {
diff --git a/frontend/src/container/ListOfDashboard/index.tsx b/frontend/src/container/ListOfDashboard/index.tsx
index 071e43fc94..9ab2ff94ee 100644
--- a/frontend/src/container/ListOfDashboard/index.tsx
+++ b/frontend/src/container/ListOfDashboard/index.tsx
@@ -66,9 +66,7 @@ function ListOfAllDashboard(): JSX.Element {
};
useEffect(() => {
- if (dashboardListResponse.length) {
- sortDashboardsByCreatedAt(dashboardListResponse);
- }
+ sortDashboardsByCreatedAt(dashboardListResponse);
}, [dashboardListResponse]);
const [newDashboardState, setNewDashboardState] = useState({