ready only in datasets 🎉

This commit is contained in:
Nate Kelley 2025-04-14 13:06:39 -06:00
parent 556e11bcd8
commit e1344fcfa6
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
6 changed files with 46 additions and 35 deletions

View File

@ -4,7 +4,7 @@ import { BusterRoutes } from '@/routes';
import { Dropdown, DropdownItems } from '@/components/ui/dropdown';
import { Button } from '@/components/ui/buttons';
import React, { useMemo } from 'react';
import { Dots, DotsVertical, Trash } from '@/components/ui/icons';
import { Dots, Trash } from '@/components/ui/icons';
export const DatasetIndividualThreeDotMenu: React.FC<{
datasetId?: string;
@ -31,7 +31,7 @@ export const DatasetIndividualThreeDotMenu: React.FC<{
}, [datasetId, onDeleteDataset]);
return (
<Dropdown items={items} side={'bottom'}>
<Dropdown items={items} side={'bottom'} align={'end'}>
<Button variant={'ghost'} prefix={<Dots />} />
</Dropdown>
);

View File

@ -76,11 +76,12 @@ export const EditorContent: React.FC<{
data={shownData}
fetchingData={fetchingInitialData || fetchingTempData}
defaultLayout={defaultLayout}
readOnly={true}
/>
)}
{selectedApp === EditorApps.METADATA && (
<MetadataContainer ymlFile={ymlFile} setYmlFile={setYmlFile} />
<MetadataContainer ymlFile={ymlFile} setYmlFile={setYmlFile} readOnly={true} />
)}
</div>
</div>

View File

@ -4,16 +4,17 @@ import React from 'react';
export const MetadataContainer: React.FC<{
ymlFile: string;
readOnly?: boolean;
setYmlFile: (ymlFile: string) => void;
}> = React.memo(({ ymlFile, setYmlFile }) => {
}> = React.memo(({ ymlFile, setYmlFile, readOnly = false }) => {
return (
<div
className={cn('bg-background rounded border', 'flex h-full w-full flex-col overflow-hidden')}>
<div className={cn('bg-background flex h-full w-full flex-col overflow-hidden rounded border')}>
<AppCodeEditor
language="yaml"
className="overflow-hidden"
className="border-none"
value={ymlFile}
onChange={setYmlFile}
readOnly={readOnly}
/>
</div>
);

View File

@ -1,25 +1,18 @@
'use client';
import React, { use } from 'react';
import { permanentRedirect, RedirectType } from 'next/navigation';
import React from 'react';
import { permanentRedirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes';
export default function DashboardPage(
props: {
params: Promise<{ datasetId: string }>;
}
) {
const params = use(props.params);
export default async function DashboardPage(props: { params: Promise<{ datasetId: string }> }) {
const params = await props.params;
const {
datasetId
} = params;
const { datasetId } = params;
permanentRedirect(
createBusterRoute({
route: BusterRoutes.APP_DATASETS_ID_OVERVIEW,
datasetId
}),
RedirectType.replace
})
);
return <></>;

View File

@ -18,6 +18,7 @@ export interface AppVerticalCodeSplitterProps {
disabledSave?: boolean;
gapAmount?: number;
className?: string;
readOnly?: boolean;
}
export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCodeSplitterProps>(
@ -29,6 +30,7 @@ export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCod
onRunQuery,
onSaveSQL,
data,
readOnly = false,
fetchingData,
defaultLayout,
autoSaveId,
@ -55,6 +57,7 @@ export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCod
onRunQuery={onRunQuery}
onSaveSQL={onSaveSQL}
disabledSave={disabledSave}
readOnly={readOnly}
/>
}
rightChildren={

View File

@ -18,8 +18,18 @@ export const SQLContainer: React.FC<{
onSaveSQL: AppVerticalCodeSplitterProps['onSaveSQL'];
disabledSave?: AppVerticalCodeSplitterProps['disabledSave'];
error?: string | null;
readOnly?: boolean;
}> = React.memo(
({ disabledSave, className = '', sql, setDatasetSQL, onRunQuery, onSaveSQL, error }) => {
({
disabledSave,
className = '',
readOnly = false,
sql,
setDatasetSQL,
onRunQuery,
onSaveSQL,
error
}) => {
const [isRunning, setIsRunning] = useState(false);
const [isSaving, setIsSaving] = useState(false);
const { openInfoMessage } = useBusterNotifications();
@ -57,20 +67,22 @@ export const SQLContainer: React.FC<{
</Button>
)}
<Button
variant="default"
loading={isRunning}
disabled={!sql}
className="flex items-center space-x-0"
onClick={onRunQueryPreflight}
suffix={
<div className="flex items-center gap-x-1 text-sm">
<Command />
<ReturnKey />
</div>
}>
Run
</Button>
{!readOnly && (
<Button
variant="default"
loading={isRunning}
disabled={!sql}
className="flex items-center space-x-0"
onClick={onRunQueryPreflight}
suffix={
<div className="flex items-center gap-x-1 text-sm">
<Command />
<ReturnKey />
</div>
}>
Run
</Button>
)}
</div>
</>
);
@ -87,6 +99,7 @@ export const SQLContainer: React.FC<{
onChange={setDatasetSQL}
onMetaEnter={onRunQueryPreflight}
variant={null}
readOnly={readOnly}
/>
{error && <ErrorClosableContainer error={error} />}