From 6e0ef127a694678764cc8e524ec6581112e57ac1 Mon Sep 17 00:00:00 2001
From: nowgnuesLee <192685612+nowgnuesLee@users.noreply.github.com>
Date: Thu, 25 Sep 2025 09:01:07 +0000
Subject: [PATCH] feat(FR-1507): add a value to config.toml to enalbe reservoir
page (#4327)
# Add configuration option to enable/disable Reservoir page
resolves #4326 (FR-1507)
This PR adds a new configuration option `enableReservoir` to control the visibility of the Reservoir page in the UI. By default, this feature is disabled (`false`).
The changes include:
- Adding the `enableReservoir` configuration option to the sample config file
- Updating the WebUISider component to check this configuration before displaying the Reservoir menu item
- Adding the configuration property to the BackendAIConfig type
- Implementing the property in the login component and passing it to the client configuration
**Checklist:**
- [ ] Documentation
- [ ] Minium required manager version
- [ ] Specific setting for review (eg., KB link, endpoint or how to setup)
- [ ] Minimum requirements to check during review
- [ ] Test case(s) to demonstrate the difference of before/after
---
config.toml.sample | 1 +
.../components/fragments/BAIArtifactTable.tsx | 16 ++++++----------
react/src/components/MainLayout/WebUISider.tsx | 13 ++++++++-----
react/src/hooks/index.tsx | 1 +
src/components/backend-ai-login.ts | 9 +++++++++
5 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/config.toml.sample b/config.toml.sample
index 04d51177b7..57afe3d930 100644
--- a/config.toml.sample
+++ b/config.toml.sample
@@ -32,6 +32,7 @@ enableExtendLoginSession = false # If true, enables login session extensi
enableImportFromHuggingFace = false # Enable import from Hugging Face feature. (From Backend.AI 24.09)
enableInteractiveLoginAccountSwitch = true # If false, hide the "Sign in with a different account" button from the interactive login page.
enableModelFolders = true # Enable model folders feature. (From Backend.AI 23.03)
+enableReservoir = false # Enable reservoir page
[wsproxy]
proxyURL = "[Proxy URL]"
diff --git a/packages/backend.ai-ui/src/components/fragments/BAIArtifactTable.tsx b/packages/backend.ai-ui/src/components/fragments/BAIArtifactTable.tsx
index 6b562c9146..fc81392a7b 100644
--- a/packages/backend.ai-ui/src/components/fragments/BAIArtifactTable.tsx
+++ b/packages/backend.ai-ui/src/components/fragments/BAIArtifactTable.tsx
@@ -159,11 +159,9 @@ const BAIArtifactTable = ({
}
onClick={() => onClickDelete(record.id)}
/>
@@ -173,12 +171,10 @@ const BAIArtifactTable = ({
}
- style={{
- color: token.colorInfo,
- background: token.colorInfoBg,
- }}
onClick={() => onClickRestore(record.id)}
/>
);
diff --git a/react/src/components/MainLayout/WebUISider.tsx b/react/src/components/MainLayout/WebUISider.tsx
index f66c0f87c6..dc53decbee 100644
--- a/react/src/components/MainLayout/WebUISider.tsx
+++ b/react/src/components/MainLayout/WebUISider.tsx
@@ -287,11 +287,14 @@ const WebUISider: React.FC = (props) => {
icon: ,
key: 'resource-policy',
},
- baiClient?.supports('reservoir') && {
- label: {t('webui.menu.Reservoir')},
- icon: ,
- key: 'reservoir',
- },
+ baiClient?.supports('reservoir') &&
+ baiClient?._config.enableReservoir && {
+ label: (
+ {t('webui.menu.Reservoir')}
+ ),
+ icon: ,
+ key: 'reservoir',
+ },
]);
const superAdminMenu: MenuProps['items'] = [
diff --git a/react/src/hooks/index.tsx b/react/src/hooks/index.tsx
index c954a0b7ab..160c4f06f1 100644
--- a/react/src/hooks/index.tsx
+++ b/react/src/hooks/index.tsx
@@ -605,6 +605,7 @@ type BackendAIConfig = {
showNonInstalledImages: boolean;
enableInteractiveLoginAccountSwitch: boolean;
isDirectorySizeVisible: boolean;
+ enableReservoir: boolean;
debug: boolean;
[key: string]: any;
};
diff --git a/src/components/backend-ai-login.ts b/src/components/backend-ai-login.ts
index 1794fd8d4f..5cc3053acf 100644
--- a/src/components/backend-ai-login.ts
+++ b/src/components/backend-ai-login.ts
@@ -144,6 +144,7 @@ export default class BackendAILogin extends BackendAIPage {
@property({ type: Boolean }) enableExtendLoginSession = false;
@property({ type: Boolean }) enableModelFolders = true;
@property({ type: Boolean }) showNonInstalledImages = false;
+ @property({ type: Boolean }) enableReservoir = false;
@property({ type: Boolean }) enableInteractiveLoginAccountSwitch = true;
@property({ type: String }) eduAppNamePrefix;
@property({ type: String }) pluginPages;
@@ -867,6 +868,12 @@ export default class BackendAILogin extends BackendAIPage {
defaultValue: true,
value: generalConfig?.enableModelFolders,
} as ConfigValueObject) as boolean;
+ // Enable reservoir feature
+ this.enableReservoir = this._getConfigValueByExists(generalConfig, {
+ valueType: 'boolean',
+ defaultValue: false,
+ value: generalConfig?.enableReservoir,
+ } as ConfigValueObject) as boolean;
}
/**
@@ -1937,6 +1944,8 @@ export default class BackendAILogin extends BackendAIPage {
globalThis.backendaiclient._config.inactiveList = this.inactiveList;
globalThis.backendaiclient._config.allowSignout = this.allow_signout;
globalThis.backendaiclient.ready = true;
+ globalThis.backendaiclient._config.enableReservoir =
+ this.enableReservoir;
if (
this.endpoints.indexOf(
globalThis.backendaiclient._config.endpoint as string,