mirror of
https://github.com/OliveTin/OliveTin
synced 2026-08-28 13:36:32 +00:00
feature: Refresh dashboards when entity files change. (#319)
* feature: Refresh dashboards when entities change * feature: Refresh dashboards when entities change * bugfix: Concurrency, lock around websocket write
This commit is contained in:
@@ -14,6 +14,8 @@ export function initMarshaller () {
|
||||
|
||||
window.initialHash = window.location.hash
|
||||
|
||||
window.currentSection = ''
|
||||
|
||||
window.addEventListener('EventExecutionFinished', onExecutionFinished)
|
||||
}
|
||||
|
||||
@@ -99,6 +101,8 @@ function onExecutionFinished (evt) {
|
||||
function showSection (title) {
|
||||
title = title.replaceAll(' ', '')
|
||||
|
||||
window.currentSection = title
|
||||
|
||||
for (const section of document.querySelectorAll('section')) {
|
||||
if (section.title === title) {
|
||||
section.style.display = 'block'
|
||||
@@ -213,7 +217,9 @@ function marshalDashboardStructureToHtml (json) {
|
||||
}
|
||||
}
|
||||
|
||||
if (window.initialHash !== '' && document.body.getAttribute('initial-marshal-complete') === null) {
|
||||
if (window.currentSection !== '') {
|
||||
showSection(window.currentSection)
|
||||
} else if (window.initialHash !== '' && document.body.getAttribute('initial-marshal-complete') === null) {
|
||||
showSection(window.initialHash.replace('#', ''))
|
||||
} else {
|
||||
if (rootGroup.querySelectorAll('action-button').length === 0 && json.dashboards.length > 0) {
|
||||
|
||||
@@ -42,10 +42,11 @@ function websocketOnMessage (msg) {
|
||||
switch (j.type) {
|
||||
case 'EventConfigChanged':
|
||||
case 'EventExecutionFinished':
|
||||
case 'EventEntityChanged':
|
||||
window.dispatchEvent(e)
|
||||
break
|
||||
default:
|
||||
window.showBigError('Unknown message type from server: ' + j.type)
|
||||
window.showBigError('ws-unhandled-message', 'handling websocket message', 'Unhandled websocket message type from server: ' + j.type, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user