4
0

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. }
  136. }
  137. function onExecutionStarted (evt) {
  138. const logEntry = evt.payload.logEntry
  139. marshalLogsJsonToHtml({
  140. logs: [logEntry]
  141. })
  142. }
  143. function onExecutionFinished (evt) {
  144. const logEntry = evt.payload.logEntry
  145. window.logEntries.set(logEntry.executionTrackingId, logEntry)
  146. const actionButton = window.actionButtons[logEntry.actionTitle]
  147. if (actionButton === undefined) {
  148. return
  149. }
  150. const executionButton = document.querySelector('execution-button#execution-' + logEntry.executionTrackingId)
  151. let feedbackButton = actionButton
  152. switch (actionButton.popupOnStart) {
  153. case 'execution-button':
  154. if (executionButton != null) {
  155. feedbackButton = executionButton
  156. }
  157. break
  158. case 'execution-dialog-output-html':
  159. case 'execution-dialog-stdout-only':
  160. case 'execution-dialog':
  161. // We don't need to fetch the logEntry for the dialog because we already
  162. // have it, so we open the dialog and it will get updated below.
  163. window.executionDialog.show()
  164. window.executionDialog.executionTrackingId = logEntry.uuid
  165. break
  166. }
  167. feedbackButton.onExecutionFinished(logEntry)
  168. marshalLogsJsonToHtml({
  169. logs: [logEntry]
  170. })
  171. // If the current execution dialog is open, update that too
  172. if (window.executionDialog.dlg.open && window.executionDialog.executionUuid === logEntry.uuid) {
  173. window.executionDialog.renderExecutionResult({
  174. logEntry: logEntry,
  175. type: actionButton.popupOnStart
  176. })
  177. }
  178. }
  179. function convertPathToBreadcrumb (path) {
  180. const parts = path.split('/')
  181. const result = []
  182. for (let i = 0; i < parts.length; i++) {
  183. if (parts[i] === '') {
  184. continue
  185. }
  186. result.push(parts.slice(0, i + 1).join('/'))
  187. }
  188. return result
  189. }
  190. function showExecutionResult (pathName) {
  191. const executionTrackingId = pathName.split('/')[2]
  192. window.executionDialog.fetchExecutionResult(executionTrackingId)
  193. window.executionDialog.show()
  194. }
  195. function showSection (pathName) {
  196. if (pathName.startsWith('/logs/')) {
  197. showExecutionResult(pathName)
  198. pushNewNavigationPath(pathName)
  199. return
  200. }
  201. const path = window.registeredPaths.get(pathName)
  202. if (path === undefined) {
  203. console.warn('Section not found by path: ' + pathName)
  204. showSection('/')
  205. return
  206. }
  207. window.convertPathToBreadcrumb = convertPathToBreadcrumb
  208. window.currentPath = pathName
  209. window.breadcrumbNavigation = convertPathToBreadcrumb(pathName)
  210. for (const section of document.querySelectorAll('section')) {
  211. if (section.title === path.section) {
  212. section.style.display = 'block'
  213. } else {
  214. section.style.display = 'none'
  215. }
  216. }
  217. // Check for action parameter in query string
  218. if (!checkAndTriggerActionFromQueryParam()) {
  219. pushNewNavigationPath(pathName)
  220. }
  221. setSectionNavigationVisible(false)
  222. showSectionView(path.view)
  223. }
  224. function pushNewNavigationPath (pathName) {
  225. // Get the current query string
  226. const queryString = window.location.search
  227. // Push the new state with the path and preserve the query string
  228. window.history.pushState({
  229. path: pathName
  230. }, null, pathName + queryString)
  231. }
  232. function setSectionNavigationVisible (visible) {
  233. const nav = document.querySelector('nav')
  234. const btn = document.getElementById('sidebar-toggler-button')
  235. nav.removeAttribute('hidden')
  236. if (document.body.classList.contains('has-sidebar')) {
  237. if (visible) {
  238. btn.setAttribute('aria-pressed', false)
  239. btn.setAttribute('aria-label', 'Open sidebar navigation')
  240. btn.innerHTML = '&laquo;'
  241. nav.classList.add('shown')
  242. } else {
  243. btn.setAttribute('aria-pressed', true)
  244. btn.setAttribute('aria-label', 'Close sidebar navigation')
  245. btn.innerHTML = '&#9776;'
  246. nav.classList.remove('shown')
  247. }
  248. } else {
  249. btn.disabled = true
  250. }
  251. }
  252. export function setupSectionNavigation (style) {
  253. const nav = document.querySelector('nav')
  254. const btn = document.getElementById('sidebar-toggler-button')
  255. if (style === 'sidebar') {
  256. nav.classList.add('sidebar')
  257. document.body.classList.add('has-sidebar')
  258. btn.onclick = () => {
  259. if (nav.classList.contains('shown')) {
  260. setSectionNavigationVisible(false)
  261. } else {
  262. setSectionNavigationVisible(true)
  263. }
  264. }
  265. } else {
  266. nav.classList.add('topbar')
  267. document.body.classList.add('has-topbar')
  268. }
  269. registerSection('/', 'Actions', null, document.getElementById('showActions'))
  270. registerSection('/diagnostics', 'Diagnostics', null, null)
  271. registerSection('/logs', 'Logs', null, null)
  272. registerSection('/login', 'Login', null, null)
  273. }
  274. function registerSection (path, section, view, linkElement) {
  275. window.registeredPaths.set(path, {
  276. section: section,
  277. view: view
  278. })
  279. if (linkElement != null) {
  280. addLinkToSection(path, linkElement)
  281. }
  282. }
  283. function addLinkToSection (pathName, element) {
  284. const path = window.registeredPaths.get(pathName)
  285. element.href = 'javascript:void(0)'
  286. element.title = path.section
  287. element.onclick = () => {
  288. showSection(pathName)
  289. }
  290. }
  291. function refreshDiagnostics (json) {
  292. document.getElementById('diagnostics-sshfoundkey').innerHTML = json.diagnostics.SshFoundKey
  293. document.getElementById('diagnostics-sshfoundconfig').innerHTML = json.diagnostics.SshFoundConfig
  294. }
  295. function getSystemTitle (title) {
  296. return title.replaceAll(' ', '')
  297. }
  298. function marshalSingleDashboard (dashboard, nav) {
  299. const oldsection = document.querySelector('section[title="' + getSystemTitle(dashboard.title) + '"]')
  300. if (oldsection != null) {
  301. oldsection.remove()
  302. }
  303. const section = document.createElement('section')
  304. section.setAttribute('system-title', getSystemTitle(dashboard.title))
  305. section.title = section.getAttribute('system-title')
  306. const def = createFieldset('default', section)
  307. section.appendChild(def)
  308. document.getElementsByTagName('main')[0].appendChild(section)
  309. marshalContainerContents(dashboard, section, def, dashboard.title)
  310. const oldLi = nav.querySelector('li[title="' + dashboard.title + '"]')
  311. if (oldLi != null) {
  312. oldLi.remove()
  313. }
  314. const systemTitleUrl = '/' + getSystemTitle(dashboard.title)
  315. window.navbar.createLink(dashboard.title, systemTitleUrl, false)
  316. registerSection(systemTitleUrl, section.title, null, null)
  317. }
  318. function marshalDashboardStructureToHtml (json) {
  319. const nav = document.getElementById('navigation-links')
  320. for (const dashboard of json.dashboards) {
  321. marshalSingleDashboard(dashboard, nav)
  322. }
  323. const rootGroup = document.querySelector('#root-group')
  324. for (const btn of Object.values(window.actionButtons)) {
  325. if (btn.parentElement === null) {
  326. rootGroup.appendChild(btn)
  327. }
  328. }
  329. const shouldHideActions = rootGroup.querySelectorAll('action-button').length === 0 && json.dashboards.length > 0
  330. if (shouldHideActions) {
  331. nav.querySelector('li[title="Actions"]').style.display = 'none'
  332. }
  333. if (window.currentPath !== '') {
  334. showSection(window.currentPath)
  335. } else if (window.location.pathname !== '/' && document.body.getAttribute('initial-marshal-complete') === null) {
  336. showSection(window.location.pathname)
  337. } else {
  338. if (shouldHideActions) {
  339. showSection('/' + getSystemTitle(json.dashboards[0].title))
  340. } else {
  341. showSection('/')
  342. }
  343. }
  344. }
  345. function marshalLink (item, fieldset) {
  346. let btn = window.actionButtons[item.title]
  347. if (typeof btn === 'undefined') {
  348. btn = document.createElement('button')
  349. btn.innerText = 'Action not found: ' + item.title
  350. btn.classList.add('error')
  351. }
  352. if (item.cssClass !== '') {
  353. btn.classList.add(item.cssClass)
  354. }
  355. fieldset.appendChild(btn)
  356. }
  357. function marshalMreOutput (dashboardComponent, fieldset) {
  358. const pre = document.createElement('pre')
  359. pre.classList.add('mre-output')
  360. pre.innerHTML = 'Waiting...'
  361. const executionStatus = {
  362. actionId: dashboardComponent.title
  363. }
  364. window.fetch(window.restBaseUrl + 'ExecutionStatus', {
  365. method: 'POST',
  366. headers: {
  367. 'Content-Type': 'application/json'
  368. },
  369. body: JSON.stringify(executionStatus)
  370. }).then((res) => {
  371. if (res.ok) {
  372. return res.json()
  373. } else {
  374. pre.innerHTML = 'error'
  375. throw new Error(res.statusText)
  376. }
  377. }).then((json) => {
  378. updateMre(pre, json.logEntry)
  379. })
  380. const updateMre = (pre, json) => {
  381. pre.innerHTML = json.output
  382. }
  383. window.addEventListener('ExecutionFinished', (e) => {
  384. // The dashboard component "title" field is used for lots of things
  385. // and in this context for MreOutput it's just to refer an an actionId.
  386. //
  387. // So this is not a typo.
  388. if (e.payload.actionId === dashboardComponent.title) {
  389. updateMre(pre, e.payload)
  390. }
  391. })
  392. fieldset.appendChild(pre)
  393. }
  394. function marshalContainerContents (json, section, fieldset, parentDashboard) {
  395. for (const item of json.contents) {
  396. switch (item.type) {
  397. case 'fieldset':
  398. marshalFieldset(item, section, parentDashboard)
  399. break
  400. case 'directory': {
  401. const directoryPath = marshalDirectory(item, section)
  402. marshalDirectoryButton(item, fieldset, directoryPath)
  403. }
  404. break
  405. case 'display':
  406. marshalDisplay(item, fieldset)
  407. break
  408. case 'stdout-most-recent-execution':
  409. marshalMreOutput(item, fieldset)
  410. break
  411. case 'link':
  412. marshalLink(item, fieldset)
  413. break
  414. default:
  415. }
  416. }
  417. }
  418. function createFieldset (title, parentDashboard) {
  419. const legend = document.createElement('legend')
  420. legend.innerText = title
  421. const fs = document.createElement('fieldset')
  422. fs.title = title
  423. fs.appendChild(legend)
  424. if (typeof parentDashboard === 'undefined') {
  425. fs.setAttribute('parent-dashboard', '')
  426. } else {
  427. fs.setAttribute('parent-dashboard', parentDashboard)
  428. }
  429. return fs
  430. }
  431. function marshalFieldset (item, section, parentDashboard) {
  432. const fs = createFieldset(item.title, parentDashboard)
  433. marshalContainerContents(item, section, fs, parentDashboard)
  434. section.appendChild(fs)
  435. }
  436. function showSectionView (selected) {
  437. if (selected === '') {
  438. selected = null
  439. }
  440. for (const fieldset of document.querySelectorAll('fieldset')) {
  441. if (selected === null) {
  442. if ((fieldset.id === 'root-group' || fieldset.getAttribute('parent-dashboard') !== '') && fieldset.children.length > 1) {
  443. fieldset.style.display = 'grid'
  444. } else {
  445. fieldset.style.display = 'none'
  446. }
  447. } else {
  448. if (fieldset.title === selected) {
  449. fieldset.style.display = 'grid'
  450. } else {
  451. fieldset.style.display = 'none'
  452. }
  453. }
  454. }
  455. const current = window.registeredPaths.get(window.currentPath)
  456. for (const navLink of document.querySelector('nav').querySelectorAll('a')) {
  457. if (navLink.title === current.section) {
  458. navLink.classList.add('selected')
  459. } else {
  460. navLink.classList.remove('selected')
  461. }
  462. }
  463. rebuildH1BreadcrumbNavigation(selected)
  464. pushNewNavigationPath(window.currentPath)
  465. }
  466. function rebuildH1BreadcrumbNavigation () {
  467. const title = document.querySelector('h1')
  468. title.innerHTML = ''
  469. const rootLink = document.createElement('a')
  470. rootLink.innerText = window.pageTitle
  471. rootLink.href = 'javascript:void(0)'
  472. rootLink.onclick = () => {
  473. showSection('/')
  474. }
  475. title.appendChild(rootLink)
  476. for (const pathName of window.breadcrumbNavigation) {
  477. const sep = document.createElement('span')
  478. sep.innerHTML = ' &raquo; '
  479. title.append(sep)
  480. const path = window.registeredPaths.get(pathName)
  481. title.appendChild(createNavigationBreadcrumbDisplay(path))
  482. }
  483. document.title = title.innerText
  484. }
  485. function createNavigationBreadcrumbDisplay (path) {
  486. const a = document.createElement('a')
  487. a.href = 'javascript:void(0)'
  488. if (path.view === null) {
  489. a.title = path.section
  490. a.innerText = path.section
  491. } else {
  492. a.innerText = path.view
  493. a.title = path.view
  494. }
  495. a.onclick = () => {
  496. showSectionView(path.view)
  497. }
  498. return a
  499. }
  500. function marshalDisplay (item, fieldset) {
  501. const display = document.createElement('div')
  502. display.innerHTML = item.title
  503. display.classList.add('display')
  504. if (item.cssClass !== '') {
  505. display.classList.add(item.cssClass)
  506. }
  507. fieldset.appendChild(display)
  508. }
  509. function marshalDirectoryButton (item, fieldset, path) {
  510. const directoryButton = document.createElement('button')
  511. directoryButton.classList.add('directory')
  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.classList.add('directory')
  524. directoryBackButton.title = 'Go back one directory'
  525. directoryBackButton.onclick = () => {
  526. showSection('/' + section.title)
  527. }
  528. fs.appendChild(directoryBackButton)
  529. marshalContainerContents(item, section, fs)
  530. section.appendChild(fs)
  531. const path = '/' + section.title + '/' + getSystemTitle(item.title)
  532. registerSection(path, section.title, item.title, null)
  533. return path
  534. }
  535. export function marshalLogsJsonToHtml (json) {
  536. // This function is called internally with a "fake" server response, that does
  537. // not have pageSize set. So we need to check if it's set before trying to use it.
  538. if (json.pageSize !== undefined) {
  539. document.getElementById('logs-server-page-size').innerText = json.pageSize
  540. }
  541. if (json.logs != null && json.logs.length > 0) {
  542. document.getElementById('logsTable').hidden = false
  543. document.getElementById('logsTableEmpty').hidden = true
  544. } else {
  545. return
  546. }
  547. for (const logEntry of json.logs) {
  548. let row = document.getElementById('log-' + logEntry.executionTrackingId)
  549. if (row == null) {
  550. const tpl = document.getElementById('tplLogRow')
  551. row = tpl.content.querySelector('tr').cloneNode(true)
  552. row.id = 'log-' + logEntry.executionTrackingId
  553. row.querySelector('.content').onclick = () => {
  554. window.executionDialog.reset()
  555. window.executionDialog.show()
  556. window.executionDialog.renderExecutionResult({
  557. logEntry: window.logEntries.get(logEntry.executionTrackingId)
  558. })
  559. pushNewNavigationPath('/logs/' + logEntry.executionTrackingId)
  560. }
  561. row.exitCodeDisplay = new ActionStatusDisplay(row.querySelector('.exit-code'))
  562. logEntry.dom = row
  563. window.logEntries.set(logEntry.executionTrackingId, logEntry)
  564. document.querySelector('#logTableBody').prepend(row)
  565. }
  566. row.querySelector('.timestamp').innerText = logEntry.datetimeStarted
  567. row.querySelector('.content').innerText = logEntry.actionTitle
  568. row.querySelector('.icon').innerHTML = logEntry.actionIcon
  569. row.setAttribute('title', logEntry.actionTitle)
  570. row.exitCodeDisplay.update(logEntry)
  571. row.querySelector('.tags').innerHTML = ''
  572. for (const tag of logEntry.tags) {
  573. row.querySelector('.tags').append(createTag(tag))
  574. }
  575. row.querySelector('.tags').append(createAnnotation('user', logEntry.user))
  576. }
  577. }
  578. window.addEventListener('popstate', (e) => {
  579. e.preventDefault()
  580. if (e.state != null && typeof e.state.path !== 'undefined') {
  581. showSection(e.state.path)
  582. }
  583. })
  584. export function refreshServerConnectionLabel () {
  585. if (window.restAvailable) {
  586. document.querySelector('#serverConnectionRest').classList.remove('error')
  587. } else {
  588. document.querySelector('#serverConnectionRest').classList.add('error')
  589. }
  590. if (window.websocketAvailable) {
  591. document.querySelector('#serverConnectionWebSocket').classList.remove('error')
  592. document.querySelector('#serverConnectionWebSocket').innerText = 'WebSocket'
  593. } else {
  594. document.querySelector('#serverConnectionWebSocket').classList.add('error')
  595. document.querySelector('#serverConnectionWebSocket').innerText = 'WebSocket Error'
  596. }
  597. }