diff --git a/apps/web/src/api/buster_rest/reports/queryRequests.ts b/apps/web/src/api/buster_rest/reports/queryRequests.ts
index 3ee9430cd..bae1e4080 100644
--- a/apps/web/src/api/buster_rest/reports/queryRequests.ts
+++ b/apps/web/src/api/buster_rest/reports/queryRequests.ts
@@ -85,6 +85,13 @@ export const prefetchGetReport = async (
return existingData || queryClient.getQueryData(queryKey);
};
+export const usePrefetchGetReportClient = () => {
+ const queryClient = useQueryClient();
+ return (reportId: string, versionNumber?: number) => {
+ return prefetchGetReport(reportId, versionNumber, queryClient);
+ };
+};
+
/**
* Hook to get an individual report by ID
*/
diff --git a/apps/web/src/components/ui/report/elements/MetricElement/MetricToolbar.tsx b/apps/web/src/components/ui/report/elements/MetricElement/MetricToolbar.tsx
index c7f90018e..93ba10cb1 100644
--- a/apps/web/src/components/ui/report/elements/MetricElement/MetricToolbar.tsx
+++ b/apps/web/src/components/ui/report/elements/MetricElement/MetricToolbar.tsx
@@ -50,11 +50,12 @@ export function MetricToolbar({
}, []);
const handleAddMetrics = React.useCallback(
- async (metrics: { id: string; name: string }[]) => {
+ async (metrics: { id: string; name: string; versionNumber: number | undefined }[]) => {
const id = metrics?.[0]?.id;
+ const versionNumber = metrics?.[0]?.versionNumber;
const at = editor.api.findPath(element);
if (!id || !at) return onCloseEdit();
- plugin.api.metric.updateMetric(id, { at });
+ plugin.api.metric.updateMetric(id, versionNumber, { at });
onCloseEdit();
},
[editor, element, onCloseEdit, plugin.api.metric]
@@ -85,7 +86,7 @@ export function MetricToolbar({
-
+ /> */}
);
}
diff --git a/apps/web/src/components/ui/report/plugins/markdown-kit/metric-serializer.ts b/apps/web/src/components/ui/report/plugins/markdown-kit/metric-serializer.ts
index aaecece8c..c7c8819b0 100644
--- a/apps/web/src/components/ui/report/plugins/markdown-kit/metric-serializer.ts
+++ b/apps/web/src/components/ui/report/plugins/markdown-kit/metric-serializer.ts
@@ -25,7 +25,7 @@ export const metricSerializer: MetricMdNode = {
return {
type: 'html',
- value: ``,
+ value: ``,
};
},
deserialize: (node): MetricElement => {
diff --git a/apps/web/src/components/ui/report/plugins/metric-kit/metric-kit.tsx b/apps/web/src/components/ui/report/plugins/metric-kit/metric-kit.tsx
index efd486dec..5e8b73e3a 100644
--- a/apps/web/src/components/ui/report/plugins/metric-kit/metric-kit.tsx
+++ b/apps/web/src/components/ui/report/plugins/metric-kit/metric-kit.tsx
@@ -50,8 +50,12 @@ export const MetricPlugin = createPlatePlugin<
closeAddMetricModal: () => {
setOption('openMetricModal', false);
},
- updateMetric: (metricId: string, options?: SetNodesOptions) => {
- tf.setNodes({ metricId }, options);
+ updateMetric: (
+ metricId: string,
+ versionNumber: number | undefined,
+ options?: SetNodesOptions
+ ) => {
+ tf.setNodes({ metricId, versionNumber }, options);
},
};
});
diff --git a/apps/web/src/layouts/ChatLayout/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_StandardFile.tsx b/apps/web/src/layouts/ChatLayout/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_StandardFile.tsx
index 52f5592f2..e0fcfa894 100644
--- a/apps/web/src/layouts/ChatLayout/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_StandardFile.tsx
+++ b/apps/web/src/layouts/ChatLayout/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_StandardFile.tsx
@@ -17,6 +17,9 @@ export const ChatResponseMessage_StandardFile: React.FC<{
const selectedIcon = useMemo(() => {
if (file_type === 'metric') return ;
if (file_type === 'dashboard') return ;
+ if (file_type === 'report') return ;
+ if (file_type === 'reasoning') return null;
+ const _exhaustiveCheck: never = file_type;
return null;
}, [file_type]);
diff --git a/packages/database/src/schema-types/report-elements.ts b/packages/database/src/schema-types/report-elements.ts
index 8a4d033f0..c4686b2c7 100644
--- a/packages/database/src/schema-types/report-elements.ts
+++ b/packages/database/src/schema-types/report-elements.ts
@@ -365,6 +365,7 @@ export const MetricElementSchema = z.object({
type: z.literal('metric'),
id: z.string().optional(), //THIS IS A UNIQUE ID THAT PLATEJS USES. WE SHOULD NOT SET IT.
metricId: z.string(),
+ versionNumber: z.number().optional(),
width: z.union([z.number(), z.string().regex(/^(?:\d+px|\d+%)$/)]).optional(),
children: z.array(VoidTextSchema).default([]),
caption: z