mirror of https://github.com/buster-so/buster.git
dashboard versions
This commit is contained in:
parent
0de852ae09
commit
1d272b36ec
|
@ -91,7 +91,7 @@ export const useGetDashboard = <TData = BusterDashboardResponse>(
|
|||
return useQuery({
|
||||
...dashboardQueryKeys.dashboardGetDashboard(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,
|
||||
...params
|
||||
});
|
||||
|
|
|
@ -11,12 +11,14 @@ import {
|
|||
import { useDashboardContentStore } from '@/context/Dashboards';
|
||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { canEdit } from '@/lib/share';
|
||||
import { useChatLayoutContextSelector } from '@/layouts/ChatLayout';
|
||||
|
||||
export const DashboardViewDashboardController: React.FC<{
|
||||
dashboardId: string;
|
||||
chatId: string | undefined;
|
||||
readOnly?: boolean;
|
||||
}> = ({ dashboardId, chatId, readOnly: readOnlyProp = false }) => {
|
||||
const isVersionHistoryMode = useChatLayoutContextSelector((x) => x.isVersionHistoryMode);
|
||||
const { data: dashboardResponse } = useGetDashboard({ id: dashboardId });
|
||||
const { mutateAsync: onUpdateDashboard } = useUpdateDashboard();
|
||||
const { mutateAsync: onUpdateDashboardConfig } = useUpdateDashboardConfig();
|
||||
|
@ -24,7 +26,7 @@ export const DashboardViewDashboardController: React.FC<{
|
|||
|
||||
const metrics = dashboardResponse?.metrics;
|
||||
const dashboard = dashboardResponse?.dashboard;
|
||||
const readOnly = readOnlyProp || !canEdit(dashboardResponse?.permission);
|
||||
const readOnly = readOnlyProp || !canEdit(dashboardResponse?.permission) || isVersionHistoryMode;
|
||||
|
||||
return (
|
||||
<ScrollArea className="h-full">
|
||||
|
|
|
@ -45,7 +45,6 @@ export const useGetFileHref = ({
|
|||
}
|
||||
|
||||
if (file_type === 'dashboard') {
|
||||
console.log('dashboard', { isLatestVersion, id, version_number });
|
||||
if (isLatestVersion) {
|
||||
return createBusterRoute({
|
||||
route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID,
|
||||
|
|
Loading…
Reference in New Issue