Add binding to show config

This commit is contained in:
Aaron France 2015-01-28 00:14:32 +01:00
parent 97966d8cd9
commit 396ef337b2
2 changed files with 19 additions and 1 deletions

View file

@ -187,12 +187,28 @@ dash = (function() {
);
}
var showconfig = function() {
stash();
var configTemplate = _.template("<div>{{- config }}</div>");
var rendered = configTemplate({config: JSON.stringify({
server: toolbar.server(),
server_type: toolbar.server_type(),
workspaces: workspaces
})});
var dialog = $(rendered);
dialog.modal({onClose: function() {
keys.enable();
$.modal.close();
}});
};
var help = function() {
var dialog = $(
'<div><h1>Help</h1><ul>' +
'<li><b>e</b>: edit the view</li>' +
'<li><b>?</b>: display this help box</li>' +
'<li><b>s</b>: save the dashboard</li>' +
'<li><b>c</b>: display the current config</li>' +
'<li><b>r</b>: reload the dashboard from last saved config</li>' +
'<li><b>+</b>: increase the size of the view</li>' +
'<li><b>-</b>: decrease the size of the view</li>' +
@ -221,6 +237,7 @@ dash = (function() {
keys.bind(80, subs.toggle); // p
keys.bind(82, reload); // r
keys.bind(83, save); // s
keys.bind(67, showconfig); // c
keys.bind(191, help); // ?
keys.bind(49, function(e) { e.altKey && switchWorkspace(workspaces[0]) });
keys.bind(50, function(e) { e.altKey && switchWorkspace(workspaces[1]) });

View file

@ -8,7 +8,8 @@
"<p>Need a refresher on the query language? See the <a href=\"https://github.com/aphyr/riemann/blob/master/test/riemann/query_test.clj\">query tests</a> for examples, or read the <a href=\"https://github.com/aphyr/riemann/blob/master/src/riemann/Query.g\">spec</a>.</p>" +
"<p>Press <b>Control/Meta+click</b> to select a view. Escape unfocuses. Use the arrow keys to move a view. Use Control+arrow to <i>split</i> a view in the given direction.</p>" +
"<p>To edit a view, hit e. Use enter, or click 'apply', to apply your changes. Escape cancels.</p>" +
"<p>To save your changes to the server, press s. You can refresh the page, or press r to reload.</p>" +
"<p>To save your changes to the server, press s. To display the configuration, press c.</p>" +
"<p>You can refresh the page, or press r to reload.</p>" +
"<p>Make views bigger and smaller with the +/- keys. Pageup selects the parent of the current view. To delete a view, use the delete key.</p>" +
"<p>Switch between workspaces with alt-1, alt-2, etc.</p>" +
"<p>View is an empty space. Title is an editable text title. Fullscreen and Balloon are top-level container views; you probably won't use them. HStack and VStack are the horizontal and vertical container views; they're implicitly created by splits, but you can create them yourself for fine control. Gauge shows a single event. Grid shows a table of events. Timeseries and Flot show metrics over time--Timeseries is deprecated; Flot will probably replace it.</p>" +