import React from 'react'; import { JSONTree } from 'UI'; import cn from 'classnames'; import { withTranslation } from 'react-i18next'; class GQLDetails extends React.PureComponent { render() { const { gql: { variables, response, duration, operationKind, operationName }, first = false, last = false, t, } = this.props; let jsonVars; let jsonResponse; try { jsonVars = JSON.parse(variables); } catch (e) {} try { jsonResponse = JSON.parse(response); } catch (e) {} const dataClass = cn('p-2 bg-gray-lightest rounded color-gray-darkest'); return (
{t('Operation Name')}
{operationName}
{t('Operation Kind')}
{operationKind}
{t('Duration')}
{duration ? parseInt(duration) : '???'} {t('ms')}
{t('Variables')}
{jsonVars === undefined ? variables : }
{t('Response')}
{jsonResponse === undefined ? ( response ) : ( )}
); } } export default withTranslation()(GQLDetails);