open-nomad/ui/app/components/allocation-status-bar.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

import { computed } from '@ember/object';
2017-09-19 14:47:10 +00:00
import DistributionBar from './distribution-bar';
export default DistributionBar.extend({
layoutName: 'components/distribution-bar',
allocationContainer: null,
2018-02-01 00:55:43 +00:00
'data-test-allocation-status-bar': true,
2017-09-19 14:47:10 +00:00
data: computed(
'allocationContainer.{queuedAllocs,completeAllocs,failedAllocs,runningAllocs,startingAllocs}',
function() {
2019-03-26 07:46:44 +00:00
if (!this.allocationContainer) {
2017-09-19 14:47:10 +00:00
return [];
}
2019-03-26 07:46:44 +00:00
const allocs = this.allocationContainer.getProperties(
2017-09-19 14:47:10 +00:00
'queuedAllocs',
'completeAllocs',
'failedAllocs',
'runningAllocs',
'startingAllocs',
'lostAllocs'
);
return [
{ label: 'Queued', value: allocs.queuedAllocs, className: 'queued' },
{
label: 'Starting',
value: allocs.startingAllocs,
className: 'starting',
layers: 2,
},
{ label: 'Running', value: allocs.runningAllocs, className: 'running' },
{
label: 'Complete',
value: allocs.completeAllocs,
className: 'complete',
},
{ label: 'Failed', value: allocs.failedAllocs, className: 'failed' },
{ label: 'Lost', value: allocs.lostAllocs, className: 'lost' },
];
}
),
});