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: editing condition is updated (#2952)

Palash Gupta1c98d4f55c04
diff --git a/frontend/src/container/NewWidget/index.tsx b/frontend/src/container/NewWidget/index.tsx
index 3919f8fe12..17cb4ea884 100644
--- a/frontend/src/container/NewWidget/index.tsx
+++ b/frontend/src/container/NewWidget/index.tsx
@@ -163,7 +163,7 @@ function NewWidget({ selectedGraph, saveSettingOfPanel }: Props): JSX.Element {
FeatureKeys.QUERY_BUILDER_PANELS,
);
- const isSaveDisabled = useMemo(
+ const isNewTraceLogsAvailable = useMemo(
() =>
isQueryBuilderActive &&
currentQuery.queryType === EQueryType.QUERY_BUILDER &&
@@ -177,6 +177,30 @@ function NewWidget({ selectedGraph, saveSettingOfPanel }: Props): JSX.Element {
],
);
+ const isSaveDisabled = useMemo(() => {
+ // new created dashboard
+ if (selectedWidget?.id === 'empty') {
+ return isNewTraceLogsAvailable;
+ }
+
+ const isTraceOrLogsQueryBuilder =
+ currentQuery.builder.queryData.find(
+ (query) =>
+ query.dataSource === DataSource.TRACES ||
+ query.dataSource === DataSource.LOGS,
+ ) !== undefined;
+
+ if (isTraceOrLogsQueryBuilder) {
+ return false;
+ }
+
+ return isNewTraceLogsAvailable;
+ }, [
+ currentQuery.builder.queryData,
+ selectedWidget?.id,
+ isNewTraceLogsAvailable,
+ ]);
+
return (
<Container>
<ButtonContainer>
diff --git a/frontend/src/store/actions/dashboard/saveDashboard.ts b/frontend/src/store/actions/dashboard/saveDashboard.ts
index ac7516ff6e..107fecee25 100644
--- a/frontend/src/store/actions/dashboard/saveDashboard.ts
+++ b/frontend/src/store/actions/dashboard/saveDashboard.ts
@@ -1,3 +1,4 @@
+import { notification } from 'antd';
import updateDashboardApi from 'api/dashboard/update';
import { AxiosError } from 'axios';
import { COMPOSITE_QUERY } from 'constants/queryBuilderQueryNames';
@@ -129,10 +130,16 @@ export const SaveDashboard = ({
});
history.push(generatePath(ROUTES.DASHBOARD, { dashboardId }));
} else {
+ const error = 'Something went wrong';
+
+ notification.error({
+ message: response.error || error,
+ });
+
dispatch({
type: 'SAVE_SETTING_TO_PANEL_ERROR',
payload: {
- errorMessage: response.error || 'Something went wrong',
+ errorMessage: response.error || error,
},
});
}