mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Model out the rest of the CSI Plugin properties
This commit is contained in:
@@ -1,13 +1,30 @@
|
||||
import { computed } from '@ember/object';
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { fragmentArray } from 'ember-data-model-fragments/attributes';
|
||||
|
||||
export default Model.extend({
|
||||
plainId: attr('string'),
|
||||
|
||||
topologies: attr(),
|
||||
provider: attr('string'),
|
||||
version: attr('string'),
|
||||
controllerRequired: attr('boolean'),
|
||||
|
||||
controllers: fragmentArray('storage-controller', { defaultValue: () => [] }),
|
||||
nodes: fragmentArray('storage-node', { defaultValue: () => [] }),
|
||||
|
||||
controllerRequired: attr('boolean'),
|
||||
controllersHealthy: attr('number'),
|
||||
controllersExpected: attr('number'),
|
||||
|
||||
controllersHealthyProportion: computed('controllersHealthy', 'controllersExpected', function() {
|
||||
return this.controllersHealthy / this.controllersExpected;
|
||||
}),
|
||||
|
||||
nodesHealthy: attr('number'),
|
||||
nodesExpected: attr('number'),
|
||||
|
||||
nodesHealthyProportion: computed('nodesHealthy', 'nodesExpected', function() {
|
||||
return this.nodesHealthy / this.nodesExpected;
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ const unmap = (hash, propKey) =>
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
normalize(typeHash, hash) {
|
||||
hash.PlainID = hash.ID;
|
||||
hash.PlainId = hash.ID;
|
||||
|
||||
// TODO This shouldn't hardcode `csi/` as part of the ID,
|
||||
// but it is necessary to make the correct find request and the
|
||||
|
||||
@@ -13,8 +13,14 @@ export default Factory.extend({
|
||||
version: '1.0.1',
|
||||
controllerRequired: faker.random.boolean,
|
||||
controllersHealthy: () => faker.random.number(10),
|
||||
controllersExpected() {
|
||||
return this.controllersHealthy + faker.random.number(10);
|
||||
},
|
||||
|
||||
nodesHealthy: () => faker.random.number(10),
|
||||
nodesExpected() {
|
||||
return this.nodesHealthy + faker.random.number(10);
|
||||
},
|
||||
|
||||
// Internal property to determine whether or not this plugin
|
||||
// Should create one or two Jobs to represent Node and
|
||||
@@ -52,7 +58,7 @@ export default Factory.extend({
|
||||
});
|
||||
|
||||
if (plugin.createVolumes) {
|
||||
server.createList('csi-volume', faker.random.number(5), {
|
||||
server.createList('csi-volume', faker.random.number({ min: 1, max: 5 }), {
|
||||
plugin,
|
||||
provider: plugin.provider,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user