github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/mirage/factories/storage-node.js (about) 1 import { Factory } from 'ember-cli-mirage'; 2 import faker from 'nomad-ui/mirage/faker'; 3 import { STORAGE_PROVIDERS } from '../common'; 4 const REF_TIME = new Date(); 5 6 export default Factory.extend({ 7 provider: faker.helpers.randomize(STORAGE_PROVIDERS), 8 providerVersion: '1.0.1', 9 10 healthy: faker.random.boolean, 11 healthDescription() { 12 this.healthy ? 'healthy' : 'unhealthy'; 13 }, 14 15 updateTime: () => faker.date.past(2 / 365, REF_TIME), 16 17 requiresControllerPlugin: true, 18 requiresTopologies: true, 19 20 shallow: false, 21 22 nodeInfo: () => ({ 23 MaxVolumes: 51, 24 AccessibleTopology: { 25 key: 'value', 26 }, 27 RequiresNodeStageVolume: true, 28 }), 29 30 afterCreate(storageNode, server) { 31 const alloc = server.create('allocation', { 32 jobId: storageNode.job.id, 33 modifyTime: storageNode.updateTime * 1000000, 34 shallow: storageNode.shallow, 35 }); 36 37 storageNode.update({ 38 allocID: alloc.id, 39 nodeId: alloc.nodeId, 40 }); 41 }, 42 });