From 4fab7c314f79af92284026ec2b0ffdec6f22e24e Mon Sep 17 00:00:00 2001 From: Dennis Ashby Date: Sat, 26 Aug 2017 11:13:04 -0700 Subject: [PATCH] Update appmetrics-dashby.js Adding functionality to suppress "menu" for a "demo" mode. This will allow "pre-sales" to show dashboard in a publicly available app without worry about users starting heap dumps or profiles --- lib/appmetrics-dash.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/appmetrics-dash.js b/lib/appmetrics-dash.js index 81ccc42..792942d 100644 --- a/lib/appmetrics-dash.js +++ b/lib/appmetrics-dash.js @@ -86,6 +86,7 @@ exports.monitor = function(options) { var url = options.url || '/appmetrics-dash'; var title = options.title || 'Application Metrics for Node.js'; + var demo = options.demo || false; var docs = options.docs || 'https://developer.ibm.com/node/application-metrics-node-js/'; options.console = options.console || console; @@ -215,6 +216,7 @@ exports.monitor = function(options) { // Send static data ASAP but re-send below in case the client isn't ready. socket.emit('environment', JSON.stringify(envData)); socket.emit('title', JSON.stringify({title: title, docs: docs})); + socket.emit('demo', JSON.stringify({demo: demo})); socket.emit('status', JSON.stringify({profiling_enabled: profiling_enabled})); // When the client confirms it's connected and has listeners ready, @@ -222,6 +224,7 @@ exports.monitor = function(options) { socket.on('connected', () => { socket.emit('environment', JSON.stringify(envData)); socket.emit('title', JSON.stringify({title: title, docs: docs})); + socket.emit('demo', JSON.stringify({demo: demo})); socket.emit('status', JSON.stringify({profiling_enabled: profiling_enabled})); });