Skip to content

Commit

Permalink
feat(ui-debug): disable import for archived studies
Browse files Browse the repository at this point in the history
  • Loading branch information
skamril committed Sep 23, 2024
1 parent 113d26b commit 1bd9393
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import Folder from "./Folder";
import type { FileInfo, FileType } from "../utils";
import type { DataCompProps } from "../utils";
import ViewWrapper from "../../../../../common/page/ViewWrapper";
import type { StudyMetadata } from "../../../../../../common/types";

interface Props extends FileInfo {
studyId: string;
study: StudyMetadata;
setSelectedFile: (file: FileInfo) => void;
reloadTreeData: () => void;
}
Expand All @@ -24,11 +25,12 @@ const componentByFileType: Record<FileType, DataComponent> = {
} as const;

function Data(props: Props) {
const { studyId, setSelectedFile, reloadTreeData, ...fileInfo } = props;
const { study, setSelectedFile, reloadTreeData, ...fileInfo } = props;
const { fileType, filePath } = fileInfo;
const DataViewer = componentByFileType[fileType];

const enableImport =
!study.archived &&
(filePath === "user" || filePath.startsWith("user/")) &&
// To remove when Xpansion tool configuration will be moved to "input/expansion" directory
!(filePath === "user/expansion" || filePath.startsWith("user/expansion/"));
Expand All @@ -37,7 +39,7 @@ function Data(props: Props) {
<ViewWrapper>
<DataViewer
{...fileInfo}
studyId={studyId}
studyId={study.id}
enableImport={enableImport}
setSelectedFile={setSelectedFile}
reloadTreeData={reloadTreeData}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function Debug() {
{...selectedFile}
setSelectedFile={setSelectedFile}
reloadTreeData={res.reload}
studyId={study.id}
study={study}
/>
)}
</Box>
Expand Down

0 comments on commit 1bd9393

Please sign in to comment.