open-nomad/ui/mirage/factories/client-allocation-stats.js
2018-09-19 16:33:18 -07:00

23 lines
500 B
JavaScript

import { Factory } from 'ember-cli-mirage';
import generateResources from '../data/generate-resources';
export default Factory.extend({
resourceUsage: generateResources,
_taskNames: () => [], // Set by allocation
timestamp: () => Date.now() * 1000000,
tasks() {
var hash = {};
this._taskNames.forEach(task => {
hash[task] = {
Pids: null,
ResourceUsage: generateResources(),
Timestamp: Date.now() * 1000000,
};
});
return hash;
},
});