Skip to content

Commit

Permalink
Overhaul of the dashboard, better default dashboard, fix #683, addres…
Browse files Browse the repository at this point in the history
…s some issues found in #681
  • Loading branch information
gashcrumb committed Oct 28, 2013
1 parent 0f2e7f9 commit 795d620
Show file tree
Hide file tree
Showing 9 changed files with 328 additions and 138 deletions.
39 changes: 28 additions & 11 deletions hawtio-web/src/main/webapp/app/core/js/loggingInit.js
Expand Up @@ -32,8 +32,9 @@ var consoleLogger = null;

if ('console' in window) {

var MyConsole = window.console;
window['JSConsole'] = window.console;
consoleLogger = function(messages, context) {
var MyConsole = window['JSConsole'];
var hdlr = MyConsole.log;

// Prepend the logger's name to the log message for easy identification.
Expand All @@ -42,15 +43,19 @@ if ('console' in window) {
}

// Delegate through to custom warn/error loggers if present on the console.
if (context.level === Logger.WARN && MyConsole.warn) {
if (context.level === Logger.WARN && 'warn' in MyConsole) {
hdlr = MyConsole.warn;
} else if (context.level === Logger.ERROR && MyConsole.error) {
} else if (context.level === Logger.ERROR && 'error' in MyConsole) {
hdlr = MyConsole.error;
} else if (context.level === Logger.INFO && MyConsole.info) {
} else if (context.level === Logger.INFO && 'info' in MyConsole) {
hdlr = MyConsole.info;
}

hdlr.apply(MyConsole, messages);
try {
hdlr.apply(MyConsole, messages);
} catch (e) {
MyConsole.log(messages);
}
};
}

Expand Down Expand Up @@ -103,14 +108,14 @@ Logger.setHandler(function(messages, context) {
scroll = true;
}

Rainbow.color(node, function() {
function onAdd() {
panel.appendChild(node);
if (scroll) {
panel.scrollTop = panel.scrollHeight;
}
if (panel.childNodes.length > parseInt(window['LogBuffer'])) {
panel.firstChild.remove();
}
if (scroll) {
panel.scrollTop = panel.scrollHeight;
}
if (consoleLogger) {
consoleLogger(messages, context);
}
Expand All @@ -119,7 +124,19 @@ Logger.setHandler(function(messages, context) {
for (var i = 0; i < interceptors.length; i++) {
interceptors[i](context.level.name, text);
}
});
}

onAdd();

/*
try {
Rainbow.color(node, onAdd);
} catch (e) {
// in case rainbow hits an error...
onAdd();
}
*/


});

Expand All @@ -128,7 +145,7 @@ window.onerror = function(msg, url, line) {
Logger.error(msg, " (url:", url, ", line:", line, ")");
// supress error alert
return true;
}
};

// sneaky hack to redirect console.log !
window.console = {
Expand Down
@@ -1,16 +1,13 @@
<div class="controller-section" ng-controller="Dashboard.EditDashboardsController">
<div class="row-fluid">
<div class="span10 offset1 well">
Select a dashboard (or multiple dashboards) in the table below and click "Add View To Dashboard" to add the view to a dashboard. You can also create a new dashboard using the "Create" button, select it and then click the "Add View To Dashboard" to add the view to a new dashboard.
</div>
</div>
<div class="row-fluid">

<div class="span12">
<ul class="nav nav-tabs">

<li>
<a href="" ng-click="goBack()"
title="Go back to the previous view" data-placement="bottom">
<i class="icon-backward"></i> Back
</a>
</li>

<li>
<a href="" ng-disabled="!hasSelection()" ng-click="addViewToDashboard()"
title="Adds the current view to the selected dashboard(s)" data-placement="bottom">
Expand Down
@@ -1,7 +1,11 @@
<ul class="nav nav-tabs" ng-controller="Dashboard.NavBarController">
<li ng-repeat="dash in dashboards()" ng-class='{active : isActive(dash)}'>
<li ng-repeat="dash in _dashboards track by $index"
ng-class='{active : isActive(dash)}'>
<a ng-href="#/dashboard/id/{{dash.id}}{{hash}}">
<editable-property class="inline-block" on-save="onTabRenamed(dash)" property="title" ng-model="dash"></editable-property>
<editable-property class="inline-block"
on-save="onTabRenamed(dash)"
property="title"
ng-model="dash"></editable-property>
</a>
</li>
<li class="pull-right" ng-class='{active : isEditing()}'>
Expand Down

0 comments on commit 795d620

Please sign in to comment.