diff --git a/web/src/api/asset_interfaces/datasources/interfaces.test.ts b/web/src/api/asset_interfaces/datasources/interfaces.test.ts index fff57358f..148b04cf6 100644 --- a/web/src/api/asset_interfaces/datasources/interfaces.test.ts +++ b/web/src/api/asset_interfaces/datasources/interfaces.test.ts @@ -180,7 +180,6 @@ describe('DataSourceSchema', () => { // This validation currently passes because there's no cross-field validation // If you want to enforce this, you'd need to add a custom validator - console.log('Note: Current schema does not validate credential type matching DataSource type'); expect(result.success).toBe(true); }); }); diff --git a/web/src/context/BusterAppLayout/AppLayoutProvider.tsx b/web/src/context/BusterAppLayout/AppLayoutProvider.tsx index 72b6f17d5..30f98dc6f 100644 --- a/web/src/context/BusterAppLayout/AppLayoutProvider.tsx +++ b/web/src/context/BusterAppLayout/AppLayoutProvider.tsx @@ -49,10 +49,21 @@ export const useAppLayout = () => { } ); + const onChangeQueryParams = useMemoizedFn((params: Record) => { + const searchParams = window.location.search; + const newSearchParams = new URLSearchParams(searchParams); + Object.entries(params).forEach(([key, value]) => { + newSearchParams.set(key, value); + }); + const newPath = `${pathname}?${newSearchParams.toString()}`; + push(newPath); + }); + return { currentRoute, onChangePage, - currentParentRoute + currentParentRoute, + onChangeQueryParams }; }; diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderButtons/MetricThreeDotMenu.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderButtons/MetricThreeDotMenu.tsx index 1e04f3124..3e17d19bb 100644 --- a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderButtons/MetricThreeDotMenu.tsx +++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderButtons/MetricThreeDotMenu.tsx @@ -49,6 +49,8 @@ import { METRIC_CHART_TITLE_INPUT_ID } from '@/controllers/MetricController/Metr import { ShareMenuContent } from '@/components/features/ShareMenu/ShareMenuContent'; import { canEdit, getIsEffectiveOwner, getIsOwner } from '@/lib/share'; import { getShareAssetConfig } from '@/components/features/ShareMenu/helpers'; +import { usePathname, useRouter, useSearchParams } from 'next/navigation'; +import { useAppLayoutContextSelector } from '@/context/BusterAppLayout'; export const ThreeDotMenuButton = React.memo(({ metricId }: { metricId: string }) => { const { openSuccessMessage } = useBusterNotifications(); @@ -176,6 +178,7 @@ const useDashboardSelectMenu = ({ metricId }: { metricId: string }) => { }; const useVersionHistorySelectMenu = ({ metricId }: { metricId: string }) => { + const onChangeQueryParams = useAppLayoutContextSelector((x) => x.onChangeQueryParams); const { data } = useGetMetric({ id: metricId }, (x) => ({ versions: x.versions, version_number: x.version_number @@ -183,7 +186,7 @@ const useVersionHistorySelectMenu = ({ metricId }: { metricId: string }) => { const { versions = [], version_number } = data || {}; const onClickVersionHistory = useMemoizedFn((versionNumber: number) => { - console.log('versionNumber', versionNumber); + onChangeQueryParams({ metric_version_number: versionNumber.toString() }); }); const versionHistoryItems: DropdownItems = useMemo(() => { diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx index 0334e1634..0ded5229c 100644 --- a/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx +++ b/web/src/layouts/ChatLayout/FileContainer/FileContainerHeader/MetricContainerHeaderSegment.tsx @@ -5,7 +5,6 @@ import { useChatLayoutContextSelector } from '../../ChatLayoutContext'; import type { FileView, MetricFileView } from '../../ChatLayoutContext/useChatFileLayout'; import { type SegmentedItem } from '@/components/ui/segmented'; import { useMemoizedFn } from '@/hooks'; -import { useGetMetric } from '@/api/buster_rest/metrics'; const segmentOptions: { label: string; value: MetricFileView }[] = [ { label: 'Chart', value: 'chart' },