Skip to content

Commit 5d588d3

Browse files
authored
fix: rayjob table cannot get ray dashboard link in pending status (#4122)
Signed-off-by: Cheyu Wu <[email protected]>
1 parent 656602f commit 5d588d3

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

dashboard/src/components/JobsTable/JobsTable.tsx

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const JobsTable = () => {
9494
</td>
9595
<td>{dayjs(row.createdAt).format("M/D/YY HH:mm:ss")}</td>
9696
<td className="flex">
97-
{
97+
{row.links.rayHeadDashboardLink && (
9898
<IconButton
9999
variant="plain"
100100
size="sm"
@@ -112,7 +112,7 @@ export const JobsTable = () => {
112112
width={26}
113113
/>
114114
</IconButton>
115-
}
115+
)}
116116
{row.links.rayGrafanaDashboardLink && (
117117
<IconButton
118118
variant="plain"
@@ -130,31 +130,33 @@ export const JobsTable = () => {
130130
<Image priority src={GrafanaIcon} alt="Grafana Metrics" />
131131
</IconButton>
132132
)}
133-
<IconButton
134-
variant="plain"
135-
size="sm"
136-
sx={{
137-
minHeight: "1rem",
138-
minWidth: "1rem",
139-
px: 0.6,
140-
}}
141-
title="Loki Logs"
142-
href={row.links.logsLink}
143-
target="_blank"
144-
component="a"
145-
>
146-
<Typography
133+
{row.links.logsLink && (
134+
<IconButton
135+
variant="plain"
136+
size="sm"
147137
sx={{
148-
fontFamily: "monospace",
149-
letterSpacing: -0.9,
150-
fontSize: "small",
151-
color: "#0b6bcb",
152-
textDecoration: "underline",
138+
minHeight: "1rem",
139+
minWidth: "1rem",
140+
px: 0.6,
153141
}}
142+
title="Loki Logs"
143+
href={row.links.logsLink}
144+
target="_blank"
145+
component="a"
154146
>
155-
Logs
156-
</Typography>
157-
</IconButton>
147+
<Typography
148+
sx={{
149+
fontFamily: "monospace",
150+
letterSpacing: -0.9,
151+
fontSize: "small",
152+
color: "#0b6bcb",
153+
textDecoration: "underline",
154+
}}
155+
>
156+
Logs
157+
</Typography>
158+
</IconButton>
159+
)}
158160
</td>
159161
<td className="truncate">
160162
<Tooltip variant="outlined" title={row.message}>

dashboard/src/hooks/api/useListJobs.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ const convertRayJobItemToJobRow = (item: RayJobItem): JobRow => {
5050
item.spec.rayClusterSpec.headGroupSpec?.template?.spec?.containers?.[0].ports?.find(
5151
(port) => port.name === "dashboard",
5252
)?.containerPort;
53-
if (!dashboardPort || !config.coreApiUrl) {
54-
return {
55-
rayHeadDashboardLink: "",
56-
};
53+
if (!serviceName || !dashboardPort || !config.coreApiUrl) {
54+
return {};
5755
}
5856
const rayHeadDashboardLink = `${config.coreApiUrl}/namespaces/${namespace}/services/${serviceName}:${dashboardPort}/proxy/#/jobs`;
5957
const rayJobId = item.status?.jobId;

dashboard/src/types/table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export interface JobRow {
4444
createdAt: Date;
4545
message: string;
4646
links: {
47-
rayHeadDashboardLink: string;
47+
rayHeadDashboardLink?: string;
4848
rayGrafanaDashboardLink?: string;
4949
logsLink?: string;
5050
};

0 commit comments

Comments
 (0)