Bug 1590046 - Formatting for Action Cable WebSocket messages. r=Harald,Honza

Differential Revision: https://phabricator.services.mozilla.com/D65191

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Uday 2020-03-09 09:41:42 +00:00
Родитель 8d463effbd
Коммит b954b2e459
1 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -163,6 +163,13 @@ class FramePayload extends Component {
// json payload
const { json } = isJSON(payload);
if (json) {
const actionCablePayload = this.parseActionCable(json);
if (actionCablePayload) {
return {
formattedData: actionCablePayload,
formattedDataTitle: "Action Cable",
};
}
return {
formattedData: json,
formattedDataTitle: "JSON",
@ -237,6 +244,21 @@ class FramePayload extends Component {
return null;
}
parseActionCable(payload) {
const identifier = payload.identifier && isJSON(payload.identifier).json;
const data = payload.data && isJSON(payload.data).json;
if (!data && !identifier) {
return null;
}
if (identifier) {
payload.identifier = identifier;
}
if (data) {
payload.data = data;
}
return payload;
}
render() {
let payload = this.state.payload;
let isTruncated = false;