Column headers, allow volume ID length trimming.

This commit is contained in:
Ian Gulliver
2016-05-11 00:12:14 +00:00
parent bbf64c91de
commit 504c6ab81a
2 changed files with 23 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ body {
imageTypeSection {
display: table;
border-spacing: 3px;
margin: 10px;
}
imageTypeSection::before {
@@ -14,11 +15,11 @@ imageTypeSection::before {
content: attr(data-key);
}
instanceSection {
headers, instanceSection {
display: table-row;
}
instanceSection:nth-child(2n+1) {
instanceSection:nth-child(2n) {
background-color: #e9e9e9;
}
@@ -26,10 +27,19 @@ instanceSection:hover {
background-color: #ff9900 !important;
}
header {
display: table-cell;
text-align: center;
color: #bcbcbc;
white-space: nowrap;
padding: 2px;
}
hostname, lastSeen, uptime, timestamp, volumeID {
font-family: "droid-sans-mono";
display: table-cell;
padding: 2px;
text-align: right;
}
volumeID {

View File

@@ -39,6 +39,14 @@ ImageController.prototype.addImageType_ = function(type) {
instances: new Map(),
};
this.insertSorted_(this.container_, value.section, type);
let headers = this.createNode_(value.section, 'headers');
this.createNode_(headers, 'header', 'Hostname');
this.createNode_(headers, 'header', 'Last seen');
this.createNode_(headers, 'header', 'Uptime');
this.createNode_(headers, 'header', 'Current image');
this.createNode_(headers, 'header', 'Current volume ID');
this.createNode_(headers, 'header', 'Next image');
this.createNode_(headers, 'header', 'Next volume ID');
this.image_types_.set(type, value);
};
@@ -57,9 +65,10 @@ ImageController.prototype.onReport_ = function(msg) {
instance.last_seen.innerText = this.formatSeconds_(0);
instance.uptime.innerText = this.formatSeconds_(msg['uptime_seconds']);
instance.timestamp.innerText = msg['timestamp'];
instance.volume_id.innerText = msg['volume_id'];
let volume_id_len = localStorage.getItem('volume_id_len') || Number.POSITIVE_INFINITY;
instance.volume_id.innerText = msg['volume_id'].substring(0, volume_id_len);
instance.next_timestamp.innerText = msg['next_timestamp'];
instance.next_volume_id.innerText = msg['next_volume_id'];
instance.next_volume_id.innerText = msg['next_volume_id'].substring(0, volume_id_len);
};
ImageController.prototype.addInstance_ = function(type, hostname) {