-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add to Lookout to allow reprioritization of Jobs (#591)
* Initial changes for Job reprioritization * Functioning reprioritize * Add newPriority input * Displayed failed reprioritization better * Add jobset reprioritization * Formatting tweaks * Formatting changes * Fix jobset button states * Handle new api structure * Fix JobService to use new variable names * Tidy up from codereview * Tidy up from code review * Use new css class names in job-set Outcomes * Fix job sets * Use Dialog instead of Modal * Fix CancelJobSet ListItemText className * Reset reprioritize contexts on deselectAll * Remove forwardRef from RepioritizeJob components
- Loading branch information
1 parent
cb2d468
commit 3ed91b8
Showing
19 changed files
with
996 additions
and
70 deletions.
There are no files selected for viewing
48 changes: 0 additions & 48 deletions
48
internal/lookout/ui/src/components/job-sets/CancelJobSets.css
This file was deleted.
Oops, something went wrong.
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
48 changes: 48 additions & 0 deletions
48
internal/lookout/ui/src/components/job-sets/JobSetActions.css
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,48 @@ | ||
.job-sets-action-container { | ||
padding: 0 4em 2em 4em; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 100%; | ||
max-height: 100%; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-text { | ||
width: 100%; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-table-container { | ||
width: 100%; | ||
max-height: 100%; | ||
margin-bottom: 2em; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-table { | ||
width: 100%; | ||
table-layout: fixed; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-id { | ||
width: 40%; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-error { | ||
width: 60% !important; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-wrap { | ||
white-space: normal; | ||
word-wrap: break-word; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-success { | ||
background-color: #e8f5e9; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-failure-header { | ||
background-color: #ffcdd2 !important; | ||
} | ||
|
||
.job-sets-action-container .job-sets-action-failure { | ||
background-color: #ffebee; | ||
} |
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
49 changes: 49 additions & 0 deletions
49
internal/lookout/ui/src/components/job-sets/ReprioritizeJobSets.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,49 @@ | ||
import React from "react" | ||
|
||
import { List, ListItem, ListItemText, Paper, TextField } from "@material-ui/core" | ||
|
||
import { JobSet } from "../../services/JobService" | ||
import LoadingButton from "../jobs/LoadingButton" | ||
|
||
import "./JobSetActions.css" | ||
|
||
type ReprioritizeJobSetsProps = { | ||
queue: string | ||
jobSets: JobSet[] | ||
isLoading: boolean | ||
isValid: boolean | ||
onReprioritizeJobsSets: () => void | ||
onPriorityChange: (e: string) => void | ||
} | ||
|
||
export default function ReprioritizeJobSets(props: ReprioritizeJobSetsProps) { | ||
return ( | ||
<div className="job-sets-action-container"> | ||
<p className="job-sets-action-text">The following Job Sets in queue {props.queue} will be reprioritized:</p> | ||
<List component={Paper} className="job-sets-action-table-container"> | ||
{props.jobSets.map((jobSet) => ( | ||
<ListItem key={jobSet.jobSetId}> | ||
<ListItemText className="job-sets-action-wrap">{jobSet.jobSetId}</ListItemText> | ||
</ListItem> | ||
))} | ||
</List> | ||
<div> | ||
<TextField | ||
autoFocus={true} | ||
placeholder={"New priority"} | ||
margin={"normal"} | ||
type={"text"} | ||
error={!props.isValid} | ||
helperText={!props.isValid ? "Value must be a number >= 0" : " "} | ||
onChange={(event) => props.onPriorityChange(event.target.value)} | ||
/> | ||
<LoadingButton | ||
content={"Reprioritize Job Sets"} | ||
isDisabled={!props.isValid} | ||
isLoading={props.isLoading} | ||
onClick={props.onReprioritizeJobsSets} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} |
68 changes: 68 additions & 0 deletions
68
internal/lookout/ui/src/components/job-sets/ReprioritizeJobSetsDialog.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,68 @@ | ||
import React from "react" | ||
|
||
import { Dialog, DialogContent, DialogTitle } from "@material-ui/core" | ||
|
||
import { ReprioritizeJobSetsRequestStatus } from "../../containers/JobSetsContainer" | ||
import { JobSet, ReprioritizeJobSetsResult } from "../../services/JobService" | ||
import ReprioritizeJobSets from "./ReprioritizeJobSets" | ||
import ReprioritizeJobSetsOutcome from "./ReprioritizeJobSetsOutcome" | ||
|
||
export type ReprioritizeJobSetsDialogState = "ReprioritizeJobSets" | "ReprioritizeJobSetsResult" | "None" | ||
|
||
export interface ReprioritizeJobSetsDialogContext { | ||
dialogState: ReprioritizeJobSetsDialogState | ||
queue: string | ||
newPriority: number | ||
isValid: boolean | ||
jobSetsToReprioritize: JobSet[] | ||
reprioritizeJobSetsResult: ReprioritizeJobSetsResult | ||
reproiritizeJobSetsRequestStatus: ReprioritizeJobSetsRequestStatus | ||
} | ||
|
||
interface ReprioritizeJobSetsProps extends ReprioritizeJobSetsDialogContext { | ||
onReprioritizeJobSets: () => void | ||
onPriorityChange: (e: string) => void | ||
onClose: () => void | ||
} | ||
|
||
export default function ReprioritizeJobSetsDialog(props: ReprioritizeJobSetsProps) { | ||
const isOpen = props.dialogState === "ReprioritizeJobSets" || props.dialogState === "ReprioritizeJobSetsResult" | ||
const isLoading = props.reproiritizeJobSetsRequestStatus === "Loading" | ||
|
||
let content = <div /> | ||
if (props.dialogState === "ReprioritizeJobSets") { | ||
content = ( | ||
<ReprioritizeJobSets | ||
queue={props.queue} | ||
jobSets={props.jobSetsToReprioritize} | ||
isLoading={isLoading} | ||
isValid={props.isValid} | ||
onReprioritizeJobsSets={props.onReprioritizeJobSets} | ||
onPriorityChange={props.onPriorityChange} | ||
/> | ||
) | ||
} | ||
if (props.dialogState === "ReprioritizeJobSetsResult") { | ||
content = ( | ||
<ReprioritizeJobSetsOutcome | ||
reprioritizeJobSetResult={props.reprioritizeJobSetsResult} | ||
isLoading={isLoading} | ||
newPriority={props.newPriority} | ||
onReprioritizeJobSets={props.onReprioritizeJobSets} | ||
/> | ||
) | ||
} | ||
|
||
return ( | ||
<Dialog | ||
open={isOpen} | ||
aria-labelledby="reprioritize-job-sets-dialog-title" | ||
aria-describedby="reprioritize-job-sets-dialog-description" | ||
onClose={props.onClose} | ||
maxWidth={"md"} | ||
> | ||
<DialogTitle id="-reprioritize-job-sets-dialog-title">Reprioritize Job Sets</DialogTitle> | ||
<DialogContent>{content}</DialogContent> | ||
</Dialog> | ||
) | ||
} |
Oops, something went wrong.