@cryptotaxi247 / netdata-1 / commits / 528810c5a

fix white text on white background on registry modals; registry hosts are now sorted by name

Costa Tsaousis (ktsaou) committed May 14, 2016 at 15:18 UTC 528810c5a5b77118d5e816678ef841bf9cfd7c1b
7 files changed +66 -39
web/dashboard.html
+1 -1
@@ -646,4 +646,4 @@ So, to avoid flashing the charts, we destroy and re-create the charts on each up
646 <!-- <script> netdataServer = "http://box:19999"; </script> -->
647
648 <!-- load the dashboard manager - it will do the rest -->
649 - <script type="text/javascript" src="dashboard.js?v35"></script>
649 + <script type="text/javascript" src="dashboard.js?v36"></script>
web/dashboard.js
+33 -20
@@ -5496,38 +5496,51 @@
5496 machine_guid: null, // the unique ID the netdata server that served dashboard.js
5497 hostname: null, // the hostname of the netdata server that served dashboard.js
5498 urls: null, // the user's other URLs
5499 + urls_array: null, // the user's other URLs in an array
5500
5501 parsePersonUrls: function(person_urls) {
5502 + // console.log(person_urls);
5503 +
5504 if(person_urls) {
5505 NETDATA.registry.urls = {};
5506 + NETDATA.registry.urls_array = new Array();
5507
5504 - // sort based on the timestamp of the last access
5505 - function pu_comparator_asc(a, b) {
5506 - if (a[2] < b[2]) return -1;
5507 - if (a[2] > b[2]) return 1;
5508 - return 0;
5509 - }
5510 -
5511 - var apu = person_urls.sort(pu_comparator_asc);
5512 - var len = apu.length;
5513 - while(len--) {
5514 - if(typeof NETDATA.registry.urls[apu[len][0]] === 'undefined') {
5515 - NETDATA.registry.urls[apu[len][0]] = {
5516 - guid: apu[len][0],
5517 - url: apu[len][1],
5518 - last_t: apu[len][2],
5519 - accesses: apu[len][3],
5520 - name: apu[len][4],
5508 + var now = new Date().getTime();
5509 + var apu = person_urls;
5510 + var i = apu.length;
5511 + while(i--) {
5512 + if(typeof NETDATA.registry.urls[apu[i][0]] === 'undefined') {
5513 + // console.log('adding: ' + apu[i][4] + ', ' + ((now - apu[i][2]) / 1000).toString());
5514 +
5515 + var obj = {
5516 + guid: apu[i][0],
5517 + url: apu[i][1],
5518 + last_t: apu[i][2],
5519 + accesses: apu[i][3],
5520 + name: apu[i][4],
5521 alternate_urls: new Array()
5522 };
5523 +
5524 + NETDATA.registry.urls[apu[i][0]] = obj;
5525 + NETDATA.registry.urls_array.push(obj);
5526 + }
5527 + else {
5528 + // console.log('appending: ' + apu[i][4] + ', ' + ((now - apu[i][2]) / 1000).toString());
5529 +
5530 + var pu = NETDATA.registry.urls[apu[i][0]];
5531 + if(pu.last_t < apu[i][2]) {
5532 + pu.url = apu[i][1];
5533 + pu.last_t = apu[i][2];
5534 + pu.name = apu[i][4];
5535 + }
5536 + pu.accesses += apu[i][3];
5537 + pu.alternate_urls.push(apu[i][1]);
5538 }
5524 - else
5525 - NETDATA.registry.urls[apu[len][0]].alternate_urls.push(apu[len][1]);
5539 }
5540 }
5541
5542 if(typeof netdataRegistryCallback === 'function')
5530 - netdataRegistryCallback(NETDATA.registry.urls);
5543 + netdataRegistryCallback(NETDATA.registry.urls_array);
5544 },
5545
5546 init: function() {
web/demo.html
+1 -1
@@ -11,7 +11,7 @@
11 <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
12 <meta name="author" content="costa@tsaousis.gr">
13
14 - <script type="text/javascript" src="dashboard.js?v35"></script>
14 + <script type="text/javascript" src="dashboard.js?v36"></script>
15 </head>
16 <body>
17
web/demo2.html
+1 -1
@@ -12,7 +12,7 @@
12 <meta name="author" content="costa@tsaousis.gr">
13
14 <script>var netdataTheme = 'slate';</script>
15 - <script type="text/javascript" src="dashboard.js"></script>
15 + <script type="text/javascript" src="dashboard.js?v36"></script>
16 </head>
17 <body>
18
web/demosites.html
+1 -1
@@ -42,7 +42,7 @@
42 and that you have chown it to be owned by netdata:netdata
43 -->
44 <!-- <script type="text/javascript" src="http://my.server:19999/dashboard.js"></script> -->
45 - <script type="text/javascript" src="dashboard.js?v35"></script>
45 + <script type="text/javascript" src="dashboard.js?v36"></script>
46
47 <script>
48 // --- OPTIONS FOR THE CHARTS --
web/index.html
+28 -14
@@ -365,19 +365,32 @@
365 return saveLocalStorage('netdataTheme', theme);
366 }
367
368 - var netdataRegistryCallback = function(urls) {
368 + var netdataRegistryCallback = function(urls_array) {
369 var el = '';
370 var a1 = '';
371 var found = 0;
372
373 - if(urls) {
374 - $.each(urls, function(i, u) {
375 - if(u.guid !== NETDATA.registry.machine_guid) {
376 - found++;
377 - el += '<li id="registry_server_' + u.guid + '"><a href="' + u.url + '">' + u.name + '</a></li>';
378 - a1 += '<li id="registry_action_' + u.guid + '"><a href="#" onclick="deleteRegistryModalHandler(\'' + u.guid + '\',\'' + u.name + '\',\'' + u.url + '\'); return false;"><i class="fa fa-trash-o" aria-hidden="true" style="color: #999;"></i></a></li>';
379 - }
380 - });
373 + if(urls_array) {
374 + function name_comparator_desc(a, b) {
375 + if (a.name > b.name) return -1;
376 + if (a.name < b.name) return 1;
377 + return 0;
378 + }
379 +
380 + var urls = urls_array.sort(name_comparator_desc);
381 + var len = urls.length;
382 + while(len--) {
383 + var u = urls[len];
384 +
385 + var status = "enabled";
386 + found++;
387 +
388 + if(u.guid === NETDATA.registry.machine_guid)
389 + status = "disabled"
390 +
391 + el += '<li id="registry_server_' + u.guid + '" class="' + status + '"><a href="' + u.url + '">' + u.name + '</a></li>';
392 + a1 += '<li id="registry_action_' + u.guid + '"><a href="#" onclick="deleteRegistryModalHandler(\'' + u.guid + '\',\'' + u.name + '\',\'' + u.url + '\'); return false;"><i class="fa fa-trash-o" aria-hidden="true" style="color: #999;"></i></a></li>';
393 + }
394 }
395
396 if(!found) {
@@ -405,15 +418,14 @@
418 a1 += '<li><a href="#" style="color: #999;" onclick="switchRegistryModalHandler(); return false;"><i class="fa fa-cog" aria-hidden="true" style="color: #999;"></i></a></li>'
419
420 document.getElementById('mynetdata_servers').innerHTML = el;
408 - document.getElementById('mynetdata_actions1').innerHTML = a1;
409 -
421 document.getElementById('mynetdata_servers2').innerHTML = el;
422 + document.getElementById('mynetdata_actions1').innerHTML = a1;
423 };
424
425 </script>
426
427 <!-- load the dashboard manager - it will do the rest -->
416 - <script type="text/javascript" src="dashboard.js?v35"></script>
428 + <script type="text/javascript" src="dashboard.js?v36"></script>
429 </head>
430
431 <body data-spy="scroll" data-target="#sidebar">
@@ -904,7 +916,7 @@
916 <div style="padding: 10px;"></div>
917 <small>Keep in mind, this server will be added back if and when you visit it again.</small>
918 <br/>
907 - <div id="deleteRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px; color: #fff;"></div>
919 + <div id="deleteRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px;"></div>
920 </div>
921 <div class="modal-footer">
922 <button type="button" class="btn btn-success" data-dismiss="modal">keep it</button>
@@ -940,7 +952,7 @@
952 <li>to get a new ID, just clear your browser cookies.</li>
953 </ul>
954 </small></p>
943 - <div id="switchRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px; color: #fff;"></div>
955 + <div id="switchRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px;"></div>
956 </div>
957 <div class="modal-footer">
958 <button type="button" class="btn btn-success" data-dismiss="modal">cancel</button>
@@ -980,6 +992,7 @@ if(isdemo()) {
992 function switchRegistryModalHandler() {
993 document.getElementById('switchRegistryPersonGUID').value = NETDATA.registry.person_guid;
994 document.getElementById('switchRegistryURL').innerHTML = NETDATA.registry.server;
995 + document.getElementById('switchRegistryResponse').innerHTML = '';
996 $('#switchRegistryModal').modal('show');
997 }
998
@@ -1007,6 +1020,7 @@ function deleteRegistryModalHandler(guid, name, url) {
1020 document.getElementById('deleteRegistryServerName').innerHTML = name;
1021 document.getElementById('deleteRegistryServerName2').innerHTML = name;
1022 document.getElementById('deleteRegistryServerURL').innerHTML = url;
1023 + document.getElementById('deleteRegistryResponse').innerHTML = '';
1024 $('#deleteRegistryModal').modal('show');
1025 }
1026
web/tv.html
+1 -1
@@ -40,7 +40,7 @@
40 and that you have chown it to be owned by netdata:netdata
41 -->
42 <!-- <script type="text/javascript" src="http://my.server:19999/dashboard.js"></script> -->
43 - <script type="text/javascript" src="dashboard.js?v35"></script>
43 + <script type="text/javascript" src="dashboard.js?v36"></script>
44
45 <script>
46 // Set options for TV operation