diff options
author | Thomas Anderson <tnyeanderson@users.noreply.github.com> | 2020-05-14 10:11:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 17:11:47 +0300 |
commit | 5b23ce88d433021b37df0497eff69ad63ba86d95 (patch) | |
tree | 1f9a02429573b979af7e3bfb65cb1cc70b3c5975 /web | |
parent | 9d712b513566f1f90f6031f16c25953c5d836891 (diff) |
Sort alphabetically and automatic scroll (#8762)
Diffstat (limited to 'web')
-rw-r--r-- | web/gui/dash-example.html | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/web/gui/dash-example.html b/web/gui/dash-example.html index b9bc80376d..b1ff1af82f 100644 --- a/web/gui/dash-example.html +++ b/web/gui/dash-example.html @@ -446,7 +446,7 @@ class PickNSort { try { return JSON.parse(localStorage.getItem('netdata_ordered_hosts')).enabled } catch (e) { - return this.netdata_info.mirrored_hosts; + return this.netdata_info.mirrored_hosts.sort(); } } @@ -550,9 +550,9 @@ class PickNSort { for (var i=0, len=hosts.length; i<len; i++) { var hostname = hosts[i]; - $('#alarms .alarm-host-list').append('<div class="host-alarms ' + hostname + '"><a target="_blank" href="' + this.get_host_url(hostname, true) + '/"><h2>' + hostname + '</h2></a></div>'); + $('#alarms .alarm-host-list').append('<div class="host-alarms ' + hostname + '"><a onclick="return dash.scroll_to_host_stats(' + "'" + hostname + "'" + ')" href="#' + hostname + '"><h2>' + hostname + '</h2></a></div>'); - $template.clone().removeClass('template').appendTo('#dash'); + $template.clone().removeClass('template').attr('id', hostname).appendTo('#dash'); var $newest = $('.netdata-host-stats-container').last(); this.build_stats($newest, hostname); } @@ -625,6 +625,14 @@ class PickNSort { $graph.appendTo($wrapper); } + + scroll_to_host_stats (hostname) { + event.preventDefault(); + $('#dash').scrollLeft(document.getElementById(hostname).offsetLeft - $('#' + hostname).width()); + + // Prevent regular event from happening + return false; + } all_alarms_are_warnings () { var out = true; |