UNPKG

@trusthab/composable-resources

Version:

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

31 lines (22 loc) 560 B
const composer = require('../../mixin_loader'); module.exports = (App) => { const { underscore } = require('inflected'); const WEAK_SIGNAL_THRESHOLD = -50; class DevicesWeakSignalResource { static mixins() { return ['Kpi']; } getMetricId() { return `devices_weak_signal`; } getMetricType() { return 'gauge'; } getValue() { const { value } = this.get('diff'); if (value < WEAK_SIGNAL_THRESHOLD) { return 1; } return 0; } } return composer(DevicesWeakSignalResource, App); };