Skip to content

Commit

Permalink
Revert "[UPSTREAM] Add spawn progress watch modal, replace spawn_pend…
Browse files Browse the repository at this point in the history
…ing page (opendatahub-io-contrib#47)"

This reverts commit 0ce2482.
  • Loading branch information
Chad Roberts committed Nov 29, 2021
1 parent 0ce2482 commit 375ab0f
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 642 deletions.
2 changes: 1 addition & 1 deletion jupyterhub_singleuser_profiles/ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/build

# Created templates
/templates
/templates/admin.html

*stats.json

Expand Down
2 changes: 1 addition & 1 deletion jupyterhub_singleuser_profiles/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"scripts": {
"build": "run-s build:prod",
"postbuild": "mkdir -p templates; cp build/index.html templates/spawn.html; cp build/index.html templates/spawn_pending.html; cp build/admin.html templates/admin.html",
"postbuild": "cp build/admin.html templates/admin.html",
"build:analyze": "export _JSP_OUTPUT_ONLY=true; run-s build build:bundle-profile build:bundle-analyze",
"build:bundle-profile": "webpack --config ./config/webpack.prod.js --json ./bundle.stats.json",
"build:bundle-analyze": "webpack-bundle-analyzer ./bundle.stats.json",
Expand Down
11 changes: 0 additions & 11 deletions jupyterhub_singleuser_profiles/ui/src/App/App.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
html {
height: 100%;
}

body, #root {
display: flex;
flex: 1;
flex-direction: column;
}

.jsp-app {
flex: 1;
position: relative;
padding: 20px var(--pf-global--spacer--2xl) !important;
margin-top: -20px !important;
Expand Down
62 changes: 27 additions & 35 deletions jupyterhub_singleuser_profiles/ui/src/App/Spawner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import '@patternfly/patternfly/patternfly.min.css';
import '@patternfly/patternfly/patternfly-addons.css';
import {
Alert,
Button,
ButtonVariant,
Title,
EmptyState,
EmptyStateVariant,
Expand All @@ -16,12 +14,10 @@ import { WarningTriangleIcon } from '@patternfly/react-icons';
import ImageForm from '../ImageForm/ImageForm';
import SizesForm from '../SizesForm/SizesForm';
import EnvVarForm from '../EnvVarForm/EnvVarForm';
import { HubUserRequest } from '../utils/HubCalls';
import { APIGet } from '../utils/APICalls';
import { CM_PATH, FOR_USER, INSTANCE_PATH, UI_CONFIG_PATH, USER } from '../utils/const';
import { InstanceType, UiConfigType, UserConfigMapType } from '../utils/types';
import { initSegment } from '../utils/segmentIOUtils';
import StartServerModal from './StartServerModal';
import { fireTrackingEvent, initSegment } from '../utils/segmentIOUtils';

import './App.scss';

Expand All @@ -30,23 +26,9 @@ const Spawner: React.FC = () => {
const [configError, setConfigError] = React.useState<string>();
const [imageValid, setImageValid] = React.useState<boolean>(false);
const [userConfig, setUserConfig] = React.useState<UserConfigMapType>();
const [startShown, setStartShown] = React.useState<boolean>(false);
const pageRef = React.useRef<HTMLDivElement>(null);

React.useEffect(() => {
let cancelled = false;
HubUserRequest('GET')
.then((response) => {
return response?.json();
})
.then((results) => {
if (results.pending) {
setStartShown(true);
}
})
.catch((e) => {
console.error(e);
});

APIGet(CM_PATH).then((data: UserConfigMapType) => {
if (!cancelled) {
Expand Down Expand Up @@ -83,6 +65,20 @@ const Spawner: React.FC = () => {
});
}, []);

const fireStartServerEvent = () => {
APIGet(CM_PATH)
.then((data: UserConfigMapType) => {
fireTrackingEvent('Notebook Server Started', {
GPU: data.gpu,
lastSelectedSize: data.last_selected_size,
lastSelectedImage: data.last_selected_image,
});
})
.catch((e) => {
console.dir(e);
});
};

const renderContent = () => {
if (configError) {
return (
Expand All @@ -106,27 +102,30 @@ const Spawner: React.FC = () => {

return (
<>
<ImageForm uiConfig={uiConfig} userConfig={userConfig} onValidImage={setImageValid} />
<ImageForm
uiConfig={uiConfig}
userConfig={userConfig}
onValidImage={() => setImageValid(true)}
/>
<SizesForm uiConfig={uiConfig} userConfig={userConfig} />
{uiConfig.envVarConfig?.enabled !== false && (
<EnvVarForm uiConfig={uiConfig} userConfig={userConfig} />
)}
<div className="jsp-spawner__buttons-bar">
<Button
variant={ButtonVariant.primary}
<input
type="submit"
disabled={!imageValid}
className="jsp-app__spawner__submit-button"
onClick={() => setStartShown(true)}
>
Start Server
</Button>
value="Start server"
onClick={fireStartServerEvent}
className="jsp-spawner__submit-button pf-c-button pf-m-primary"
/>
</div>
</>
);
};

return (
<div className="jsp-app jsp-spawner" ref={pageRef}>
<div className="jsp-app jsp-spawner">
<div className="jsp-app__header">
{FOR_USER ? (
<Alert
Expand All @@ -139,13 +138,6 @@ const Spawner: React.FC = () => {
<div className="jsp-app__header__sub-title">Select options for your notebook server.</div>
</div>
{renderContent()}
{startShown ? (
<StartServerModal
pageRef={pageRef.current as HTMLElement}
shown={startShown}
onClose={() => setStartShown(false)}
/>
) : null}
</div>
);
};
Expand Down
88 changes: 0 additions & 88 deletions jupyterhub_singleuser_profiles/ui/src/App/StartServerModal.scss

This file was deleted.

Loading

0 comments on commit 375ab0f

Please sign in to comment.