errs fixed

This commit is contained in:
Drew Ansbacher
2021-08-23 10:32:07 -06:00
committed by Aiden McClelland
parent 8e9daaa056
commit 056452faca
3 changed files with 14 additions and 15 deletions

View File

@@ -36,25 +36,25 @@ export class AppLogsPage {
before: this.before,
limit,
})
this.firstTimeLoaded = true
if (logs.length < limit) {
this.needInfinite = false
return
}
this.firstTimeLoaded = true
this.before = logs[0].timestamp
const container = document.getElementById('container')
const beforeContainerHeight = container.scrollHeight
const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement
newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + '\n\n'
newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + (logs.length ? '\n\n' : '')
container.prepend(newLogs)
const afterContainerHeight = container.scrollHeight
// scroll down
scrollBy(0, afterContainerHeight - beforeContainerHeight)
this.content.scrollToPoint(0, afterContainerHeight - beforeContainerHeight)
if (logs.length < limit) {
this.needInfinite = false
}
} catch (e) {
this.errToast.present(e)
}

View File

@@ -30,12 +30,6 @@ export class ServerLogsPage {
try {
// get logs
const logs = await this.embassyApi.getServerLogs({ before: this.before, limit })
if (logs.length < limit) {
this.needInfinite = false
return
}
this.before = logs[0].timestamp
this.firstTimeLoaded = true
@@ -43,13 +37,18 @@ export class ServerLogsPage {
const container = document.getElementById('container')
const beforeContainerHeight = container.scrollHeight
const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement
newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + '\n\n'
newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + (logs.length ? '\n\n' : '')
container.prepend(newLogs)
const afterContainerHeight = container.scrollHeight
// scroll down
scrollBy(0, afterContainerHeight - beforeContainerHeight)
this.content.scrollToPoint(0, afterContainerHeight - beforeContainerHeight)
if (logs.length < limit) {
this.needInfinite = false
}
} catch (e) {
this.errToast.present(e)
}