Skip to content

Commit

Permalink
Merge pull request #135 from smortex/ui-improvements
Browse files Browse the repository at this point in the history
Improve UI
  • Loading branch information
jamtur01 authored Jun 30, 2024
2 parents c0b4ab9 + f611ea7 commit 2d479c6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
26 changes: 16 additions & 10 deletions lib/riemann/dash/public/eventPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ var eventPane = (function() {
var fixedFields = ['host', 'service', 'time', 'state', 'metric', 'ttl', 'description', 'tags'];
var fixedTemplate =
_.template(
'<div class="host">{{-host}}</div>' +
'<div class="service">{{-service}}</div>' +
'<div class="state {{-state}}">{{-state}}</div>' +
'<div class="metric">{{-metric}}</div>' +
'<div>' +
'<span class="host">{{-host}}</span>' +
'<span class="service">{{-service}}</span>' +
'<span class="state {{-state}}">{{-state}}</span>' +
'<span class="metric">{{-metric}}</span>' +
'<time class="absolute">{{-time}}</time>' +
'<div class="ttl">{{-ttl}}</div>' +
'<div class="tags">{{-tags}}</div>' +
'<div class="description">{{-description}}</description>');
'<span class="ttl">{{-ttl}}</span>' +
'<span class="tags">{{-tags}}</span>' +
'</div>' +
'<pre class="description">{{-description}}</pre>');

var rowTemplate =
_.template("<tr><td>{{-field}}</td><td>{{-value}}</td></tr>");
_.template('<tr><td class="field-name">{{-field}}</td><td>{{-value}}</td></tr>');

// Hide the pane
var hide = function() {
Expand Down Expand Up @@ -45,14 +47,18 @@ var eventPane = (function() {
tags: "nil",
description: "nil"})));

var table = el.append('<table></table>');
var table = '<table>'

// Remaining fields
_.each(event, function(value, field) {
if (! _.contains(fixedFields, field)) {
table.append(rowTemplate({field: field, value: value}));
table += rowTemplate({field: field, value: value});
}
});

table += '</table>';

el.append(table);
};

// Hide on escape.
Expand Down
6 changes: 5 additions & 1 deletion lib/riemann/dash/public/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ var format = (function() {
}
precision = precision || 2;
var base = Math.pow(10, precision);
var val = Math.round(number * base) / base;
var val;
if (Math.round(number) == number)
val = number;
else
val = number.toFixed(precision);

if(!commas) {
return val;
Expand Down
10 changes: 8 additions & 2 deletions lib/riemann/dash/views/css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ html,table {
}

* {
float: left;
padding: 3px;
}

Expand All @@ -168,12 +167,19 @@ html,table {

.tags:before {
color: $grey;
content: "tags: ";
content: "tags ";
}

.field-name {
color: $grey;
text-align: right;
}

.description {
float: left;
clear: both;
white-space: pre-wrap;
margin: 3px;
}
}

Expand Down

0 comments on commit 2d479c6

Please sign in to comment.