marshaller.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  1. import './ActionButton.js' // To define action-button
  2. import { NavigationBar } from './NavigationBar.js'
  3. import { ExecutionDialog } from './ExecutionDialog.js'
  4. import { ActionStatusDisplay } from './ActionStatusDisplay.js'
  5. function getQueryParams () {
  6. return new URLSearchParams(window.location.search.substring(1))
  7. }
  8. function checkAndTriggerActionFromQueryParam () {
  9. const params = getQueryParams()
  10. const action = params.get('action')
  11. if (action && window.actionButtons) {
  12. // Look for an action button with matching title
  13. const actionButton = window.actionButtons[action]
  14. if (actionButton) {
  15. // Only trigger actions that have arguments
  16. const jsonButton = window.actionButtonsJson[action]
  17. if (jsonButton && jsonButton.arguments && jsonButton.arguments.length > 0) {
  18. // Trigger the action button click
  19. setTimeout(() => {
  20. actionButton.btn.click()
  21. }, 500) // Small delay to ensure UI is fully loaded
  22. return true
  23. }
  24. }
  25. }
  26. return false
  27. }
  28. function createElement (tag, attributes) {
  29. const el = document.createElement(tag)
  30. if (attributes !== null) {
  31. if (attributes.classNames !== undefined) {
  32. el.classList.add(...attributes.classNames)
  33. }
  34. if (attributes.innerText !== undefined) {
  35. el.innerText = attributes.innerText
  36. }
  37. }
  38. return el
  39. }
  40. function createTag (val) {
  41. const domTag = createElement('span', {
  42. innerText: val,
  43. classNames: ['tag']
  44. })
  45. return domTag
  46. }
  47. function createAnnotation (key, val) {
  48. const domAnnotation = createElement('span', {
  49. classNames: ['annotation']
  50. })
  51. domAnnotation.appendChild(createElement('span', {
  52. innerText: key,
  53. classNames: ['annotation-key']
  54. }))
  55. domAnnotation.appendChild(createElement('span', {
  56. innerText: val,
  57. classNames: ['annotation-value']
  58. }))
  59. return domAnnotation
  60. }
  61. /**
  62. * This is a weird function that just sets some globals.
  63. */
  64. export function initMarshaller () {
  65. window.navbar = new NavigationBar()
  66. window.showSection = showSection
  67. window.showSectionView = showSectionView
  68. window.executionDialog = new ExecutionDialog()
  69. window.logEntries = new Map()
  70. window.registeredPaths = new Map()
  71. window.breadcrumbNavigation = []
  72. window.currentPath = ''
  73. window.addEventListener('EventExecutionStarted', onExecutionStarted)
  74. window.addEventListener('EventExecutionFinished', onExecutionFinished)
  75. window.addEventListener('EventOutputChunk', onOutputChunk)
  76. }
  77. function setUsername (username, provider) {
  78. document.getElementById('username').innerText = username
  79. document.getElementById('username').setAttribute('title', provider)
  80. if (window.settings.AuthLocalLogin || window.settings.AuthOAuth2Providers !== null) {
  81. if (username === 'guest') {
  82. document.getElementById('link-login').hidden = false
  83. document.getElementById('link-logout').hidden = true
  84. } else {
  85. document.getElementById('link-login').hidden = true
  86. if (provider === 'local' || provider === 'oauth2') {
  87. document.getElementById('link-logout').hidden = false
  88. }
  89. }
  90. }
  91. }
  92. export function marshalDashboardComponentsJsonToHtml (json) {
  93. if (json == null) { // eg: HTTP 403
  94. setUsername('guest', 'system')
  95. if (window.settings.AuthLoginUrl !== '') {
  96. window.location = window.settings.AuthLoginUrl
  97. } else {
  98. showSection('/login')
  99. }
  100. } else {
  101. setUsername(json.authenticatedUser, json.authenticatedUserProvider)
  102. marshalActionsJsonToHtml(json)
  103. marshalDashboardStructureToHtml(json)
  104. window.navbar.refreshSectionPolicyLinks(json.effectivePolicy)
  105. refreshDiagnostics(json)
  106. }
  107. document.body.setAttribute('initial-marshal-complete', 'true')
  108. }
  109. function marshalActionsJsonToHtml (json) {
  110. const currentIterationTimestamp = Date.now()
  111. window.actionButtons = {}
  112. window.actionButtonsJson = {} // Store the JSON representation
  113. for (const jsonButton of json.actions) {
  114. let htmlButton = window.actionButtons[jsonButton.id]
  115. if (typeof htmlButton === 'undefined') {
  116. htmlButton = document.createElement('action-button')
  117. htmlButton.constructFromJson(jsonButton)
  118. window.actionButtons[jsonButton.title] = htmlButton
  119. window.actionButtonsJson[jsonButton.title] = jsonButton // Store the JSON representation
  120. }
  121. htmlButton.updateFromJson(jsonButton)
  122. htmlButton.updateIterationTimestamp = currentIterationTimestamp
  123. }
  124. // Remove existing, but stale buttons (that were not updated in this round)
  125. for (const existingButton of document.querySelectorAll('action-button')) {
  126. if (existingButton.updateIterationTimestamp !== currentIterationTimestamp) {
  127. existingButton.remove()
  128. }
  129. }
  130. }
  131. function onOutputChunk (evt) {
  132. const chunk = evt.payload
  133. if (chunk.executionTrackingId === window.executionDialog.executionTrackingId) {
  134. window.terminal.write(chunk.output)
  135. window.executionDialog.showOutput()
  136. }
  137. }
  138. function onExecutionStarted (evt) {
  139. const logEntry = evt.payload.logEntry
  140. marshalLogsJsonToHtml({
  141. logs: [logEntry]
  142. })
  143. }
  144. function onExecutionFinished (evt) {
  145. const logEntry = evt.payload.logEntry
  146. window.logEntries.set(logEntry.executionTrackingId, logEntry)
  147. const actionButton = window.actionButtons[logEntry.actionTitle]
  148. if (actionButton === undefined) {
  149. return
  150. }
  151. const executionButton = document.querySelector('execution-button#execution-' + logEntry.executionTrackingId)
  152. let feedbackButton = actionButton
  153. switch (actionButton.popupOnStart) {
  154. case 'execution-button':
  155. if (executionButton != null) {
  156. feedbackButton = executionButton
  157. }
  158. break
  159. case 'execution-dialog-output-html':
  160. case 'execution-dialog-stdout-only':
  161. case 'execution-dialog':
  162. // We don't need to fetch the logEntry for the dialog because we already
  163. // have it, so we open the dialog and it will get updated below.
  164. window.executionDialog.show()
  165. window.executionDialog.executionTrackingId = logEntry.uuid
  166. break
  167. }
  168. feedbackButton.onExecutionFinished(logEntry)
  169. marshalLogsJsonToHtml({
  170. logs: [logEntry]
  171. })
  172. // If the current execution dialog is open, update that too
  173. if (window.executionDialog.dlg.open && window.executionDialog.executionUuid === logEntry.uuid) {
  174. window.executionDialog.renderExecutionResult({
  175. logEntry: logEntry,
  176. type: actionButton.popupOnStart
  177. })
  178. }
  179. }
  180. function convertPathToBreadcrumb (path) {
  181. const parts = path.split('/')
  182. const result = []
  183. for (let i = 0; i < parts.length; i++) {
  184. if (parts[i] === '') {
  185. continue
  186. }
  187. result.push(parts.slice(0, i + 1).join('/'))
  188. }
  189. return result
  190. }
  191. function showExecutionResult (pathName) {
  192. const executionTrackingId = pathName.split('/')[2]
  193. window.executionDialog.fetchExecutionResult(executionTrackingId)
  194. window.executionDialog.show()
  195. }
  196. function showSection (pathName) {
  197. if (pathName.startsWith('/logs/')) {
  198. showExecutionResult(pathName)
  199. pushNewNavigationPath(pathName)
  200. return
  201. }
  202. const path = window.registeredPaths.get(pathName)
  203. if (path === undefined) {
  204. console.warn('Section not found by path: ' + pathName)
  205. showSection('/')
  206. return
  207. }
  208. window.convertPathToBreadcrumb = convertPathToBreadcrumb
  209. window.currentPath = pathName
  210. window.breadcrumbNavigation = convertPathToBreadcrumb(pathName)
  211. for (const section of document.querySelectorAll('section')) {
  212. if (section.title === path.section) {
  213. section.style.display = 'block'
  214. } else {
  215. section.style.display = 'none'
  216. }
  217. }
  218. // Check for action parameter in query string
  219. if (!checkAndTriggerActionFromQueryParam()) {
  220. pushNewNavigationPath(pathName)
  221. }
  222. setSectionNavigationVisible(false)
  223. showSectionView(path.view)
  224. }
  225. function pushNewNavigationPath (pathName) {
  226. // Get the current query string
  227. const queryString = window.location.search
  228. // Push the new state with the path and preserve the query string
  229. window.history.pushState({
  230. path: pathName
  231. }, null, pathName + queryString)
  232. }
  233. function setSectionNavigationVisible (visible) {
  234. const nav = document.querySelector('nav')
  235. const btn = document.getElementById('sidebar-toggler-button')
  236. nav.removeAttribute('hidden')
  237. if (document.body.classList.contains('has-sidebar')) {
  238. if (visible) {
  239. btn.setAttribute('aria-pressed', false)
  240. btn.setAttribute('aria-label', 'Open sidebar navigation')
  241. btn.innerHTML = '&laquo;'
  242. nav.classList.add('shown')
  243. } else {
  244. btn.setAttribute('aria-pressed', true)
  245. btn.setAttribute('aria-label', 'Close sidebar navigation')
  246. btn.innerHTML = '&#9776;'
  247. nav.classList.remove('shown')
  248. }
  249. } else {
  250. btn.disabled = true
  251. }
  252. }
  253. export function setupSectionNavigation (style) {
  254. const nav = document.querySelector('nav')
  255. const btn = document.getElementById('sidebar-toggler-button')
  256. if (style === 'sidebar') {
  257. nav.classList.add('sidebar')
  258. document.body.classList.add('has-sidebar')
  259. btn.onclick = () => {
  260. if (nav.classList.contains('shown')) {
  261. setSectionNavigationVisible(false)
  262. } else {
  263. setSectionNavigationVisible(true)
  264. }
  265. }
  266. } else {
  267. nav.classList.add('topbar')
  268. document.body.classList.add('has-topbar')
  269. }
  270. registerSection('/', 'Actions', null, document.getElementById('showActions'))
  271. registerSection('/diagnostics', 'Diagnostics', null, null)
  272. registerSection('/logs', 'Logs', null, null)
  273. registerSection('/login', 'Login', null, null)
  274. }
  275. function registerSection (path, section, view, linkElement) {
  276. window.registeredPaths.set(path, {
  277. section: section,
  278. view: view
  279. })
  280. if (linkElement != null) {
  281. addLinkToSection(path, linkElement)
  282. }
  283. }
  284. function addLinkToSection (pathName, element) {
  285. const path = window.registeredPaths.get(pathName)
  286. element.href = 'javascript:void(0)'
  287. element.title = path.section
  288. element.onclick = () => {
  289. showSection(pathName)
  290. }
  291. }
  292. function refreshDiagnostics (json) {
  293. document.getElementById('diagnostics-sshfoundkey').innerHTML = json.diagnostics.SshFoundKey
  294. document.getElementById('diagnostics-sshfoundconfig').innerHTML = json.diagnostics.SshFoundConfig
  295. }
  296. function getSystemTitle (title) {
  297. return title.replaceAll(' ', '')
  298. }
  299. function marshalSingleDashboard (dashboard, nav) {
  300. const oldsection = document.querySelector('section[title="' + getSystemTitle(dashboard.title) + '"]')
  301. if (oldsection != null) {
  302. oldsection.remove()
  303. }
  304. const section = document.createElement('section')
  305. section.setAttribute('system-title', getSystemTitle(dashboard.title))
  306. section.title = section.getAttribute('system-title')
  307. const def = createFieldset('default', section)
  308. section.appendChild(def)
  309. document.getElementsByTagName('main')[0].appendChild(section)
  310. marshalContainerContents(dashboard, section, def, dashboard.title)
  311. const oldLi = nav.querySelector('li[title="' + dashboard.title + '"]')
  312. if (oldLi != null) {
  313. oldLi.remove()
  314. }
  315. const systemTitleUrl = '/' + getSystemTitle(dashboard.title)
  316. window.navbar.createLink(dashboard.title, systemTitleUrl, false)
  317. registerSection(systemTitleUrl, section.title, null, null)
  318. }
  319. function marshalDashboardStructureToHtml (json) {
  320. const nav = document.getElementById('navigation-links')
  321. for (const dashboard of json.dashboards) {
  322. marshalSingleDashboard(dashboard, nav)
  323. }
  324. const rootGroup = document.querySelector('#root-group')
  325. for (const btn of Object.values(window.actionButtons)) {
  326. if (btn.parentElement === null) {
  327. rootGroup.appendChild(btn)
  328. }
  329. }
  330. const shouldHideActions = rootGroup.querySelectorAll('action-button').length === 0 && json.dashboards.length > 0
  331. if (shouldHideActions) {
  332. nav.querySelector('li[title="Actions"]').style.display = 'none'
  333. }
  334. if (window.currentPath !== '') {
  335. showSection(window.currentPath)
  336. } else if (window.location.pathname !== '/' && document.body.getAttribute('initial-marshal-complete') === null) {
  337. showSection(window.location.pathname)
  338. } else {
  339. if (shouldHideActions) {
  340. showSection('/' + getSystemTitle(json.dashboards[0].title))
  341. } else {
  342. showSection('/')
  343. }
  344. }
  345. }
  346. function marshalLink (item, fieldset) {
  347. let btn = window.actionButtons[item.title]
  348. if (typeof btn === 'undefined') {
  349. btn = document.createElement('button')
  350. btn.innerText = 'Action not found: ' + item.title
  351. btn.classList.add('error')
  352. }
  353. if (item.cssClass !== '') {
  354. btn.classList.add(item.cssClass)
  355. }
  356. fieldset.appendChild(btn)
  357. }
  358. function marshalMreOutput (dashboardComponent, fieldset) {
  359. const pre = document.createElement('pre')
  360. pre.classList.add('mre-output')
  361. pre.innerHTML = 'Waiting...'
  362. const executionStatus = {
  363. actionId: dashboardComponent.title
  364. }
  365. window.fetch(window.restBaseUrl + 'ExecutionStatus', {
  366. method: 'POST',
  367. headers: {
  368. 'Content-Type': 'application/json'
  369. },
  370. body: JSON.stringify(executionStatus)
  371. }).then((res) => {
  372. if (res.ok) {
  373. return res.json()
  374. } else {
  375. pre.innerHTML = 'error'
  376. throw new Error(res.statusText)
  377. }
  378. }).then((json) => {
  379. updateMre(pre, json.logEntry)
  380. })
  381. const updateMre = (pre, json) => {
  382. pre.innerHTML = json.output
  383. }
  384. window.addEventListener('ExecutionFinished', (e) => {
  385. // The dashboard component "title" field is used for lots of things
  386. // and in this context for MreOutput it's just to refer an an actionId.
  387. //
  388. // So this is not a typo.
  389. if (e.payload.actionId === dashboardComponent.title) {
  390. updateMre(pre, e.payload)
  391. }
  392. })
  393. fieldset.appendChild(pre)
  394. }
  395. function marshalContainerContents (json, section, fieldset, parentDashboard) {
  396. for (const item of json.contents) {
  397. switch (item.type) {
  398. case 'fieldset':
  399. marshalFieldset(item, section, parentDashboard)
  400. break
  401. case 'directory': {
  402. const directoryPath = marshalDirectory(item, section)
  403. marshalDirectoryButton(item, fieldset, directoryPath)
  404. }
  405. break
  406. case 'display':
  407. marshalDisplay(item, fieldset)
  408. break
  409. case 'stdout-most-recent-execution':
  410. marshalMreOutput(item, fieldset)
  411. break
  412. case 'link':
  413. marshalLink(item, fieldset)
  414. break
  415. default:
  416. }
  417. }
  418. }
  419. function createFieldset (title, parentDashboard) {
  420. const legend = document.createElement('legend')
  421. legend.innerText = title
  422. const fs = document.createElement('fieldset')
  423. fs.title = title
  424. fs.appendChild(legend)
  425. if (typeof parentDashboard === 'undefined') {
  426. fs.setAttribute('parent-dashboard', '')
  427. } else {
  428. fs.setAttribute('parent-dashboard', parentDashboard)
  429. }
  430. return fs
  431. }
  432. function marshalFieldset (item, section, parentDashboard) {
  433. const fs = createFieldset(item.title, parentDashboard)
  434. marshalContainerContents(item, section, fs, parentDashboard)
  435. section.appendChild(fs)
  436. }
  437. function showSectionView (selected) {
  438. if (selected === '') {
  439. selected = null
  440. }
  441. for (const fieldset of document.querySelectorAll('fieldset')) {
  442. if (selected === null) {
  443. if ((fieldset.id === 'root-group' || fieldset.getAttribute('parent-dashboard') !== '') && fieldset.children.length > 1) {
  444. fieldset.style.display = 'grid'
  445. } else {
  446. fieldset.style.display = 'none'
  447. }
  448. } else {
  449. if (fieldset.title === selected) {
  450. fieldset.style.display = 'grid'
  451. } else {
  452. fieldset.style.display = 'none'
  453. }
  454. }
  455. }
  456. const current = window.registeredPaths.get(window.currentPath)
  457. for (const navLink of document.querySelector('nav').querySelectorAll('a')) {
  458. if (navLink.title === current.section) {
  459. navLink.classList.add('selected')
  460. } else {
  461. navLink.classList.remove('selected')
  462. }
  463. }
  464. rebuildH1BreadcrumbNavigation(selected)
  465. pushNewNavigationPath(window.currentPath)
  466. }
  467. function rebuildH1BreadcrumbNavigation () {
  468. const title = document.querySelector('h1')
  469. title.innerHTML = ''
  470. const rootLink = document.createElement('a')
  471. rootLink.innerText = window.pageTitle
  472. rootLink.href = 'javascript:void(0)'
  473. rootLink.onclick = () => {
  474. showSection('/')
  475. }
  476. title.appendChild(rootLink)
  477. for (const pathName of window.breadcrumbNavigation) {
  478. const sep = document.createElement('span')
  479. sep.innerHTML = ' &raquo; '
  480. title.append(sep)
  481. const path = window.registeredPaths.get(pathName)
  482. title.appendChild(createNavigationBreadcrumbDisplay(path))
  483. }
  484. document.title = title.innerText
  485. }
  486. function createNavigationBreadcrumbDisplay (path) {
  487. const a = document.createElement('a')
  488. a.href = 'javascript:void(0)'
  489. if (path.view === null) {
  490. a.title = path.section
  491. a.innerText = path.section
  492. } else {
  493. a.innerText = path.view
  494. a.title = path.view
  495. }
  496. a.onclick = () => {
  497. showSectionView(path.view)
  498. }
  499. return a
  500. }
  501. function marshalDisplay (item, fieldset) {
  502. const display = document.createElement('div')
  503. display.innerHTML = item.title
  504. display.classList.add('display')
  505. if (item.cssClass !== '') {
  506. display.classList.add(item.cssClass)
  507. }
  508. fieldset.appendChild(display)
  509. }
  510. function marshalDirectoryButton (item, fieldset, path) {
  511. const directoryButton = document.createElement('button')
  512. directoryButton.innerHTML = '<span class = "icon">' + item.icon + '</span> ' + item.title
  513. directoryButton.onclick = () => {
  514. showSection(path)
  515. }
  516. fieldset.appendChild(directoryButton)
  517. }
  518. function marshalDirectory (item, section) {
  519. const fs = createFieldset(item.title)
  520. fs.style.display = 'none'
  521. const directoryBackButton = document.createElement('button')
  522. directoryBackButton.innerHTML = window.settings.DefaultIconForBack
  523. directoryBackButton.title = 'Go back one directory'
  524. directoryBackButton.onclick = () => {
  525. showSection('/' + section.title)
  526. }
  527. fs.appendChild(directoryBackButton)
  528. marshalContainerContents(item, section, fs)
  529. section.appendChild(fs)
  530. const path = '/' + section.title + '/' + getSystemTitle(item.title)
  531. registerSection(path, section.title, item.title, null)
  532. return path
  533. }
  534. export function marshalLogsJsonToHtml (json) {
  535. // This function is called internally with a "fake" server response, that does
  536. // not have pageSize set. So we need to check if it's set before trying to use it.
  537. if (json.pageSize !== undefined) {
  538. document.getElementById('logs-server-page-size').innerText = json.pageSize
  539. }
  540. if (json.logs != null && json.logs.length > 0) {
  541. document.getElementById('logsTable').hidden = false
  542. document.getElementById('logsTableEmpty').hidden = true
  543. } else {
  544. return
  545. }
  546. for (const logEntry of json.logs) {
  547. let row = document.getElementById('log-' + logEntry.executionTrackingId)
  548. if (row == null) {
  549. const tpl = document.getElementById('tplLogRow')
  550. row = tpl.content.querySelector('tr').cloneNode(true)
  551. row.id = 'log-' + logEntry.executionTrackingId
  552. row.querySelector('.content').onclick = () => {
  553. window.executionDialog.reset()
  554. window.executionDialog.show()
  555. window.executionDialog.renderExecutionResult({
  556. logEntry: window.logEntries.get(logEntry.executionTrackingId)
  557. })
  558. pushNewNavigationPath('/logs/' + logEntry.executionTrackingId)
  559. }
  560. row.exitCodeDisplay = new ActionStatusDisplay(row.querySelector('.exit-code'))
  561. logEntry.dom = row
  562. window.logEntries.set(logEntry.executionTrackingId, logEntry)
  563. document.querySelector('#logTableBody').prepend(row)
  564. }
  565. row.querySelector('.timestamp').innerText = logEntry.datetimeStarted
  566. row.querySelector('.content').innerText = logEntry.actionTitle
  567. row.querySelector('.icon').innerHTML = logEntry.actionIcon
  568. row.setAttribute('title', logEntry.actionTitle)
  569. row.exitCodeDisplay.update(logEntry)
  570. row.querySelector('.tags').innerHTML = ''
  571. for (const tag of logEntry.tags) {
  572. row.querySelector('.tags').append(createTag(tag))
  573. }
  574. row.querySelector('.tags').append(createAnnotation('user', logEntry.user))
  575. }
  576. }
  577. window.addEventListener('popstate', (e) => {
  578. e.preventDefault()
  579. if (e.state != null && typeof e.state.path !== 'undefined') {
  580. showSection(e.state.path)
  581. }
  582. })
  583. export function refreshServerConnectionLabel () {
  584. if (window.restAvailable) {
  585. document.querySelector('#serverConnectionRest').classList.remove('error')
  586. } else {
  587. document.querySelector('#serverConnectionRest').classList.add('error')
  588. }
  589. if (window.websocketAvailable) {
  590. document.querySelector('#serverConnectionWebSocket').classList.remove('error')
  591. document.querySelector('#serverConnectionWebSocket').innerText = 'WebSocket'
  592. } else {
  593. document.querySelector('#serverConnectionWebSocket').classList.add('error')
  594. document.querySelector('#serverConnectionWebSocket').innerText = 'WebSocket Error'
  595. }
  596. }