Skip to content

Commit 9dce164

Browse files
authored
feat(ui-debug): hide the view for study without filesystem storage (#3278)
ANT-5111
1 parent a04c6d5 commit 9dce164

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

webapp/src/routes/_authenticated/studies/$studyId/explore/debug/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ function Debug() {
4242
// Allow to keep expanded items when the tree is reloaded with `reloadTree`
4343
const [expandedItems, setExpandedItems] = useState<string[]>([]);
4444
const { path } = Route.useSearch();
45+
const isFilesystemStudy = study.storageMode === "filesystem";
4546

4647
const treeDataResponse = usePromiseWithSnackbarError(() => getTreeData(study.id), {
4748
errorMessage: t("studies.error.retrieveData"),
49+
disabled: !isFilesystemStudy,
4850
deps: [study.id],
4951
});
5052

@@ -108,6 +110,10 @@ function Debug() {
108110
// JSX
109111
////////////////////////////////////////////////////////////////
110112

113+
if (!isFilesystemStudy) {
114+
throw new Error(`${Route.path} is only available for studies with filesystem storage mode.`);
115+
}
116+
111117
return (
112118
<DebugContext.Provider value={contextValue}>
113119
<SplitView splitId="debug">

webapp/src/routes/_authenticated/studies/$studyId/explore/route.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function StudyExploreLayout() {
8888
params,
8989
}),
9090
},
91-
{
91+
study.storageMode === "filesystem" && {
9292
id: "debug",
9393
label: t("study.debug"),
9494
linkOptions: linkOptions({
@@ -97,7 +97,7 @@ function StudyExploreLayout() {
9797
search: { path: undefined },
9898
}),
9999
},
100-
]}
100+
].filter(Boolean)}
101101
divider
102102
/>
103103
);

webapp/src/services/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const convertStudyDtoToMetadata = (
4040
owner: metadata.owner,
4141
author: metadata.author,
4242
editor: metadata.editor,
43+
storageMode: metadata.storage_mode,
4344
groups: metadata.groups,
4445
type: metadata.type,
4546
publicMode: metadata.public_mode,

webapp/src/types/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export interface StudyMetadata {
9090
workspace: string;
9191
managed: boolean;
9292
archived: boolean;
93+
storageMode: StorageMode;
9394
groups: Array<{ id: string; name: string }>;
9495
publicMode: StudyPublicMode;
9596
folder?: string;

0 commit comments

Comments
 (0)