Skip to content

Commit a0c9bb9

Browse files
committed
feat(FR-1507): add a value to config.toml to enalbe reservoir page
1 parent 5357af0 commit a0c9bb9

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

config.toml.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ enableExtendLoginSession = false # If true, enables login session extensi
3232
enableImportFromHuggingFace = false # Enable import from Hugging Face feature. (From Backend.AI 24.09)
3333
enableInteractiveLoginAccountSwitch = true # If false, hide the "Sign in with a different account" button from the interactive login page.
3434
enableModelFolders = true # Enable model folders feature. (From Backend.AI 23.03)
35+
enableReservoir = false # Enable reservoir page
3536

3637
[wsproxy]
3738
proxyURL = "[Proxy URL]"

react/src/components/MainLayout/WebUISider.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,14 @@ const WebUISider: React.FC<WebUISiderProps> = (props) => {
287287
icon: <SolutionOutlined style={{ color: token.colorInfo }} />,
288288
key: 'resource-policy',
289289
},
290-
baiClient?.supports('reservoir') && {
291-
label: <WebUILink to="/reservoir">{t('webui.menu.Reservoir')}</WebUILink>,
292-
icon: <PackagePlus style={{ color: token.colorInfo }} />,
293-
key: 'reservoir',
294-
},
290+
baiClient?.supports('reservoir') &&
291+
baiClient?._config.enableReservoir && {
292+
label: (
293+
<WebUILink to="/reservoir">{t('webui.menu.Reservoir')}</WebUILink>
294+
),
295+
icon: <PackagePlus style={{ color: token.colorInfo }} />,
296+
key: 'reservoir',
297+
},
295298
]);
296299

297300
const superAdminMenu: MenuProps['items'] = [

react/src/hooks/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ type BackendAIConfig = {
605605
showNonInstalledImages: boolean;
606606
enableInteractiveLoginAccountSwitch: boolean;
607607
isDirectorySizeVisible: boolean;
608+
enableReservoir: boolean;
608609
debug: boolean;
609610
[key: string]: any;
610611
};

src/components/backend-ai-login.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export default class BackendAILogin extends BackendAIPage {
144144
@property({ type: Boolean }) enableExtendLoginSession = false;
145145
@property({ type: Boolean }) enableModelFolders = true;
146146
@property({ type: Boolean }) showNonInstalledImages = false;
147+
@property({ type: Boolean }) enableReservoir = false;
147148
@property({ type: Boolean }) enableInteractiveLoginAccountSwitch = true;
148149
@property({ type: String }) eduAppNamePrefix;
149150
@property({ type: String }) pluginPages;
@@ -867,6 +868,12 @@ export default class BackendAILogin extends BackendAIPage {
867868
defaultValue: true,
868869
value: generalConfig?.enableModelFolders,
869870
} as ConfigValueObject) as boolean;
871+
// Enable reservoir feature
872+
this.enableReservoir = this._getConfigValueByExists(generalConfig, {
873+
valueType: 'boolean',
874+
defaultValue: false,
875+
value: generalConfig?.enableReservoir,
876+
} as ConfigValueObject) as boolean;
870877
}
871878

872879
/**
@@ -1937,6 +1944,8 @@ export default class BackendAILogin extends BackendAIPage {
19371944
globalThis.backendaiclient._config.inactiveList = this.inactiveList;
19381945
globalThis.backendaiclient._config.allowSignout = this.allow_signout;
19391946
globalThis.backendaiclient.ready = true;
1947+
globalThis.backendaiclient._config.enableReservoir =
1948+
this.enableReservoir;
19401949
if (
19411950
this.endpoints.indexOf(
19421951
globalThis.backendaiclient._config.endpoint as string,

0 commit comments

Comments
 (0)