Skip to content

Commit 1d665eb

Browse files
committed
chore: code cleanup in description command handler
also remove some lower-priority fields from the description list model, to clean up the UI a bit
1 parent d306c0b commit 1d665eb

File tree

2 files changed

+16
-30
lines changed

2 files changed

+16
-30
lines changed

plugins/plugin-codeflare/src/components/Description.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const Description = (props: Props) => {
3636

3737
return (
3838
<DescriptionList>
39-
{Object.values(summaryData).map(({ label, value }, index) => (
39+
{summaryData.map(({ label, value }, index) => (
4040
<DescriptionListGroup key={index}>
4141
<DescriptionListTerm>{label}</DescriptionListTerm>
4242
<DescriptionListDescription>{value}</DescriptionListDescription>

plugins/plugin-codeflare/src/controller/description.ts

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,9 @@
1717
import { Arguments, Registrar } from "@kui-shell/core"
1818
import { expand } from "../lib/util"
1919

20-
export type Summary = {
21-
appClass: { label: string; value: string }
22-
appName: { label: string; value: string }
23-
language: { label: string; value: string }
24-
pythonVersion: { label: string; value: string }
25-
rayVersion: { label: string; value: string }
26-
gpuClass: { label: string; value: string }
27-
workerGPUs: { label: string; value: string }
28-
workerMemory: { label: string; value: string }
29-
workerCount: { label: string; value: string }
30-
status: { label: string; value: string }
31-
parameters: { label: string; value: string }
32-
dataSources: { label: string; value: string }
33-
}
20+
type Item = { label: string; value: string }
21+
22+
export type Summary = Item[]
3423

3524
export type SummaryResponse = {
3625
jobid: string
@@ -40,6 +29,7 @@ export type SummaryResponse = {
4029
}
4130
runtimeEnv: {
4231
env_vars: {
32+
KUBE_CONTEXT: string
4333
KUBE_NS: string
4434
WORKER_MEMORY: string
4535
NUM_GPUS: string
@@ -59,22 +49,18 @@ async function description(args: Arguments) {
5949
}
6050

6151
const summaryCmd = JSON.parse(await args.REPL.qexec<string>(`vfs fslice ${expand(filepath)} 0`))
62-
const { KUBE_NS, WORKER_MEMORY, NUM_GPUS, MIN_WORKERS, MAX_WORKERS, RAY_IMAGE } = summaryCmd.runtimeEnv.env_vars
52+
const { KUBE_CONTEXT, KUBE_NS, WORKER_MEMORY, MIN_WORKERS, MAX_WORKERS, RAY_IMAGE } = summaryCmd.runtimeEnv.env_vars
6353

64-
const summaryData = {
65-
appClass: { label: "Application Class", value: "Unknown" },
66-
appName: { label: "Application Name", value: "Unknown" },
67-
language: { label: "Source Language", value: summaryCmd.language },
68-
pythonVersion: { label: "Python Version", value: "Unknown" },
69-
rayVersion: { label: "Ray Version", value: RAY_IMAGE },
70-
gpuClass: { label: "GPU Class", value: KUBE_NS },
71-
workerGPUs: { label: "GPUs per Worker", value: NUM_GPUS },
72-
workerMemory: { label: "Memory per Worker", value: WORKER_MEMORY },
73-
workerCount: { label: "Worker Count", value: `${MIN_WORKERS}-${MAX_WORKERS}` },
74-
status: { label: "Status", value: "Unknown" },
75-
parameters: { label: "Parameters", value: "Unknown" },
76-
dataSources: { label: "Data Sources", value: "Unknown" },
77-
}
54+
const summaryData = [
55+
{ label: "Application Class", value: "Unknown" },
56+
{ label: "Application Name", value: "Unknown" },
57+
{ label: "Cluster Context", value: KUBE_CONTEXT.replace(/^[^/]+\//, "") },
58+
{ label: "Cluster Namespace", value: KUBE_NS },
59+
{ label: "Base Image", value: RAY_IMAGE },
60+
{ label: "GPU Class", value: "Unknown" },
61+
{ label: "Memory per Worker", value: WORKER_MEMORY },
62+
{ label: "Worker Count", value: `${MIN_WORKERS}-${MAX_WORKERS}` },
63+
]
7864

7965
const React = await import("react")
8066
const Description = await import("../components/Description")

0 commit comments

Comments
 (0)