eslint codestyle
This commit is contained in:
parent
ad93c8e3ff
commit
437d8ccb5a
|
|
@ -1,8 +1,8 @@
|
|||
import { marshalLogsJsonToHtml } from './marshaller.js';
|
||||
import { marshalLogsJsonToHtml } from './marshaller.js'
|
||||
|
||||
class ActionButton extends window.HTMLButtonElement {
|
||||
constructFromJson (json) {
|
||||
this.updateIterationTimestamp = 0;
|
||||
this.updateIterationTimestamp = 0
|
||||
|
||||
this.title = json.title
|
||||
this.temporaryStatusMessage = null
|
||||
|
|
@ -17,7 +17,7 @@ class ActionButton extends window.HTMLButtonElement {
|
|||
|
||||
this.updateHtml()
|
||||
|
||||
this.setAttribute("id", "actionButton_" + json.id)
|
||||
this.setAttribute('id', 'actionButton_' + json.id)
|
||||
}
|
||||
|
||||
updateFromJson (json) {
|
||||
|
|
@ -42,7 +42,7 @@ class ActionButton extends window.HTMLButtonElement {
|
|||
|
||||
window.fetch(this.actionCallUrl).then(res => res.json()
|
||||
).then((json) => {
|
||||
marshalLogsJsonToHtml({"logs": [json.logEntry]})
|
||||
marshalLogsJsonToHtml({ logs: [json.logEntry] })
|
||||
|
||||
if (json.logEntry.timedOut) {
|
||||
this.onActionResult('actionTimeout', 'Timed out')
|
||||
|
|
@ -63,7 +63,7 @@ class ActionButton extends window.HTMLButtonElement {
|
|||
|
||||
setTimeout(() => {
|
||||
this.classList.remove(cssClass)
|
||||
}, 1000);
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
onActionError (err) {
|
||||
|
|
@ -75,7 +75,7 @@ class ActionButton extends window.HTMLButtonElement {
|
|||
|
||||
setTimeout(() => {
|
||||
this.classList.remove('actionFailed')
|
||||
}, 1000);
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
constructTemplate () {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ export function marshalActionButtonsJsonToHtml (json) {
|
|||
const currentIterationTimestamp = Date.now()
|
||||
|
||||
for (const jsonButton of json.actions) {
|
||||
var htmlButton = document.querySelector('#actionButton_' + jsonButton.id)
|
||||
let htmlButton = document.querySelector('#actionButton_' + jsonButton.id)
|
||||
|
||||
if (htmlButton == null) {
|
||||
htmlButton = document.createElement('button', { is: 'action-button' })
|
||||
|
|
@ -16,12 +16,12 @@ export function marshalActionButtonsJsonToHtml (json) {
|
|||
htmlButton.updateHtml()
|
||||
}
|
||||
|
||||
htmlButton.updateIterationTimestamp = currentIterationTimestamp;
|
||||
htmlButton.updateIterationTimestamp = currentIterationTimestamp
|
||||
}
|
||||
|
||||
for (const existingButton of document.querySelector('#contentActions').querySelectorAll('button')) {
|
||||
if (existingButton.updateIterationTimestamp != currentIterationTimestamp) {
|
||||
existingButton.remove();
|
||||
if (existingButton.updateIterationTimestamp !== currentIterationTimestamp) {
|
||||
existingButton.remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,20 +15,20 @@ function showBigError (type, friendlyType, message) {
|
|||
}
|
||||
|
||||
function showSection (name) {
|
||||
for (let otherName of ["Actions", "Logs"]) {
|
||||
document.getElementById('show' + otherName).classList.remove('activeSection');
|
||||
document.getElementById('content' + otherName).hidden = true;
|
||||
for (const otherName of ['Actions', 'Logs']) {
|
||||
document.getElementById('show' + otherName).classList.remove('activeSection')
|
||||
document.getElementById('content' + otherName).hidden = true
|
||||
}
|
||||
|
||||
document.getElementById('show' + name).classList.add('activeSection')
|
||||
document.getElementById('content' + name).hidden = false;
|
||||
document.getElementById('content' + name).hidden = false
|
||||
}
|
||||
|
||||
function setupSections () {
|
||||
document.getElementById('showActions').onclick = () => { showSection('Actions') };
|
||||
document.getElementById('showActions').onclick = () => { showSection('Actions') }
|
||||
document.getElementById('showLogs').onclick = () => { showSection('Logs') }
|
||||
|
||||
showSection('Actions');
|
||||
showSection('Actions')
|
||||
}
|
||||
|
||||
function fetchGetButtons () {
|
||||
|
|
@ -59,16 +59,16 @@ function processWebuiSettingsJson (settings) {
|
|||
window.restBaseUrl = settings.Rest
|
||||
|
||||
if (settings.ThemeName) {
|
||||
var themeCss = document.createElement('link')
|
||||
themeCss.setAttribute('rel', 'stylesheet');
|
||||
const themeCss = document.createElement('link')
|
||||
themeCss.setAttribute('rel', 'stylesheet')
|
||||
themeCss.setAttribute('type', 'text/css')
|
||||
themeCss.setAttribute('href', '/themes/' + settings.ThemeName + '/theme.css');
|
||||
themeCss.setAttribute('href', '/themes/' + settings.ThemeName + '/theme.css')
|
||||
|
||||
document.head.appendChild(themeCss);
|
||||
document.head.appendChild(themeCss)
|
||||
}
|
||||
}
|
||||
|
||||
setupSections();
|
||||
setupSections()
|
||||
|
||||
window.fetch('webUiSettings.json').then(res => {
|
||||
return res.json()
|
||||
|
|
@ -78,8 +78,7 @@ window.fetch('webUiSettings.json').then(res => {
|
|||
fetchGetButtons()
|
||||
fetchGetLogs()
|
||||
|
||||
window.buttonInterval = setInterval(fetchGetButtons, 3000);
|
||||
window.buttonInterval = setInterval(fetchGetButtons, 3000)
|
||||
}).catch(err => {
|
||||
showBigError('fetch-webui-settings', 'getting webui settings', err)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue