Skip to content

Commit 76eec42

Browse files
committed
[Feature]: Show probe statuses in the UI #3204
1 parent 19d1ede commit 76eec42

6 files changed

Lines changed: 35 additions & 22 deletions

File tree

frontend/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"@cloudscape-design/chat-components": "^1.0.62",
102102
"@cloudscape-design/collection-hooks": "^1.0.74",
103103
"@cloudscape-design/component-toolkit": "^1.0.0-beta.120",
104-
"@cloudscape-design/components": "^3.0.1091",
104+
"@cloudscape-design/components": "^3.0.1188",
105105
"@cloudscape-design/design-tokens": "^3.0.60",
106106
"@cloudscape-design/global-styles": "^1.0.45",
107107
"@hookform/resolvers": "^2.9.10",

frontend/src/components/NavigateLink/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React from 'react';
22
import { useNavigate } from 'react-router-dom';
33
import Link, { LinkProps } from '@cloudscape-design/components/link';
4+
5+
import styles from './style.module.scss';
6+
47
export const NavigateLink: React.FC<LinkProps> = ({ onFollow, ...props }) => {
58
const navigate = useNavigate();
69
const onFollowHandler: LinkProps['onFollow'] = (event) => {
@@ -10,5 +13,9 @@ export const NavigateLink: React.FC<LinkProps> = ({ onFollow, ...props }) => {
1013
if (event.detail.href) navigate(event.detail.href);
1114
};
1215

13-
return <Link {...props} onFollow={onFollowHandler} />;
16+
return (
17+
<span className={styles.link}>
18+
<Link {...props} onFollow={onFollowHandler} />
19+
</span>
20+
);
1421
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.link {
2+
& > a {
3+
text-decoration: underline !important;
4+
}
5+
}

frontend/src/pages/Runs/Details/Jobs/List/helpers.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { format } from 'date-fns';
2+
import type { StatusIndicatorProps } from '@cloudscape-design/components/status-indicator';
23

34
import { DATE_TIME_FORMAT } from 'consts';
45
import { capitalize } from 'libs';
@@ -52,25 +53,22 @@ export const getJobSubmissionProbes = (job: IJob) => {
5253
return job.job_submissions?.[job.job_submissions.length - 1].probes;
5354
};
5455

55-
export const getJobProbesStatuses = (job: IJob) => {
56+
export const getJobProbesStatuses = (job: IJob): StatusIndicatorProps.Type[] => {
5657
const status = getJobStatus(job);
5758
const probes = getJobSubmissionProbes(job);
5859

5960
if (!probes?.length || status !== 'running') {
60-
return null;
61+
return [];
6162
}
6263

63-
return probes
64-
?.map((probe, index) => {
65-
if (job.job_spec?.probes?.[index] && probe.success_streak >= job.job_spec.probes[index].ready_after) {
66-
return '✓';
67-
} else if (probe.success_streak > 0) {
68-
return '~';
69-
} else {
70-
return '×';
71-
}
72-
})
73-
.join('');
64+
return probes.map((probe, index) => {
65+
if (job.job_spec?.probes?.[index] && probe.success_streak >= job.job_spec.probes[index].ready_after) {
66+
return 'success';
67+
} else if (probe.success_streak > 0) {
68+
return 'in-progress';
69+
}
70+
return 'not-started';
71+
});
7472
};
7573

7674
export const getJobTerminationReason = (job: IJob) => {

frontend/src/pages/Runs/Details/Jobs/List/hooks.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ export const useColumnsDefinitions = ({
7171
{
7272
id: 'probe',
7373
header: t('projects.run.probe'),
74-
cell: (item: IJob) => getJobProbesStatuses(item),
74+
cell: (item: IJob) => {
75+
const statuses = getJobProbesStatuses(item);
76+
return statuses.map((statusType, index) => <StatusIndicator key={index} type={statusType} />);
77+
},
7578
},
7679
{
7780
id: 'priority',

0 commit comments

Comments
 (0)