diff --git a/packages/console-app/config.yml b/packages/console-app/config.yml
index 85be7a6..b34222e 100644
--- a/packages/console-app/config.yml
+++ b/packages/console-app/config.yml
@@ -12,7 +12,7 @@ app:
api:
path: '/api'
- port: 4000
+ port: 4004
intervalLog: 5000
pollInterval: 10000
diff --git a/packages/console-app/src/components/Log.js b/packages/console-app/src/components/Log.js
index 8016ed3..470c98b 100644
--- a/packages/console-app/src/components/Log.js
+++ b/packages/console-app/src/components/Log.js
@@ -106,6 +106,9 @@ const Log = ({ log = [] }) => {
);
};
+ // TODO(telackey): Why do these display in reverse?
+ log.reverse();
+
return (
diff --git a/packages/console-app/src/containers/panels/signal/SignalLog.js b/packages/console-app/src/containers/panels/signal/SignalLog.js
index 77a84ea..0e59248 100644
--- a/packages/console-app/src/containers/panels/signal/SignalLog.js
+++ b/packages/console-app/src/containers/panels/signal/SignalLog.js
@@ -11,6 +11,9 @@ import { ConsoleContext, useQueryStatusReducer } from '../../../hooks';
import Log from '../../../components/Log';
+const MAX_LINES = 1000;
+const oldLines = [];
+
const SignalLog = () => {
const { config } = useContext(ConsoleContext);
const data = useQueryStatusReducer(useQuery(SIGNAL_LOG, { pollInterval: config.api.intervalLog }));
@@ -18,8 +21,14 @@ const SignalLog = () => {
return null;
}
+ const newLines = JSON.parse(data.signal_log.json);
+ oldLines.push(...newLines);
+ if (oldLines.length > MAX_LINES) {
+ oldLines.splice(0, oldLines.length - MAX_LINES);
+ }
+
return (
-
+
);
};
diff --git a/packages/console-app/src/containers/panels/wns/WNSLog.js b/packages/console-app/src/containers/panels/wns/WNSLog.js
index 9fcb485..d9d3ed1 100644
--- a/packages/console-app/src/containers/panels/wns/WNSLog.js
+++ b/packages/console-app/src/containers/panels/wns/WNSLog.js
@@ -11,16 +11,24 @@ import { ConsoleContext, useQueryStatusReducer } from '../../../hooks';
import Log from '../../../components/Log';
+const MAX_LINES = 1000;
+const oldLines = [];
+
const WNSLog = () => {
const { config } = useContext(ConsoleContext);
const data = useQueryStatusReducer(useQuery(WNS_LOG, { pollInterval: config.api.intervalLog }));
- console.error(data);
if (!data) {
return null;
}
+ const newLines = JSON.parse(data.wns_log.json);
+ oldLines.push(...newLines);
+ if (oldLines.length > MAX_LINES) {
+ oldLines.splice(0, oldLines.length - MAX_LINES);
+ }
+
return (
-
+
);
};
diff --git a/packages/console-app/src/gql/signal_log.graphql b/packages/console-app/src/gql/signal_log.graphql
index 9e8194d..ea53570 100644
--- a/packages/console-app/src/gql/signal_log.graphql
+++ b/packages/console-app/src/gql/signal_log.graphql
@@ -3,8 +3,8 @@
#
query {
- signal_log @client {
+ signal_log {
timestamp
- log
+ json
}
}
diff --git a/packages/console-app/src/version.json b/packages/console-app/src/version.json
index 8dbb7e7..d120e6d 100644
--- a/packages/console-app/src/version.json
+++ b/packages/console-app/src/version.json
@@ -1,7 +1,7 @@
{
"build": {
"name": "@dxos/console-app",
- "buildDate": "2020-06-10T20:28:40.010Z",
+ "buildDate": "2020-06-10T22:08:16.919Z",
"version": "1.0.0-beta.0"
}
}
diff --git a/packages/console-server/src/gql/api.graphql b/packages/console-server/src/gql/api.graphql
index 542a323..5b2cfd5 100644
--- a/packages/console-server/src/gql/api.graphql
+++ b/packages/console-server/src/gql/api.graphql
@@ -13,15 +13,17 @@ type JSONResult {
#
type Query {
- app_swarm_log: JSONResult!
+ app_log: JSONResult!
+ app_status: JSONResult!
ipfs_log: JSONResult!
ipfs_status: JSONResult!
ipfs_swarm_log: JSONResult!
+ ipfs_swarm_status: JSONResult!
+ signal_log: JSONResult!
signal_status: JSONResult!
- signal_swarm_log: JSONResult!
system_status: JSONResult!
- wns_status: JSONResult!
wns_log: JSONResult!
+ wns_status: JSONResult!
}
schema {
diff --git a/packages/console-server/src/resolvers/log.js b/packages/console-server/src/resolvers/log.js
index a58693f..bb6eaba 100644
--- a/packages/console-server/src/resolvers/log.js
+++ b/packages/console-server/src/resolvers/log.js
@@ -2,11 +2,7 @@
// Copyright 2020 DxOS.org
//
-import moment from 'moment';
-import pick from 'lodash.pick';
-import os from 'os';
-import si from 'systeminformation';
-import { spawnSync } from "child_process";
+import { spawnSync } from 'child_process';
class LogCache {
constructor(maxLines = 500) {
@@ -60,6 +56,34 @@ export const logResolvers = {
timestamp: new Date().toUTCString(),
json: JSON.stringify(logs)
};
+ },
+ signal_log: async () => {
+ const logs = await getLogs('signal');
+ return {
+ timestamp: new Date().toUTCString(),
+ json: JSON.stringify(logs)
+ };
+ },
+ ipfs_log: async () => {
+ const logs = await getLogs('ipfs');
+ return {
+ timestamp: new Date().toUTCString(),
+ json: JSON.stringify(logs)
+ };
+ },
+ ipfs_swarm_log: async () => {
+ const logs = await getLogs('ipfs');
+ return {
+ timestamp: new Date().toUTCString(),
+ json: JSON.stringify(logs)
+ };
+ },
+ app_log: async () => {
+ const logs = await getLogs('ipfs');
+ return {
+ timestamp: new Date().toUTCString(),
+ json: JSON.stringify(logs)
+ };
}
}
};