Giter Club home page Giter Club logo

hapi-dashboard's Introduction

hapi-dashboard

Hapi plugin for displaying metrics on a dashboard

Installation

npm install --save hapi-dashboard

Usage

server.pack.register([
  { plugin: require('hapi-dashboard'), options: {
    //defaults shown below
    endpoint: '/dashboard'
    dashboards: {},
    ttl: 60*1000, //time to cache responses. 60 seconds
    concurrent: 20, //max metrics to process at once
    password: 'something', //password used to access dashboards
	favicon: 'favicon.png' // Also used as home screen icon for ios
  }}
], function(err) {
});

Dashboards Object

Dashboards object should look something like this:

{
  'dashboard-1': {
    name: 'Dashboard 1',
    metrics: {
      loggedIn: {
        value: function(server, done) {
          //perform some async call
          server.plugins.db.metrics.loggedInCount(function(err, result) {
            done(null, {
            name: 'Number of times a user logged in',
            value: result.total
          });
          }
        },
        ttl: 60
      }
    }
  }
}

hapi-dashboard's People

Contributors

jgallen23 avatar dawnerd avatar orthagonal avatar greenkeeper[bot] avatar

Stargazers

lex_xenda avatar Eder Sosa avatar

Watchers

 avatar  avatar Eric Willis avatar James Cloos avatar  avatar  avatar

Forkers

majjihari my-hapi

hapi-dashboard's Issues

auto refresh

should we add a meta content refresh every minute?

multiple columns

we have a use case to show total, last 30 days, last 7 days, yesterday, today. How should we handle this? Maybe on the dashboard level, we define columns that get passes to each metric?

@dawnerd

password protection

very simple, pass in the password via options. build a simple password protection page, set a cookie on post and check the cookie on the dashboard pages.

json export

/{{endpoint}}.json
/{{endpoint}}/{{name}}.json

similar to csv

log

we should log when data is fetched with a 'dashboard' tag. log the name of the dashboard and the metric name

500 error in handler

Pretty sure it's erroring out because Hapi is defined in devDeps. We should also just use Boom for error responses instead of the outdated Hapi.error

{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}},"path":"/_dashboard/circles.csv","method":"get","payload":null,"stack":"TypeError: Cannot call method 'notFound' of undefined\n at Object.exports.dashboard (/app/node_modules/hapi-dashboard/lib/handler.js:29:29)

be able to return multiple metrics from a single call

there are some instances where we want to return multiple metrics for a single call. We need to think through how to tackle it. One way would be to return something like:

done(null, [ { name: 'Blah', value: 123 }, { name: 'Blah2', value: 456 }]);

and then have the top level metric name be a row with no value and then have the sub metrics indented in on the table. Thoughts @dawnerd ?

csv export

Be able to export the current data table as a csv

auth via querystring

want to support ?pass= based authentication in addition to the cookie based we have now.

Specs for v1

MVP

  • need to be able to easily run a bunch of queries and show them in a data table.
  • will allow multiple dashboards
  • each metric should be queried in parallel
  • metrics should be cached by a given ttl (look into catbox-mongodb) - should we cache each query or the whole output?
  • implementation details in the readme

Next Rev

  • date ranges (need to think through how to handle this)
  • password protection
  • multiple widget types (graphs?)

sections

Allow a metric to say it's part of a section. Each section is its own table with its own table headers. By default there is no section and it operates as is today.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.