diff --git a/internal/api/asset_component_actions_api.go b/internal/api/asset_component_actions_api.go index a3eb643..ebac9ea 100644 --- a/internal/api/asset_component_actions_api.go +++ b/internal/api/asset_component_actions_api.go @@ -13,16 +13,17 @@ import ( ) type currentAssetComponentItem struct { - ComponentID string `json:"component_id"` - Status string `json:"status"` - Type string `json:"type,omitempty"` - Slot string `json:"slot,omitempty"` - VendorSerial string `json:"vendor_serial"` - Vendor *string `json:"vendor,omitempty"` - Model *string `json:"model,omitempty"` - Firmware *string `json:"firmware,omitempty"` - InstalledAt *time.Time `json:"installed_at,omitempty"` - CurrentAssetID string `json:"current_asset_id"` + ComponentID string `json:"component_id"` + Status string `json:"status"` + Type string `json:"type,omitempty"` + Slot string `json:"slot,omitempty"` + VendorSerial string `json:"vendor_serial"` + Vendor *string `json:"vendor,omitempty"` + Model *string `json:"model,omitempty"` + Firmware *string `json:"firmware,omitempty"` + FirmwareMismatch bool `json:"firmware_mismatch,omitempty"` + InstalledAt *time.Time `json:"installed_at,omitempty"` + CurrentAssetID string `json:"current_asset_id"` } type currentAssetComponentsFilters struct { @@ -191,6 +192,7 @@ func (h assetComponentHandlers) buildCurrentAssetComponentsPayload(r *http.Reque firmwareByID, _ := h.deps.Installations.ListLatestFirmwareByComponentIDs(r.Context(), ids) metaByID, _ := h.deps.Installations.ListCurrentComponentMetaByIDs(r.Context(), ids) instByID, _ := h.deps.Installations.ListCurrentInstallationsByComponentIDs(r.Context(), ids) + firmwareMismatchByID := detectFirmwareMismatchByComponent(components, firmwareByID) items := make([]currentAssetComponentItem, 0, len(components)) var statuses, types, slots, serials, vendors, models, firmwares []string for _, c := range components { @@ -227,6 +229,7 @@ func (h assetComponentHandlers) buildCurrentAssetComponentsPayload(r *http.Reque v := strings.TrimSpace(fw) item.Firmware = &v } + item.FirmwareMismatch = firmwareMismatchByID[c.ID] items = append(items, item) statuses = append(statuses, item.Status) types = append(types, item.Type) diff --git a/internal/api/ui_assets.tmpl b/internal/api/ui_assets.tmpl index 7d1817d..e0a7f2c 100644 --- a/internal/api/ui_assets.tmpl +++ b/internal/api/ui_assets.tmpl @@ -18,6 +18,9 @@
+ {{if .HasFirmwareMismatch}} + + {{end}}