UNPKG

@iotize/cli

Version:
52 lines 1.75 kB
"use strict"; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const blessed = __importStar(require("blessed")); class MonitoringScreen { constructor() { this.refreshCounter = 0; this.create(); } create() { this.screen = blessed.screen({ smartCSR: true }); this.screen.title = 'Device Monitoring'; this.table = blessed.table(); this.table.setData([['initialization', 'please wait']]); // Append our box to the this.screen. this.screen.append(this.table); // Quit on Escape, q, or Control-C. this.screen.key(['escape', 'q', 'C-c'], function (ch, key) { return process.exit(0); }); // Render the this.screen. this.screen.render(); } setVariables(variables) { let data = []; for (let variable of variables) { data.push(); } this.screen.render(); } updateScreen(values) { let data = [ ['Refresh counter', (this.refreshCounter++).toString()] ]; for (let variableId in values) { data.push([variableId.toString(), values[variableId].toString()]); } // global.output.pretty(data); this.table.setData(data); this.screen.render(); } } exports.MonitoringScreen = MonitoringScreen; //# sourceMappingURL=monitoring-sreen.js.map