github.com/aminovpavel/nomad@v0.11.8/ui/mirage/factories/storage-controller.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    controllerInfo: () => ({
    23      SupportsReadOnlyAttach: true,
    24      SupportsAttachDetach: true,
    25      SupportsListVolumes: true,
    26      SupportsListVolumesAttachedNodes: false,
    27    }),
    28  
    29    afterCreate(storageController, server) {
    30      const alloc = server.create('allocation', {
    31        jobId: storageController.job.id,
    32        forceRunningClientStatus: true,
    33        modifyTime: storageController.updateTime * 1000000,
    34        shallow: storageController.shallow,
    35      });
    36  
    37      storageController.update({
    38        allocID: alloc.id,
    39        nodeId: alloc.nodeId,
    40      });
    41    },
    42  });