From 46087a0f6f9b555cace872cd79d8c219c4e3732c Mon Sep 17 00:00:00 2001 From: KIRAN KASHALKAR Date: Wed, 9 Nov 2016 17:13:10 -0500 Subject: [PATCH] RIFT-15068: Encoded strings in VNFR/NSR output cause record details view to fail in Viewport and Computer Topology pages Signed-off-by: KIRAN KASHALKAR --- .../launchpad/src/recordViewer/recordDetails.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/skyquake/plugins/launchpad/src/recordViewer/recordDetails.jsx b/skyquake/plugins/launchpad/src/recordViewer/recordDetails.jsx index 0a3e35eb8..9b35d1ba3 100644 --- a/skyquake/plugins/launchpad/src/recordViewer/recordDetails.jsx +++ b/skyquake/plugins/launchpad/src/recordViewer/recordDetails.jsx @@ -27,7 +27,17 @@ export default class RecordDetails extends React.Component{ } render(){ let html; - let text = JSON.stringify(this.props.data, undefined, 2); + // Prism can't handle escaped \n and other characters + let text = JSON.stringify(this.props.data, undefined, 2) + .replace(/\r\n/g, '\n') + .replace(/\\\\n/g, "\n") + .replace(/\\\\'/g, "\'") + .replace(/\\\\"/g, '\"') + .replace(/\\\\&/g, "\&") + .replace(/\\\\r/g, "\r") + .replace(/\\\\t/g, "\t") + .replace(/\\\\b/g, "\b") + .replace(/\\\\f/g, "\f"); // html = this.props.isLoading ? :
{JSON.stringify(this.props.data, undefined, 2)}
; html = this.props.isLoading ? : Prism.highlight(text, Prism.languages.javascript, 'javascript'); return ( -- 2.25.1