webui provides better diagnostics, logo was too thin

This commit is contained in:
jamesread 2021-05-16 08:13:40 +01:00
parent 1bd874e0f1
commit 17bab28431
5 changed files with 43 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -13,7 +13,10 @@
version="1.1" version="1.1"
id="svg8" id="svg8"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)" inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="OliveTinLogo.svg"> sodipodi:docname="OliveTinLogo.svg"
inkscape:export-filename="/home/xconspirisist/sandbox/OliveTin/webui/OliveTinLogo.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs <defs
id="defs2" /> id="defs2" />
<sodipodi:namedview <sodipodi:namedview
@ -31,9 +34,9 @@
inkscape:document-rotation="0" inkscape:document-rotation="0"
showgrid="false" showgrid="false"
inkscape:pagecheckerboard="true" inkscape:pagecheckerboard="true"
inkscape:window-width="1920" inkscape:window-width="1600"
inkscape:window-height="1080" inkscape:window-height="1200"
inkscape:window-x="1600" inkscape:window-x="3520"
inkscape:window-y="1080" inkscape:window-y="1080"
inkscape:window-maximized="1" /> inkscape:window-maximized="1" />
<metadata <metadata
@ -44,7 +47,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -19,8 +19,8 @@
</footer> </footer>
<template id = "tplActionButton"> <template id = "tplActionButton">
<p class = "title">Untitled Button</p>
<p><span class = "icon">&#x1f4a9;</span></p> <p><span class = "icon">&#x1f4a9;</span></p>
<p role = "title" class = "title">Untitled Button</p>
</template> </template>
<script type = "module" src = "main.js"></script> <script type = "module" src = "main.js"></script>

View File

@ -3,6 +3,7 @@ class ActionButton extends window.HTMLButtonElement {
this.title = json.title this.title = json.title
this.states = [] this.states = []
this.stateLabels = [] this.stateLabels = []
this.temporaryStatusMessage = null
this.currentState = 0 this.currentState = 0
this.isWaiting = false this.isWaiting = false
this.actionCallUrl = window.restBaseUrl + 'StartAction?actionName=' + this.title this.actionCallUrl = window.restBaseUrl + 'StartAction?actionName=' + this.title
@ -25,26 +26,22 @@ class ActionButton extends window.HTMLButtonElement {
this.updateHtml() this.updateHtml()
this.classList = [] // Removes old animation classes this.classList = [] // Removes old animation classes
window.fetch(this.actionCallUrl).then(res => { window.fetch(this.actionCallUrl).then(res => res.json()
if (!res.ok) { ).then((json) => {
return res.json()
}
}).then(json => {
if (json.timedOut) { if (json.timedOut) {
this.onActionResult('actionTimedOut') this.onActionResult('actionTimeout', "Timed out")
} else if (json.exitCode != 0) { } else if (json.exitCode != 0) {
this.onActionResult('actionNonZeroExit') this.onActionResult('actionNonZeroExit', "Exit code " + json.exitCode)
} else { } else {
this.onActionResult('actionSuccess') this.onActionResult('actionSuccess', "Success!")
} }
}).catch(err => { }).catch(err => {
this.onActionError(err) this.onActionError(err)
}) })
} }
onActionResult (cssClass) { onActionResult (cssClass, temporaryStatusMessage) {
this.disabled = false this.temporaryStatusMessage = '[ ' + temporaryStatusMessage + ' ]'
this.isWaiting = false
this.updateHtml() this.updateHtml()
this.classList.add(cssClass) this.classList.add(cssClass)
} }
@ -73,7 +70,18 @@ class ActionButton extends window.HTMLButtonElement {
} }
updateHtml () { updateHtml () {
if (this.isWaiting) { if (this.temporaryStatusMessage != null) {
this.domTitle.innerText = this.temporaryStatusMessage
this.domTitle.classList.add('temporaryStatusMessage')
this.isWaiting = false
this.disabled = false
setTimeout(() => {
this.temporaryStatusMessage = null
this.domTitle.classList.remove('temporaryStatusMessage')
this.updateHtml()
}, 2000)
} else if (this.isWaiting) {
this.domTitle.innerText = 'Waiting...' this.domTitle.innerText = 'Waiting...'
} else { } else {
this.domTitle.innerText = this.title this.domTitle.innerText = this.title

View File

@ -1,5 +1,5 @@
body { body {
background-color: #efefef; background-color: #dee3e7;
color: black; color: black;
text-align: center; text-align: center;
font-family: sans-serif; font-family: sans-serif;
@ -21,8 +21,12 @@ body {
padding: 1em; padding: 1em;
} }
.title.temporaryStatusMessage {
color: gray;
}
div.entity { div.entity {
background-color: #222; background-color: white;
box-shadow: 0 0 10px 0 #444; box-shadow: 0 0 10px 0 #444;
display: grid; display: grid;
grid-column: auto / span 2; grid-column: auto / span 2;
@ -41,15 +45,11 @@ button {
display: table-cell; display: table-cell;
text-align: center; text-align: center;
border: 1px solid #999; border: 1px solid #999;
background-color: #dee3e7; background-color: white;
box-shadow: 0 0 6px 0 #aaa; box-shadow: 0 0 6px 0 #aaa;
user-select: none; user-select: none;
} }
button.good {
background-color: limegreen;
}
button:hover { button:hover {
box-shadow: 0 0 10px 0 #666; box-shadow: 0 0 10px 0 #666;
cursor: pointer; cursor: pointer;
@ -57,7 +57,7 @@ button:hover {
button:disabled { button:disabled {
color: gray; color: gray;
background-color: black; background-color: #333;
cursor: not-allowed; cursor: not-allowed;
} }
@ -81,7 +81,7 @@ span.icon {
@keyframes kfActionSuccess { @keyframes kfActionSuccess {
0% { background-color: black; } 0% { background-color: black; }
20% { background-color: green; } 20% { background-color: limegreen; }
0% { background-color: inherit; } 0% { background-color: inherit; }
} }
@ -91,7 +91,7 @@ span.icon {
@keyframes kfActionNonZeroExit { @keyframes kfActionNonZeroExit {
0% { background-color: black; } 0% { background-color: black; }
20% { background-color: blue; } 20% { background-color: orange; }
0% { background-color: inherit; } 0% { background-color: inherit; }
} }
@ -119,7 +119,6 @@ img.logo {
@media (max-width: 320px) { @media (max-width: 320px) {
.group { .group {
grid-template-columns: auto; grid-template-columns: auto;
background-color: red;
grid-gap: 0; grid-gap: 0;
padding: 0; padding: 0;
} }
@ -137,4 +136,8 @@ img.logo {
box-shadow: 0 0 6px 0 #444; box-shadow: 0 0 6px 0 #444;
color: white; color: white;
} }
button:disabled {
background-color: black;
}
} }