Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop pending page #396

Merged
merged 6 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jhub_apps/static/css/index.css

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions jhub_apps/static/js/index.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CreateApp } from './pages/create-app/create-app';
import { EditApp } from './pages/edit-app/edit-app';
import { Home } from './pages/home/home';
import { ServerTypes } from './pages/server-types/server-types';
import { StopPending } from './pages/stop-pending/stop-pending';
import {
currentNotification,
currentJhData as defaultJhData,
Expand Down Expand Up @@ -111,6 +112,7 @@ export const App = (): React.ReactElement => {
<Route path="/create-app" element={<CreateApp />} />
<Route path="/edit-app" element={<EditApp />} />
<Route path="/server-types" element={<ServerTypes />} />
<Route path="/stop-pending" element={<StopPending />} />
<Route path="/" element={<Home />} />
</Routes>
</Box>
Expand Down
22 changes: 22 additions & 0 deletions ui/src/pages/stop-pending/stop-pending.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#stop-pending.container {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
font-family: Arial, sans-serif;
padding-top: 50px;
}

.home-button {
background-color: #a020f0; /* Purple color for the button */
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}

.home-button:hover {
background-color: #800080; /* Darker purple for hover effect */
}
46 changes: 46 additions & 0 deletions ui/src/pages/stop-pending/stop-pending.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
import { RecoilRoot } from 'recoil';
import { StopPending } from './stop-pending';

const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
},
},
});

const componentWrapper = (
<RecoilRoot>
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<StopPending />
</BrowserRouter>
</QueryClientProvider>
</RecoilRoot>
);

describe('StopPending', () => {
test('should render successfully', async () => {
const { baseElement } = render(componentWrapper);
expect(baseElement).toBeTruthy();
expect(
screen.getByText(/Thank you for your patience/i),
).toBeInTheDocument();
expect(
screen.getByText(
/We are stopping your application, you may start it again when we have finished/i,
),
).toBeInTheDocument();
expect(screen.getByRole('progressbar')).toBeInTheDocument();
expect(
screen.getByText(/You may return to the Application Screen at any time/i),
).toBeInTheDocument();
expect(
screen.getByRole('button', { name: /Back To Home/i }),
).toBeInTheDocument();
});
});
54 changes: 54 additions & 0 deletions ui/src/pages/stop-pending/stop-pending.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// src/pages/stop-pending/StopPending.tsx
import { Box, Button, CircularProgress, Typography } from '@mui/material';
import { APP_BASE_URL } from '@src/utils/constants';
import { navigateToUrl } from '@src/utils/jupyterhub';
import React from 'react';
import './stop-pending.css';

export const StopPending = (): React.ReactElement => {
return (
<Box
id="stop-pending"
className="container"
display="flex"
flexDirection="column"
alignItems="center"
textAlign="center"
padding="20px"
>
<Box
display="flex"
flexDirection="column"
alignItems="center"
textAlign="center"
>
<Typography
variant="h5"
component="h1"
gutterBottom
sx={{ paddingBottom: '0 !important' }}
>
Thank you for your patience
<br />
We are stopping your application, you may start it again when we have
finished
</Typography>
<CircularProgress style={{ color: '#a020f0', margin: '20px 0' }} />
</Box>
<Box sx={{ marginTop: '4rem' }}>
<Typography variant="body1" gutterBottom>
You may return to the Application Screen at any time
</Typography>
<Button
id="back-btn"
variant="contained"
color="primary"
style={{ backgroundColor: '#a020f0' }}
onClick={() => navigateToUrl(`${APP_BASE_URL}`)}
>
Back To Home
</Button>
</Box>
</Box>
);
};
Loading