Skip to content

Commit 4ec4a9b

Browse files
committed
Fix buggy sorting of the build result
1 parent ece2c53 commit 4ec4a9b

2 files changed

Lines changed: 43 additions & 22 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
using System.Reflection;
33

4-
[assembly: AssemblyVersionAttribute("1.0.69.456")]
4+
[assembly: AssemblyVersionAttribute("1.0.69.508")]
55

BuildService/websocket.html

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,18 @@
4242
display: flex;
4343
flex-direction: column-reverse;
4444
}
45-
div.spitcontent dir {
46-
flex-direction: column;
47-
}
4845

4946
body {
5047
background: #303030;
5148
color: #f0f0f0;
5249
}
5350

54-
#output pre {
51+
div.spitcontent pre {
5552
background: #303030;
5653
color: #f0f0f0;
5754
padding: 4px;
5855
margin: 0;
59-
border-bottom: 1px solid #f0f0f0;
56+
border-bottom: 1px solid #616161;
6057
}
6158
img {
6259
vertical-align: middle;
@@ -202,10 +199,18 @@
202199
if (message.toString().length < 4) return
203200
output.innerHTML = "<p>" + message + "</p>" + output.innerHTML
204201
}
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+
205209
writeToScreen(`DISCONNECTED`);
206210

207211
function onClickButtonConnect() {
208212
websocket = new WebSocket(wsUri);
213+
writeToScreen("CONNECTING")
209214
doSend = (message) => {
210215
writeToScreen(`<div><pre><h3>send</h3><code>${message}</code></pre></div>`)
211216
let split = message.split('\n')
@@ -218,10 +223,12 @@
218223
setTimeout(() => {
219224
doSend(`BuildService.Shared.WebSocketProcessing.AvailableBuildsMessage\n{}`)
220225
}, 300)
226+
document.querySelector('button[action=connect]').setAttribute('disabled', '')
221227
};
222228

223229
websocket.onclose = function (e) {
224230
writeToScreen("DISCONNECTED");
231+
document.querySelector('button[action=connect]').removeAttribute('disabled')
225232
};
226233

227234
websocket.onmessage = async function (e, ...p) {
@@ -251,25 +258,34 @@
251258
reloadSignatureStatus()
252259
break;
253260
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, "&lt;").replace(/>/g, "&gt;")}</code></pre>\n` + parentElement.innerHTML
281+
let wbreak = true
258282

259-
if (parentElement == null)
283+
let welem = document.querySelector(`[action=buildResponse]`)
284+
while (welem.children.length >= 700)
260285
{
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)
265287
}
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, "&lt;").replace(/>/g, "&gt;")}</code></pre>\n`
288+
wbreak = false
273289
break;
274290
case 'BuildService.Shared.Build.BuildInstanceStatus':
275291
if (data.Status == enumBuildStatus.Done && targetDictionary[data.Signature].CurrentBuildStatus != data.Status)
@@ -278,6 +294,11 @@
278294
reloadSignatureStatus()
279295
break;
280296
}
297+
298+
while ( document.querySelector("#output").children.length >= 500)
299+
{
300+
output.removeChild(output.firstElementChild)
301+
}
281302
};
282303

283304
websocket.onerror = function (e) {

0 commit comments

Comments
 (0)