Skip to content

Commit 4c9c7b8

Browse files
committed
fix: adjust status themes to use diverging style
and arrange it from Failed -> Queued -> Provisioning -> Initializing -> Running -> Success as the spectrum
1 parent 7c76093 commit 4c9c7b8

File tree

8 files changed

+116
-151
lines changed

8 files changed

+116
-151
lines changed

Diff for: plugins/plugin-codeflare-dashboard/src/components/Dashboard.tsx

-133
This file was deleted.

Diff for: plugins/plugin-codeflare-dashboard/src/components/Dashboard/Grid.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export default class Grid extends React.PureComponent<GridProps> {
6262

6363
// private readonly sizes = ["▁▁", "▃▃", "▅▅", "▆▆", "██", "■■"]
6464

65-
private readonly cell = "█▉"
65+
private readonly defaultCell = "█▉"
6666
private cellFor(props: TextProps): TextProps {
67-
return Object.assign({ children: this.cell }, props)
67+
return Object.assign({ children: this.defaultCell }, props)
6868
}
6969

7070
private get emptyCell(): TextProps {
@@ -89,7 +89,7 @@ export default class Grid extends React.PureComponent<GridProps> {
8989
* just the length of a side in the grid/heat map).
9090
*/
9191
private get minMatrixSize() {
92-
return 6
92+
return 4
9393
}
9494

9595
private matrixModel(): Worker[][] {

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async function gridFor(
9393
): Promise<GridSpec> {
9494
const tails = await tailf(kind, profile, jobId)
9595
return kind === "status"
96-
? status(tails, historyConfig, { demo: opts.demo, theme: opts.theme, themeDefault: "colorbrewer" })
96+
? status(tails, historyConfig, { demo: opts.demo, theme: opts.theme })
9797
: utilization(kind, tails, historyConfig, opts)
9898
}
9999

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/status/Live.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export default class Live {
109109

110110
// inform the UI that we have updates
111111
cb({
112-
// lines: this.pushLine(data, metric, timestamp),
112+
lines: this.pushLine(data, metric, timestamp),
113113
workers: Object.values(this.workers),
114114
})
115115
}
@@ -166,7 +166,7 @@ export default class Live {
166166

167167
/** `pushLine` and then pass the updated model to `cb` */
168168
private pushLineAndPublish(line: string, metric: WorkerState, timestamp: number, cb: OnData) {
169-
cb({ /* lines: this.pushLine(line, metric, timestamp), */ workers: Object.values(this.workers) })
169+
cb({ lines: this.pushLine(line, metric, timestamp), workers: Object.values(this.workers) })
170170
}
171171

172172
private asMillisSinceEpoch(timestamp: string) {

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/status/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import { isValidStatusTheme, statusThemes } from "./theme.js"
3030
export default function statusDashboard(
3131
tails: Promise<Tail>[],
3232
historyConfig: HistoryConfig,
33-
opts: Pick<Options, "demo" | "theme" | "themeDefault">
33+
opts: Pick<Options, "demo" | "theme"> & Partial<Pick<Options, "themeDefault">>
3434
): GridSpec {
35-
const { theme: themeS = opts.themeDefault } = opts
35+
const { theme: themeS = opts.themeDefault || "colorbrewer6" } = opts
3636
if (!isValidStatusTheme(themeS)) {
3737
throw new Error("Invalid theme: " + themeS)
3838
}

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/status/states.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
export const states = ["Queued", "Provisioning", "Initializing", "Running", "Success", "Failed"]
17+
export const states = ["Failed", "Queued", "Provisioning", "Initializing", "Running", "Success"]
1818

1919
/** Type declaration for quantized utilization states */
2020
export type WorkerState = (typeof states)[number]

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/status/theme.ts

+106-8
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,123 @@ export const patternfly: StatusTheme = [
4747
]
4848

4949
/** https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=8 */
50-
export const colorbrewer: StatusTheme = [
51-
{ color: "#fddbc7" },
52-
{ color: "#ef8a62" },
53-
{ color: "#d1e5f0" },
54-
{ color: "#67a9cf" },
55-
{ color: "#2166ac" },
56-
{ color: "#b2182b" },
50+
export const colorbrewer1: StatusTheme = [
51+
/*{ color: "#ffff99" },
52+
{ color: "#fdbf6f" },
53+
{ color: "#ff7f00" },
54+
{ color: "#33a02c" },
55+
{ color: "#a6cee3" },
56+
{ color: "#b2182b" },*/
57+
58+
/* pastel */
59+
/* { color: "#ffffb3" },
60+
{ color: "#fdb462" },
61+
{ color: "#bebada" },
62+
{ color: "#8dd3c7" },
63+
{ color: "#80b1d3" },
64+
{ color: "#fb8072" }, */
65+
66+
/* only works in dark terminals */
67+
/* { color: "#ffff33" },
68+
{ color: "#ff7f00" },
69+
{ color: "#984ea3" },
70+
{ color: "#4daf4a" },
71+
{ color: "#377eb8" },
72+
{ color: "#e41a1c" }, */
73+
74+
{ color: "#" },
75+
{ color: "#" },
76+
{ color: "#" },
77+
{ color: "#" },
78+
{ color: "#" },
79+
{ color: "#" },
80+
5781
/* { color: "#5e4fa2" },
5882
{ color: "#3288bd" },
5983
{ color: "#e6f598" },
6084
{ color: "#66c2a5" },
6185
{ color: "#d53e4f" },*/
6286
]
6387

88+
/* pastel */
89+
export const colorbrewer2: StatusTheme = [
90+
{ color: "#ffffb3" },
91+
{ color: "#fdb462" },
92+
{ color: "#bebada" },
93+
{ color: "#8dd3c7" },
94+
{ color: "#80b1d3" },
95+
{ color: "#fb8072" },
96+
]
97+
98+
/* only works in dark terminals */
99+
export const colorbrewer3: StatusTheme = [
100+
{ color: "#ffff33" },
101+
{ color: "#ff7f00" },
102+
{ color: "#984ea3" },
103+
{ color: "#4daf4a" },
104+
{ color: "#377eb8" },
105+
{ color: "#e41a1c" },
106+
]
107+
108+
export const colorbrewer4: StatusTheme = [
109+
{ color: "#ffff99" },
110+
{ color: "#fdc086" },
111+
{ color: "#beaed4" },
112+
{ color: "#7fc97f" },
113+
{ color: "#386cb0" },
114+
{ color: "#f0027f" },
115+
]
116+
117+
/* diverging scheme=Spectral */
118+
export const colorbrewer5: StatusTheme = [
119+
{ color: "#fc8d59" },
120+
{ color: "#fee08b" },
121+
{ color: "#e6f598" },
122+
{ color: "#99d594" },
123+
{ color: "#3288bd" },
124+
{ color: "#d53e4f" },
125+
]
126+
127+
/* diverging scheme=RdYlBu */
128+
export const colorbrewer6: StatusTheme = [
129+
{ color: "#fc8d59" },
130+
{ color: "#fee090" },
131+
{ color: "#e0f3f8" },
132+
{ color: "#91bfdb" },
133+
{ color: "#4575b4" },
134+
{ color: "#d73027" },
135+
]
136+
137+
/* diverging scheme=RdBu */
138+
export const colorbrewer7: StatusTheme = [
139+
{ color: "#ef8a62" },
140+
{ color: "#fddbc7" },
141+
{ color: "#d1e5f0" },
142+
{ color: "#67a9cf" },
143+
{ color: "#2166ac" },
144+
{ color: "#b2182b" },
145+
]
146+
147+
/*export const colorbrewer4: StatusTheme = [
148+
{ color: "#" },
149+
{ color: "#" },
150+
{ color: "#" },
151+
{ color: "#" },
152+
{ color: "#" },
153+
{ color: "#" },
154+
]*/
155+
64156
export const statusThemes = {
65157
user,
66158
carbon,
67159
patternfly,
68-
colorbrewer,
160+
colorbrewer1,
161+
colorbrewer2,
162+
colorbrewer3,
163+
colorbrewer4,
164+
colorbrewer5,
165+
colorbrewer6,
166+
colorbrewer7,
69167
}
70168

71169
export type ValidTheme = keyof typeof statusThemes

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/utilization/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function utilizationDashboard(
4646
historyConfig: HistoryConfig,
4747
opts: Pick<Options, "demo" | "theme"> & Partial<Pick<Options, "themeDefault">>
4848
): GridSpec {
49-
const { theme: themeS = opts.themeDefault || defaultUtilizationThemes[kind] } = opts
49+
const themeS = opts.themeDefault || defaultUtilizationThemes[kind]
5050
if (!isValidTheme(themeS)) {
5151
throw new Error("Invalid theme: " + themeS)
5252
}

0 commit comments

Comments
 (0)