UNPKG

@trusthab/composable-resources

Version:

migrating https://github.com/knetikmedia/hab-api/tree/integration/app/resources/composable

32 lines (22 loc) 640 B
const composer = require('../../mixin_loader'); module.exports = (App) => { const { underscore } = require('inflected'); class ActiveDevicesNotReportingResource { static mixins() { return ['Kpi']; } getMetricId() { return 'active_devices_not_reporting'; } getMetricType() { return 'gauge'; } getValue() { if (this.get('obj').location_type === 'property') { return 0; } const { value, oldValue } = this.get('diff'); if (oldValue === 'true' && value === 'false') { return 1; } return 0; } } return composer(ActiveDevicesNotReportingResource, App); };