-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update project list view to readily show active notebooks (#3348)
- Loading branch information
1 parent
3b5a56b
commit 6b6dc43
Showing
17 changed files
with
394 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
frontend/src/pages/projects/notebook/NotebookStateAction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as React from 'react'; | ||
import { Button } from '@patternfly/react-core'; | ||
import { NotebookImageAvailability } from '~/pages/projects/screens/detail/notebooks/const'; | ||
import useNotebookImage from '~/pages/projects/screens/detail/notebooks/useNotebookImage'; | ||
import { NotebookState } from './types'; | ||
|
||
type Props = { | ||
notebookState: NotebookState; | ||
onStart: () => void; | ||
onStop: () => void; | ||
isDisabled?: boolean; | ||
}; | ||
|
||
const NotebookStateAction: React.FC<Props> = ({ notebookState, onStart, onStop, isDisabled }) => { | ||
const { notebook, isStarting, isRunning, isStopping } = notebookState; | ||
const [notebookImage] = useNotebookImage(notebook); | ||
|
||
const actionDisabled = | ||
isDisabled || | ||
isStopping || | ||
(notebookImage?.imageAvailability === NotebookImageAvailability.DELETED && !isRunning); | ||
|
||
return isStarting || isRunning ? ( | ||
<Button | ||
data-testid="notebook-stop-action" | ||
variant="link" | ||
isInline | ||
isDisabled={actionDisabled} | ||
onClick={onStop} | ||
> | ||
Stop | ||
</Button> | ||
) : ( | ||
<Button | ||
data-testid="notebook-start-action" | ||
variant="link" | ||
isInline | ||
isDisabled={actionDisabled} | ||
onClick={onStart} | ||
> | ||
Start | ||
</Button> | ||
); | ||
}; | ||
|
||
export default NotebookStateAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.