import React, { Component } from 'react'; import JSONTree from 'react-json-tree'; const styles = { actionBar: { paddingTop: 8, paddingBottom: 7, paddingLeft: 16 }, payload: { margin: 0, paddingLeft: 16, overflow: 'auto' } }; export default class LogMonitorAction extends Component { constructor(props) { super(props); this.shouldExpandNode = this.shouldExpandNode.bind(this); } renderPayload(payload) { return (
{Object.keys(payload).length > 0 ? ( ) : ( '' )}
); } shouldExpandNode(keyName, data, level) { return this.props.expandActionRoot && level === 0; } render() { const { type, ...payload } = this.props.action; return (
{type !== null && type.toString()}
{!this.props.collapsed ? this.renderPayload(payload) : ''}
); } }