From f0f786324da452273950732a2d785a8cba1a473f Mon Sep 17 00:00:00 2001 From: iou1name Date: Thu, 20 Jun 2019 11:19:31 -0400 Subject: [PATCH] added lock_device() --- static/fontawesome-webfont.woff2 | Bin 2688 -> 2932 bytes static/juice.css | 5 ++--- static/juice.js | 17 +++++++++++++++++ templates/index.html | 10 +++++----- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/static/fontawesome-webfont.woff2 b/static/fontawesome-webfont.woff2 index 082ba3725124e715784df65ca73712506e52eb71..2d1883329e9de5096111e81076358b28d94d07c4 100644 GIT binary patch literal 2932 zcmV-)3ybu3Pew8T0RR9101I>g4*&oF02mYi01F%d0RR9100000000000000000000 z0000SR0dW6gD?mn36^jX2nvZ%h(8Ms00A}vBm)=(AO(d@2UQG#1{-P?BN29Ukz$hl z)d6o}T@@kKT7wE-TlMf|pV0iV)rovw$H}WzhyT-EF&rZy0tf^0wTTbG^Zz-s?)xCi zG8Q>N>Zp(dq?8@bT}*)!J{#=CqA> zO-vG^oW!Pdn@&zUSH*h!;s0MVmx>aynkPQw)e@4!khBT1oh71X*LG1;l$`0Rt06CL z+rVSOLlUziZsusUJnxrDM6<^2AQTFh0_V(G{aUZ>ncJ;<|MS)tCbS_GiiC?ZOLw{V zb`Rc#_JT-0?7mO|WJLK>T<(=) z{_(`2T%M$|zyu2=G6FG60%ev2+AIl7>V+^TRg0U7&oUy%U-RqiK?*H~&Zv zzQK8YOmrWqf0q+=qY0($e>b_zE^O|+he?QR+#^IK1_bzV5>U{Q_|_K2KKAw5izbW7 z&Zp$fyKX`ZY$Z>aojBZ?aQK~7Ifk}J)DNcy92U2$b|HLg3Z1BXy6wV~WkmV7@;cm$ z-gltnoE_ph8w{l5oC6w~2&3(hu-r;mi8vCS_Zf+RfqC;fs`e9=4_x*dF%p@f=;E;# zLUsOsaoKBoy9Q(1scgA+Cnw8Zgu4lG7owD>rwUjQf{&L|UQ+vUszXs`-ucWm13kJy13>VmrOr z&1mN{iHhdSQOQL6nM~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3IR5-gEe-tiCt`AH+!&$ZR}-lxDPXb zaH6diw4e4-P%^lP6%Me05NnjNiE_3OW)CXZMkRaaRzb~DLiHMj0p9kL+SSy)M~2R4B~v&2Tg!pk9NFJ#nO8p`dp|w50eaX(6^TAe zMb1+ZD{-&X_Xqzk0EV90W^HJft_7lhP@`!RLm0%bDA0((wI8E*h*M`w6{(a1(cb^;o? z*`pgY`xt8o|JXFpqzi>1%8hT##elKRY6mxZyF$M}hgfj9NT4GuIBLQG9b-YPNTA~^ zm@uK2POufs!mZX~H0#V!`PmfzGhttOtj8;6Kr*fu{r9-d=5W%v)5tpi+9i`o*AGL3J>Ajzs_?$u{$ebw z60ccW;~uT44js_8meE|%me^_p$0OQy^m%Ly%QntqAy{(OR0^+`iQuW?P2k0Q*zIX= z351&pi@OR73w-9@8aIqK^d^F&O)#oM+T#MC&7myS+hb%}cLXY`pBUh3CamBa!a+rZ~?=>{iuNV~|bKT+Jmc zv&a&c5mafADnX4RqB;c4!1SQa1g$T#L5ekhf>K=0Wh{}4FD1wYwSa1aSUk@fYi#A~ z&9ce5peEMQBA4S8Q(O|U=Y2KB%Hq9cs`5cm^&$yq)Z0kprHIU2v!hG7LQsv2c^L~+ z7r3NBR|*=zsX=L4tsJRY%Bvp`b(tD=YOwaLYf}}#m>sA|ixNY$nCK^ax3Cu0Hq+@| ztM!weZ32fr$M+@@+aeDnx8yGEob)#4othlgt7RWMN^HJ3kIk)tFQ~5}coCiw+^P+R tw#($MfG3z6sHX!E78OhLUE>ALl5^ss5Z~L*Kux7y|kjF#iAm diff --git a/static/juice.css b/static/juice.css index 33e90dc..889fa23 100644 --- a/static/juice.css +++ b/static/juice.css @@ -46,7 +46,6 @@ nav span:hover { background-color: whitesmoke; } - .ip_address { font-size: 0.8em; font-style: italic; @@ -78,12 +77,12 @@ nav span:hover { src: url("/static/fontawesome-webfont.woff2"); } -.edit, .save { +.edit, .save, .lock, .unlock { font-size: 0.8em; color: dimgrey; } -.edit:hover, .save:hover { +.edit:hover, .save:hover, .lock:hover, .unlock:hover { color: red; cursor: pointer; } diff --git a/static/juice.js b/static/juice.js index eb79ffa..308b5ec 100644 --- a/static/juice.js +++ b/static/juice.js @@ -120,3 +120,20 @@ function new_device() { children[children.length - 1].id = json.device_id; }); } + +function lock_device(device) { + let fields = device.querySelectorAll('.editable'); + fields.forEach(function(field) { + field.querySelector('.edit').remove(); + }); + device.querySelector('.id').querySelector('.lock').remove(); + let unlock = document.createElement('span'); + unlock.innerHTML = ''; + unlock.className = 'unlock font-awesome'; + unlock.setAttribute('onclick', 'unlock_device(this.parentElement.parentElement)'); + device.querySelector('.id').appendChild(unlock); +} + +function unlock_device(device) { + console.log(device); +} diff --git a/templates/index.html b/templates/index.html index 6ea7909..f9de7d3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -18,16 +18,16 @@
{% for device in network %}
-
{{ device.id }}
-
{{ device.description }}
-
{{ device.location }}
-
{{ device.ip_address }}
+
{{ device.id }}
+
{{ device.description }}
+
{{ device.location }}
+
{{ device.ip_address }}
{% for sub_dev in device.sub_devices %}
{{ sub_dev.id }}
-
{{ sub_dev.description }}
+
{{ sub_dev.description }}
{% endfor %}