From 16be3db0c6d655149d652e3beb6fbba83f01573e Mon Sep 17 00:00:00 2001 From: Rostislav Dugin Date: Sun, 1 Feb 2026 18:30:50 +0300 Subject: [PATCH] FIX (playground): Pre-select system storage if exists in playground --- .gitignore | 3 +- .../backups/ui/EditBackupConfigComponent.tsx | 7 +++ .../ui/PlaygroundWarningComponent.tsx | 10 ++-- .../storages/ui/StorageCardComponent.tsx | 2 +- .../features/storages/ui/StorageComponent.tsx | 47 ++++++++++++------- .../storages/ui/show/ShowStorageComponent.tsx | 16 ++----- 6 files changed, 49 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index b51ea47..4a9b959 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ node_modules/ /articles .DS_Store -/scripts \ No newline at end of file +/scripts +.vscode/settings.json diff --git a/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx b/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx index 7931544..a16a61a 100644 --- a/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx +++ b/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx @@ -204,6 +204,13 @@ export const EditBackupConfigComponent = ({ try { const storages = await storageApi.getStorages(database.workspaceId); setStorages(storages); + + if (IS_CLOUD) { + const systemStorages = storages.filter((s) => s.isSystem); + if (systemStorages.length > 0) { + updateBackupConfig({ storage: systemStorages[0] }); + } + } } catch (e) { alert((e as Error).message); } diff --git a/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx b/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx index ed2ecd9..23d6ed4 100644 --- a/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx +++ b/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx @@ -78,9 +78,10 @@ export const PlaygroundWarningComponent = (): JSX.Element => {

What is Playground?

- Playground is a dev environment where you can test small databases backup and see - Databasus in action. Databasus dev team can test new features and see issues which hard - to detect when using self hosted (without logs or reports) + Playground is a dev environment of Databasus development team. It is used by Databasus + dev team to test new features and see issues which hard to detect when using self hosted + (without logs or reports).{' '} + Here you can make backups for small and not critical databases for free

@@ -114,7 +115,8 @@ export const PlaygroundWarningComponent = (): JSX.Element => { No, because playground use only read-only users and cannot affect your DB. Only issue you can face is instability: playground background workers frequently reloaded so backup can be slower or be restarted due to app restart. Do not rely production DBs on - playground, please + playground, please. At once we may clean backups or something like this. At least, check + your backups here once a week

diff --git a/frontend/src/features/storages/ui/StorageCardComponent.tsx b/frontend/src/features/storages/ui/StorageCardComponent.tsx index 08a7a00..f66e4fe 100644 --- a/frontend/src/features/storages/ui/StorageCardComponent.tsx +++ b/frontend/src/features/storages/ui/StorageCardComponent.tsx @@ -42,7 +42,7 @@ export const StorageCardComponent = ({ )} {storage.isSystem && ( -
+
System storage
)} diff --git a/frontend/src/features/storages/ui/StorageComponent.tsx b/frontend/src/features/storages/ui/StorageComponent.tsx index 43b0404..2ab10ab 100644 --- a/frontend/src/features/storages/ui/StorageComponent.tsx +++ b/frontend/src/features/storages/ui/StorageComponent.tsx @@ -143,15 +143,22 @@ export const StorageComponent = ({ ) : (
{!isEditName ? ( -
- {storage.name} - {(storage.isSystem && user.role === UserRole.ADMIN) || - (isCanManageStorages && ( + <> +
+ {storage.name} + {(!storage.isSystem || user.role === UserRole.ADMIN) && isCanManageStorages && (
startEdit('name')}>
- ))} -
+ )} +
+ + {storage.isSystem && ( + + System storage + + )} + ) : (
@@ -220,19 +227,23 @@ export const StorageComponent = ({
)} -
-
Storage settings
+ {!storage.isSystem || + (user.role === UserRole.ADMIN && ( +
+
Storage settings
- {!isEditSettings && - isCanManageStorages && - !(storage.isSystem && user.role !== UserRole.ADMIN) ? ( -
startEdit('settings')}> - + {!isEditSettings && isCanManageStorages ? ( +
startEdit('settings')} + > + +
+ ) : ( +
+ )}
- ) : ( -
- )} -
+ ))}
{isEditSettings && isCanManageStorages ? ( @@ -254,7 +265,7 @@ export const StorageComponent = ({ )}
- {!isEditSettings && ( + {!isEditSettings && (!storage.isSystem || user.role === UserRole.ADMIN) && (