mirror of https://github.com/buster-so/buster.git
fix sizing bug
This commit is contained in:
parent
699558447c
commit
76f479f739
|
@ -1,4 +1,4 @@
|
||||||
import React, { forwardRef } from 'react';
|
import React, { forwardRef, MutableRefObject } from 'react';
|
||||||
import { AppSplitter, type AppSplitterRef } from '@/components/ui/layouts/AppSplitter';
|
import { AppSplitter, type AppSplitterRef } from '@/components/ui/layouts/AppSplitter';
|
||||||
import { SQLContainer } from './SQLContainer';
|
import { SQLContainer } from './SQLContainer';
|
||||||
import { DataContainer } from './DataContainer';
|
import { DataContainer } from './DataContainer';
|
||||||
|
|
|
@ -91,7 +91,7 @@ export const SQLContainer: React.FC<{
|
||||||
return (
|
return (
|
||||||
<FileCard
|
<FileCard
|
||||||
className={className}
|
className={className}
|
||||||
footerClassName="flex justify-between space-x-4"
|
footerClassName="flex justify-between file-card space-x-4"
|
||||||
footer={memoizedFooter}>
|
footer={memoizedFooter}>
|
||||||
<AppCodeEditor
|
<AppCodeEditor
|
||||||
className="overflow-hidden border-x-0 border-t-0"
|
className="overflow-hidden border-x-0 border-t-0"
|
||||||
|
|
|
@ -91,10 +91,11 @@ export const AppSplitter = React.memo(
|
||||||
}, [hasHidden, leftHidden, sizes]);
|
}, [hasHidden, leftHidden, sizes]);
|
||||||
|
|
||||||
const memoizedLeftPaneStyle = useMemo(() => {
|
const memoizedLeftPaneStyle = useMemo(() => {
|
||||||
|
const isHidden = leftHidden || _sizes[0] === '0%'; //leftHidden || _sizes[0] === '0px' || _sizes[0] === 0 || _sizes[0] === '0%';
|
||||||
return {
|
return {
|
||||||
display: leftHidden ? 'none' : undefined
|
display: isHidden ? 'none' : undefined
|
||||||
};
|
};
|
||||||
}, [leftHidden]);
|
}, [leftHidden, _sizes[0]]);
|
||||||
|
|
||||||
const memoizedRightPaneStyle = useMemo(() => {
|
const memoizedRightPaneStyle = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -269,7 +270,7 @@ export const AppSplitter = React.memo(
|
||||||
sashRender={sashRender}>
|
sashRender={sashRender}>
|
||||||
<Pane
|
<Pane
|
||||||
style={memoizedLeftPaneStyle}
|
style={memoizedLeftPaneStyle}
|
||||||
className="left-pane flex h-full flex-col"
|
className={'left-pane flex h-full flex-col'}
|
||||||
minSize={leftPanelMinSize}
|
minSize={leftPanelMinSize}
|
||||||
maxSize={leftPanelMaxSize}>
|
maxSize={leftPanelMaxSize}>
|
||||||
{leftHidden || size?.width === 0 || size?.width === undefined ? null : leftChildren}
|
{leftHidden || size?.width === 0 || size?.width === undefined ? null : leftChildren}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import Link from 'next/link';
|
||||||
import { assetParamsToRoute } from '@/lib/assets';
|
import { assetParamsToRoute } from '@/lib/assets';
|
||||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||||
import { useIsMetricReadOnly } from '@/context/Metrics/useIsMetricReadOnly';
|
import { useIsMetricReadOnly } from '@/context/Metrics/useIsMetricReadOnly';
|
||||||
|
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||||
|
|
||||||
export const MetricContainerHeaderButtons: React.FC<FileContainerButtonsProps> = React.memo(
|
export const MetricContainerHeaderButtons: React.FC<FileContainerButtonsProps> = React.memo(
|
||||||
({ selectedFileId }) => {
|
({ selectedFileId }) => {
|
||||||
|
@ -102,6 +103,7 @@ const EditChartButton = React.memo(({ metricId }: { metricId: string }) => {
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
//SHALLOW PAGE CHANGED! DO NOT REMOVE
|
||||||
}}>
|
}}>
|
||||||
<SelectableButton
|
<SelectableButton
|
||||||
tooltipText="Edit chart"
|
tooltipText="Edit chart"
|
||||||
|
@ -125,41 +127,35 @@ const EditSQLButton = React.memo(({ metricId }: { metricId: string }) => {
|
||||||
const isSelectedView = selectedFileViewSecondary === editableSecondaryView;
|
const isSelectedView = selectedFileViewSecondary === editableSecondaryView;
|
||||||
|
|
||||||
const href = useMemo(() => {
|
const href = useMemo(() => {
|
||||||
if (isSelectedView) {
|
if (!isSelectedView) {
|
||||||
return assetParamsToRoute({
|
return createBusterRoute({
|
||||||
chatId,
|
route: BusterRoutes.APP_METRIC_ID_RESULTS,
|
||||||
assetId: metricId,
|
versionNumber: metricVersionNumber,
|
||||||
type: 'metric',
|
metricId,
|
||||||
secondaryView: null,
|
secondaryView: 'sql-edit'
|
||||||
versionNumber: metricVersionNumber
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return assetParamsToRoute({
|
return createBusterRoute({
|
||||||
chatId,
|
route: BusterRoutes.APP_METRIC_ID_RESULTS,
|
||||||
assetId: metricId,
|
versionNumber: metricVersionNumber,
|
||||||
type: 'metric',
|
metricId
|
||||||
secondaryView: 'sql-edit',
|
|
||||||
versionNumber: metricVersionNumber
|
|
||||||
});
|
});
|
||||||
}, [chatId, metricId, metricVersionNumber]);
|
}, [chatId, metricId, metricVersionNumber, isSelectedView]);
|
||||||
|
|
||||||
const onClickButton = useMemoizedFn(() => {
|
// const onClickButton = useMemoizedFn(() => {
|
||||||
const secondaryView = isSelectedView ? null : editableSecondaryView;
|
// const secondaryView = isSelectedView ? null : editableSecondaryView;
|
||||||
onSetFileView({ secondaryView, fileView: 'results' });
|
// onSetFileView({ secondaryView, fileView: 'results' });
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
console.log('href', href);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link href={href}>
|
||||||
href={href}
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
}}>
|
|
||||||
<SelectableButton
|
<SelectableButton
|
||||||
tooltipText="SQL editor"
|
tooltipText="SQL editor"
|
||||||
icon={<SquareCode />}
|
icon={<SquareCode />}
|
||||||
onClick={onClickButton}
|
onClick={() => {}}
|
||||||
selected={isSelectedView}
|
selected={isSelectedView}
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -8,7 +8,7 @@ export enum BusterAppRoutes {
|
||||||
APP_METRIC_ID_CHART = '/app/metrics/:metricId/chart?secondary_view=:secondaryView',
|
APP_METRIC_ID_CHART = '/app/metrics/:metricId/chart?secondary_view=:secondaryView',
|
||||||
APP_METRIC_ID_VERSION_NUMBER = '/app/metrics/:metricId/chart?metric_version_number=:versionNumber&secondary_view=:secondaryView',
|
APP_METRIC_ID_VERSION_NUMBER = '/app/metrics/:metricId/chart?metric_version_number=:versionNumber&secondary_view=:secondaryView',
|
||||||
APP_METRIC_ID_FILE = '/app/metrics/:metricId/file',
|
APP_METRIC_ID_FILE = '/app/metrics/:metricId/file',
|
||||||
APP_METRIC_ID_RESULTS = '/app/metrics/:metricId/results?secondary_view=:secondaryView',
|
APP_METRIC_ID_RESULTS = '/app/metrics/:metricId/results?secondary_view=:secondaryView&metric_version_number=:versionNumber',
|
||||||
APP_DASHBOARDS = '/app/dashboards',
|
APP_DASHBOARDS = '/app/dashboards',
|
||||||
APP_DASHBOARD_ID = '/app/dashboards/:dashboardId?secondary_view=:secondaryView',
|
APP_DASHBOARD_ID = '/app/dashboards/:dashboardId?secondary_view=:secondaryView',
|
||||||
APP_DASHBOARD_ID_VERSION_NUMBER = '/app/dashboards/:dashboardId?dashboard_version_number=:versionNumber&secondary_view=:secondaryView',
|
APP_DASHBOARD_ID_VERSION_NUMBER = '/app/dashboards/:dashboardId?dashboard_version_number=:versionNumber&secondary_view=:secondaryView',
|
||||||
|
@ -33,7 +33,7 @@ export enum BusterAppRoutes {
|
||||||
APP_CHAT_ID_METRIC_ID_CHART = '/app/chats/:chatId/metrics/:metricId/chart?secondary_view=:secondaryView',
|
APP_CHAT_ID_METRIC_ID_CHART = '/app/chats/:chatId/metrics/:metricId/chart?secondary_view=:secondaryView',
|
||||||
APP_CHAT_ID_METRIC_ID_VERSION_NUMBER = '/app/chats/:chatId/metrics/:metricId/chart?metric_version_number=:versionNumber&secondary_view=:secondaryView',
|
APP_CHAT_ID_METRIC_ID_VERSION_NUMBER = '/app/chats/:chatId/metrics/:metricId/chart?metric_version_number=:versionNumber&secondary_view=:secondaryView',
|
||||||
APP_CHAT_ID_METRIC_ID_FILE = '/app/chats/:chatId/metrics/:metricId/file',
|
APP_CHAT_ID_METRIC_ID_FILE = '/app/chats/:chatId/metrics/:metricId/file',
|
||||||
APP_CHAT_ID_METRIC_ID_RESULTS = '/app/chats/:chatId/metrics/:metricId/results?secondary_view=:secondaryView',
|
APP_CHAT_ID_METRIC_ID_RESULTS = '/app/chats/:chatId/metrics/:metricId/results?secondary_view=:secondaryView&metric_version_number=:versionNumber',
|
||||||
APP_CHAT_ID_COLLECTION_ID = '/app/chats/:chatId/collections/:collectionId',
|
APP_CHAT_ID_COLLECTION_ID = '/app/chats/:chatId/collections/:collectionId',
|
||||||
APP_CHAT_ID_DASHBOARD_ID = '/app/chats/:chatId/dashboards/:dashboardId?secondary_view=:secondaryView&dashboard_version_number=:versionNumber',
|
APP_CHAT_ID_DASHBOARD_ID = '/app/chats/:chatId/dashboards/:dashboardId?secondary_view=:secondaryView&dashboard_version_number=:versionNumber',
|
||||||
APP_CHAT_ID_DASHBOARD_ID_VERSION_NUMBER = '/app/chats/:chatId/dashboards/:dashboardId?dashboard_version_number=:versionNumber&secondary_view=:secondaryView',
|
APP_CHAT_ID_DASHBOARD_ID_VERSION_NUMBER = '/app/chats/:chatId/dashboards/:dashboardId?dashboard_version_number=:versionNumber&secondary_view=:secondaryView',
|
||||||
|
@ -71,7 +71,8 @@ export type BusterAppRoutesWithArgs = {
|
||||||
[BusterAppRoutes.APP_METRIC_ID_RESULTS]: {
|
[BusterAppRoutes.APP_METRIC_ID_RESULTS]: {
|
||||||
route: BusterAppRoutes.APP_METRIC_ID_RESULTS;
|
route: BusterAppRoutes.APP_METRIC_ID_RESULTS;
|
||||||
metricId: string;
|
metricId: string;
|
||||||
secondaryView?: MetricFileViewSecondary;
|
versionNumber?: number;
|
||||||
|
secondaryView?: MetricFileViewSecondary | null;
|
||||||
};
|
};
|
||||||
[BusterAppRoutes.APP_DASHBOARDS]: { route: BusterAppRoutes.APP_DASHBOARDS };
|
[BusterAppRoutes.APP_DASHBOARDS]: { route: BusterAppRoutes.APP_DASHBOARDS };
|
||||||
[BusterAppRoutes.APP_DASHBOARD_ID]: {
|
[BusterAppRoutes.APP_DASHBOARD_ID]: {
|
||||||
|
@ -149,6 +150,7 @@ export type BusterAppRoutesWithArgs = {
|
||||||
route: BusterAppRoutes.APP_CHAT_ID_METRIC_ID_RESULTS;
|
route: BusterAppRoutes.APP_CHAT_ID_METRIC_ID_RESULTS;
|
||||||
chatId: string;
|
chatId: string;
|
||||||
metricId: string;
|
metricId: string;
|
||||||
|
versionNumber?: number;
|
||||||
secondaryView?: MetricFileViewSecondary;
|
secondaryView?: MetricFileViewSecondary;
|
||||||
};
|
};
|
||||||
[BusterAppRoutes.APP_CHAT_ID_COLLECTION_ID]: {
|
[BusterAppRoutes.APP_CHAT_ID_COLLECTION_ID]: {
|
||||||
|
|
Loading…
Reference in New Issue