mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-18 10:21:56 +00:00
Bug/UI/tra 4473 grpc decoding error (#1025)
* note added and formatting added * showing message on ui instead of console error
This commit is contained in:
parent
de533730d3
commit
e03db7b09b
@ -49,7 +49,7 @@
|
|||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"node-fetch": "^3.1.1",
|
"node-fetch": "^3.1.1",
|
||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
"protobuf-decoder": "^0.1.0",
|
"protobuf-decoder": "^0.1.2",
|
||||||
"react-graph-vis": "^1.0.7",
|
"react-graph-vis": "^1.0.7",
|
||||||
"react-lowlight": "^3.0.0",
|
"react-lowlight": "^3.0.0",
|
||||||
"react-router-dom": "^6.2.1",
|
"react-router-dom": "^6.2.1",
|
||||||
|
@ -130,6 +130,7 @@ export const EntryBodySection: React.FC<EntryBodySectionProps> = ({
|
|||||||
|
|
||||||
const isBase64Encoding = encoding === 'base64';
|
const isBase64Encoding = encoding === 'base64';
|
||||||
const supportsPrettying = supportedFormats.some(format => contentType?.indexOf(format) > -1);
|
const supportsPrettying = supportedFormats.some(format => contentType?.indexOf(format) > -1);
|
||||||
|
const [isDecodeGrpc, setIsDecodeGrpc] = useState(true);
|
||||||
|
|
||||||
const formatTextBody = (body: any): string => {
|
const formatTextBody = (body: any): string => {
|
||||||
if (!decodeBase64) return body;
|
if (!decodeBase64) return body;
|
||||||
@ -157,8 +158,12 @@ export const EntryBodySection: React.FC<EntryBodySectionProps> = ({
|
|||||||
return jsonBeautify(protobufDecoded, null, 2, 80);
|
return jsonBeautify(protobufDecoded, null, 2, 80);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if(isDecodeGrpc)
|
||||||
|
setIsDecodeGrpc(false);
|
||||||
|
if (!String(error).includes("More than one message in")){
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return bodyBuf;
|
return bodyBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,21 +183,23 @@ export const EntryBodySection: React.FC<EntryBodySectionProps> = ({
|
|||||||
<Checkbox checked={showLineNumbers} onToggle={() => { setShowLineNumbers(!showLineNumbers) }} />
|
<Checkbox checked={showLineNumbers} onToggle={() => { setShowLineNumbers(!showLineNumbers) }} />
|
||||||
</div>
|
</div>
|
||||||
<span style={{ marginLeft: '.2rem' }}>Line numbers</span>
|
<span style={{ marginLeft: '.2rem' }}>Line numbers</span>
|
||||||
|
|
||||||
{isBase64Encoding && <div style={{ paddingTop: 3, paddingLeft: 20 }}>
|
{isBase64Encoding && <div style={{ paddingTop: 3, paddingLeft: 20 }}>
|
||||||
<Checkbox checked={decodeBase64} onToggle={() => { setDecodeBase64(!decodeBase64) }} />
|
<Checkbox checked={decodeBase64} onToggle={() => { setDecodeBase64(!decodeBase64) }} />
|
||||||
</div>}
|
</div>}
|
||||||
{isBase64Encoding && <span style={{ marginLeft: '.2rem' }}>Decode Base64</span>}
|
{isBase64Encoding && <span style={{ marginLeft: '.2rem' }}>Decode Base64</span>}
|
||||||
|
{!isDecodeGrpc && <span style={{ fontSize: '12px', color: '#DB2156', marginLeft: '.8rem' }}>More than one message in protobuf payload is not supported</span>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
code={formatTextBody(content)}
|
code={formatTextBody(content)}
|
||||||
showLineNumbers={showLineNumbers}
|
showLineNumbers={showLineNumbers}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</EntrySectionContainer>}
|
</EntrySectionContainer>}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface EntrySectionProps {
|
interface EntrySectionProps {
|
||||||
title: string,
|
title: string,
|
||||||
color: string,
|
color: string,
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
"node-fetch": "^3.1.1",
|
"node-fetch": "^3.1.1",
|
||||||
"node-sass": "^6.0.0",
|
"node-sass": "^6.0.0",
|
||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
"protobuf-decoder": "^0.1.0",
|
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-copy-to-clipboard": "^5.0.3",
|
"react-copy-to-clipboard": "^5.0.3",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user