From 528810c5a5b77118d5e816678ef841bf9cfd7c1b Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Sat, 14 May 2016 15:18:43 +0300 Subject: [PATCH] fix white text on white background on registry modals; registry hosts are now sorted by name --- web/dashboard.html | 2 +- web/dashboard.js | 53 +++++++++++++++++++++++++++++----------------- web/demo.html | 2 +- web/demo2.html | 2 +- web/demosites.html | 2 +- web/index.html | 42 ++++++++++++++++++++++++------------ web/tv.html | 2 +- 7 files changed, 66 insertions(+), 39 deletions(-) diff --git a/web/dashboard.html b/web/dashboard.html index 41bd4cbd..a3b41d39 100644 --- a/web/dashboard.html +++ b/web/dashboard.html @@ -646,4 +646,4 @@ So, to avoid flashing the charts, we destroy and re-create the charts on each up - + diff --git a/web/dashboard.js b/web/dashboard.js index 85620a7b..55e7b721 100644 --- a/web/dashboard.js +++ b/web/dashboard.js @@ -5496,38 +5496,51 @@ machine_guid: null, // the unique ID the netdata server that served dashboard.js hostname: null, // the hostname of the netdata server that served dashboard.js urls: null, // the user's other URLs + urls_array: null, // the user's other URLs in an array parsePersonUrls: function(person_urls) { + // console.log(person_urls); + if(person_urls) { NETDATA.registry.urls = {}; + NETDATA.registry.urls_array = new Array(); - // sort based on the timestamp of the last access - function pu_comparator_asc(a, b) { - if (a[2] < b[2]) return -1; - if (a[2] > b[2]) return 1; - return 0; - } - - var apu = person_urls.sort(pu_comparator_asc); - var len = apu.length; - while(len--) { - if(typeof NETDATA.registry.urls[apu[len][0]] === 'undefined') { - NETDATA.registry.urls[apu[len][0]] = { - guid: apu[len][0], - url: apu[len][1], - last_t: apu[len][2], - accesses: apu[len][3], - name: apu[len][4], + var now = new Date().getTime(); + var apu = person_urls; + var i = apu.length; + while(i--) { + if(typeof NETDATA.registry.urls[apu[i][0]] === 'undefined') { + // console.log('adding: ' + apu[i][4] + ', ' + ((now - apu[i][2]) / 1000).toString()); + + var obj = { + guid: apu[i][0], + url: apu[i][1], + last_t: apu[i][2], + accesses: apu[i][3], + name: apu[i][4], alternate_urls: new Array() }; + + NETDATA.registry.urls[apu[i][0]] = obj; + NETDATA.registry.urls_array.push(obj); + } + else { + // console.log('appending: ' + apu[i][4] + ', ' + ((now - apu[i][2]) / 1000).toString()); + + var pu = NETDATA.registry.urls[apu[i][0]]; + if(pu.last_t < apu[i][2]) { + pu.url = apu[i][1]; + pu.last_t = apu[i][2]; + pu.name = apu[i][4]; + } + pu.accesses += apu[i][3]; + pu.alternate_urls.push(apu[i][1]); } - else - NETDATA.registry.urls[apu[len][0]].alternate_urls.push(apu[len][1]); } } if(typeof netdataRegistryCallback === 'function') - netdataRegistryCallback(NETDATA.registry.urls); + netdataRegistryCallback(NETDATA.registry.urls_array); }, init: function() { diff --git a/web/demo.html b/web/demo.html index 341156b2..b773bf43 100644 --- a/web/demo.html +++ b/web/demo.html @@ -11,7 +11,7 @@ - + diff --git a/web/demo2.html b/web/demo2.html index 7a8d75a5..d926b55d 100644 --- a/web/demo2.html +++ b/web/demo2.html @@ -12,7 +12,7 @@ - + diff --git a/web/demosites.html b/web/demosites.html index 70340776..13b02e56 100644 --- a/web/demosites.html +++ b/web/demosites.html @@ -42,7 +42,7 @@ and that you have chown it to be owned by netdata:netdata --> - + - + @@ -904,7 +916,7 @@
Keep in mind, this server will be added back if and when you visit it again.
-
+