]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
fix up recuweb password popup weirdness, now give nice warning on wrong password...
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 26 Feb 2016 15:14:09 +0000 (16:14 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 26 Feb 2016 15:14:09 +0000 (16:14 +0100)
pdns/recursordist/html/index.html
pdns/recursordist/html/local.js

index a513ccd0a138c7a2efefef59697c056f62c1fff2..c38cf75b4055d336093097e1710c3ca113d7d99e 100644 (file)
 
 <table width="100%" border="0"><tr><td><img src="powerdns-logo-220px.png"/></td>
 <td width="75%">
-<form id="serverform" action="javascript:void();">Password: <input type="password" id="password" value="no"></form>
+<form id="serverform" action="javascript:void();">Password: <input type="password" id="password" value="no">
+<span id="connection-status" style="color:red; display:none">No server connection!</span>
+<span id="connection-error" style="color:red"></span>
+</form> 
 </td>
 </tr></table>
 <p>
index 6818f155180d8ca63a5bf77553944c091e20b327..cd7bc658a782416851a961433ed05b1ac58f38d2 100644 (file)
@@ -9,6 +9,7 @@ $(document).ready(function() {
     var password=$("#password").val();
     $("#password").change(function(e) {
        password=$("#password").val();
+        update();
     });
 
     var qpsgraph = new Rickshaw.Graph( {
@@ -55,7 +56,7 @@ $(document).ready(function() {
     function updateRingBuffers()
     {
        var filtered=$("#filter1").is(':checked')
-       var qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=queries&callback=?';
+       var qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=queries';
 
        if(filtered)
            qstring=qstring+"&public-filtered=1";
@@ -83,7 +84,7 @@ $(document).ready(function() {
                  });
 
        filtered=$("#filter2").is(':checked')
-       qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=servfail-queries&callback=?';
+       qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=servfail-queries';
 
        if(filtered)
            qstring=qstring+"&public-filtered=1";
@@ -108,7 +109,7 @@ $(document).ready(function() {
 
                  });
 
-       $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=remotes&callback=?', 
+       $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=remotes', 
                  function(data) {
                      var bouw="<table><tr><th>Number</th><th>Remote</th></tr>";
                      var num=0, total=0, rest=0;
@@ -126,7 +127,7 @@ $(document).ready(function() {
 
                  });
 
-       $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=servfail-remotes&callback=?', 
+       $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=servfail-remotes', 
                  function(data) {
                      var bouw="<table><tr><th>Number</th><th>Servfail Remote</th></tr>";
                      var num=0, total=0, rest=0;
@@ -149,12 +150,13 @@ $(document).ready(function() {
 
     function update()
     {
-
        $.ajax({
-            url: '/api/v1/servers/localhost/statistics?api-key='+password+'&callback=?',
+            url: '/api/v1/servers/localhost/statistics?api-key='+password,
             type: 'GET',
-            dataType: 'jsonp',
+            dataType: 'json',
             success: function(adata, x, y) {
+                $("#connection-status").hide();
+                $("#connection-error").html("");
                var data={};
                $.each(adata, function(key, val) {
                    data[val.name]=val.value;
@@ -189,8 +191,9 @@ $(document).ready(function() {
 
                gdata=data;
             },
-            error:  function() {
-                alert('boo!');
+            error:  function(o) {
+                $("#connection-status").show();
+                $("#connection-error").html(o.status+" "+o.statusText);
             },
             beforeSend: function(xhr) { 
                 xhr.setRequestHeader('X-API-Key', 'changeme');
@@ -200,7 +203,7 @@ $(document).ready(function() {
            }
         });
        
-       $.ajax({ url: '/api/v1/servers/localhost?api-key='+password+'&callback=?', type: 'GET', dataType: 'jsonp',
+       $.ajax({ url: '/api/v1/servers/localhost?api-key='+password, type: 'GET', dataType: 'json',
                 success: function(data) {
                     $("#version").text("PowerDNS "+data["daemon_type"]+" "+data["version"]);
                 }