Added loading to dashboard and fixed sri hash

master
Keith Irwin 2022-11-06 15:50:48 -07:00
parent bd433e3f24
commit b3ab0538eb
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
3 changed files with 11 additions and 4 deletions

View File

@ -16,4 +16,5 @@
[ ] Let users download ssl certs
[ ] Show QR code with new config
[ ] Clean up bash file headings
[ ] Deploy on GF4
[ ] Deploy on GF4
[ ] Write tests

View File

@ -6,7 +6,8 @@
<p>Use this console to edit your network-connected devices. </p>
<h2>Your peers</h2>
<table>
<p data-bind="visible:!isLoaded">Loading...</p>
<table data-bind="visible:isLoaded">
<thead><tr>
<th>Host</th><th></th>
</tr></thead>
@ -18,7 +19,8 @@
<h2>Add a peer</h2>
<p>To add a new peer, type in a hostname and click add. The hostname must be 3-10 lowercase letters and numbers <code>/[a-z0-9]{3,10}/</code>. Keep it short for your own sake!</p>
<div>
<p data-bind="visible:!isLoaded">Loading...</p>
<div data-bind="visible:isLoaded">
<input type="text" data-bind="textInput:newPeerName,event:{keypress:addKeyPress}" placeholder="mypc1"></input>
<button data-bind="click:addPeer,disable:isAdding,text:addText">Add</button>
</div>
@ -26,7 +28,8 @@
<hr>
<pre data-bind="text:newConfigText"></pre>
<script src="/knockout.min.js" integrity="sha512-2AL/VEauKkZqQU9BHgnv48OhXcJPx9vdzxN1JrKDVc4FPU/MEE/BZ6d9l0mP7VmvLsjtYwqiYQpDskK9dG8KBA=="></script>
<script src="/knockout.min.js" integrity="sha512-vs7+jbztHoMto5Yd/yinM4/y2DOkPLt0fATcN+j+G4ANY2z4faIzZIOMkpBmWdcxt+596FemCh9M18NUJTZwvw==
"></script>
<script src="/dashboard.js"></script>
</body>
</html>

View File

@ -16,6 +16,7 @@ function PeerList() {
self.newConfigText = ko.observable('')
self.isAdding = ko.observable(false)
self.addText = ko.computed(() => self.isAdding()?'Adding...':'Add')
self.isLoaded = ko.observable(false)
// Initial loading
self.getUser = async () => {
@ -40,6 +41,8 @@ function PeerList() {
.map( (i)=>new Peer(i))
)
self.token = user.token
} finally {
self.isLoaded(true)
}
}