dashboard versions

This commit is contained in:
Nate Kelley 2025-04-08 11:15:24 -06:00
parent 0de852ae09
commit 1d272b36ec
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 4 additions and 3 deletions

View File

@ -91,7 +91,7 @@ export const useGetDashboard = <TData = BusterDashboardResponse>(
return useQuery({ return useQuery({
...dashboardQueryKeys.dashboardGetDashboard(id!, version_number), ...dashboardQueryKeys.dashboardGetDashboard(id!, version_number),
queryFn: () => queryFn(id!, version_number), queryFn: () => queryFn(id!, version_number),
enabled: false, //it is false because we fetch the dashboard server side enabled: !!id, //it is false because we fetch the dashboard server side
select: params?.select, select: params?.select,
...params ...params
}); });

View File

@ -11,12 +11,14 @@ import {
import { useDashboardContentStore } from '@/context/Dashboards'; import { useDashboardContentStore } from '@/context/Dashboards';
import { ScrollArea } from '@/components/ui/scroll-area'; import { ScrollArea } from '@/components/ui/scroll-area';
import { canEdit } from '@/lib/share'; import { canEdit } from '@/lib/share';
import { useChatLayoutContextSelector } from '@/layouts/ChatLayout';
export const DashboardViewDashboardController: React.FC<{ export const DashboardViewDashboardController: React.FC<{
dashboardId: string; dashboardId: string;
chatId: string | undefined; chatId: string | undefined;
readOnly?: boolean; readOnly?: boolean;
}> = ({ dashboardId, chatId, readOnly: readOnlyProp = false }) => { }> = ({ dashboardId, chatId, readOnly: readOnlyProp = false }) => {
const isVersionHistoryMode = useChatLayoutContextSelector((x) => x.isVersionHistoryMode);
const { data: dashboardResponse } = useGetDashboard({ id: dashboardId }); const { data: dashboardResponse } = useGetDashboard({ id: dashboardId });
const { mutateAsync: onUpdateDashboard } = useUpdateDashboard(); const { mutateAsync: onUpdateDashboard } = useUpdateDashboard();
const { mutateAsync: onUpdateDashboardConfig } = useUpdateDashboardConfig(); const { mutateAsync: onUpdateDashboardConfig } = useUpdateDashboardConfig();
@ -24,7 +26,7 @@ export const DashboardViewDashboardController: React.FC<{
const metrics = dashboardResponse?.metrics; const metrics = dashboardResponse?.metrics;
const dashboard = dashboardResponse?.dashboard; const dashboard = dashboardResponse?.dashboard;
const readOnly = readOnlyProp || !canEdit(dashboardResponse?.permission); const readOnly = readOnlyProp || !canEdit(dashboardResponse?.permission) || isVersionHistoryMode;
return ( return (
<ScrollArea className="h-full"> <ScrollArea className="h-full">

View File

@ -45,7 +45,6 @@ export const useGetFileHref = ({
} }
if (file_type === 'dashboard') { if (file_type === 'dashboard') {
console.log('dashboard', { isLatestVersion, id, version_number });
if (isLatestVersion) { if (isLatestVersion) {
return createBusterRoute({ return createBusterRoute({
route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID, route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID,