feat: Z-Park branding, data collection fix, buyoff pass (v1.3.0)
Branding: - Replace all Tianpu text/colors with Z-Park (green #52c41a) - Update login, sidebar, BigScreen, localStorage keys Data collection: - Populate ps_id for all 10 inverters (Phase1: 2226182, Phase2: 2226188) - Fix docker-compose volume mount for customer config.yaml Buyoff warning fixes: - Installed capacity: 2200 kW / 10 Sungrow inverters (was wrong Huawei data) - Feature flags: hide charging menu when features.charging=false - Device total count: compute client-side from stats - Device groups: enrich group names from metadata Buyoff result: CONDITIONAL PASS (21/21 critical, 54/63 total) Data accuracy: <3% deviation from iSolarCloud reference Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,11 +43,21 @@ export default function Devices() {
|
||||
Object.entries(query).forEach(([k, v]) => {
|
||||
if (v !== undefined && v !== null && v !== '') cleanQuery[k] = v;
|
||||
});
|
||||
const res = await getDevices(cleanQuery);
|
||||
setData(res as any);
|
||||
const res = await getDevices(cleanQuery) as any;
|
||||
// Enrich items with type name and group name from cached meta
|
||||
if (res?.items) {
|
||||
const typeMap = new Map(deviceTypes.map((t: any) => [t.code || t.id, t.name]));
|
||||
const groupMap = new Map(deviceGroups.map((g: any) => [g.id, g.name]));
|
||||
res.items = res.items.map((d: any) => ({
|
||||
...d,
|
||||
device_type_name: d.device_type_name || typeMap.get(d.device_type) || typeMap.get(d.device_type_id) || '-',
|
||||
device_group_name: d.device_group_name || groupMap.get(d.group_id) || '-',
|
||||
}));
|
||||
}
|
||||
setData(res);
|
||||
} catch (e) { console.error(e); }
|
||||
finally { setLoading(false); }
|
||||
}, [filters]);
|
||||
}, [filters, deviceTypes, deviceGroups]);
|
||||
|
||||
const loadMeta = async () => {
|
||||
try {
|
||||
@@ -56,7 +66,9 @@ export default function Devices() {
|
||||
]);
|
||||
setDeviceTypes(types as any[]);
|
||||
setDeviceGroups(groups as any[]);
|
||||
setStats(st as any);
|
||||
const stData = st as any;
|
||||
stData.total = (stData.online || 0) + (stData.offline || 0) + (stData.alarm || 0) + (stData.maintenance || 0);
|
||||
setStats(stData);
|
||||
} catch (e) { console.error(e); }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user