Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx9FNLG2CqeBbVGGd9bFsP
23 lines
565 B
Go
23 lines
565 B
Go
package api
|
|
|
|
import "github.com/v10networks/nmon/internal/store"
|
|
|
|
// warningsOf is the device's stored warnings (discovery and poller findings) plus the live ones the
|
|
// reachability evaluator adds, such as icmp_unsupported. The result is never nil.
|
|
func (s *server) warningsOf(d *store.Device) []string {
|
|
out := append([]string{}, d.Warnings...)
|
|
if s.DeviceWarnings == nil {
|
|
return out
|
|
}
|
|
for _, w := range s.DeviceWarnings(d.Slug) {
|
|
dup := false
|
|
for _, x := range out {
|
|
dup = dup || x == w
|
|
}
|
|
if !dup {
|
|
out = append(out, w)
|
|
}
|
|
}
|
|
return out
|
|
}
|