From 5faa3dedd9683d9c5ca5afc556d6bccb83a1f01a Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 21 Jul 2020 11:47:25 -0500 Subject: [PATCH] Separate servers and channels into different tabs. --- .../panels/signal/SignalChannels.js | 57 +++++++++++++++++++ .../containers/panels/signal/SignalServers.js | 14 ++--- .../src/containers/panels/signal/Signaling.js | 19 +++++-- packages/console-app/src/version.json | 4 +- 4 files changed, 79 insertions(+), 15 deletions(-) create mode 100644 packages/console-app/src/containers/panels/signal/SignalChannels.js diff --git a/packages/console-app/src/containers/panels/signal/SignalChannels.js b/packages/console-app/src/containers/panels/signal/SignalChannels.js new file mode 100644 index 0000000..ab9766e --- /dev/null +++ b/packages/console-app/src/containers/panels/signal/SignalChannels.js @@ -0,0 +1,57 @@ +// +// Copyright 2020 DXOS.org +// + +import React, { useContext } from 'react'; +import { useQuery } from '@apollo/react-hooks'; + +import TableBody from '@material-ui/core/TableBody'; +import TableContainer from '@material-ui/core/TableContainer'; +import TableHead from '@material-ui/core/TableHead'; +import TableRow from '@material-ui/core/TableRow'; + +import Table from '../../../components/Table'; +import TableCell from '../../../components/TableCell'; + +import SIGNAL_STATUS from '../../../gql/signal_status.graphql'; + +import { ConsoleContext, useQueryStatusReducer } from '../../../hooks'; + +const SignalChannels = () => { + const { config } = useContext(ConsoleContext); + const data = useQueryStatusReducer(useQuery(SIGNAL_STATUS, { pollInterval: config.api.intervalQuery })); + if (!data) { + return null; + } + + const { json: { channels = [] } } = data.signal_status; + + return ( + + + + + Channel + Participants + + + + {channels.map(({ channel, peers = [] }) => { + return ( + + + {channel} + + + {peers.length} + + + ); + })} + +
+
+ ); +}; + +export default SignalChannels; diff --git a/packages/console-app/src/containers/panels/signal/SignalServers.js b/packages/console-app/src/containers/panels/signal/SignalServers.js index f0eeca1..4017603 100644 --- a/packages/console-app/src/containers/panels/signal/SignalServers.js +++ b/packages/console-app/src/containers/panels/signal/SignalServers.js @@ -24,26 +24,22 @@ const SignalServers = () => { return null; } - const { json: { channels = [] } } = data.signal_status; + const { json: { signals = [] } } = data.signal_status; return ( - Server - Peers + Signal Server - {channels.map(({ channel, peers = [] }) => { + {signals.map((signal) => { return ( - + - {channel} - - - {peers.length} + {signal} ); diff --git a/packages/console-app/src/containers/panels/signal/Signaling.js b/packages/console-app/src/containers/panels/signal/Signaling.js index 7a2542b..da9ce79 100644 --- a/packages/console-app/src/containers/panels/signal/Signaling.js +++ b/packages/console-app/src/containers/panels/signal/Signaling.js @@ -13,9 +13,11 @@ import Panel from '../../../components/Panel'; import Toolbar from '../../../components/Toolbar'; import LogPoller from '../../../components/LogPoller'; +import SignalChannels from './SignalChannels'; import SignalServers from './SignalServers'; -const TAB_STATUS = 'status'; +const TAB_NETWORK = 'servers'; +const TAB_CHANNELS = 'channels'; const TAB_LOG = 'log'; const useStyles = makeStyles(() => ({ @@ -38,21 +40,22 @@ const useStyles = makeStyles(() => ({ const Signal = () => { const classes = useStyles(); - const [tab, setTab] = useState(TAB_STATUS); + const [tab, setTab] = useState(TAB_NETWORK); return ( setTab(value)}> - + + } > - {tab === TAB_STATUS && ( + {tab === TAB_NETWORK && (
@@ -60,6 +63,14 @@ const Signal = () => {
)} + {tab === TAB_CHANNELS && ( +
+ + + +
+ )} + {tab === TAB_LOG && (
diff --git a/packages/console-app/src/version.json b/packages/console-app/src/version.json index 9226535..0b1a611 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-07-20T22:54:23.462Z", - "version": "1.0.0-beta.19" + "buildDate": "2020-07-21T16:37:30.252Z", + "version": "1.0.0-beta.21" } }