fix(ci): resolve all lint and test failures

- Go: nil-safe profile cache in SNMPCollector, updated test assertion
- ESLint: fix conditional useQuery hook in SNMPMetricsSection
- ESLint: remove unused CREDENTIAL_TYPE_LABELS, ChevronDown/Right,
  EmptyState import, advancedOpen state
- TypeScript: replace empty interface with type alias

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-22 17:45:06 -05:00
parent 023e45c908
commit 0c1ffe0e39
6 changed files with 9 additions and 16 deletions

View File

@@ -68,12 +68,14 @@ func (c *SNMPCollector) Collect(ctx context.Context, dev store.Device, pub *bus.
profileID := ""
if dev.SNMPProfileID != nil {
profileID = *dev.SNMPProfileID
} else {
} else if c.profiles != nil {
profileID = c.profiles.GetGenericID()
if profileID == "" {
return fmt.Errorf("device %s: no SNMP profile assigned and no generic-snmp fallback found", dev.ID)
}
slog.Debug("using generic-snmp fallback profile", "device_id", dev.ID)
} else {
return fmt.Errorf("device %s: no SNMP profile assigned and profile cache not available", dev.ID)
}
profile := c.profiles.Get(profileID)
if profile == nil {

View File

@@ -20,7 +20,7 @@ func TestSNMPCollectorImplementsCollector(t *testing.T) {
}
// TestSNMPCollectorCollect_NilProfileID verifies that Collect returns an error
// when the device has no SNMPProfileID set.
// when the device has no SNMPProfileID and the profile cache is nil.
func TestSNMPCollectorCollect_NilProfileID(t *testing.T) {
collector := NewSNMPCollector(nil, nil, nil, DefaultSNMPConfig())
dev := store.Device{
@@ -32,7 +32,7 @@ func TestSNMPCollectorCollect_NilProfileID(t *testing.T) {
err := collector.Collect(context.Background(), dev, &bus.Publisher{})
require.Error(t, err)
assert.Contains(t, err.Error(), "no SNMP profile")
assert.Contains(t, err.Error(), "no SNMP profile assigned")
}
// TestSNMPCollectorCollect_UnknownProfileID verifies that Collect returns an error