Skip to content

Commit

Permalink
Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Jan 18, 2024
1 parent 11b2ad1 commit 8debc9a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 51 deletions.
53 changes: 28 additions & 25 deletions frontend/src/environments/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,36 @@ import '@fontsource/roboto/500.css';
import '@fontsource/roboto/700.css';

import { createRoot } from 'react-dom/client';

import { JupyterhubContext } from '../common/JupyterhubContext';
import App, { IAppProps } from './App';

const rootElement = document.getElementById('environments-root');
const root = createRoot(rootElement!);
const dataElement = document.getElementById('tljh-page-data');
let configData: IAppProps = {
images: [],
default_cpu_limit: '2',
default_mem_limit: '2G'
};
if (dataElement) {
configData = JSON.parse(dataElement.textContent || '') as IAppProps;
}
const jhData = (window as any).jhdata;
const { base_url, xsrf_token, user, prefix, admin_access } = jhData;
if (rootElement) {
const root = createRoot(rootElement);
const dataElement = document.getElementById('tljh-page-data');
let configData: IAppProps = {
images: [],
default_cpu_limit: '2',
default_mem_limit: '2G'
};
if (dataElement) {
configData = JSON.parse(dataElement.textContent || '') as IAppProps;
}
const jhData = (window as any).jhdata;
const { base_url, xsrf_token, user, prefix, admin_access } = jhData;

root.render(
<JupyterhubContext.Provider
value={{
baseUrl: base_url,
xsrfToken: xsrf_token,
user,
prefix,
adminAccess: admin_access
}}
>
<App {...configData} />
</JupyterhubContext.Provider>
);
root.render(
<JupyterhubContext.Provider
value={{
baseUrl: base_url,
xsrfToken: xsrf_token,
user,
prefix,
adminAccess: admin_access
}}
>
<App {...configData} />
</JupyterhubContext.Provider>
);
}
2 changes: 1 addition & 1 deletion frontend/src/servers/OpenServerButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function _OpenServerButton(props: IOpenServerButton) {

setProgress(data.progress ?? 0);
};
}, [jhData, setProgress]);
}, [jhData, setProgress, props.serverName]);

return (
<Fragment>
Expand Down
53 changes: 28 additions & 25 deletions frontend/src/servers/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,33 @@ import { JupyterhubContext } from '../common/JupyterhubContext';
import App, { IAppProps } from './App';

const rootElement = document.getElementById('servers-root');
const root = createRoot(rootElement!);

const dataElement = document.getElementById('tljh-page-data');
let configData: IAppProps = {
images: [],
server_data: [],
allow_named_servers: false,
named_server_limit_per_user: 0
};
if (dataElement) {
configData = JSON.parse(dataElement.textContent || '') as IAppProps;
if (rootElement) {
const root = createRoot(rootElement);

const dataElement = document.getElementById('tljh-page-data');
let configData: IAppProps = {
images: [],
server_data: [],
allow_named_servers: false,
named_server_limit_per_user: 0
};
if (dataElement) {
configData = JSON.parse(dataElement.textContent || '') as IAppProps;
}
const jhData = (window as any).jhdata;
const { base_url, xsrf_token, user, prefix, admin_access } = jhData;
root.render(
<JupyterhubContext.Provider
value={{
baseUrl: base_url,
xsrfToken: xsrf_token,
user,
prefix,
adminAccess: admin_access
}}
>
<App {...configData} />
</JupyterhubContext.Provider>
);
}
const jhData = (window as any).jhdata;
const { base_url, xsrf_token, user, prefix, admin_access } = jhData;
root.render(
<JupyterhubContext.Provider
value={{
baseUrl: base_url,
xsrfToken: xsrf_token,
user,
prefix,
adminAccess: admin_access
}}
>
<App {...configData} />
</JupyterhubContext.Provider>
);

0 comments on commit 8debc9a

Please sign in to comment.