mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
errs fixed
This commit is contained in:
committed by
Aiden McClelland
parent
8e9daaa056
commit
056452faca
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ export class MockApiService extends ApiService {
|
||||
return Mock.ServerLogs
|
||||
}
|
||||
const arrLength = params.limit ? Math.ceil(params.limit / Mock.ServerLogs.length) : 10
|
||||
return new Array(arrLength).map(_ => Mock.ServerLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
return new Array(arrLength).fill(Mock.ServerLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
}
|
||||
|
||||
async getServerMetrics (params: RR.GetServerMetricsReq): Promise<RR.GetServerMetricsRes> {
|
||||
@@ -320,7 +320,7 @@ export class MockApiService extends ApiService {
|
||||
return Mock.PackageLogs
|
||||
}
|
||||
const arrLength = params.limit ? Math.ceil(params.limit / Mock.PackageLogs.length) : 10
|
||||
return new Array(arrLength).map(_ => Mock.PackageLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
return new Array(arrLength).fill(Mock.PackageLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
}
|
||||
|
||||
async installPackageRaw (params: RR.InstallPackageReq): Promise<RR.InstallPackageRes> {
|
||||
|
||||
Reference in New Issue
Block a user