mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
log backend integration fixes
This commit is contained in:
committed by
Aiden McClelland
parent
483e02a41b
commit
0d59952fb9
@@ -785,30 +785,30 @@ export module Mock {
|
||||
export const ServerLogs: Log[] = [
|
||||
{
|
||||
timestamp: '2019-12-26T14:20:30.872Z',
|
||||
log: '****** START *****',
|
||||
message: '****** START *****',
|
||||
},
|
||||
{
|
||||
timestamp: '2019-12-26T14:21:30.872Z',
|
||||
log: 'ServerLogs ServerLogs ServerLogs ServerLogs ServerLogs',
|
||||
message: 'ServerLogs ServerLogs ServerLogs ServerLogs ServerLogs',
|
||||
},
|
||||
{
|
||||
timestamp: '2019-12-26T14:22:30.872Z',
|
||||
log: '****** FINISH *****',
|
||||
message: '****** FINISH *****',
|
||||
},
|
||||
]
|
||||
|
||||
export const PackageLogs: Log[] = [
|
||||
{
|
||||
timestamp: '2019-12-26T14:20:30.872Z',
|
||||
log: '****** START *****',
|
||||
message: '****** START *****',
|
||||
},
|
||||
{
|
||||
timestamp: '2019-12-26T14:21:30.872Z',
|
||||
log: 'PackageLogs PackageLogs PackageLogs PackageLogs PackageLogs',
|
||||
message: 'PackageLogs PackageLogs PackageLogs PackageLogs PackageLogs',
|
||||
},
|
||||
{
|
||||
timestamp: '2019-12-26T14:22:30.872Z',
|
||||
log: '****** FINISH *****',
|
||||
message: '****** FINISH *****',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ export module RR {
|
||||
export type GetPackagePropertiesReq = { id: string } // package.properties
|
||||
export type GetPackagePropertiesRes<T extends number> = PackagePropertiesVersioned<T>
|
||||
|
||||
export type LogsRes = { logs: Log[], startCursor?: string, endCursor?: string }
|
||||
export type LogsRes = { entries: Log[], 'start-cursor'?: string, 'end-cursor'?: string }
|
||||
|
||||
export type GetPackageLogsReq = { id: string, cursor?: string, before_flag?: boolean, limit?: number } // package.logs
|
||||
export type GetPackageLogsRes = LogsRes
|
||||
@@ -250,7 +250,7 @@ export interface TaggedDependencyError {
|
||||
|
||||
export interface Log {
|
||||
timestamp: string
|
||||
log: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface ActionResponse {
|
||||
|
||||
@@ -75,18 +75,18 @@ export class MockApiService extends ApiService {
|
||||
|
||||
async getServerLogs (params: RR.GetServerLogsReq): Promise<RR.GetServerLogsRes> {
|
||||
await pauseFor(2000)
|
||||
let logArr
|
||||
let entries
|
||||
if (Math.random() < .2) {
|
||||
console.log('last page')
|
||||
logArr = Mock.ServerLogs
|
||||
entries = Mock.ServerLogs
|
||||
} else {
|
||||
const arrLength = params.limit ? Math.ceil(params.limit / Mock.ServerLogs.length) : 10
|
||||
logArr = new Array(arrLength).fill(Mock.ServerLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
entries = new Array(arrLength).fill(Mock.ServerLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
}
|
||||
return {
|
||||
logs: logArr,
|
||||
startCursor: 'startCursor',
|
||||
endCursor: 'endCursor',
|
||||
entries,
|
||||
'start-cursor': 'startCursor',
|
||||
'end-cursor': 'endCursor',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,18 +322,18 @@ export class MockApiService extends ApiService {
|
||||
|
||||
async getPackageLogs (params: RR.GetPackageLogsReq): Promise<RR.GetPackageLogsRes> {
|
||||
await pauseFor(2000)
|
||||
let logArr
|
||||
let entries
|
||||
if (Math.random() < .2) {
|
||||
console.log('last page')
|
||||
logArr = Mock.PackageLogs
|
||||
entries = Mock.PackageLogs
|
||||
} else {
|
||||
const arrLength = params.limit ? Math.ceil(params.limit / Mock.PackageLogs.length) : 10
|
||||
logArr = new Array(arrLength).fill(Mock.PackageLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
entries = new Array(arrLength).fill(Mock.PackageLogs).reduce((acc, val) => acc.concat(val), [])
|
||||
}
|
||||
return {
|
||||
logs: logArr,
|
||||
startCursor: 'startCursor',
|
||||
endCursor: 'endCursor',
|
||||
entries,
|
||||
'start-cursor': 'startCursor',
|
||||
'end-cursor': 'endCursor',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user