|
42 | 42 | display: flex; |
43 | 43 | flex-direction: column-reverse; |
44 | 44 | } |
45 | | - div.spitcontent dir { |
46 | | - flex-direction: column; |
47 | | - } |
48 | 45 |
|
49 | 46 | body { |
50 | 47 | background: #303030; |
51 | 48 | color: #f0f0f0; |
52 | 49 | } |
53 | 50 |
|
54 | | - #output pre { |
| 51 | + div.spitcontent pre { |
55 | 52 | background: #303030; |
56 | 53 | color: #f0f0f0; |
57 | 54 | padding: 4px; |
58 | 55 | margin: 0; |
59 | | - border-bottom: 1px solid #f0f0f0; |
| 56 | + border-bottom: 1px solid #616161; |
60 | 57 | } |
61 | 58 | img { |
62 | 59 | vertical-align: middle; |
|
202 | 199 | if (message.toString().length < 4) return |
203 | 200 | output.innerHTML = "<p>" + message + "</p>" + output.innerHTML |
204 | 201 | } |
| 202 | + |
| 203 | + while ( document.querySelector("#output").children.length >= 500) |
| 204 | + { |
| 205 | + output.removeChild(output.firstElementChild) |
| 206 | + console.log(document.querySelector("#output").children.length) |
| 207 | + } |
| 208 | + |
205 | 209 | writeToScreen(`DISCONNECTED`); |
206 | 210 |
|
207 | 211 | function onClickButtonConnect() { |
208 | 212 | websocket = new WebSocket(wsUri); |
| 213 | + writeToScreen("CONNECTING") |
209 | 214 | doSend = (message) => { |
210 | 215 | writeToScreen(`<div><pre><h3>send</h3><code>${message}</code></pre></div>`) |
211 | 216 | let split = message.split('\n') |
|
218 | 223 | setTimeout(() => { |
219 | 224 | doSend(`BuildService.Shared.WebSocketProcessing.AvailableBuildsMessage\n{}`) |
220 | 225 | }, 300) |
| 226 | + document.querySelector('button[action=connect]').setAttribute('disabled', '') |
221 | 227 | }; |
222 | 228 |
|
223 | 229 | websocket.onclose = function (e) { |
224 | 230 | writeToScreen("DISCONNECTED"); |
| 231 | + document.querySelector('button[action=connect]').removeAttribute('disabled') |
225 | 232 | }; |
226 | 233 |
|
227 | 234 | websocket.onmessage = async function (e, ...p) { |
|
251 | 258 | reloadSignatureStatus() |
252 | 259 | break; |
253 | 260 | case 'BuildService.Shared.Build.BuildInstanceMessageEventArgs': |
254 | | - let parentElement = null |
255 | | - try { |
256 | | - parentElement = document.querySelector(`[action=buildResponse] div[buildID=${data.buildID}]`) |
257 | | - } catch (error) {} |
| 261 | + // let parentElement = null |
| 262 | + // try { |
| 263 | + // parentElement = document.querySelector(`[action=buildResponse] div[buildID=${data.buildID}]`) |
| 264 | + // } catch (error) {} |
| 265 | + // |
| 266 | + // if (parentElement == null) |
| 267 | + // { |
| 268 | + // let child = document.createElement('div') |
| 269 | + // child.setAttribute('buildID', data.buildID) |
| 270 | + // document.querySelector(`[action=buildResponse]`).appendChild(child) |
| 271 | + // parentElement = child |
| 272 | + // } |
| 273 | + // else |
| 274 | + // { |
| 275 | + // parentElement = document.querySelector(`[action=buildResponse] div[buildID=${data.buildID}]`) |
| 276 | + // } |
| 277 | + let parentElement = document.querySelector(`[action=buildResponse]`) |
| 278 | + |
| 279 | + if (data.content != null && data.content.length > 0) |
| 280 | + parentElement.innerHTML = `<pre><code timestamp="${data.timestamp}" outputType="${data.outputType}">${data.content.replace(/</g, "<").replace(/>/g, ">")}</code></pre>\n` + parentElement.innerHTML |
| 281 | + let wbreak = true |
258 | 282 |
|
259 | | - if (parentElement == null) |
| 283 | + let welem = document.querySelector(`[action=buildResponse]`) |
| 284 | + while (welem.children.length >= 700) |
260 | 285 | { |
261 | | - let child = document.createElement('div') |
262 | | - child.setAttribute('buildID', data.buildID) |
263 | | - document.querySelector(`[action=buildResponse]`).appendChild(child) |
264 | | - parentElement = child |
| 286 | + welem.removeChild(welem.firstElementChild) |
265 | 287 | } |
266 | | - else |
267 | | - { |
268 | | - parentElement = document.querySelector(`[action=buildResponse] div[buildID=${data.buildID}]`) |
269 | | - } |
270 | | - |
271 | | - if (data.content != null && data.content.length > 0) |
272 | | - parentElement.innerHTML += `<pre><code timestamp="${data.timestamp}" outputType="${data.outputType}">${data.content.replace(/</g, "<").replace(/>/g, ">")}</code></pre>\n` |
| 288 | + wbreak = false |
273 | 289 | break; |
274 | 290 | case 'BuildService.Shared.Build.BuildInstanceStatus': |
275 | 291 | if (data.Status == enumBuildStatus.Done && targetDictionary[data.Signature].CurrentBuildStatus != data.Status) |
|
278 | 294 | reloadSignatureStatus() |
279 | 295 | break; |
280 | 296 | } |
| 297 | + |
| 298 | + while ( document.querySelector("#output").children.length >= 500) |
| 299 | + { |
| 300 | + output.removeChild(output.firstElementChild) |
| 301 | + } |
281 | 302 | }; |
282 | 303 |
|
283 | 304 | websocket.onerror = function (e) { |
|
0 commit comments