]> arthur.barton.de Git - netdata.git/commitdiff
fix white text on white background on registry modals; registry hosts are now sorted...
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 14 May 2016 12:18:43 +0000 (15:18 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 14 May 2016 12:18:43 +0000 (15:18 +0300)
web/dashboard.html
web/dashboard.js
web/demo.html
web/demo2.html
web/demosites.html
web/index.html
web/tv.html

index 41bd4cbd9812518ee8ae7c3304820160dadc10a0..a3b41d39b18ee596405fe611c913e905d92ddc70 100644 (file)
@@ -646,4 +646,4 @@ So, to avoid flashing the charts, we destroy and re-create the charts on each up
        <!-- <script> netdataServer = "http://box:19999"; </script> -->
 
        <!-- load the dashboard manager - it will do the rest -->
-       <script type="text/javascript" src="dashboard.js?v35"></script>
+       <script type="text/javascript" src="dashboard.js?v36"></script>
index 85620a7b42c78e8b9bc78ee4e5068c3f62f08033..55e7b72156d6b58c8b166b6baa6f94b28993051e 100644 (file)
                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() {
index 341156b26949592bc3cabef5b74577739549bcfd..b773bf43d285110a2d940d62cd3b5618642c2ec3 100644 (file)
@@ -11,7 +11,7 @@
        <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">\r
        <meta name="author" content="costa@tsaousis.gr">\r
 \r
-       <script type="text/javascript" src="dashboard.js?v35"></script>\r
+       <script type="text/javascript" src="dashboard.js?v36"></script>\r
 </head>\r
 <body>\r
 \r
index 7a8d75a547ba28b3f2c370bbe60cc466c96f0dbd..d926b55d5ca6379728794267953b9e7d8f38e7dd 100644 (file)
@@ -12,7 +12,7 @@
        <meta name="author" content="costa@tsaousis.gr">\r
 \r
        <script>var netdataTheme = 'slate';</script>\r
-       <script type="text/javascript" src="dashboard.js"></script>\r
+       <script type="text/javascript" src="dashboard.js?v36"></script>\r
 </head>\r
 <body>\r
 \r
index 703407766980740cecde7e3fb2c62a6682bafaaf..13b02e564d9b6ce3b7fe9f89a8c376b192ded583 100644 (file)
@@ -42,7 +42,7 @@
                and that you have chown it to be owned by netdata:netdata
        -->
        <!-- <script type="text/javascript" src="http://my.server:19999/dashboard.js"></script> -->
-       <script type="text/javascript" src="dashboard.js?v35"></script>
+       <script type="text/javascript" src="dashboard.js?v36"></script>
 
        <script>
        // --- OPTIONS FOR THE CHARTS --
index 32fe5a52826e5e1fa32e17413d4d0084ee12bfb8..7e92196f733ea1aa87be5c35349c121847f078c6 100644 (file)
                        return saveLocalStorage('netdataTheme', theme);
                }
 
-               var netdataRegistryCallback = function(urls) {
+               var netdataRegistryCallback = function(urls_array) {
                        var el = '';
                        var a1 = '';
                        var found = 0;
 
-                       if(urls) {
-                               $.each(urls, function(i, u) {
-                                       if(u.guid !== NETDATA.registry.machine_guid) {
-                                               found++;
-                                               el += '<li id="registry_server_' + u.guid + '"><a href="' + u.url + '">' + u.name + '</a></li>';
-                                               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>';
-                                       }
-                               });
+                       if(urls_array) {
+                               function name_comparator_desc(a, b) {
+                                       if (a.name > b.name) return -1;
+                                       if (a.name < b.name) return 1;
+                                       return 0;
+                               }
+
+                               var urls = urls_array.sort(name_comparator_desc);
+                               var len = urls.length;
+                               while(len--) {
+                                       var u = urls[len];
+
+                                       var status = "enabled";
+                                       found++;
+
+                                       if(u.guid === NETDATA.registry.machine_guid)
+                                               status = "disabled"
+
+                                       el += '<li id="registry_server_' + u.guid + '" class="' + status + '"><a href="' + u.url + '">' + u.name + '</a></li>';
+                                       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>';
+                               }
                        }
 
                        if(!found) {
                        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>'
 
                        document.getElementById('mynetdata_servers').innerHTML = el;
-                       document.getElementById('mynetdata_actions1').innerHTML = a1;
-
                        document.getElementById('mynetdata_servers2').innerHTML = el;
+                       document.getElementById('mynetdata_actions1').innerHTML = a1;
                };
 
        </script>
 
        <!-- load the dashboard manager - it will do the rest -->
-       <script type="text/javascript" src="dashboard.js?v35"></script>
+       <script type="text/javascript" src="dashboard.js?v36"></script>
 </head>
 
 <body data-spy="scroll" data-target="#sidebar">
                                        <div style="padding: 10px;"></div>
                                        <small>Keep in mind, this server will be added back if and when you visit it again.</small>
                                        <br/>
-                                       <div id="deleteRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px; color: #fff;"></div>
+                                       <div id="deleteRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px;"></div>
                                </div>
                                <div class="modal-footer">
                                        <button type="button" class="btn btn-success" data-dismiss="modal">keep it</button>
                                                        <li>to get a new ID, just clear your browser cookies.</li>
                                                </ul>
                                        </small></p>
-                                       <div id="switchRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px; color: #fff;"></div>
+                                       <div id="switchRegistryResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px;"></div>
                                </div>
                                <div class="modal-footer">
                                        <button type="button" class="btn btn-success" data-dismiss="modal">cancel</button>
@@ -980,6 +992,7 @@ if(isdemo()) {
 function switchRegistryModalHandler() {
        document.getElementById('switchRegistryPersonGUID').value = NETDATA.registry.person_guid;
        document.getElementById('switchRegistryURL').innerHTML = NETDATA.registry.server;
+       document.getElementById('switchRegistryResponse').innerHTML = '';
        $('#switchRegistryModal').modal('show');
 }
 
@@ -1007,6 +1020,7 @@ function deleteRegistryModalHandler(guid, name, url) {
        document.getElementById('deleteRegistryServerName').innerHTML = name;
        document.getElementById('deleteRegistryServerName2').innerHTML = name;
        document.getElementById('deleteRegistryServerURL').innerHTML = url;
+       document.getElementById('deleteRegistryResponse').innerHTML = '';
        $('#deleteRegistryModal').modal('show');
 }
 
index 2dd42654e0c9e3a8a9f79b5331ecfdb1f28cd56f..766cb7bc7c84b6fc93c0fc7d1f97e3b4543e3643 100644 (file)
@@ -40,7 +40,7 @@
                and that you have chown it to be owned by netdata:netdata
        -->
        <!-- <script type="text/javascript" src="http://my.server:19999/dashboard.js"></script> -->
-       <script type="text/javascript" src="dashboard.js?v35"></script>
+       <script type="text/javascript" src="dashboard.js?v36"></script>
 
        <script>
        // Set options for TV operation