2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2020-05-03 04:31:17 +00:00
|
|
|
import { computed } from '@ember/object';
|
2021-02-17 21:01:44 +00:00
|
|
|
import Model from '@ember-data/model';
|
|
|
|
import { attr } from '@ember-data/model';
|
2020-05-02 06:38:05 +00:00
|
|
|
import { fragmentArray } from 'ember-data-model-fragments/attributes';
|
2020-03-25 12:51:26 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
export default class Plugin extends Model {
|
|
|
|
@attr('string') plainId;
|
2020-05-03 04:31:17 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@attr() topologies;
|
|
|
|
@attr('string') provider;
|
|
|
|
@attr('string') version;
|
2020-03-25 12:51:26 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@fragmentArray('storage-controller', { defaultValue: () => [] }) controllers;
|
|
|
|
@fragmentArray('storage-node', { defaultValue: () => [] }) nodes;
|
2020-05-03 04:31:17 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@attr('boolean') controllerRequired;
|
|
|
|
@attr('number') controllersHealthy;
|
|
|
|
@attr('number') controllersExpected;
|
2020-05-03 04:31:17 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('controllersHealthy', 'controllersExpected')
|
|
|
|
get controllersHealthyProportion() {
|
2020-05-03 04:31:17 +00:00
|
|
|
return this.controllersHealthy / this.controllersExpected;
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2020-05-03 04:31:17 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@attr('number') nodesHealthy;
|
|
|
|
@attr('number') nodesExpected;
|
2020-05-03 04:31:17 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('nodesHealthy', 'nodesExpected')
|
|
|
|
get nodesHealthyProportion() {
|
2020-05-03 04:31:17 +00:00
|
|
|
return this.nodesHealthy / this.nodesExpected;
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|