-
Notifications
You must be signed in to change notification settings - Fork 1
Implement selectable job table rows to select a workflow #175
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 all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5908385
Add custom styled table row component for selectable job table row
yousefmoazzam a34856a
Add selected workflow state to job table
yousefmoazzam 3c9428e
Select workflow associated with job table row on click
yousefmoazzam d46974d
Move selected workflow state to top-level app component
yousefmoazzam 34da52b
Pass selected workflow to plot component
yousefmoazzam e57ee1d
Display "no workflow selected" message in plot component
yousefmoazzam aa6bdb1
Display data plotter only if selected workflow is not `null`
yousefmoazzam 2bd200b
Pass selected workflow to log component
yousefmoazzam 0caad8a
Remove workflow selector in log component
yousefmoazzam 40622c5
Remove table info state
yousefmoazzam f9bcc32
Display "no workflow selected" message instead of plot component
yousefmoazzam 6ee6538
Handle `undefined` query response separately
yousefmoazzam a148fb0
Display buttons for log artifacts of selected workflow
yousefmoazzam c151bcd
Replace MUI icon with lucide icon
yousefmoazzam 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
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
14 changes: 14 additions & 0 deletions
14
frontend/unified/src/components/JobsViewer/JobTableRow.tsx
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,14 @@ | ||
| import { TableRow, TableRowProps } from "@mui/material"; | ||
| import { alpha, styled } from "@mui/material/styles"; | ||
|
|
||
| export const JobTableRow = styled(TableRow)<TableRowProps>(({ theme }) => ({ | ||
| // Duplicating the state selector `Mui-selected` to have the background colour of a selected | ||
| // row take precendence over the background colour of a hovered-over row | ||
| "&.JobTableRow.Mui-selected.Mui-selected.Mui-selected": { | ||
| backgroundColor: alpha(theme.palette.primary.main, 0.25), | ||
| }, | ||
| "&.JobTableRow.MuiTableRow-hover:hover": { | ||
| backgroundColor: alpha(theme.palette.primary.main, 0.15), | ||
| cursor: "pointer", | ||
| }, | ||
| })); |
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Most of the styling is self-explanatory, but this one deserves an explicit explanation.
The problem
In order to achieve the bolding of text when a row was selected, the text naturally changes from normal to bold. When the font weight changes between normal and bold, the table cell "shifts" ever so slightly, due to the text shrinking/expanding when going between normal and bold.
The solution chosen here
From some searching online, there are some CSS hacks which seemed interesting and from which I took some inspiration from.
What is going here is that there's a two "versions" of the workflow name text: one normal, and one bolded. They both occupy the same space via the parent
Boxhaving thegriddisplay and them both being put into the same single cell of the grid.When a workflow is unselected, the normal version is display and the bolded version is hidden, and when a workflow is selected, the normal version is hidden and the bolded version is displayed.
Because both normal and bolded versions exist in the DOM simultaneously, the width of the rendered table cell in the jobs table will always stay the same no matter which one is visible.
Any other suggestions are most welcome, I settled for this due to it not requiring separate CSS files involving pseudo elements or anything like that, which solutions online I found made use of.