mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
errs fixed
This commit is contained in:
committed by
Matt Hill
parent
18ff528ceb
commit
bcc8ab579b
@@ -36,25 +36,25 @@ export class AppLogsPage {
|
|||||||
before: this.before,
|
before: this.before,
|
||||||
limit,
|
limit,
|
||||||
})
|
})
|
||||||
this.firstTimeLoaded = true
|
|
||||||
|
|
||||||
if (logs.length < limit) {
|
this.firstTimeLoaded = true
|
||||||
this.needInfinite = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.before = logs[0].timestamp
|
this.before = logs[0].timestamp
|
||||||
|
|
||||||
const container = document.getElementById('container')
|
const container = document.getElementById('container')
|
||||||
const beforeContainerHeight = container.scrollHeight
|
const beforeContainerHeight = container.scrollHeight
|
||||||
const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement
|
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)
|
container.prepend(newLogs)
|
||||||
const afterContainerHeight = container.scrollHeight
|
const afterContainerHeight = container.scrollHeight
|
||||||
|
|
||||||
// scroll down
|
// scroll down
|
||||||
scrollBy(0, afterContainerHeight - beforeContainerHeight)
|
scrollBy(0, afterContainerHeight - beforeContainerHeight)
|
||||||
this.content.scrollToPoint(0, afterContainerHeight - beforeContainerHeight)
|
this.content.scrollToPoint(0, afterContainerHeight - beforeContainerHeight)
|
||||||
|
|
||||||
|
if (logs.length < limit) {
|
||||||
|
this.needInfinite = false
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.errToast.present(e)
|
this.errToast.present(e)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,6 @@ export class ServerLogsPage {
|
|||||||
try {
|
try {
|
||||||
// get logs
|
// get logs
|
||||||
const logs = await this.embassyApi.getServerLogs({ before: this.before, limit })
|
const logs = await this.embassyApi.getServerLogs({ before: this.before, limit })
|
||||||
|
|
||||||
if (logs.length < limit) {
|
|
||||||
this.needInfinite = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.before = logs[0].timestamp
|
this.before = logs[0].timestamp
|
||||||
|
|
||||||
this.firstTimeLoaded = true
|
this.firstTimeLoaded = true
|
||||||
@@ -43,13 +37,18 @@ export class ServerLogsPage {
|
|||||||
const container = document.getElementById('container')
|
const container = document.getElementById('container')
|
||||||
const beforeContainerHeight = container.scrollHeight
|
const beforeContainerHeight = container.scrollHeight
|
||||||
const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement
|
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)
|
container.prepend(newLogs)
|
||||||
const afterContainerHeight = container.scrollHeight
|
const afterContainerHeight = container.scrollHeight
|
||||||
|
|
||||||
// scroll down
|
// scroll down
|
||||||
scrollBy(0, afterContainerHeight - beforeContainerHeight)
|
scrollBy(0, afterContainerHeight - beforeContainerHeight)
|
||||||
this.content.scrollToPoint(0, afterContainerHeight - beforeContainerHeight)
|
this.content.scrollToPoint(0, afterContainerHeight - beforeContainerHeight)
|
||||||
|
|
||||||
|
if (logs.length < limit) {
|
||||||
|
this.needInfinite = false
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.errToast.present(e)
|
this.errToast.present(e)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export class MockApiService extends ApiService {
|
|||||||
return Mock.ServerLogs
|
return Mock.ServerLogs
|
||||||
}
|
}
|
||||||
const arrLength = params.limit ? Math.ceil(params.limit / Mock.ServerLogs.length) : 10
|
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> {
|
async getServerMetrics (params: RR.GetServerMetricsReq): Promise<RR.GetServerMetricsRes> {
|
||||||
@@ -320,7 +320,7 @@ export class MockApiService extends ApiService {
|
|||||||
return Mock.PackageLogs
|
return Mock.PackageLogs
|
||||||
}
|
}
|
||||||
const arrLength = params.limit ? Math.ceil(params.limit / Mock.PackageLogs.length) : 10
|
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> {
|
async installPackageRaw (params: RR.InstallPackageReq): Promise<RR.InstallPackageRes> {
|
||||||
|
|||||||
Reference in New Issue
Block a user