version updates

This commit is contained in:
Nate Kelley 2025-03-25 20:57:27 -06:00
parent 9092723faf
commit 53474546db
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
4 changed files with 16 additions and 4 deletions

View File

@ -180,7 +180,6 @@ describe('DataSourceSchema', () => {
// This validation currently passes because there's no cross-field validation // 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 // 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); expect(result.success).toBe(true);
}); });
}); });

View File

@ -49,10 +49,21 @@ export const useAppLayout = () => {
} }
); );
const onChangeQueryParams = useMemoizedFn((params: Record<string, string>) => {
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 { return {
currentRoute, currentRoute,
onChangePage, onChangePage,
currentParentRoute currentParentRoute,
onChangeQueryParams
}; };
}; };

View File

@ -49,6 +49,8 @@ import { METRIC_CHART_TITLE_INPUT_ID } from '@/controllers/MetricController/Metr
import { ShareMenuContent } from '@/components/features/ShareMenu/ShareMenuContent'; import { ShareMenuContent } from '@/components/features/ShareMenu/ShareMenuContent';
import { canEdit, getIsEffectiveOwner, getIsOwner } from '@/lib/share'; import { canEdit, getIsEffectiveOwner, getIsOwner } from '@/lib/share';
import { getShareAssetConfig } from '@/components/features/ShareMenu/helpers'; 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 }) => { export const ThreeDotMenuButton = React.memo(({ metricId }: { metricId: string }) => {
const { openSuccessMessage } = useBusterNotifications(); const { openSuccessMessage } = useBusterNotifications();
@ -176,6 +178,7 @@ const useDashboardSelectMenu = ({ metricId }: { metricId: string }) => {
}; };
const useVersionHistorySelectMenu = ({ metricId }: { metricId: string }) => { const useVersionHistorySelectMenu = ({ metricId }: { metricId: string }) => {
const onChangeQueryParams = useAppLayoutContextSelector((x) => x.onChangeQueryParams);
const { data } = useGetMetric({ id: metricId }, (x) => ({ const { data } = useGetMetric({ id: metricId }, (x) => ({
versions: x.versions, versions: x.versions,
version_number: x.version_number version_number: x.version_number
@ -183,7 +186,7 @@ const useVersionHistorySelectMenu = ({ metricId }: { metricId: string }) => {
const { versions = [], version_number } = data || {}; const { versions = [], version_number } = data || {};
const onClickVersionHistory = useMemoizedFn((versionNumber: number) => { const onClickVersionHistory = useMemoizedFn((versionNumber: number) => {
console.log('versionNumber', versionNumber); onChangeQueryParams({ metric_version_number: versionNumber.toString() });
}); });
const versionHistoryItems: DropdownItems = useMemo(() => { const versionHistoryItems: DropdownItems = useMemo(() => {

View File

@ -5,7 +5,6 @@ import { useChatLayoutContextSelector } from '../../ChatLayoutContext';
import type { FileView, MetricFileView } from '../../ChatLayoutContext/useChatFileLayout'; import type { FileView, MetricFileView } from '../../ChatLayoutContext/useChatFileLayout';
import { type SegmentedItem } from '@/components/ui/segmented'; import { type SegmentedItem } from '@/components/ui/segmented';
import { useMemoizedFn } from '@/hooks'; import { useMemoizedFn } from '@/hooks';
import { useGetMetric } from '@/api/buster_rest/metrics';
const segmentOptions: { label: string; value: MetricFileView }[] = [ const segmentOptions: { label: string; value: MetricFileView }[] = [
{ label: 'Chart', value: 'chart' }, { label: 'Chart', value: 'chart' },