Skip to content

Commit be2707e

Browse files
committed
Version 1.0.5
Now handling newly added servers in the UI more gracefully.
1 parent 2bbb0fc commit be2707e

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

htdocs/js/app.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,10 @@ app.extend({
152152
getRecentServerMenuOptionsHTML: function() {
153153
// get nice server list with sorted groups (and sorted servers in groups)
154154
var self = this;
155+
var menu_groups = {};
156+
var other_hostnames = [];
155157

156158
// jump to server menu
157-
var menu_groups = {};
158159
for (var hostname in this.recent_hostnames) {
159160
var value = this.recent_hostnames[hostname];
160161
if (value === 1) {
@@ -164,6 +165,7 @@ app.extend({
164165
if (!menu_groups[group_def.id]) menu_groups[group_def.id] = [];
165166
menu_groups[group_def.id].push( hostname );
166167
}
168+
else other_hostnames.push(hostname);
167169
}
168170
else {
169171
// auto-scale host, has group embedded as value
@@ -192,6 +194,19 @@ app.extend({
192194
}
193195
});
194196

197+
if (other_hostnames.length) {
198+
if (num_menu_groups > 1) {
199+
menu_html += '<option value="" disabled></option>';
200+
menu_html += '<optgroup label="(Unassigned)">';
201+
}
202+
menu_html += other_hostnames.map( function(hostname) {
203+
return '<option value="' + hostname + '">' + self.formatHostname(hostname) + '</option>';
204+
} ).join('');
205+
if (num_menu_groups > 1) {
206+
menu_html += '</optgroup>';
207+
}
208+
}
209+
195210
return menu_html;
196211
},
197212

lib/api/config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ module.exports = Class.create({
7272
});
7373
}
7474

75+
if (self.hostnameCache.hourly) {
76+
// add in cached hostnames not yet written to storage
77+
for (var hostname in self.hostnameCache.hourly) {
78+
if (hostname.match(/^(\w+)\/(.+)$/)) {
79+
hostnames[ RegExp.$2 ] = RegExp.$1;
80+
}
81+
else {
82+
hostnames[hostname] = 1;
83+
}
84+
}
85+
} // hourly cache
86+
7587
// massage first-time user experience:
7688
// if no hostnames found but `monitor_self` config is set, inject current hostname
7789
if (!Tools.numKeys(hostnames) && self.server.config.get('monitor_self')) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "performa",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "A multi-server monitoring system with a web based UI.",
55
"author": "Joseph Huckaby <jhuckaby@gmail.com>",
66
"homepage": "https://github.com/jhuckaby/performa",

0 commit comments

Comments
 (0)