From 3133891b19f0813f093ee2b05b38d08f55e0f82e Mon Sep 17 00:00:00 2001 From: checktheroads Date: Mon, 13 May 2019 10:37:33 -0700 Subject: [PATCH] converted /lg POST to jquery ajax --- ...8a07b => 1842a0ff0c5b4bdbdca506a3489cceed} | Bin 2844 -> 2848 bytes .flask_cache/2029240f6d1128be89ddc32729463129 | Bin 8 -> 8 bytes .flask_cache/2a6f99d4936620a3f0bd95fedf526b2f | Bin 0 -> 57 bytes .flask_cache/4d39e19ce3b3acf5580716fe63ee17a6 | Bin 0 -> 59 bytes .flask_cache/74bc75c0764cbc805c70645cef1f026b | Bin 241 -> 241 bytes .flask_cache/7ccf01c622d424f11a8e98761770e19a | Bin 0 -> 241 bytes .flask_cache/8e5cc37f0d5eb521574b7675b78fbb7a | Bin 0 -> 53 bytes .flask_cache/95b12f8cd6b93bf78161ab0764ef7d66 | Bin 0 -> 54 bytes .flask_cache/aabe6e7d021b7037492975340fe21c03 | Bin 0 -> 54 bytes .flask_cache/bfec0932dad185d106f4b86af0f7c734 | Bin 0 -> 56 bytes .flask_cache/c59a0149864f3a0ccffa8e150c81bc43 | Bin 0 -> 241 bytes .flask_cache/d277c4e120e0e4b7fa8f80455a32af2e | Bin 0 -> 52 bytes .flask_cache/dd6eca7ee6b5f09a8f1821c6c4a5510b | Bin 0 -> 108 bytes .flask_cache/e6ed342200608fc2907bdfc4b3dfe59d | Bin 0 -> 56 bytes .flask_cache/f2a7e36076223a740fa17b882df5c74a | Bin 114 -> 0 bytes .flask_cache/f9a2505762c137a92600cf2ad6c0527d | Bin 0 -> 241 bytes hyperglass/hyperglass.py | 5 +- hyperglass/static/js/hyperglass.js | 90 ++++++------------ 18 files changed, 34 insertions(+), 61 deletions(-) rename .flask_cache/{77c5444ceabaa72e7f3ca61c79d8a07b => 1842a0ff0c5b4bdbdca506a3489cceed} (96%) create mode 100644 .flask_cache/2a6f99d4936620a3f0bd95fedf526b2f create mode 100644 .flask_cache/4d39e19ce3b3acf5580716fe63ee17a6 create mode 100644 .flask_cache/7ccf01c622d424f11a8e98761770e19a create mode 100644 .flask_cache/8e5cc37f0d5eb521574b7675b78fbb7a create mode 100644 .flask_cache/95b12f8cd6b93bf78161ab0764ef7d66 create mode 100644 .flask_cache/aabe6e7d021b7037492975340fe21c03 create mode 100644 .flask_cache/bfec0932dad185d106f4b86af0f7c734 create mode 100644 .flask_cache/c59a0149864f3a0ccffa8e150c81bc43 create mode 100644 .flask_cache/d277c4e120e0e4b7fa8f80455a32af2e create mode 100644 .flask_cache/dd6eca7ee6b5f09a8f1821c6c4a5510b create mode 100644 .flask_cache/e6ed342200608fc2907bdfc4b3dfe59d delete mode 100644 .flask_cache/f2a7e36076223a740fa17b882df5c74a create mode 100644 .flask_cache/f9a2505762c137a92600cf2ad6c0527d diff --git a/.flask_cache/77c5444ceabaa72e7f3ca61c79d8a07b b/.flask_cache/1842a0ff0c5b4bdbdca506a3489cceed similarity index 96% rename from .flask_cache/77c5444ceabaa72e7f3ca61c79d8a07b rename to .flask_cache/1842a0ff0c5b4bdbdca506a3489cceed index 29ac7699a61345c3ff9b4628edbb814102b027ae..e1078ec83956f4dbf7127668ad9aa417a298a093 100644 GIT binary patch delta 37 pcmbOuwm?kSt8n$r7`+CTsr=jwU=YDEQP_ypK;OtjVWZnME&#y-32y)Z delta 33 lcmZ1=Hb+d@>)PcTF?tOwQ@Obrz#xKUqOcL8;YP1(TmY`~2|oY; diff --git a/.flask_cache/2029240f6d1128be89ddc32729463129 b/.flask_cache/2029240f6d1128be89ddc32729463129 index 8bd88e5744fc2a6e447bd2f314a1edd0144f1f3c..61c5ec062ffb260f43887c58eeb884d2edbc5ed6 100644 GIT binary patch literal 8 PcmeZf&}(4v=FrK%E0PZRg+5i9m literal 0 HcmV?d00001 diff --git a/.flask_cache/4d39e19ce3b3acf5580716fe63ee17a6 b/.flask_cache/4d39e19ce3b3acf5580716fe63ee17a6 new file mode 100644 index 0000000000000000000000000000000000000000..912d89aec14d9f8e2ac56293059fa5c09a368b90 GIT binary patch literal 59 zcmeYgUUD-=uYqN%76SzIsO4m56{n;D$+RMc%wmPS{1Sykg|ft)%oGLB00qaCl%mw) IV!bJP028MYo&W#< literal 0 HcmV?d00001 diff --git a/.flask_cache/74bc75c0764cbc805c70645cef1f026b b/.flask_cache/74bc75c0764cbc805c70645cef1f026b index 1c2abdd83761b2825c3bd88668a3ff31641c95b2..e58b6a89f173ec43cfc713bb4f075d71e807c68d 100644 GIT binary patch delta 12 Tcmey!_>qytD|6M&i7amcBG3h) delta 12 Ucmey!_>qyt>*(bh6ItE@042c&B>(^b diff --git a/.flask_cache/7ccf01c622d424f11a8e98761770e19a b/.flask_cache/7ccf01c622d424f11a8e98761770e19a new file mode 100644 index 0000000000000000000000000000000000000000..b3b7d353b9ef174be1ca1b0c57fdc88f883c10a4 GIT binary patch literal 241 zcmXAiy-EW?6om~~?Nb~(h0UF8+=bnMRj^P91Y&73nYkuI*qL>H)O2|OORan|!NNyz z7Eg1zoO{3Te)9GGNT>79-?RU`|2!NA1_vec2>hJbDn@jWTjwJc8@Afm9hwr=Y&P8< zBjawlTH{vjT^J8rYN@8WL^M6S6k!798Ks=nVNtB5I&jRpjd(S24~gKC&l0J%=MdnY zP<0($*VN6aLUA#s*d(RK*2`?n$ZW^J`7d)W8_`^q@GeSo I9s2M=e=M_0HUIzs literal 0 HcmV?d00001 diff --git a/.flask_cache/8e5cc37f0d5eb521574b7675b78fbb7a b/.flask_cache/8e5cc37f0d5eb521574b7675b78fbb7a new file mode 100644 index 0000000000000000000000000000000000000000..807e1c1ac14bf6346e0b2f1c8b34a99f0d7596b9 GIT binary patch literal 53 zcmebJw)kd@UIWWi6$S|CQAkNkN=s45ELOI literal 0 HcmV?d00001 diff --git a/.flask_cache/bfec0932dad185d106f4b86af0f7c734 b/.flask_cache/bfec0932dad185d106f4b86af0f7c734 new file mode 100644 index 0000000000000000000000000000000000000000..65d071d9301a14d665537b1242bfa2ffd0e06638 GIT binary patch literal 56 zcmeZTxa4MxUIWWibp{CNQBF%qDNZa-NmIxyR>;dQQAkuMOU%hkQSb~`S z>OaLW%*^*){d|1hs+axu@4f%Le%7i zCS0ChFL7bFF;9n``l}l32a1K^GZuofF}QqMEseb=mN_tZFI0o-U`n+r)=t}G#3)FyV;dQQAkuMOU%hkQSb~|LjECoR2Q+hZu3kr%-(=scj^spQ1f#H;dQQAkuMOU%hkQSb~JwyxZ;pfMHC<*MG7U2V=sw?&OW?0kdA_q5;}eiiGojI zPnjuJquqUT^ZxyFuilQo{*Dg%_`TbY1Y&DsFg+CtmXIUNCZ?>aH3jFx7F`Y9wzJJX z6RwxHD_q%K `) - var xhr = new XMLHttpRequest(); - xhr.open('POST', '/lg', true); - resultsbox.show() - progress.show() - xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8') - xhr.send(JSON.stringify({router: router, cmd: cmd, ipprefix: ipprefix})) - console.log(JSON.stringify({router: router, cmd: cmd, ipprefix: ipprefix})); + ///////////////////////////////////////////////////////////// - xhr_timer = window.setInterval(function() { - if (xhr.readyState == XMLHttpRequest.DONE) { - progress.hide(); - window.clearTimeout(xhr_timer); + $.ajax({ + url: `/lg`, + type: 'POST', + data: JSON.stringify({router: router, cmd: cmd, ipprefix: ipprefix}), + contentType: "application/json; charset=utf-8", + readyState: resultsbox.show() && progress.show(), + statusCode: { + 200: function(response, code) { + console.log(code, response); + progress.hide(); + $('#output').html(`

${response}

`); + }, + 405: function(response, code) { + console.log(code, response); + progress.hide(); + $('#ipprefix').addClass('is-warning'); + $('#output').html(`
${response.responseText}
`); + }, + 415: function(response, code) { + console.log(code, response); + progress.hide(); + $('#ipprefix').addClass('is-danger'); + $('#output').html(`
${response.responseText}
`); + }, + 429: function(response, code) { + console.log(code, response); + progress.hide(); + $("#ratelimit").addClass("is-active"); + } } - var output = document.getElementById('output') - if (xhr.status == 415){ - console.log(XMLHttpRequest.status, 'error') - var output = document.getElementById('output') - $('#ipprefix').addClass('is-danger') - output.innerHTML = - '
' + - '
' + - xhr.responseText + - '
' - } - if (xhr.status == 405){ - console.log(XMLHttpRequest.status, 'error') - var output = document.getElementById('output') - $('#ipprefix').addClass('is-warning') - output.innerHTML = - '
' + - '
' + - xhr.responseText + - '
' - } - else if (xhr.status == 200){ - console.log(xhr.status, 'success') - var output = document.getElementById('output') - output.innerHTML = - '
' + - '
' + - '

' + - xhr.responseText + - '

' + - '
' - } - else if (xhr.status == 429){ - console.log(xhr.status, 'rate limit reached'); - $("#ratelimit").addClass("is-active"); - } - }, 500); - - xhr.addEventListener("error", function(e) { - console.log("error: " + e); - }); + }) }