From 12fb5795ac18b9b96255c29f22d2e7b6beafb13d Mon Sep 17 00:00:00 2001 From: olloz26 Date: Mon, 2 Sep 2024 13:52:08 +0200 Subject: [PATCH] feat: implement review suggestions --- client/.eslintrc.json | 1 + .../cloudStorage/AddOrEditCloudStorage.tsx | 32 +++++++++++-------- .../cloudStorage/projectCloudStorage.types.ts | 4 +-- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/client/.eslintrc.json b/client/.eslintrc.json index c5c771cc2a..0cabcea9af 100644 --- a/client/.eslintrc.json +++ b/client/.eslintrc.json @@ -197,6 +197,7 @@ "onloadend", "onopen", "openapi", + "openbis", "papermill", "pathname", "pdfjs", diff --git a/client/src/features/project/components/cloudStorage/AddOrEditCloudStorage.tsx b/client/src/features/project/components/cloudStorage/AddOrEditCloudStorage.tsx index 4940040f41..a05f5d7e6c 100644 --- a/client/src/features/project/components/cloudStorage/AddOrEditCloudStorage.tsx +++ b/client/src/features/project/components/cloudStorage/AddOrEditCloudStorage.tsx @@ -66,7 +66,7 @@ import { parseCloudStorageConfiguration, } from "../../utils/projectCloudStorage.utils"; import { ExternalLink } from "../../../../components/ExternalLinks"; -import { WarnAlert } from "../../../../components/Alert"; +import { InfoAlert, WarnAlert } from "../../../../components/Alert"; import styles from "./CloudStorage.module.scss"; @@ -1011,11 +1011,7 @@ function AddStorageOptions({ Please fill in all the options required to connect to your storage. Mind that the specific fields required depend on your storage configuration.

- {(selectedSchema && - "convenientMode" in selectedSchema && - selectedSchema.convenientMode) || ( - - )} + {sourcePath} {optionItems} {(selectedSchema && @@ -1171,21 +1167,31 @@ function AddStorageMount({ }} value="" checked={storage.readOnly ?? false} + readOnly={(selectedSchema && selectedSchema.readOnly) ?? false} /> )} rules={{ required: true }} /> - {!storage.readOnly && ( + {(selectedSchema && selectedSchema.readOnly && (
- +

- You are mounting this storage in read-write mode. If you have - read-only access, please check the box to prevent errors with - some storage types. + This cloud storage only supports read-only access.

-
+
- )} + )) || + (!storage.readOnly && ( +
+ +

+ You are mounting this storage in read-write mode. If you have + read-only access, please check the box to prevent errors with + some storage types. +

+
+
+ ))}
Check this box to mount the storage in read-only mode. You should always check this if you do not have credentials to write. You can use diff --git a/client/src/features/project/components/cloudStorage/projectCloudStorage.types.ts b/client/src/features/project/components/cloudStorage/projectCloudStorage.types.ts index 245b7bb8cb..80a3bed079 100644 --- a/client/src/features/project/components/cloudStorage/projectCloudStorage.types.ts +++ b/client/src/features/project/components/cloudStorage/projectCloudStorage.types.ts @@ -119,8 +119,8 @@ export interface CloudStorageSchema { hide?: boolean; prefix: string; // ? weird naming; it's the machine readable name position?: number; - convenientMode?: boolean; // ? Disables the advanced mode - readOnly?: boolean; // ? Forces read-only access + convenientMode?: boolean; // ? Disables the Rclone full options list, forces read-only access where necessary, ... + readOnly?: boolean; // ? Forces read-only access e.g. for storage that do not support write access options: CloudStorageSchemaOptions[]; }