mirror of https://github.com/buster-so/buster.git
ready only in datasets 🎉
This commit is contained in:
parent
556e11bcd8
commit
e1344fcfa6
|
@ -4,7 +4,7 @@ import { BusterRoutes } from '@/routes';
|
||||||
import { Dropdown, DropdownItems } from '@/components/ui/dropdown';
|
import { Dropdown, DropdownItems } from '@/components/ui/dropdown';
|
||||||
import { Button } from '@/components/ui/buttons';
|
import { Button } from '@/components/ui/buttons';
|
||||||
import React, { useMemo } from 'react';
|
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<{
|
export const DatasetIndividualThreeDotMenu: React.FC<{
|
||||||
datasetId?: string;
|
datasetId?: string;
|
||||||
|
@ -31,7 +31,7 @@ export const DatasetIndividualThreeDotMenu: React.FC<{
|
||||||
}, [datasetId, onDeleteDataset]);
|
}, [datasetId, onDeleteDataset]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown items={items} side={'bottom'}>
|
<Dropdown items={items} side={'bottom'} align={'end'}>
|
||||||
<Button variant={'ghost'} prefix={<Dots />} />
|
<Button variant={'ghost'} prefix={<Dots />} />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
|
|
|
@ -76,11 +76,12 @@ export const EditorContent: React.FC<{
|
||||||
data={shownData}
|
data={shownData}
|
||||||
fetchingData={fetchingInitialData || fetchingTempData}
|
fetchingData={fetchingInitialData || fetchingTempData}
|
||||||
defaultLayout={defaultLayout}
|
defaultLayout={defaultLayout}
|
||||||
|
readOnly={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{selectedApp === EditorApps.METADATA && (
|
{selectedApp === EditorApps.METADATA && (
|
||||||
<MetadataContainer ymlFile={ymlFile} setYmlFile={setYmlFile} />
|
<MetadataContainer ymlFile={ymlFile} setYmlFile={setYmlFile} readOnly={true} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,16 +4,17 @@ import React from 'react';
|
||||||
|
|
||||||
export const MetadataContainer: React.FC<{
|
export const MetadataContainer: React.FC<{
|
||||||
ymlFile: string;
|
ymlFile: string;
|
||||||
|
readOnly?: boolean;
|
||||||
setYmlFile: (ymlFile: string) => void;
|
setYmlFile: (ymlFile: string) => void;
|
||||||
}> = React.memo(({ ymlFile, setYmlFile }) => {
|
}> = React.memo(({ ymlFile, setYmlFile, readOnly = false }) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div className={cn('bg-background flex h-full w-full flex-col overflow-hidden rounded border')}>
|
||||||
className={cn('bg-background rounded border', 'flex h-full w-full flex-col overflow-hidden')}>
|
|
||||||
<AppCodeEditor
|
<AppCodeEditor
|
||||||
language="yaml"
|
language="yaml"
|
||||||
className="overflow-hidden"
|
className="border-none"
|
||||||
value={ymlFile}
|
value={ymlFile}
|
||||||
onChange={setYmlFile}
|
onChange={setYmlFile}
|
||||||
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,25 +1,18 @@
|
||||||
'use client';
|
'use client';
|
||||||
import React, { use } from 'react';
|
import React from 'react';
|
||||||
import { permanentRedirect, RedirectType } from 'next/navigation';
|
import { permanentRedirect } from 'next/navigation';
|
||||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||||
|
|
||||||
export default function DashboardPage(
|
export default async function DashboardPage(props: { params: Promise<{ datasetId: string }> }) {
|
||||||
props: {
|
const params = await props.params;
|
||||||
params: Promise<{ datasetId: string }>;
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
const params = use(props.params);
|
|
||||||
|
|
||||||
const {
|
const { datasetId } = params;
|
||||||
datasetId
|
|
||||||
} = params;
|
|
||||||
|
|
||||||
permanentRedirect(
|
permanentRedirect(
|
||||||
createBusterRoute({
|
createBusterRoute({
|
||||||
route: BusterRoutes.APP_DATASETS_ID_OVERVIEW,
|
route: BusterRoutes.APP_DATASETS_ID_OVERVIEW,
|
||||||
datasetId
|
datasetId
|
||||||
}),
|
})
|
||||||
RedirectType.replace
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return <></>;
|
return <></>;
|
||||||
|
|
|
@ -18,6 +18,7 @@ export interface AppVerticalCodeSplitterProps {
|
||||||
disabledSave?: boolean;
|
disabledSave?: boolean;
|
||||||
gapAmount?: number;
|
gapAmount?: number;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
readOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCodeSplitterProps>(
|
export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCodeSplitterProps>(
|
||||||
|
@ -29,6 +30,7 @@ export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCod
|
||||||
onRunQuery,
|
onRunQuery,
|
||||||
onSaveSQL,
|
onSaveSQL,
|
||||||
data,
|
data,
|
||||||
|
readOnly = false,
|
||||||
fetchingData,
|
fetchingData,
|
||||||
defaultLayout,
|
defaultLayout,
|
||||||
autoSaveId,
|
autoSaveId,
|
||||||
|
@ -55,6 +57,7 @@ export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCod
|
||||||
onRunQuery={onRunQuery}
|
onRunQuery={onRunQuery}
|
||||||
onSaveSQL={onSaveSQL}
|
onSaveSQL={onSaveSQL}
|
||||||
disabledSave={disabledSave}
|
disabledSave={disabledSave}
|
||||||
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
rightChildren={
|
rightChildren={
|
||||||
|
|
|
@ -18,8 +18,18 @@ export const SQLContainer: React.FC<{
|
||||||
onSaveSQL: AppVerticalCodeSplitterProps['onSaveSQL'];
|
onSaveSQL: AppVerticalCodeSplitterProps['onSaveSQL'];
|
||||||
disabledSave?: AppVerticalCodeSplitterProps['disabledSave'];
|
disabledSave?: AppVerticalCodeSplitterProps['disabledSave'];
|
||||||
error?: string | null;
|
error?: string | null;
|
||||||
|
readOnly?: boolean;
|
||||||
}> = React.memo(
|
}> = React.memo(
|
||||||
({ disabledSave, className = '', sql, setDatasetSQL, onRunQuery, onSaveSQL, error }) => {
|
({
|
||||||
|
disabledSave,
|
||||||
|
className = '',
|
||||||
|
readOnly = false,
|
||||||
|
sql,
|
||||||
|
setDatasetSQL,
|
||||||
|
onRunQuery,
|
||||||
|
onSaveSQL,
|
||||||
|
error
|
||||||
|
}) => {
|
||||||
const [isRunning, setIsRunning] = useState(false);
|
const [isRunning, setIsRunning] = useState(false);
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
const { openInfoMessage } = useBusterNotifications();
|
const { openInfoMessage } = useBusterNotifications();
|
||||||
|
@ -57,20 +67,22 @@ export const SQLContainer: React.FC<{
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Button
|
{!readOnly && (
|
||||||
variant="default"
|
<Button
|
||||||
loading={isRunning}
|
variant="default"
|
||||||
disabled={!sql}
|
loading={isRunning}
|
||||||
className="flex items-center space-x-0"
|
disabled={!sql}
|
||||||
onClick={onRunQueryPreflight}
|
className="flex items-center space-x-0"
|
||||||
suffix={
|
onClick={onRunQueryPreflight}
|
||||||
<div className="flex items-center gap-x-1 text-sm">
|
suffix={
|
||||||
<Command />
|
<div className="flex items-center gap-x-1 text-sm">
|
||||||
<ReturnKey />
|
<Command />
|
||||||
</div>
|
<ReturnKey />
|
||||||
}>
|
</div>
|
||||||
Run
|
}>
|
||||||
</Button>
|
Run
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -87,6 +99,7 @@ export const SQLContainer: React.FC<{
|
||||||
onChange={setDatasetSQL}
|
onChange={setDatasetSQL}
|
||||||
onMetaEnter={onRunQueryPreflight}
|
onMetaEnter={onRunQueryPreflight}
|
||||||
variant={null}
|
variant={null}
|
||||||
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{error && <ErrorClosableContainer error={error} />}
|
{error && <ErrorClosableContainer error={error} />}
|
||||||
|
|
Loading…
Reference in New Issue