Missing pieces for adding log limit

This commit is contained in:
emizzle 2018-10-12 12:36:21 +11:00 committed by Pascal Precht
parent 145f376000
commit 7b784b9618
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
3 changed files with 5 additions and 3 deletions

View File

@ -108,7 +108,9 @@ export const commands = {
export const PROCESS_LOGS = createRequestTypes('PROCESS_LOGS'); export const PROCESS_LOGS = createRequestTypes('PROCESS_LOGS');
export const processLogs = { export const processLogs = {
request: (processName, limit) => action(PROCESS_LOGS[REQUEST], {processName, limit}), request: (processName, limit) => {
return action(PROCESS_LOGS[REQUEST], {processName, limit});
},
success: (processLogs) => action(PROCESS_LOGS[SUCCESS], {processLogs}), success: (processLogs) => action(PROCESS_LOGS[SUCCESS], {processLogs}),
failure: (error) => action(PROCESS_LOGS[FAILURE], {error}) failure: (error) => action(PROCESS_LOGS[FAILURE], {error})
}; };

View File

@ -56,7 +56,7 @@ export function fetchProcesses() {
} }
export function fetchProcessLogs(payload) { export function fetchProcessLogs(payload) {
return get(`/process-logs/${payload.processName}`, ...arguments); return get(`/process-logs/${payload.processName}`, {params: payload, credentials: payload.credentials});
} }
export function fetchContractLogs() { export function fetchContractLogs() {

View File

@ -84,7 +84,7 @@ class ProcessLauncher {
self.embark.registerAPICall( self.embark.registerAPICall(
'get', 'get',
apiRoute, apiRoute,
(_req, res) => { (req, res) => {
let limit = parseInt(req.query.limit, 10); let limit = parseInt(req.query.limit, 10);
if(!Number.isInteger(limit)) limit = 0; if(!Number.isInteger(limit)) limit = 0;
const result = self.logs.map((log, id) => Object.assign(log, {id})).slice(limit); const result = self.logs.map((log, id) => Object.assign(log, {id})).slice(limit);