marshaller.js 21 KB

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