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 { 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>
|
||||
);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
|
|
|
@ -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 <></>;
|
||||
|
|
|
@ -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={
|
||||
|
|
|
@ -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,6 +67,7 @@ export const SQLContainer: React.FC<{
|
|||
</Button>
|
||||
)}
|
||||
|
||||
{!readOnly && (
|
||||
<Button
|
||||
variant="default"
|
||||
loading={isRunning}
|
||||
|
@ -71,6 +82,7 @@ export const SQLContainer: React.FC<{
|
|||
}>
|
||||
Run
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
@ -87,6 +99,7 @@ export const SQLContainer: React.FC<{
|
|||
onChange={setDatasetSQL}
|
||||
onMetaEnter={onRunQueryPreflight}
|
||||
variant={null}
|
||||
readOnly={readOnly}
|
||||
/>
|
||||
|
||||
{error && <ErrorClosableContainer error={error} />}
|
||||
|
|
Loading…
Reference in New Issue