mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
* refactor(edge-groups): use es6 imports * refactor(edge-jobs): es6 imports * refactor(edge-stacks): use es6 imports * refactor(edge-compute): use es6 imports in components * refactor(edge-compute): use named imports
20 lines
547 B
JavaScript
20 lines
547 B
JavaScript
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;
|
|
}
|
|
}
|