From ff030670e2901b3c2da52301d5f725a3e8017ee5 Mon Sep 17 00:00:00 2001 From: markmybytes Date: Sat, 10 Oct 2026 22:42:15 +0800 Subject: [PATCH] refactor(sysinfo): reorder hardware fields to match display order Field order in ResolvedHardware drives the home page layout, since Go emits JSON struct fields in declaration order and the frontend iterates Object.entries. Order now reads as: motherboard, CPU, memory, GPU, storage, NIC, then OS (already appended separately). Regenerated wailsjs models.ts to match. --- frontend/wailsjs/go/models.ts | 12 ++++++------ pkg/sysinfo/sysinfo.go | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/wailsjs/go/models.ts b/frontend/wailsjs/go/models.ts index 9f6e324..f63d508 100644 --- a/frontend/wailsjs/go/models.ts +++ b/frontend/wailsjs/go/models.ts @@ -345,12 +345,12 @@ export namespace sysinfo { } } export class ResolvedHardware { + motherboard: string[]; cpu: string[]; - gpu: string[]; memory: string[]; - motherboard: string[]; - nic: string[]; + gpu: string[]; storage: string[]; + nic: string[]; static createFrom(source: any = {}) { return new ResolvedHardware(source); @@ -358,12 +358,12 @@ export namespace sysinfo { constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); + this.motherboard = source["motherboard"]; this.cpu = source["cpu"]; - this.gpu = source["gpu"]; this.memory = source["memory"]; - this.motherboard = source["motherboard"]; - this.nic = source["nic"]; + this.gpu = source["gpu"]; this.storage = source["storage"]; + this.nic = source["nic"]; } } diff --git a/pkg/sysinfo/sysinfo.go b/pkg/sysinfo/sysinfo.go index 3f09cb8..184edc9 100644 --- a/pkg/sysinfo/sysinfo.go +++ b/pkg/sysinfo/sysinfo.go @@ -14,12 +14,12 @@ import ( // ResolvedHardware holds all resolved hardware names in a single struct // for efficient frontend retrieval via one Wails bridge call. type ResolvedHardware struct { + Motherboard []string `json:"motherboard"` Cpu []string `json:"cpu"` - Gpu []string `json:"gpu"` Memory []string `json:"memory"` - Motherboard []string `json:"motherboard"` - Nic []string `json:"nic"` + Gpu []string `json:"gpu"` Storage []string `json:"storage"` + Nic []string `json:"nic"` } // OSInfo carries raw OS data; the frontend assembles and translates.