From 5e5c2a1fb8d7cd1abb435386da9b7878e1b87b13 Mon Sep 17 00:00:00 2001 From: Lorenzo Cavazzi <43481553+lorenzo-cavazzi@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:47:29 +0100 Subject: [PATCH 1/5] feat: enable RW option on cloud storage (#2901) fix #2899 --- .../components/AddCloudStorageButton.tsx | 159 +++++++----------- .../ProjectSettingsCloudStorage.tsx | 87 ++++------ .../project/projectCloudStorage.constants.ts | 2 - .../options/SessionCloudStorageOption.tsx | 141 ++++++---------- tests/cypress.config.ts | 3 - tests/cypress/e2e/newSession.spec.ts | 8 +- tests/cypress/e2e/projectSettings.spec.ts | 37 ++-- 7 files changed, 156 insertions(+), 281 deletions(-) diff --git a/client/src/features/project/components/AddCloudStorageButton.tsx b/client/src/features/project/components/AddCloudStorageButton.tsx index 665aa93201..1af9740dc2 100644 --- a/client/src/features/project/components/AddCloudStorageButton.tsx +++ b/client/src/features/project/components/AddCloudStorageButton.tsx @@ -49,7 +49,6 @@ import { } from "../projectCloudStorage.api"; import { CLOUD_STORAGE_CONFIGURATION_PLACEHOLDER, - CLOUD_STORAGE_READWRITE_ENABLED, CLOUD_STORAGE_SENSITIVE_FIELD_TOKEN, } from "../projectCloudStorage.constants"; import { @@ -205,7 +204,7 @@ function AdvancedAddCloudStorage({ configuration: "", name: "", private: true, - readonly: true, + readonly: false, source_path: "", }, }); @@ -321,55 +320,34 @@ function AdvancedAddCloudStorage({ - {!CLOUD_STORAGE_READWRITE_ENABLED ? null : ( -
-
Mode
- ( - <> -
- field.onChange(true)} - /> - -
-
- field.onChange(false)} - /> - -
- - )} - /> -
- )} +
+ ( + + )} + /> + + + Check this box to mount the storage in read-only mode. Use this + setting to prevent accidental data modifications. + +
- {!CLOUD_STORAGE_READWRITE_ENABLED ? null : ( -
-
Mode
- ( - <> -
- field.onChange(true)} - /> - -
-
- field.onChange(false)} - /> - -
- - )} - /> -
- )} +
+ ( + + )} + /> + + + Check this box to mount the storage in read-only mode. Use this + setting to prevent accidental data modifications. + +
diff --git a/client/src/features/project/components/ProjectSettingsCloudStorage.tsx b/client/src/features/project/components/ProjectSettingsCloudStorage.tsx index 639bd135b3..634be2e875 100644 --- a/client/src/features/project/components/ProjectSettingsCloudStorage.tsx +++ b/client/src/features/project/components/ProjectSettingsCloudStorage.tsx @@ -70,7 +70,6 @@ import { } from "../projectCloudStorage.api"; import { CLOUD_STORAGE_CONFIGURATION_PLACEHOLDER, - CLOUD_STORAGE_READWRITE_ENABLED, CLOUD_STORAGE_SENSITIVE_FIELD_TOKEN, } from "../projectCloudStorage.constants"; import { @@ -645,55 +644,35 @@ function EditCloudStorage({ )} - {!CLOUD_STORAGE_READWRITE_ENABLED ? null : ( -
-
Mode
- ( - <> -
- field.onChange(true)} - /> - -
-
- field.onChange(false)} - /> - -
- - )} - /> -
- )} +
+ ( + + )} + /> + + + Check this box to mount the storage in read-only mode. Use this + setting to prevent accidental data modifications. + +
+
diff --git a/client/src/features/project/projectCloudStorage.constants.ts b/client/src/features/project/projectCloudStorage.constants.ts index 4329066acc..0a13958c25 100644 --- a/client/src/features/project/projectCloudStorage.constants.ts +++ b/client/src/features/project/projectCloudStorage.constants.ts @@ -20,5 +20,3 @@ export const CLOUD_STORAGE_SENSITIVE_FIELD_TOKEN = ""; export const CLOUD_STORAGE_CONFIGURATION_PLACEHOLDER = "[example]\ntype = s3\nprovider = AWS\nregion = us-east-1"; - -export const CLOUD_STORAGE_READWRITE_ENABLED = false; diff --git a/client/src/features/session/components/options/SessionCloudStorageOption.tsx b/client/src/features/session/components/options/SessionCloudStorageOption.tsx index c0d26c5898..986cd7d4e3 100644 --- a/client/src/features/session/components/options/SessionCloudStorageOption.tsx +++ b/client/src/features/session/components/options/SessionCloudStorageOption.tsx @@ -78,7 +78,6 @@ import { } from "../../../project/projectCloudStorage.api"; import { CLOUD_STORAGE_CONFIGURATION_PLACEHOLDER, - CLOUD_STORAGE_READWRITE_ENABLED, CLOUD_STORAGE_SENSITIVE_FIELD_TOKEN, } from "../../../project/projectCloudStorage.constants"; import { @@ -695,45 +694,27 @@ function CloudStorageDetails({ index, storage }: CloudStorageItemProps) { />
- {!CLOUD_STORAGE_READWRITE_ENABLED ? null : ( -
-
Mode
-
- - -
-
- - -
-
- )} +
+ + + + Check this box to mount the storage in read-only mode. Use this + setting to prevent accidental data modifications. + +
+
- {!CLOUD_STORAGE_READWRITE_ENABLED ? null : ( -
-
Mode
- ( - <> -
- field.onChange(true)} - /> - -
-
- field.onChange(false)} - /> - -
- - )} - /> -
- )} +
+ ( + + )} + /> + + + Check this box to mount the storage in read-only mode. Use this + setting to prevent accidental data modifications. + +
+