pi-agent: Implement progressive Target detection
This commit is contained in:
@@ -23,7 +23,7 @@ type targetCatalog struct {
|
||||
func newTargetCatalog(snapshot app.Snapshot, includeUnavailable bool) targetCatalog {
|
||||
items := make([]app.TargetSnapshot, 0, len(snapshot.Targets))
|
||||
for _, item := range snapshot.Targets {
|
||||
if item.Available || includeUnavailable {
|
||||
if item.Available || includeUnavailable || item.DetectionPhase != app.TargetReady {
|
||||
items = append(items, item)
|
||||
}
|
||||
}
|
||||
@@ -84,11 +84,21 @@ type targetStateCounts struct {
|
||||
disabled int
|
||||
external int
|
||||
drifted int
|
||||
checking int
|
||||
failed int
|
||||
}
|
||||
|
||||
func countAvailableTargetStates(snapshot app.Snapshot) targetStateCounts {
|
||||
var counts targetStateCounts
|
||||
for _, item := range snapshot.Targets {
|
||||
switch item.DetectionPhase {
|
||||
case app.TargetChecking:
|
||||
counts.checking++
|
||||
continue
|
||||
case app.TargetDetectionFailed:
|
||||
counts.failed++
|
||||
continue
|
||||
}
|
||||
if !item.Available {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user