Skip to content

Commit fd1ae2f

Browse files
committed
fix: fix default name for jobs to be usable
1 parent 3007b98 commit fd1ae2f

File tree

8 files changed

+20
-14
lines changed

8 files changed

+20
-14
lines changed

src/components/BaseCard.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ export interface BaseCardProps {
4848
* String values to be displayed in the header section of the card. Only title is required.
4949
* Missing values are not displayed.
5050
*/
51-
header?: { title: string; subtitle?: string; avatar?: string; color?: string };
51+
header?: { title: string; subtitle?: string; avatar?: string };
52+
/**
53+
* Color for the avatar background and top border
54+
*/
55+
accentColor?: string;
5256
}
5357

5458
/**
@@ -68,16 +72,17 @@ export const BaseCard = ({
6872
collapsed,
6973
keepCollapsedMounted = true,
7074
collapsedByDefault = true,
75+
accentColor,
7176
}: BaseCardProps) => {
7277
const [hasExpanded, setHasExpanded] = useState(!collapsedByDefault);
7378
const [expanded, setExpanded] = useState(!collapsedByDefault);
7479

7580
return (
76-
<Card sx={{ borderTop: header?.color ? "3px solid" : "none", borderTopColor: header?.color }}>
81+
<Card sx={{ borderTop: accentColor ? "3px solid" : "none", borderTopColor: accentColor }}>
7782
{!!header && (
7883
<CardHeader
7984
avatar={
80-
<Avatar sx={{ fontFamily: "verdana", backgroundColor: header.color ?? "transparent" }}>
85+
<Avatar sx={{ fontFamily: "verdana", backgroundColor: accentColor ?? "transparent" }}>
8186
{header.avatar?.[0].toUpperCase()}
8287
</Avatar>
8388
}

src/components/RunningWorkflowCard/RunningWorkflowCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export const RunningWorkflowCard = ({
199199

200200
return (
201201
<ResultCard
202+
accentColor="#f1c40f"
202203
actions={() => null}
203204
collapsed={collapsed}
204205
collapsedByDefault={collapsedByDefault}

src/components/instances/ResultJobCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const ResultJobCard = ({
5353

5454
return (
5555
<ResultCard
56+
accentColor="primary.main"
5657
actions={({ setSlideIn }) => (
5758
<>
5859
<TerminateInstance

src/components/results/ResultCard.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ export const ResultCard: FC<ResultCardProps> = ({
4242
collapsedByDefault = true,
4343
collapsed,
4444
children,
45+
accentColor,
4546
}) => {
4647
const [slideIn, setSlideIn] = useState(true);
4748

4849
return (
4950
<Slide appear={false} direction="right" in={slideIn}>
5051
<div>
5152
<BaseCard
53+
accentColor={accentColor}
5254
actions={(params) => actions({ ...params, slideIn, setSlideIn })}
5355
collapsed={<CardContent>{collapsed}</CardContent>}
5456
collapsedByDefault={collapsedByDefault}

src/components/runCards/ApplicationCard/ApplicationCard.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const ApplicationCard = ({ app, projectId }: ApplicationCardProps) => {
3434

3535
return (
3636
<BaseCard
37+
accentColor="secondary.dark"
3738
actions={({ setExpanded }) => (
3839
<ApplicationModalButton
3940
applicationId={app.application_id}
@@ -45,12 +46,7 @@ export const ApplicationCard = ({ app, projectId }: ApplicationCardProps) => {
4546
collapsed={
4647
<InstancesList predicate={(instance) => instance.application_id === app.application_id} />
4748
}
48-
header={{
49-
title: app.kind,
50-
subtitle: app.group,
51-
avatar: app.kind[0],
52-
color: "secondary.dark",
53-
}}
49+
header={{ title: app.kind, subtitle: app.group, avatar: app.kind[0] }}
5450
>
5551
<Typography
5652
color="text.secondary"

src/components/runCards/JobCard/JobCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const JobCard = ({ projectId, job: jobs, disabled = false }: ApplicationC
5353

5454
return (
5555
<BaseCard
56+
accentColor="primary.main"
5657
actions={({ setExpanded }) => (
5758
<>
5859
<TextField
@@ -85,7 +86,7 @@ export const JobCard = ({ projectId, job: jobs, disabled = false }: ApplicationC
8586
}
8687
/>
8788
}
88-
header={{ color: "primary.main", subtitle: job.name, avatar: job.job[0], title: job.job }}
89+
header={{ subtitle: job.name, avatar: job.job[0], title: job.job }}
8990
key={projectId} // Reset state when project changes
9091
>
9192
<Typography

src/components/runCards/JobCard/JobModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ export const JobModal = ({
7676
const { data: job } = useGetJob(jobId, undefined, {
7777
query: { retry: jobId === TEST_JOB_ID ? 1 : 3 },
7878
});
79-
const [nameState, setNameState] = useState(instance?.name ?? "");
79+
const [nameState, setNameState] = useState(instance?.job_name ?? "");
8080
useEffect(() => {
81-
job?.name && setNameState(job.name);
82-
}, [job?.name]);
81+
job?.job && setNameState(job.job);
82+
}, [job?.job]);
8383

8484
const spec = instance?.application_specification;
8585
const specVariables = useMemo(

src/components/runCards/WorkflowCard/WorkflowCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const WorkflowCard = ({ workflow, runningWorkflows = [] }: WorkflowCardPr
4444

4545
return (
4646
<BaseCard
47+
accentColor="#f1c40f"
4748
actions={() => (
4849
<RunWorkflowButton
4950
disabled={!projectId}
@@ -83,7 +84,6 @@ export const WorkflowCard = ({ workflow, runningWorkflows = [] }: WorkflowCardPr
8384
)
8485
}
8586
header={{
86-
color: "#f1c40f",
8787
subtitle: workflow.name,
8888
avatar: workflow.name[0],
8989
title: workflow.workflow_name ?? workflow.name,

0 commit comments

Comments
 (0)