fix(presence): list only running agents; a finished task's agent is not stale
This commit is contained in:
2 files changed
+5
-5
No files matched your search
@@ -139,10 +139,11 @@ func Mesh(records []storecontract.Presence, now time.Time) []Service {
|
||||
if record.Service != Agent {
|
||||
continue
|
||||
}
|
||||
// An agent reports for one task and stops when the task ends, so a
|
||||
// silent agent is finished, not failed: only running agents are listed.
|
||||
worker := Service{Presence: record, State: state(record, true, now)}
|
||||
if worker.State == StateDown {
|
||||
worker.Detail = ""
|
||||
worker.Checks = nil
|
||||
continue
|
||||
}
|
||||
workers = append(workers, worker)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ function problems(service: Service): { key: string; text: string }[] {
|
||||
];
|
||||
}
|
||||
|
||||
const stateLabel = (service: Service, agent: boolean) => (agent && service.state === "down" ? "stale" : service.state);
|
||||
const reasons = (service: Service) => {
|
||||
const found = problems(service).map((problem) => problem.text);
|
||||
return found.length || !service.detail ? found : [service.detail];
|
||||
@@ -129,14 +128,14 @@ onUnmounted(() => clearInterval(timer));
|
||||
<Popover v-if="reasons(row).length">
|
||||
<PopoverTrigger as-child>
|
||||
<Button type="button" variant="ghost" class="h-auto rounded-sm p-0" :aria-label="`Why ${row.service} is ${row.state}`">
|
||||
<Badge :variant="tone[row.state]">{{ stateLabel(row, table.agent) }}<ChevronDown data-icon="inline-end" /></Badge>
|
||||
<Badge :variant="tone[row.state]">{{ row.state }}<ChevronDown data-icon="inline-end" /></Badge>
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start" class="w-96 max-w-[calc(100vw-2rem)] space-y-1 text-label">
|
||||
<p v-for="reason in reasons(row)" :key="reason" class="break-words">{{ reason }}</p>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
<Badge v-else :variant="tone[row.state]">{{ stateLabel(row, table.agent) }}</Badge>
|
||||
<Badge v-else :variant="tone[row.state]">{{ row.state }}</Badge>
|
||||
</template>
|
||||
</template>
|
||||
</DataTable>
|
||||
|
||||
Reference in new issue
Block a user