Skip to content

Commit

Permalink
Closes #293 - Deduplicated errors and displayed a count.
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Sep 15, 2014
1 parent c5cf9b6 commit f7ef493
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/kibana/components/notify/_notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,20 @@ define(function (require) {
});
}

notifs.push(notif);
if (!notif.count) notif.count = 1;

var dup = _.find(notifs, function (item) {
return item.content === notif.content
&& item.stack === notif.stack
&& item.lifetime === notif.lifetime;
});

if (dup) {
dup.count++;
} else {
notifs.push(notif);
}

}

function formatMsg(msg, from) {
Expand Down
3 changes: 2 additions & 1 deletion src/kibana/components/notify/directives.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
define(function (require) {
var notify = require('modules').get('kibana/notify');
var _ = require('lodash');

notify.directive('kbnNotifications', function () {
return {
Expand All @@ -11,4 +12,4 @@ define(function (require) {
template: require('text!components/notify/partials/toaster.html')
};
});
});
});
4 changes: 2 additions & 2 deletions src/kibana/components/notify/partials/toaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
>Fix it</button>
</div>

<i class="fa" ng-class="'fa-' + notif.icon" tooltip="{{notif.title}}"></i> <kbn-truncated orig="{{notif.content}}" length="250" /></kbn-truncated>
<i class="fa" ng-class="'fa-' + notif.icon" tooltip="{{notif.title}}"></i> <kbn-truncated orig="{{notif.content}}" length="250" /></kbn-truncated><span ng-show="notif.count > 1">&nbsp;({{ notif.count }} errors)</span>

<div ng-if="notif.stack && notif.showStack" class="toaster-stack">
<pre ng-bind="notif.stack"></pre>
Expand All @@ -36,4 +36,4 @@
</div>
</li>
</ul>
</div>
</div>

0 comments on commit f7ef493

Please sign in to comment.