mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
page limit added
This commit is contained in:
committed by
Aiden McClelland
parent
0b618d7a68
commit
8e9daaa056
@@ -28,15 +28,17 @@ export class AppLogsPage {
|
||||
}
|
||||
|
||||
async getLogs () {
|
||||
const limit = 200
|
||||
try {
|
||||
// get logs
|
||||
const logs = await this.embassyApi.getPackageLogs({
|
||||
id: this.pkgId,
|
||||
before: this.before,
|
||||
limit,
|
||||
})
|
||||
this.firstTimeLoaded = true
|
||||
|
||||
if (!logs.length) {
|
||||
if (logs.length < limit) {
|
||||
this.needInfinite = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -26,11 +26,12 @@ export class ServerLogsPage {
|
||||
}
|
||||
|
||||
async getLogs () {
|
||||
const limit = 200
|
||||
try {
|
||||
// get logs
|
||||
const logs = await this.embassyApi.getServerLogs({ before: this.before })
|
||||
const logs = await this.embassyApi.getServerLogs({ before: this.before, limit })
|
||||
|
||||
if (!logs.length) {
|
||||
if (logs.length < limit) {
|
||||
this.needInfinite = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export module RR {
|
||||
export type SetShareStatsReq = WithExpire<{ value: any }> // server.config.share-stats
|
||||
export type SetShareStatsRes = WithRevision<null>
|
||||
|
||||
export type GetServerLogsReq = { before?: string } // server.logs
|
||||
export type GetServerLogsReq = { before?: string, limit?: number } // server.logs
|
||||
export type GetServerLogsRes = Log[]
|
||||
|
||||
export type GetServerMetricsReq = { } // server.metrics
|
||||
@@ -137,7 +137,7 @@ export module RR {
|
||||
export type GetPackagePropertiesReq = { id: string } // package.properties
|
||||
export type GetPackagePropertiesRes<T extends number> = PackagePropertiesVersioned<T>
|
||||
|
||||
export type GetPackageLogsReq = { id: string, before?: string } // package.logs
|
||||
export type GetPackageLogsReq = { id: string, limit?: number, before?: string } // package.logs
|
||||
export type GetPackageLogsRes = Log[]
|
||||
|
||||
export type GetPackageMetricsReq = { id: string } // package.metrics
|
||||
|
||||
@@ -77,9 +77,10 @@ export class MockApiService extends ApiService {
|
||||
await pauseFor(2000)
|
||||
if (Math.random() < .2) {
|
||||
console.log('last page')
|
||||
return []
|
||||
return Mock.ServerLogs
|
||||
}
|
||||
return new Array(10).map(_ => Mock.ServerLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
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), [])
|
||||
}
|
||||
|
||||
async getServerMetrics (params: RR.GetServerMetricsReq): Promise<RR.GetServerMetricsRes> {
|
||||
@@ -316,10 +317,10 @@ export class MockApiService extends ApiService {
|
||||
await pauseFor(2000)
|
||||
if (Math.random() < .2) {
|
||||
console.log('last page')
|
||||
return []
|
||||
return Mock.PackageLogs
|
||||
}
|
||||
|
||||
return new Array(10).map(_ => Mock.PackageLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
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), [])
|
||||
}
|
||||
|
||||
async installPackageRaw (params: RR.InstallPackageReq): Promise<RR.InstallPackageRes> {
|
||||
|
||||
Reference in New Issue
Block a user