void;
onEndDrag?: (d: { id: string }) => void;
overlayComponent?: React.ReactNode;
- allowEdit?: boolean;
+ readOnly?: boolean;
}> = ({
- allowEdit = true,
+ readOnly = true,
className = '',
overlayComponent,
rows: serverRows,
@@ -57,6 +57,8 @@ export const BusterResizeableGrid: React.FC<{
const [rows, setRows] = useState(serverRows);
const styleRef = useRef(undefined);
+ console.log(serverRows);
+
const onRowLayoutChangePreflight = useMemoizedFn((newLayout: BusterResizeableGridRow[]) => {
const filteredRows = newRowPreflight(newLayout);
@@ -335,12 +337,12 @@ export const BusterResizeableGrid: React.FC<{
- {allowEdit && (
+ {!readOnly && (
+ modifiers={[useSnapToCenter ? snapCenterToCursor : adjustTranslate]}>
{activeId && (
{
if (!userData.data?.user) {
const { session: anonSession } = await signInWithAnonymousUser();
return {
- user: anonSession?.user,
+ user: anonSession?.user || null,
accessToken: anonSession?.access_token,
refreshToken: anonSession?.refresh_token,
expiresAt: anonSession?.expires_at
diff --git a/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardContentController.tsx b/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardContentController.tsx
index dfba11265..6998b636f 100644
--- a/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardContentController.tsx
+++ b/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardContentController.tsx
@@ -20,7 +20,7 @@ const DEFAULT_EMPTY_METRICS: Record = {};
const DEFAULT_EMPTY_CONFIG: DashboardConfig = {};
export const DashboardContentController: React.FC<{
- allowEdit?: boolean;
+ readOnly?: boolean;
metrics: BusterDashboardResponse['metrics'] | undefined;
dashboard: BusterDashboardResponse['dashboard'] | undefined;
onUpdateDashboardConfig: ReturnType['mutateAsync'];
@@ -29,7 +29,7 @@ export const DashboardContentController: React.FC<{
({
onOpenAddContentModal,
dashboard,
- allowEdit,
+ readOnly = false,
metrics = DEFAULT_EMPTY_METRICS,
onUpdateDashboardConfig
}) => {
@@ -79,7 +79,7 @@ export const DashboardContentController: React.FC<{
key={item.id}
metricId={item.id}
dashboardId={dashboard!.id}
- allowEdit={allowEdit}
+ readOnly={readOnly}
numberOfMetrics={numberOfMetrics}
/>
)
@@ -87,7 +87,7 @@ export const DashboardContentController: React.FC<{
})
};
});
- }, [rows]);
+ }, [rows, readOnly, dashboard?.id]);
const onDragEnd = useMemoizedFn(() => {
setDraggingId(null);
@@ -109,7 +109,7 @@ export const DashboardContentController: React.FC<{
= ({
- allowEdit,
+ readOnly,
dashboardId,
className = '',
metricId,
@@ -74,10 +74,8 @@ const DashboardMetricItemBase: React.FC<{
return (
-
+ className={`metric-item flex h-full w-full flex-col overflow-auto ${className}`}>
+
@@ -105,7 +103,7 @@ const DashboardMetricItemBase: React.FC<{
animate={!isDragOverlay && animate}
animateLegend={false}
columnMetadata={metricData?.data_metadata?.column_metadata}
- editable={allowEdit} //this is really only to resize the columns of a table
+ readOnly={true}
{...chartOptions}
/>
)}
diff --git a/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardMetricItem/MetricTitle.tsx b/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardMetricItem/MetricTitle.tsx
index 027aaac4e..90f4f5aa3 100644
--- a/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardMetricItem/MetricTitle.tsx
+++ b/web/src/controllers/DashboardController/DashboardViewDashboardController/DashboardContentController/DashboardMetricItem/MetricTitle.tsx
@@ -17,11 +17,11 @@ export const MetricTitle: React.FC<{
isDragOverlay: boolean;
metricId: string;
dashboardId: string;
- allowEdit?: boolean;
+ readOnly?: boolean;
}> = React.memo(
({
metricId,
- allowEdit = true,
+ readOnly = true,
dashboardId,
title,
description,
@@ -43,6 +43,8 @@ export const MetricTitle: React.FC<{
};
}, [title, useEllipsis]);
+ console.log(readOnly, isDragOverlay);
+
return (
- {isDragOverlay || !allowEdit ? (
+ {isDragOverlay || readOnly ? (
<>>
) : (