From 4385727cf96868946759591935d1d2ca72cc7dbf Mon Sep 17 00:00:00 2001 From: Emiliano Ciavatta Date: Fri, 25 Dec 2020 15:31:30 +0100 Subject: Fix payload visualization on metadata continuation --- frontend/src/components/panels/RulesPane.js | 2 +- frontend/src/components/panels/StreamsPane.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'frontend/src/components/panels') diff --git a/frontend/src/components/panels/RulesPane.js b/frontend/src/components/panels/RulesPane.js index cdfe185..dd1765d 100644 --- a/frontend/src/components/panels/RulesPane.js +++ b/frontend/src/components/panels/RulesPane.js @@ -252,7 +252,7 @@ class RulesPane extends Component { this.reset(); this.setState({selectedRule: _.cloneDeep(r)}); }} className={classNames("row-small", "row-clickable", {"row-selected": rule.id === r.id})}> - + {r["name"]} {r["notes"]} diff --git a/frontend/src/components/panels/StreamsPane.js b/frontend/src/components/panels/StreamsPane.js index 29aff71..8276949 100644 --- a/frontend/src/components/panels/StreamsPane.js +++ b/frontend/src/components/panels/StreamsPane.js @@ -78,6 +78,14 @@ class StreamsPane extends Component { } }; + viewAs = (mode) => { + if (mode === "decoded") { + this.setState({tryParse: true}); + } else if (mode === "raw") { + this.setState({tryParse: false}); + } + }; + tryParseConnectionMessage = (connectionMessage) => { const isClient = connectionMessage["from_client"]; if (connectionMessage.metadata == null) { @@ -212,7 +220,8 @@ class StreamsPane extends Component { }; const content = this.state.messages || []; - let payload = content.filter((c) => !c["is_metadata_continuation"]).map((c, i) => + let payload = content.filter((c) => !this.state.tryParse || (this.state.tryParse && !c["is_metadata_continuation"])) + .map((c, i) =>
@@ -244,9 +253,10 @@ class StreamsPane extends Component { + onChange={this.setFormat} /> - +