fix: render in-flight count as static white (remove blink pulse)
This commit is contained in:
@@ -19,8 +19,6 @@ type InflightState = {
|
||||
settings: InflightSettings;
|
||||
action?: KeyAction<InflightSettings>;
|
||||
unsubscribe?: () => void;
|
||||
pulseTimer?: ReturnType<typeof setInterval>;
|
||||
pulse: boolean;
|
||||
history: number[];
|
||||
sampler?: ReturnType<typeof setInterval>;
|
||||
};
|
||||
@@ -34,7 +32,7 @@ export class InflightMonitor extends SingletonAction<InflightSettings> {
|
||||
private stateFor(action: KeyAction<InflightSettings>): InflightState {
|
||||
let state = this.states.get(action.id);
|
||||
if (!state) {
|
||||
state = { settings: {}, pulse: false, history: [] };
|
||||
state = { settings: {}, history: [] };
|
||||
this.states.set(action.id, state);
|
||||
}
|
||||
return state;
|
||||
@@ -57,7 +55,6 @@ export class InflightMonitor extends SingletonAction<InflightSettings> {
|
||||
state.unsubscribe?.();
|
||||
if (state.sampler) clearInterval(state.sampler);
|
||||
state.sampler = undefined;
|
||||
this.clearPulse(state);
|
||||
this.states.delete(ev.action.id);
|
||||
}
|
||||
|
||||
@@ -89,26 +86,10 @@ export class InflightMonitor extends SingletonAction<InflightSettings> {
|
||||
state: trackerState,
|
||||
count,
|
||||
offline,
|
||||
pulse: state.pulse,
|
||||
history: state.history,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
if (trackerState === "ready" && count > 0 && !state.pulseTimer) {
|
||||
state.pulseTimer = setInterval(() => {
|
||||
state.pulse = !state.pulse;
|
||||
this.render(state);
|
||||
}, 500);
|
||||
} else if (!(trackerState === "ready" && count > 0) && state.pulseTimer) {
|
||||
this.clearPulse(state);
|
||||
}
|
||||
}
|
||||
|
||||
private clearPulse(state: InflightState): void {
|
||||
if (state.pulseTimer) clearInterval(state.pulseTimer);
|
||||
state.pulseTimer = undefined;
|
||||
state.pulse = false;
|
||||
}
|
||||
|
||||
private sample(state: InflightState): void {
|
||||
|
||||
+1
-3
@@ -19,7 +19,6 @@ export interface InflightRenderOptions {
|
||||
state?: ModelRuntimeState;
|
||||
count: number;
|
||||
offline: boolean;
|
||||
pulse: boolean;
|
||||
history?: number[];
|
||||
}
|
||||
|
||||
@@ -49,11 +48,10 @@ export function renderInflight(opts: InflightRenderOptions): string {
|
||||
const bg = opts.state === "ready" ? (isActive ? "#8b2626" : "#1e6b34") : opts.state === "loading" ? "#8a6d1d" : "#3a3a3a";
|
||||
const center = isActive ? `${opts.count}` : opts.state === "ready" ? "IDLE" : opts.state === "loading" ? "LOADING" : "OFF";
|
||||
const centerSize = isActive ? 24 : 16;
|
||||
const opacity = isActive && opts.pulse ? 0.55 : 1;
|
||||
|
||||
const parts: string[] = [
|
||||
centerText(name, 12, 7, "normal", "#ffffff"),
|
||||
centerText(center, 40, centerSize, "bold", "#ffffff", opacity),
|
||||
centerText(center, 40, centerSize, "bold", "#ffffff"),
|
||||
];
|
||||
|
||||
if (opts.state === "ready") {
|
||||
|
||||
Reference in New Issue
Block a user