Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@
"dashboard_loading_details": "Loading details…",
"dashboard_no_devices": "No devices",
"dashboard_no_location": "No location",
"dashboard_sensor_error": "Sensor Error",
"sensor_temperature": "Temperature",
"sensor_humidity": "Humidity",
"sensor_moisture": "Moisture",
Expand Down
1 change: 1 addition & 0 deletions messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@
"dashboard_loading_details": "詳細を読み込み中…",
"dashboard_no_devices": "デバイスがありません",
"dashboard_no_location": "ロケーションなし",
"dashboard_sensor_error": "センサーエラー",
"dashboard_no_matching_locations_body": "ダッシュボードのフィルターを調整するか、解除してロケーションをさらに表示してください。",
"dashboard_no_matching_locations_title": "この条件に一致するデバイスはありません",
"dashboard_virtual_scroll": "仮想スクロール",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"packageManager": "pnpm@10.18.2+sha512.9fb969fa749b3ade6035e0f109f0b8a60b5d08a1a87fdf72e337da90dcc93336e2280ca4e44f2358a649b83c17959e9993e777c2080879f3801e6f0d999ad3dd",
"dependencies": {
"@cropwatchdevelopment/cwui": "0.1.103",
"@cropwatchdevelopment/cwui": "0.1.105",
"@supabase/supabase-js": "^2.98.0"
}
}
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/lib/api/api.dtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ export interface DashboardRow {
group: string | null;
upload_interval: number | null;
last_data_updated_at: string | null;
/** Device-reported fault string; non-empty means the sensor needs attention. */
error_status: string | null;
device_type: DashboardDeviceType;
location: DashboardLocation | null;
latest: DashboardLatest | null;
Expand Down
9 changes: 9 additions & 0 deletions src/lib/components/dashboard/DashboardCards.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
existing.latest = next.latest;
existing.last_data_updated_at = next.last_data_updated_at;
existing.upload_interval = next.upload_interval;
existing.error_status = next.error_status;
}
}
}
Expand Down Expand Up @@ -176,6 +177,13 @@
return { ...readingProps(def.format, def.unit, row.latest?.secondary), icon: def.icon };
}

// A non-empty `error_status` on the device row means the sensor has reported a
// fault. Mirrors the device-detail page's convention. The raw status value is a
// device-side code (e.g. "-55"), so the card shows a localized message instead.
function hasDeviceError(row: DashboardRow): boolean {
return typeof row.error_status === 'string' && row.error_status.trim().length > 0;
}

function detailEntries(details: Record<string, unknown>) {
return Object.entries(details)
.filter(([col, value]) => isDisplayableColumn(col) && value !== null && value !== undefined)
Expand Down Expand Up @@ -276,6 +284,7 @@
<CwSensorCard
label={row.name}
status={row.latest ? 'online' : 'loading'}
hasError={hasDeviceError(row) ? m.dashboard_sensor_error() : null}
primaryValue={primary.value}
primaryUnit={primary.unit}
primaryLabel={primary.label}
Expand Down