warble-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [incubator-warble-server] 02/02: regen JS
Date Wed, 27 Jun 2018 18:15:14 GMT
This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-warble-server.git

commit 79ca3a302132d55eed36d33e06b157a42122cd10
Author: Daniel Gruno <humbedooh@apache.org>
AuthorDate: Wed Jun 27 13:15:04 2018 -0500

    regen JS
---
 ui/js/warble.v1.js | 141 ++++++++++++++++++++++++-----------------------------
 1 file changed, 65 insertions(+), 76 deletions(-)

diff --git a/ui/js/warble.v1.js b/ui/js/warble.v1.js
index a382b23..4058c03 100644
--- a/ui/js/warble.v1.js
+++ b/ui/js/warble.v1.js
@@ -1,5 +1,5 @@
 // Generated by CoffeeScript 1.9.3
-var API, APIVERSION, Chart, HTML, Row, WarbleLogin, WarbleLoginCallback, Widget, aSourceTypes,
addSourceType, addSources, addorguser, addsources, affiliate, affiliation, affiliationWizard,
altemail, app, badModal, bio, chartOnclick, chartToSvg, chartWrapperButtons, charts_donutchart,
charts_gaugechart, charts_linechart, charts_linechart_stacked, charts_linked, charts_radarchart,
ciexplorer, clientTypes, clientlist, cog, comShow, comstat, copyCSS, currentSources, dataTable,
datepicker, da [...]
+var API, APIVERSION, Chart, HTML, Row, WarbleLogin, WarbleLoginCallback, Widget, aSourceTypes,
addSourceType, addSources, addorguser, addsources, affiliate, affiliation, affiliationWizard,
altemail, app, badModal, bio, chartOnclick, chartToSvg, chartWrapperButtons, charts_donutchart,
charts_gaugechart, charts_linechart, charts_linechart_stacked, charts_linked, charts_radarchart,
ciexplorer, clientTypes, clientlist, cog, comShow, comstat, copyCSS, currentSources, dataTable,
datepicker, da [...]
   indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++)
{ if (i in this && this[i] === item) return i; } return -1; };
 
 signup = function(form) {
@@ -4636,9 +4636,9 @@ deleteNode = function(id, stats) {
   }
 };
 
-nodeLocation = function(id, obj) {
+nodeVal = function(id, obj, t) {
   var ip, loc;
-  if (!document.getElementById("tnodeloc_" + id)) {
+  if (!document.getElementById("node_" + t + "_tmp_" + id)) {
     loc = obj.innerText;
     obj.innerHTML = "";
     ip = new HTML('input', {
@@ -4649,10 +4649,10 @@ nodeLocation = function(id, obj) {
         padding: '0px'
       },
       data: loc,
-      id: "tnodeloc_" + id,
+      id: "node_" + t + "_tmp_" + id,
       type: 'text',
-      onkeydown: "saveNodeLocation(" + id + ", this, event);",
-      onblur: "savedNodeLocation({}, {id: " + id + ", location: this.getAttribute('data')});"
+      onkeydown: "saveNodeValue(" + id + ", this, event, '" + t + "');",
+      onblur: "savedNodeValue({}, {id: " + id + ", type: '" + t + "', " + t + ": this.getAttribute('data')});"
     });
     ip.value = loc;
     app(obj, ip);
@@ -4660,34 +4660,43 @@ nodeLocation = function(id, obj) {
   }
 };
 
-saveNodeLocation = function(id, obj, e) {
-  var nloc;
+saveNodeValue = function(id, obj, e, t) {
+  var js, jsx, nval;
   if (e.key === 'Enter') {
-    nloc = obj.value;
-    return post('node/modify', {
-      id: id,
-      location: nloc
-    }, {
+    nval = obj.value;
+    js = {
+      id: id
+    };
+    jsx = {
       id: id,
-      location: nloc
-    }, savedNodeLocation);
+      type: t
+    };
+    js[t] = nval;
+    jsx[t] = nval;
+    return post('node/modify', js, jsx, savedNodeValue);
   } else if (e.key === 'Escape') {
-    return savedNodeLocation({}, {
+    js = {
+      id: id
+    };
+    jsx = {
       id: id,
-      location: obj.getAttribute('data')
-    });
+      type: t
+    };
+    js[t] = obj.getAttribute('data');
+    jsx[t] = obj.getAttribute('data');
+    return savedNodeValue(js, jsx);
   }
 };
 
-savedNodeLocation = function(json, state) {
+savedNodeValue = function(json, state) {
   var obj;
-  obj = document.getElementById("nodeloc_" + state.id);
+  obj = document.getElementById("node_" + state.type + "_" + state.id);
   obj.innerHTML = "";
-  return app(obj, txt(state.location));
+  return app(obj, txt(state[state.type]));
 };
 
 clientlist = function(json, state) {
-  var btn, card, d, len, line, q, retval, slist, source, sources, vlist, vrf;
+  var banner, btn, card, d, hn, len, line, lline, lp, q, retval, rline, slist, source, sources,
vlist, vrf;
   slist = mk('div');
   vlist = new HTML('div');
   if (json.nodes) {
@@ -4703,41 +4712,39 @@ clientlist = function(json, state) {
       card = new HTML('div', {
         "class": 'clientcard'
       });
-      d = new HTML('div', {
-        height: '36px',
-        position: 'relative',
+      banner = new HTML('div', {
+        "class": 'banner'
+      });
+      rline = new HTML('div', {
         style: {
-          marginBottom: '12px'
+          float: 'right',
+          width: '300px',
+          textAlign: 'center'
         }
       });
-      line = new HTML('div', {
+      lline = new HTML('div', {
         style: {
-          position: 'relative',
-          lineHeight: '30px',
-          height: '30px',
           float: 'left',
-          padding: '2px',
-          display: 'inline-block',
-          textAlign: 'center',
-          margin: '-5.25px',
-          width: '225px',
-          borderTopLeftRadius: '6px',
-          background: '#4c8946',
-          marginBottom: '4px'
+          width: '500px',
+          textAlign: 'center'
         }
       });
+      hn = new HTML('span', {
+        title: 'Click to edit',
+        id: "node_hostname_" + source.id,
+        onclick: "nodeVal(" + source.id + ", this, 'hostname');"
+      }, txt(source.hostname || "(unknown)"));
+      lline.inject(hn);
       vrf = [];
       if (!source.verified) {
-        line.style.background = '#bc9621';
-        card.style.borderColor = '#bc9621';
-        line.style.width = '445px';
+        card.setAttribute('class', 'clientcard orange');
         vrf = [
           'Unverified Node', new HTML('button', {
             "class": 'btn btn-sm btn-primary',
             onclick: "modifyNode(" + source.id + ", {verified: true, enabled: true});"
           }, "Verify + Enable")
         ];
-        line.inject(vrf);
+        rline.inject(vrf);
         btn = new HTML('button', {
           title: 'Delete node',
           "class": 'btn btn-square btn-danger',
@@ -4750,28 +4757,11 @@ clientlist = function(json, state) {
         }, new HTML('i', {
           "class": 'fa fa-trash'
         }, ''));
-        line.inject(btn);
-        d.inject(line);
+        rline.inject(btn);
       }
       if (source.verified) {
-        line = new HTML('div', {
-          style: {
-            position: 'relative',
-            lineHeight: '30px',
-            height: '30px',
-            float: 'right',
-            padding: '2px',
-            display: 'inline-block',
-            textAlign: 'center',
-            margin: '-5.25px',
-            width: '445px',
-            borderTopRightRadius: '6px',
-            background: '#4c8946',
-            marginBottom: '4px'
-          }
-        });
         vrf = [];
-        card.style.borderColor = '#4c8946';
+        card.setAttribute('class', 'clientcard green');
         if (source.enabled) {
           vrf = [
             'Active', new HTML('button', {
@@ -4780,8 +4770,7 @@ clientlist = function(json, state) {
             }, "Disable")
           ];
         } else {
-          line.style.background = '#777';
-          card.style.borderColor = '#777';
+          card.setAttribute('class', 'clientcard grey');
           vrf = [
             'Disabled', new HTML('button', {
               "class": 'btn btn-sm btn-primary',
@@ -4789,8 +4778,7 @@ clientlist = function(json, state) {
             }, "Re-enable")
           ];
         }
-        line.inject(vrf);
-        d.inject(line);
+        rline.inject(vrf);
         btn = new HTML('button', {
           title: 'Delete node',
           "class": 'btn btn-square btn-danger',
@@ -4803,9 +4791,11 @@ clientlist = function(json, state) {
         }, new HTML('i', {
           "class": 'fa fa-trash'
         }, ''));
-        line.inject(btn);
+        rline.inject(btn);
       }
-      card.inject(d);
+      banner.inject(lline);
+      banner.inject(rline);
+      card.inject(banner);
       vlist.inject(card);
       d = new HTML('p');
       card.inject(d);
@@ -4822,11 +4812,6 @@ clientlist = function(json, state) {
       line = new HTML('div', {
         "class": 'clientcardline'
       });
-      line.inject([new HTML('b', {}, "Hostname: "), txt(source.hostname)]);
-      d.inject(line);
-      line = new HTML('div', {
-        "class": 'clientcardline'
-      });
       line.inject([new HTML('b', {}, "Fingerprint: "), new HTML('kbd', {}, source.fingerprint)]);
       d.inject(line);
       line = new HTML('div', {
@@ -4834,14 +4819,18 @@ clientlist = function(json, state) {
       });
       line.inject([
         new HTML('b', {}, "Location: "), new HTML('span', {
-          id: "nodeloc_" + source.id,
-          onclick: "nodeLocation(" + source.id + ", this, event);"
+          title: 'Click to edit',
+          id: "node_location_" + source.id,
+          onclick: "nodeVal(" + source.id + ", this, 'location');"
         }, txt(source.location || "(unknown)"))
       ]);
       d.inject(line);
+      line = new HTML('div', {
+        "class": 'clientcardline'
+      });
+      lp = new Date(source.lastping * 1000.0);
+      line.inject([new HTML('b', {}, "Last Active: "), txt(moment(lp).fromNow() + " (" +
lp.ISOBare() + ")")]);
       d.inject(line);
-      line.inject(new HTML('br'));
-      line.inject(new HTML('br'));
     }
   }
   state.widget.inject(slist, true);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@warble.apache.org
For additional commands, e-mail: commits-help@warble.apache.org


Mime
View raw message