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: Exported dashboard include response of the queries #1981 (#2052)

Fellipe Montesb72815ca2f78
diff --git a/frontend/src/container/NewDashboard/DescriptionOfDashboard/ShareModal.tsx b/frontend/src/container/NewDashboard/DescriptionOfDashboard/ShareModal.tsx
index e3be718e86..b177f056d2 100644
--- a/frontend/src/container/NewDashboard/DescriptionOfDashboard/ShareModal.tsx
+++ b/frontend/src/container/NewDashboard/DescriptionOfDashboard/ShareModal.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import { useCopyToClipboard } from 'react-use';
import { DashboardData } from 'types/api/dashboard/getAll';
-import { downloadObjectAsJson } from './util';
+import { cleardQueryData, downloadObjectAsJson } from './util';
function ShareModal({
isJSONModalVisible,
@@ -51,6 +51,7 @@ function ShareModal({
}
}, [state.error, state.value, t]);
+ const selectedDataCleaned = cleardQueryData(selectedData);
const GetFooterComponent = useMemo(() => {
if (!isViewJSON) {
return (
@@ -66,7 +67,7 @@ function ShareModal({
<Button
type="primary"
onClick={(): void => {
- downloadObjectAsJson(selectedData, selectedData.title);
+ downloadObjectAsJson(selectedDataCleaned, selectedData.title);
}}
>
{t('download_json')}
@@ -79,7 +80,7 @@ function ShareModal({
{t('copy_to_clipboard')}
</Button>
);
- }, [isViewJSON, jsonValue, selectedData, setCopy, t]);
+ }, [isViewJSON, jsonValue, selectedData, selectedDataCleaned, setCopy, t]);
return (
<Modal
diff --git a/frontend/src/container/NewDashboard/DescriptionOfDashboard/util.ts b/frontend/src/container/NewDashboard/DescriptionOfDashboard/util.ts
index c86698436d..34492ab10f 100644
--- a/frontend/src/container/NewDashboard/DescriptionOfDashboard/util.ts
+++ b/frontend/src/container/NewDashboard/DescriptionOfDashboard/util.ts
@@ -1,3 +1,5 @@
+import { DashboardData } from 'types/api/dashboard/getAll';
+
export function downloadObjectAsJson(
exportObj: unknown,
exportName: string,
@@ -12,3 +14,18 @@ export function downloadObjectAsJson(
downloadAnchorNode.click();
downloadAnchorNode.remove();
}
+
+export function cleardQueryData(param: DashboardData): DashboardData {
+ return {
+ ...param,
+ widgets: param.widgets?.map((widget) => ({
+ ...widget,
+ queryData: {
+ ...widget.queryData,
+ data: {
+ queryData: [],
+ },
+ },
+ })),
+ };
+}