fix: keep terminal charts visible during scan refresh
This commit is contained in:
@@ -702,7 +702,7 @@ export function LiveTemperatureThresholdChart({
|
||||
actions={timeframeActions}
|
||||
className={PEAK_GLOW_PANEL_CLASS[peakGlow.state]}
|
||||
>
|
||||
<div className="flex h-full min-h-[300px] flex-col">
|
||||
<div className={clsx("flex h-full flex-col", compact ? "min-h-0" : "min-h-[300px]")}>
|
||||
<TemperatureStatsBars
|
||||
isEn={isEn}
|
||||
compact={compact}
|
||||
|
||||
@@ -115,7 +115,8 @@ export function TemperatureChartCanvas({
|
||||
|
||||
const canRenderChart = chartSize.width > 0 && chartSize.height > 0;
|
||||
const chartWidth = Math.max(1, chartSize.width);
|
||||
const chartHeight = Math.max(220, chartSize.height);
|
||||
const minChartHeight = compact ? 120 : 220;
|
||||
const chartHeight = Math.max(minChartHeight, chartSize.height);
|
||||
const individualRunwaySeriesCount = chartSeries.filter(
|
||||
(series) => series.key.startsWith("runway_") && series.key !== "runway_max",
|
||||
).length;
|
||||
@@ -125,7 +126,7 @@ export function TemperatureChartCanvas({
|
||||
chartSeries.some((series) => series.key === "runway_max");
|
||||
|
||||
return (
|
||||
<div className="relative flex min-h-[240px] flex-1 flex-col p-2">
|
||||
<div className={clsx("relative flex flex-1 flex-col p-2", compact ? "min-h-[120px]" : "min-h-[240px]")}>
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 px-3 py-1.5 text-[11px] border-b border-[#e2e8f0] bg-white">
|
||||
{chartSeries.length > 1 &&
|
||||
chartSeries
|
||||
@@ -187,7 +188,7 @@ export function TemperatureChartCanvas({
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div ref={chartHostRef} className="relative min-h-[220px] flex-1">
|
||||
<div ref={chartHostRef} className={clsx("relative flex-1", compact ? "min-h-[120px]" : "min-h-[220px]")}>
|
||||
{canRenderChart && (
|
||||
<ReComposedChart
|
||||
width={chartWidth}
|
||||
|
||||
@@ -19,6 +19,10 @@ export function runTests() {
|
||||
path.join(projectRoot, "components", "dashboard", "scan-terminal", "LiveTemperatureThresholdChart.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
const chartCanvasSource = fs.readFileSync(
|
||||
path.join(projectRoot, "components", "dashboard", "scan-terminal", "TemperatureChartCanvas.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
assert(
|
||||
dashboardSource.includes("MAX_TERMINAL_CHARTS = 9"),
|
||||
@@ -55,4 +59,10 @@ export function runTests() {
|
||||
chartSource.includes("lastAppliedPatchRevisionRef.current = 0;"),
|
||||
"switching city slots must clear the previous live temperature so Fahrenheit values cannot leak into Celsius charts",
|
||||
);
|
||||
assert(
|
||||
chartSource.includes('compact ? "min-h-0" : "min-h-[300px]"') &&
|
||||
chartCanvasSource.includes("const minChartHeight = compact ? 120 : 220") &&
|
||||
chartCanvasSource.includes('compact ? "min-h-[120px]" : "min-h-[220px]"'),
|
||||
"compact grid charts must not force desktop minimum heights that get clipped inside 3x3 terminal slots",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,3 +36,14 @@ def test_scan_terminal_prewarm_is_lazy_by_default():
|
||||
"if _scan_terminal_prewarm_enabled():\n start_scan_terminal_prewarm()",
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
def test_scan_terminal_backend_timeout_returns_before_next_proxy_abort():
|
||||
import web.services.scan_terminal_config as scan_terminal_config
|
||||
|
||||
route_source = (
|
||||
ROOT / "frontend" / "app" / "api" / "scan" / "terminal" / "route.ts"
|
||||
).read_text(encoding="utf-8")
|
||||
|
||||
assert 'POLYWEATHER_SCAN_TERMINAL_PROXY_TIMEOUT_MS || "28000"' in route_source
|
||||
assert scan_terminal_config.SCAN_TERMINAL_BUILD_TIMEOUT_SEC <= 24
|
||||
|
||||
@@ -29,9 +29,11 @@ SCAN_TERMINAL_PAYLOAD_TTL_SEC = min(
|
||||
SCAN_ROWS_REFRESH_SEC,
|
||||
max(10, int(os.getenv("POLYWEATHER_SCAN_TERMINAL_PAYLOAD_TTL_SEC", str(SCAN_ROWS_REFRESH_SEC)))),
|
||||
)
|
||||
SCAN_TERMINAL_BUILD_TIMEOUT_SEC = max(
|
||||
8,
|
||||
int(os.getenv("POLYWEATHER_SCAN_TERMINAL_BUILD_TIMEOUT_SEC", "120")),
|
||||
SCAN_TERMINAL_BUILD_TIMEOUT_SEC = _env_int(
|
||||
"POLYWEATHER_SCAN_TERMINAL_BUILD_TIMEOUT_SEC",
|
||||
20,
|
||||
min_value=8,
|
||||
max_value=24,
|
||||
)
|
||||
SCAN_TERMINAL_MAX_WORKERS = _env_int(
|
||||
"POLYWEATHER_SCAN_TERMINAL_MAX_WORKERS",
|
||||
|
||||
Reference in New Issue
Block a user