You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/edge/components/edge-stack-status/edgeStackStatusController.js

21 lines
547 B

const statusMap = {
1: 'ok',
2: 'error',
3: 'acknowledged',
};
export class EdgeStackStatusController {
$onChanges({ stackStatus }) {
if (!stackStatus || !stackStatus.currentValue) {
return;
}
const aggregateStatus = { ok: 0, error: 0, acknowledged: 0 };
for (let endpointId in stackStatus.currentValue) {
const endpoint = stackStatus.currentValue[endpointId];
const endpointStatusKey = statusMap[endpoint.Type];
aggregateStatus[endpointStatusKey]++;
}
this.status = aggregateStatus;
}
}