-
Couldn't load subscription status.
- Fork 2
Refactor status classification #418
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
849a573
9a3be22
84baab2
b58ed2b
6a3a5f9
1271bb2
3852525
2a64f90
ef06a7b
1bb7203
dffbd22
00ad4bc
fbb2fb7
99552d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,14 @@ import { useFunctionContext } from "../../context/FunctionContext"; | |
| import { useJobContext } from "../../context/JobContext"; | ||
| import { useMMUXContext } from "../../context/MMUXContext"; | ||
| import { useSamplingContext } from "../../context/SamplingContext"; | ||
| import { getJobCollectionStatus } from "../../utils/function_utils"; | ||
| import { FunctionJob } from "../../osparc-api-ts-client"; | ||
| import { | ||
| getFunctionJobCollections, | ||
| getFunctionJobsFromFunctionJobCollection, | ||
| getJobCollectionStatus, | ||
| isFinalStatus, | ||
| extractJobStatus, | ||
| } from "../../utils/function_utils"; | ||
| import getMinMax from "../minmax"; | ||
| import CustomTooltip from "../utils/CustomTooltip"; | ||
| import JobRow from "./JobRow"; | ||
|
|
@@ -63,7 +70,7 @@ export default function JobsSelector(props: JobSelectorPropsType) { | |
| const auxJob = jc; | ||
| if (jc.jobCollection.uid === uid) { | ||
| auxJob.subJobs = auxJob.subJobs.map(j => ({ | ||
| selected: selected === true ? j.job.status === "SUCCESS" : false, | ||
| selected: selected === true ? extractJobStatus(j) === "SUCCESS" : false, | ||
| job: j.job, | ||
| })); | ||
| auxJob.selected = selected === true ? auxJob.subJobs.some(j => j.selected === true) : false; | ||
|
|
@@ -156,7 +163,7 @@ export default function JobsSelector(props: JobSelectorPropsType) { | |
| const newJobCollections: SelectedJobCollection[] = jobCollections.map(jc => { | ||
| const auxJob = jc; | ||
| auxJob.subJobs = jc.subJobs.map(subJob => ({ | ||
| selected: checked === true ? subJob.job.status === "SUCCESS" : false, | ||
| selected: checked === true ? extractJobStatus(subJob) === "SUCCESS" : false, | ||
| job: subJob.job, | ||
| })); | ||
| const auxJobState = auxJob.subJobs.map(j => j.selected); | ||
|
|
@@ -170,22 +177,6 @@ export default function JobsSelector(props: JobSelectorPropsType) { | |
| [jobCollections, updateJobContext], | ||
| ); | ||
|
|
||
| // const autoSelectJobs = useCallback(() => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The autoSelectJobs functions should not be removed but implemented, it was disabled as the feature which should automatically select the in-range jobs is not present, but due the fact that after every selection / deselection of a job, we refresh the moga, we should re-activate this and do it properly to save time for the user |
||
| // const newJobCollections: SelectedJobCollection[] = jobCollections.map(jc => { | ||
| // const auxJob = jc; | ||
| // auxJob.subJobs = jc.subJobs.map(subJob => ({ | ||
| // selected: subJob.job.status === "SUCCESS", | ||
| // job: subJob.job, | ||
| // })); | ||
| // const auxJobState = auxJob.subJobs.map(j => j.selected); | ||
| // auxJob.selected = !auxJobState.every(j => j === false); | ||
| // return auxJob; | ||
| // }); | ||
|
|
||
| // setJobCollections(newJobCollections); | ||
| // updateJobContext(newJobCollections); | ||
| // }, [jobCollections, updateJobContext]); | ||
|
|
||
| const handleJobsUpdate = useCallback(async () => { | ||
| await requestForceFetch(selectedFunction?.uid as string, setJobProgress); | ||
| console.info("Updated JobCollections"); | ||
|
|
@@ -282,7 +273,7 @@ export default function JobsSelector(props: JobSelectorPropsType) { | |
| indeterminate={ | ||
| jobCollections.some(jc => jc.selected === true) && | ||
| !jobCollections.every( | ||
| jc => jc.subJobs.map(j => j.job).filter(j => j.status === "SUCCESS" && j.selected === true).length > 0, | ||
| jc => jc.subJobs.map(j => j.job).filter(j => extractJobStatus(j) === "SUCCESS" && j.selected === true).length > 0, | ||
| ) | ||
| } | ||
| onChange={event => onToggleAll(event.target.checked)} | ||
|
|
@@ -295,7 +286,7 @@ export default function JobsSelector(props: JobSelectorPropsType) { | |
| checked={params.row.selected} | ||
| indeterminate={params.row.subJobs.some(j => j.selected) && !params.row.subJobs.every(j => j.selected)} | ||
| onChange={event => selectMainJob(params.row.jobCollection.uid, event.target.checked)} | ||
| disabled={params.row.subJobs.every((j: SubJob) => j.job.status !== "SUCCESS")} | ||
| disabled={params.row.subJobs.every((j: SubJob) => extractJobStatus(j) !== "SUCCESS")} | ||
| inputProps={{ "aria-label": "Select job collection" }} | ||
| sx={theme => ({ "& .MuiSvgIcon-root": { color: `${theme.palette.primary.main} !important` } })} | ||
| /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.