-
Notifications
You must be signed in to change notification settings - Fork 4
i15-1: display the queue from the daq-queue-service #45
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
Merged
Merged
Changes from 41 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
628e71d
Save example queue - does not return to robot page for some reason
noemifrisina f90ab19
Add daq queue to helm chart
noemifrisina 1cc9276
Save basic query for interrogating the queue
noemifrisina c0a9717
A first displayed queue
noemifrisina 7d9d847
Tidy up and add colour to chips
noemifrisina 766ac30
Display plan parameters as a string and add a comment about it
noemifrisina ff7585e
Fix typing in test
noemifrisina f0bbc56
Actually save the patch queue state
noemifrisina 8423d9f
Add generated types from queue fastapi
jacob720 19f7ee6
Update generated queue types
jacob720 a8a0161
Add script to generate queue types
jacob720 0e7c48e
Update mock data
jacob720 380459a
Add pause queue toggle button
jacob720 ef8f904
Use SSE to get event driven updates
jacob720 4842f66
Add button to cancel tasks
jacob720 c00f0be
Allow re-ordering of tasks
jacob720 9165e79
Add toggle to show historic tasks and button to delete history
jacob720 1c957fc
Fix move task logic
jacob720 70ebbf1
Disable clear history button unless historic tasks shown
jacob720 6fc8aab
Use more up to date node image for dev container
jacob720 ad76f2c
Rename pause queue component
jacob720 b975de0
Only make tasks draggable if status is 'Queued'
jacob720 eabc095
Don't display task ID
jacob720 1b56518
PR suggestion
jacob720 b3b2697
Have a local queue server dev mode
jacob720 263faa7
Improve docs
jacob720 62ee74b
Link to issue about displaying params
jacob720 eaf1247
Display when not connected to queue
jacob720 89ec400
Small change
jacob720 d0966f9
Put queue status panel inside table bar
jacob720 b3f2e4b
Add tests WIP
jacob720 16922b0
Add tests for queue status panel
jacob720 6ea2328
Make queue pause button smaller
jacob720 a8b173a
Add tests for QueueView
jacob720 e9bbded
Put move logic in a helper function
jacob720 766aec7
Add test for new position calculation
jacob720 03c13b8
Fix lint
jacob720 3b54cb1
Fix bug
jacob720 bfdf52b
Fix some lint issues
jacob720 a9b726e
PR comments
jacob720 b1660b3
Fix lockfile
jacob720 15b20d1
Merge branch 'main' into 1625-display-queue
jacob720 fcf191f
Fix lint in tests
jacob720 9e29162
Move generated folder
jacob720 ffa221a
Ignore lint for generated code
jacob720 5f1f547
Try to fix deployed UI
jacob720 25ce7bc
Revert unneeded fix
jacob720 14be2f3
Remove .devcontainer/devcontainer-lock.json
jacob720 198474d
PR comments
jacob720 47d17f1
Fix the mocks for the history of the queue
DominicOram 92151ca
Fix typo for endpoint
DominicOram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,9 @@ | ||
| { | ||
| "features": { | ||
| "ghcr.io/diamondlightsource/devcontainer-features/bash-config:1": { | ||
| "version": "1.0.3", | ||
| "resolved": "ghcr.io/diamondlightsource/devcontainer-features/bash-config@sha256:5b32dfbc5d02a04b200eba276b5f21b6fce31658e8965f7c4b25c002b46dab4c", | ||
| "integrity": "sha256:5b32dfbc5d02a04b200eba276b5f21b6fce31658e8965f7c4b25c002b46dab4c" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,103 @@ | ||
| import { fireEvent, render, screen } from "@atlas/vitest-conf"; | ||
| import { describe, it, expect, vi, afterEach } from "vitest"; | ||
| import { QueueStatusPanel, QueueControlButton } from "./QueueStatusPanel"; | ||
| import * as queueService from "./queueService"; | ||
|
|
||
| afterEach(() => { | ||
| vi.restoreAllMocks(); | ||
| }); | ||
|
|
||
| describe("QueueStatusPanel", () => { | ||
| it("shows Queue Running when queue not paused and not empty", () => { | ||
| vi.spyOn(queueService, "useConnected").mockReturnValue({ | ||
| connected: true, | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useGetQueuedTasks").mockReturnValue({ | ||
| data: [{ id: 1 }], | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useToggleQueueState").mockReturnValue({ | ||
| paused: false, | ||
| } as any); | ||
|
|
||
| render(<QueueStatusPanel />); | ||
|
|
||
| expect(screen.getByText(/Queue Running/i)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("shows Queue Finished when queue empty", () => { | ||
| vi.spyOn(queueService, "useConnected").mockReturnValue({ | ||
| connected: true, | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useGetQueuedTasks").mockReturnValue({ | ||
| data: [], | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useToggleQueueState").mockReturnValue({ | ||
| paused: false, | ||
| } as any); | ||
|
|
||
| render(<QueueStatusPanel />); | ||
|
|
||
| expect(screen.getByText(/Queue Finished/i)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("shows Queue Paused when queue paused", () => { | ||
| vi.spyOn(queueService, "useConnected").mockReturnValue({ | ||
| connected: true, | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useGetQueuedTasks").mockReturnValue({ | ||
| data: [{ id: 1 }], | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useToggleQueueState").mockReturnValue({ | ||
| paused: true, | ||
| } as any); | ||
|
|
||
| render(<QueueStatusPanel />); | ||
|
|
||
| expect(screen.getByText(/Queue Paused/i)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("shows Queue Not Connected when queue not connected", () => { | ||
| vi.spyOn(queueService, "useConnected").mockReturnValue({ | ||
| connected: false, | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useGetQueuedTasks").mockReturnValue({ | ||
| data: [{ id: 1 }], | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useToggleQueueState").mockReturnValue({ | ||
| paused: true, | ||
| } as any); | ||
|
|
||
| render(<QueueStatusPanel />); | ||
|
|
||
| expect(screen.getByText(/Queue Not Connected/i)).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("QueueControlButton", () => { | ||
| it("calls toggle on click", () => { | ||
| const toggle = vi.fn(); | ||
|
|
||
| vi.spyOn(queueService, "useConnected").mockReturnValue({ | ||
| connected: true, | ||
| } as any); | ||
|
|
||
| vi.spyOn(queueService, "useToggleQueueState").mockReturnValue({ | ||
| paused: false, | ||
| toggle, | ||
| isLoading: false, | ||
| } as any); | ||
|
|
||
| render(<QueueControlButton />); | ||
| fireEvent.click(screen.getByRole("button")); | ||
|
|
||
| expect(toggle).toHaveBeenCalled(); | ||
| }); | ||
| }); |
This file contains hidden or 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,96 @@ | ||
| import { | ||
| Box, | ||
| Button, | ||
| CircularProgress, | ||
| Stack, | ||
| Typography, | ||
| } from "@mui/material"; | ||
| import PlayArrowIcon from "@mui/icons-material/PlayArrow"; | ||
| import PauseIcon from "@mui/icons-material/Pause"; | ||
| import { | ||
| useConnected, | ||
| useGetQueuedTasks, | ||
| useToggleQueueState, | ||
| } from "./queueService"; | ||
|
|
||
| export function QueueControlButton() { | ||
| const { paused, toggle, isLoading } = useToggleQueueState(); | ||
| const { connected } = useConnected(); | ||
|
|
||
| const icon = isLoading ? ( | ||
| <CircularProgress size={16} /> | ||
| ) : paused ? ( | ||
| <PlayArrowIcon fontSize="small" /> | ||
| ) : ( | ||
| <PauseIcon fontSize="small" /> | ||
| ); | ||
|
|
||
| return ( | ||
| <Button | ||
| sx={{ | ||
| height: 28, | ||
| width: 100, | ||
| alignItems: "center", | ||
| "& .MuiButton-startIcon": { | ||
| display: "flex", | ||
| alignItems: "center", | ||
| }, | ||
| }} | ||
| variant="contained" | ||
| color={!connected ? "error" : paused ? "warning" : "success"} | ||
| onClick={toggle} | ||
| disabled={!connected} | ||
| startIcon={icon} | ||
| > | ||
| {paused ? "Resume" : "Pause"} | ||
| </Button> | ||
| ); | ||
| } | ||
|
|
||
| export function QueueStatusPanel() { | ||
| const { paused } = useToggleQueueState(); | ||
| const queuedTasks = useGetQueuedTasks(); | ||
| const empty = !queuedTasks.data || queuedTasks.data.length === 0; | ||
| const { connected } = useConnected(); | ||
|
|
||
| return ( | ||
| <Box | ||
| sx={{ | ||
| display: "flex", | ||
| border: "1px solid", | ||
| borderColor: !connected | ||
| ? "error.main" | ||
| : paused | ||
| ? "warning.main" | ||
| : "success.main", | ||
| borderRadius: 1, | ||
| padding: 1, | ||
| }} | ||
| > | ||
| <Stack direction="row" spacing={2} alignItems="center"> | ||
| <Typography | ||
| variant="h6" | ||
| sx={{ | ||
| color: !connected | ||
| ? "error.main" | ||
| : paused | ||
| ? "warning.main" | ||
| : "success.main", | ||
| fontWeight: 500, | ||
| fontSize: 17, | ||
| }} | ||
| > | ||
| Queue{" "} | ||
| {!connected | ||
| ? "Not Connected" | ||
| : empty | ||
| ? "Finished" | ||
| : paused | ||
| ? "Paused" | ||
| : "Running"} | ||
| </Typography> | ||
| <QueueControlButton /> | ||
| </Stack> | ||
| </Box> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should: Can you remove this and add to the
.gitignore?