diff --git a/frontend/src/servers/App.tsx b/frontend/src/servers/App.tsx
index 79ad26d..4dd62d6 100644
--- a/frontend/src/servers/App.tsx
+++ b/frontend/src/servers/App.tsx
@@ -15,6 +15,7 @@ import { useJupyterhub } from '../common/JupyterhubContext';
export interface IAppProps {
images: IEnvironmentData[];
server_data: IServerData[];
+ default_server_data: IServerData;
allow_named_servers: boolean;
named_server_limit_per_user: number;
}
@@ -34,8 +35,13 @@ export default function App(props: IAppProps) {
+
-
diff --git a/frontend/src/servers/NewServerDialog.tsx b/frontend/src/servers/NewServerDialog.tsx
index fbb744a..269e026 100644
--- a/frontend/src/servers/NewServerDialog.tsx
+++ b/frontend/src/servers/NewServerDialog.tsx
@@ -9,7 +9,7 @@ import {
OutlinedTextFieldProps
} from '@mui/material';
import { GridRowSelectionModel } from '@mui/x-data-grid';
-import { Fragment, memo, useCallback, useState } from 'react';
+import { Fragment, memo, useCallback, useMemo, useState } from 'react';
import { EnvironmentList } from '../environments/EnvironmentList';
import { IEnvironmentData } from '../environments/types';
@@ -21,6 +21,8 @@ import { useJupyterhub } from '../common/JupyterhubContext';
export interface INewServerDialogProps {
images: IEnvironmentData[];
allowNamedServers: boolean;
+ defaultRunning: boolean;
+ serverLimit: number;
}
const commonInputProps: OutlinedTextFieldProps = {
@@ -77,6 +79,18 @@ function _NewServerDialog(props: INewServerDialogProps) {
console.error(e);
}
}, [serverName, rowSelectionModel, props.images, axios, jhData]);
+ const disabled = useMemo(() => {
+ if (rowSelectionModel.length === 0) {
+ return true;
+ }
+ if (serverName.length === 0) {
+ if (props.defaultRunning) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }, [rowSelectionModel, serverName, props.defaultRunning]);
return (
@@ -95,9 +109,11 @@ function _NewServerDialog(props: INewServerDialogProps) {
name="server_name"
label="Server name"
type="string"
- required={true}
+ required={false}
+ helperText="If empty, a default server will be created"
onChange={e => setServerName(e.target.value)}
value={serverName}
+ disabled={!props.allowNamedServers}
/>
)}
@@ -118,10 +134,7 @@ function _NewServerDialog(props: INewServerDialogProps) {