open-nomad/ui/app/models/job-summary.js
Phil Renaud 15872cc2d4
[ui] Disconnected Clients: "Unknown" allocations in the UI (#12544)
* Unknown status for allocations accounted for

* Canary string removed

* Test cleanup

* Generate unknown in mirage

* aacidentally oovervoowled

* Update ui/app/components/allocation-status-bar.js

Co-authored-by: Derek Strickland <1111455+DerekStrickland@users.noreply.github.com>

* Disconnected state on job status in client

* Renaming Disconnected to Unknown in the job-status-in-client

* Unknown accounted for on job rows filtering and testsfix

* Adding lostAllocs as a computed dependency

* Unknown client status within acceptance test

* Swatches updated and PR comments addressed

* Unknown and disconnected added to test fixtures

Co-authored-by: Derek Strickland <1111455+DerekStrickland@users.noreply.github.com>
2022-04-22 11:25:02 -04:00

44 lines
1.4 KiB
JavaScript

import { collect, sum } from '@ember/object/computed';
import Model from '@ember-data/model';
import { attr, belongsTo } from '@ember-data/model';
import { fragmentArray } from 'ember-data-model-fragments/attributes';
import sumAggregation from '../utils/properties/sum-aggregation';
import classic from 'ember-classic-decorator';
@classic
export default class JobSummary extends Model {
@belongsTo('job') job;
@fragmentArray('task-group-summary') taskGroupSummaries;
// Aggregate allocation counts across all summaries
@sumAggregation('taskGroupSummaries', 'queuedAllocs') queuedAllocs;
@sumAggregation('taskGroupSummaries', 'startingAllocs') startingAllocs;
@sumAggregation('taskGroupSummaries', 'runningAllocs') runningAllocs;
@sumAggregation('taskGroupSummaries', 'completeAllocs') completeAllocs;
@sumAggregation('taskGroupSummaries', 'failedAllocs') failedAllocs;
@sumAggregation('taskGroupSummaries', 'unknownAllocs') unknownAllocs;
@sumAggregation('taskGroupSummaries', 'lostAllocs') lostAllocs;
@collect(
'queuedAllocs',
'startingAllocs',
'runningAllocs',
'completeAllocs',
'failedAllocs',
'lostAllocs',
'unknownAllocs'
)
allocsList;
@sum('allocsList') totalAllocs;
@attr('number') pendingChildren;
@attr('number') runningChildren;
@attr('number') deadChildren;
@collect('pendingChildren', 'runningChildren', 'deadChildren') childrenList;
@sum('childrenList') totalChildren;
}