open-nomad/ui/app/models/plugin.js
2020-05-06 17:21:44 -07:00

31 lines
967 B
JavaScript

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'),
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;
}),
});