• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2020 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14
15/* eslint-env browser */
16import {makeStyles, Box} from '@material-ui/core';
17import * as React from 'react';
18import {Status} from '@pigweed/pw_status';
19import {Message} from 'google-protobuf';
20import {Call} from '@pigweed/pw_rpc';
21
22type Props = {
23  calls: Call[];
24};
25
26const useStyles = makeStyles(() => ({
27  root: {
28    padding: '8px',
29    'background-color': '131416',
30    height: '300px',
31    'overflow-y': 'auto',
32    width: '100%',
33    color: 'white',
34  },
35}));
36
37export function RpcPane(props: Props) {
38  const classes = useStyles();
39
40  function row(call: Call, index: number) {
41    return (
42      <Box key={index} sx={{fontFamily: 'Monospace'}}>
43        {call.rpc.service.name}.{call.rpc.method.name}
44        \n---
45        {call.completed ? Status[call.status!] : 'In progress...'}
46      </Box>
47    );
48  }
49
50  return <div className={classes.root}>{props.calls.map(row)}</div>;
51}
52