+
@@ -38,6 +39,7 @@ const DisplayVersionHistory = React.memo(() => {
);
const versionInfo = useMemo(() => {
+ if (!metric?.version_number && !dashboard?.version_number) return null;
if (type === 'metric') {
return {
isCurrent: metric?.version_number === metric?.latestVersion?.version_number,
@@ -67,10 +69,16 @@ const DisplayVersionHistory = React.memo(() => {
DisplayVersionHistory.displayName = 'DisplayVersionHistory';
const ExitVersionHistoryButton = React.memo(() => {
+ const [isPending, startTransition] = useTransition();
const onChangeQueryParams = useAppLayoutContextSelector((x) => x.onChangeQueryParams);
+ const closeSecondaryView = useChatLayoutContextSelector((x) => x.closeSecondaryView);
- const removeVersionHistoryQueryParams = useMemoizedFn(() => {
- onChangeQueryParams({ metric_version_number: null, dashboard_version_number: null });
+ const removeVersionHistoryQueryParams = useMemoizedFn(async () => {
+ closeSecondaryView();
+ await timeout(250);
+ startTransition(() => {
+ onChangeQueryParams({ metric_version_number: null, dashboard_version_number: null });
+ });
});
return (
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx
index 201b6f82f..44d4224d4 100644
--- a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx
@@ -17,7 +17,8 @@ export const MetricContainerHeaderSegment: React.FC
=
const onSetFileView = useChatLayoutContextSelector((x) => x.onSetFileView);
const onChange = useMemoizedFn((fileView: SegmentedItem) => {
- onSetFileView({ fileView: fileView.value });
+ const renderView = fileView.value === 'results' ? false : true;
+ onSetFileView({ fileView: fileView.value, renderView });
});
return (
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/interfaces.ts b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/interfaces.ts
index 6f7579277..db8c88953 100644
--- a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/interfaces.ts
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/interfaces.ts
@@ -1,10 +1,10 @@
import { FileView } from '../../ChatLayoutContext/useLayoutConfig';
-export interface FileContainerSegmentProps {
+export type FileContainerSegmentProps = {
selectedFileView: FileView | undefined;
selectedFileId: string | undefined;
-}
+};
-export interface FileContainerButtonsProps {
+export type FileContainerButtonsProps = {
selectedFileView: FileView | undefined;
-}
+};
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/FileContainerSecondary.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/FileContainerSecondary.tsx
new file mode 100644
index 000000000..636e5021f
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/FileContainerSecondary.tsx
@@ -0,0 +1,31 @@
+import type { FileType } from '@/api/asset_interfaces/chat';
+import type { FileContainerSecondaryProps } from './interfaces';
+import type {
+ DashboardFileViewSecondary,
+ MetricFileViewSecondary
+} from '../../ChatLayoutContext/useLayoutConfig/interfaces';
+
+const MetricSecondaryRecord: Record<
+ MetricFileViewSecondary,
+ React.FC
+> = {
+ 'chart-edit': () => null,
+ 'sql-edit': () => null,
+ 'version-history': () => null
+};
+
+const DashboardSecondaryRecord: Record<
+ DashboardFileViewSecondary,
+ React.FC
+> = {
+ 'version-history': () => null
+};
+
+const SelectedFileSecondaryRecord: Record<
+ FileType,
+ Record>
+> = {
+ metric: MetricSecondaryRecord,
+ dashboard: DashboardSecondaryRecord,
+ reasoning: {}
+};
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/index.ts b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/index.ts
new file mode 100644
index 000000000..ab7cc6f67
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/index.ts
@@ -0,0 +1 @@
+export * from './FileContainerSecondary';
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/interfaces.ts b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/interfaces.ts
new file mode 100644
index 000000000..f56543cea
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/interfaces.ts
@@ -0,0 +1,6 @@
+import type { FileViewSecondary } from '@/layouts/ChatLayout/ChatLayoutContext/useLayoutConfig';
+
+export type FileContainerSecondaryProps = {
+ selectedFileId: string | undefined;
+ selectedFileViewSecondary: FileViewSecondary | undefined;
+};
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/allConfigs.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/allConfigs.tsx
new file mode 100644
index 000000000..0c0c43fa9
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/allConfigs.tsx
@@ -0,0 +1,14 @@
+import type { FileType } from '@/api/asset_interfaces/chat';
+import type { FileContainerSecondaryProps } from '../interfaces';
+import React from 'react';
+import { MetricSecondaryRecord } from './metricPanels';
+import { DashboardSecondaryRecord } from './dashboardPanels';
+
+export const SelectedFileSecondaryRecord: Record<
+ FileType,
+ Record>
+> = {
+ metric: MetricSecondaryRecord,
+ dashboard: DashboardSecondaryRecord,
+ reasoning: {}
+};
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/dashboardPanels.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/dashboardPanels.tsx
new file mode 100644
index 000000000..39fd5c21c
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/dashboardPanels.tsx
@@ -0,0 +1,21 @@
+import { type DashboardFileViewSecondary } from '@/layouts/ChatLayout/ChatLayoutContext/useLayoutConfig';
+import type { FileContainerSecondaryProps } from '../interfaces';
+import dynamic from 'next/dynamic';
+import { loading } from './loading';
+
+const VersionHistoryPanel = dynamic(
+ () =>
+ import('@/components/features/versionHistory/VersionHistoryPanel').then(
+ (x) => x.VersionHistoryPanel
+ ),
+ { loading }
+);
+
+export const DashboardSecondaryRecord: Record<
+ DashboardFileViewSecondary,
+ React.FC
+> = {
+ 'version-history': ({ selectedFileId }) => (
+
+ )
+};
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/index.ts b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/index.ts
new file mode 100644
index 000000000..bdb7d10dd
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/index.ts
@@ -0,0 +1 @@
+export * from './allConfigs';
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/loading.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/loading.tsx
new file mode 100644
index 000000000..5c06cb184
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/loading.tsx
@@ -0,0 +1,9 @@
+import { CircleSpinnerLoaderContainer } from '@/components/ui/loaders/CircleSpinnerLoaderContainer';
+
+export const loading = () => {
+ return (
+
+
+
+ );
+};
diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/metricPanels.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/metricPanels.tsx
new file mode 100644
index 000000000..68bd27ea0
--- /dev/null
+++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerSecondary/secondaryPanelsConfig/metricPanels.tsx
@@ -0,0 +1,34 @@
+import dynamic from 'next/dynamic';
+import { loading } from './loading';
+import type { MetricFileViewSecondary } from '@/layouts/ChatLayout/ChatLayoutContext/useLayoutConfig/interfaces';
+import type { FileContainerSecondaryProps } from '../interfaces';
+
+const MetricEditController = dynamic(
+ () =>
+ import('@/controllers/MetricController/MetricViewChart/MetricEditController').then(
+ (x) => x.MetricEditController
+ ),
+ { loading }
+);
+const VersionHistoryPanel = dynamic(
+ () =>
+ import('@/components/features/versionHistory/VersionHistoryPanel').then(
+ (x) => x.VersionHistoryPanel
+ ),
+ { loading }
+);
+const MetricViewResults = dynamic(
+ () => import('@/controllers/MetricController/MetricViewResults').then((x) => x.MetricViewResults),
+ { loading }
+);
+
+export const MetricSecondaryRecord: Record<
+ MetricFileViewSecondary,
+ React.FC
+> = {
+ 'chart-edit': ({ selectedFileId }) => ,
+ 'sql-edit': ({ selectedFileId }) => ,
+ 'version-history': ({ selectedFileId }) => (
+
+ )
+};