From: KIRAN KASHALKAR Date: Wed, 9 Nov 2016 22:13:10 +0000 (-0500) Subject: RIFT-15068: Encoded strings in VNFR/NSR output cause record details view to fail... X-Git-Tag: v1.0.2~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F651%2F1;p=osm%2FUI.git 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 --- 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 (