How to use blessed-contrib - 10 common examples

To help you get started, we’ve selected a few blessed-contrib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stratosphereips / StratosphereLinuxIPS / modules / blessed / ips_timewindows.js View on Github external
else{
        blockedTWs[blocked_list[1]].push(blocked_list[2])
      }
      callback(null)
    },function(err){
      if(err){
        console.log(err);
      }
     else{resolve(blockedTWs)}
    })
  })
})}

// set up elements of the interface.

var grid = new contrib.grid({
  rows: 6,
  cols: 6,
  screen: screen
});

var table_timeline =  grid.set(0.5, 1, 4.3, 5, contrib.table, 
  {keys: true
  , vi:true
  , style:{border:{ fg:'blue'}}
  , scrollbar: true
  , label: "Timeline"
  , columnWidth:[200]})
, box_generic_dashboard = grid.set(2,2, 1.5, 2,blessed.box,{
      top: 'center',
      left: 'center',
      width: '50%',
github hustcer / star / lib / watch.js View on Github external
let initUI = function initUI(){
    table = contrib.table({
        keys          : true,
        fg            : 'white',
        selectedFg    : 'black',
        selectedBg    : 'cyan',
        interactive   : true,
        label         : '股票列表',
        width         : '55%',
        height        : '80%',
        border        : { type: 'line', fg: 'cyan' },
        columnSpacing : 5,
        columnWidth   : [10, 7, 7, 7, 9],
    });

    /* eslint no-process-exit:0 */
    screen.key(['escape', 'q', 'C-c'], () => process.exit(0) );
};
github gajus / seeql / src / index.js View on Github external
let table;

if (argv.useScreen) {
  const blessed = require('blessed');
  const contrib = require('blessed-contrib');

  screen = blessed.screen({
    smartCSR: true
  });

  screen.key(['escape', 'q', 'C-c'], () => {
    // eslint-disable-next-line no-process-exit
    return process.exit(0);
  });

  table = contrib.table({
    columnSpacing: 5,
    columnWidth: [
      15,
      15,
      50,
      10,
      30
    ],
    fg: 'white',
    height: '80%',
    interactive: true,
    keys: true,
    label: null,
    selectedBg: 'blue',
    selectedFg: 'white',
    width: '80%'
github astefanutti / kubebox / kubebox.js View on Github external
// TODO: watch for namespace changes when the selection list is open
  // and avoid 'n' key to trigger another request
  get(session.openshift ? get_projects() : get_namespaces())
    .then(response => JSON.parse(response.body.toString('utf8')))
    // TODO: display a message in case the user has access to no namespaces
    .then(namespaces => session.namespaces = namespaces)
    .then(namespaces => namespaces_list.setItems(namespaces.items.reduce((data, namespace) => {
      data.push(namespace.metadata.name === session.namespace ?
        `{blue-fg}${namespace.metadata.name}{/blue-fg}` : namespace.metadata.name);
      return data;
    }, [])))
    .then(() => screen.render())
    .catch(error => console.error(error.stack));
});

const carousel = new contrib.carousel(
  [
    screen => {
      // TODO: restore selection if any
      screen.append(pods_table);
      screen.append(pod_log);
      pod_log.setScrollPerc(100);
      pods_table.focus();
    },
    screen => {
      screen.append(debug);
      debug.setScrollPerc(100);
    }
  ],
  {
    screen      : screen,
    interval    : 0,
github graylog-labs / cli-dashboard / lib / screen.js View on Github external
create(options) {
    if (module.exports.screen) throw new Error('Screen already created!');

    const screen = module.exports.screen = blessed.screen({
      autoPadding: true,
      smartCSR: true,
    });
    const grid = module.exports.grid = new contrib.grid({rows: 4, cols: 5, screen});

    // Set up widgets.
    widgets.streamThroughput = grid.set(...positions.streamThroughput, contrib.line, {
      label: "Stream Throughput (max last 5 minutes)",
      style: {
        line: "red",
        text: "green",
        baseline: "white"
      },
      showNthLabel: 60
    });

    widgets.totalThroughput = grid.set(...positions.totalThroughput, contrib.line, {
      label: "Total Throughput (max last 5 minutes)",
      style: {
        line: "green",
github wechaty / wechaty / examples / blessed-twins-bot / index.ts View on Github external
import * as contrib from 'blessed-contrib'

import { generate } from 'qrcode-terminal'

import {
  Wechaty,
}               from '../../src/'

const screen = blessed.screen({
  smartCSR:     true,
  fullUnicode:  true,  // https://github.com/chjj/blessed/issues/226#issuecomment-188777457
})

// create layout and widgets

const grid = new contrib.grid({rows: 12, cols: 12, screen: screen})

/**
 * Donut Options
 *   self.options.radius = options.radius || 14; // how wide is it? over 5 is best
 *   self.options.arcWidth = options.arcWidth || 4; //width of the donut
 *   self.options.yPadding = options.yPadding || 2; //padding from the top
 */
const donut = grid.set(8, 8, 4, 2, contrib.donut,
  {
  label: 'Percent Donut',
  radius: 16,
  arcWidth: 4,
  yPadding: 2,
  data: [{label: 'Storage', percent: 87}],
})
github ajermakovics / jvm-mon / src / dist / jvm-mon.js View on Github external
var blessed = require('blessed')
 , contrib = require('blessed-contrib')
 , screen = blessed.screen()
 , grid = new contrib.grid({rows: 2, cols: 4, screen: screen})

var times = [], hist = {};

var labelStyle = {
    fg: "white",
    bold: true
}

// grid.set(row, col, rowSpan, colSpan, obj, opts)
var table = grid.set(0, 0, 1, 2, contrib.table,
 { keys: true
 , fg: 'white'
 , selectedFg: 'white'
 , selectedBg: 'blue'
 , interactive: true
 , label: 'JVM Processes (Enter=Monitor, Del=Terminate)'
github lirantal / dockly / src / screen.js View on Github external
initScreen () {
    this.screen = blessed.screen({
      title: this.title,
      fullUnicode: true,
      dockBorders: true,
      smartCSR: true
    })

    // initialize 12x12 grid
    // eslint-disable-next-line new-cap
    this.grid = new contrib.grid({ rows: 12, cols: 12, hideBorder: true, screen: this.screen })
  }
github wechaty / wechaty / examples / blessed-twins-bot / index.ts View on Github external
/*
 *
 * LCD Options
//these options need to be modified epending on the resulting positioning/size
  options.segmentWidth = options.segmentWidth || 0.06; // how wide are the segments in % so 50% = 0.5
  options.segmentInterval = options.segmentInterval || 0.11; // spacing between the segments in % so 50% = 0.5
  options.strokeWidth = options.strokeWidth || 0.11; // spacing between the segments in % so 50% = 0.5
//default display settings
  options.elements = options.elements || 3; // how many elements in the display. or how many characters can be displayed.
  options.display = options.display || 321; // what should be displayed before anything is set
  options.elementSpacing = options.spacing || 4; // spacing between each element
  options.elementPadding = options.padding || 2; // how far away from the edges to put the elements
//coloring
  options.color = options.color || "white";
*/
const lcdLineOne = grid.set(0, 9, 2, 3, contrib.lcd,
  {
    label: 'LCD Test',
    segmentWidth: 0.06,
    segmentInterval: 0.11,
    strokeWidth: 0.1,
    elements: 5,
    display: 3210,
    elementSpacing: 4,
    elementPadding: 2,
  },
)

const errorsLine = grid.set(0, 6, 4, 3, contrib.line, {
  style: {
    line: 'red',
    text: 'white',
github wechaty / wechaty-getting-started / examples / professional / blessed-twins-bot / bless-twins-bot.ts View on Github external
/*
 *
 * LCD Options
//these options need to be modified epending on the resulting positioning/size
  options.segmentWidth = options.segmentWidth || 0.06; // how wide are the segments in % so 50% = 0.5
  options.segmentInterval = options.segmentInterval || 0.11; // spacing between the segments in % so 50% = 0.5
  options.strokeWidth = options.strokeWidth || 0.11; // spacing between the segments in % so 50% = 0.5
//default display settings
  options.elements = options.elements || 3; // how many elements in the display. or how many characters can be displayed.
  options.display = options.display || 321; // what should be displayed before anything is set
  options.elementSpacing = options.spacing || 4; // spacing between each element
  options.elementPadding = options.padding || 2; // how far away from the edges to put the elements
//coloring
  options.color = options.color || "white";
*/
const lcdLineOne = grid.set(0, 9, 2, 3, contrib.lcd,
  {
    label: 'LCD Test',
    segmentWidth: 0.06,
    segmentInterval: 0.11,
    strokeWidth: 0.1,
    elements: 5,
    display: 3210,
    elementSpacing: 4,
    elementPadding: 2,
  },
)

const errorsLine = grid.set(0, 6, 4, 3, contrib.line, {
  style: {
    line: 'red',
    text: 'white',