|
|
@ -5,6 +5,8 @@ import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import colors from 'config/colors';
|
|
|
|
import colors from 'config/colors';
|
|
|
|
import { H2 } from 'components/Heading';
|
|
|
|
import { H2 } from 'components/Heading';
|
|
|
|
|
|
|
|
import Button from 'components/Button';
|
|
|
|
|
|
|
|
import Tooltip from 'components/Tooltip';
|
|
|
|
import ReactJson from 'react-json-view';
|
|
|
|
import ReactJson from 'react-json-view';
|
|
|
|
import Icon from 'components/Icon';
|
|
|
|
import Icon from 'components/Icon';
|
|
|
|
import P from 'components/Paragraph';
|
|
|
|
import P from 'components/Paragraph';
|
|
|
@ -18,6 +20,8 @@ import l10nMessages from './index.messages';
|
|
|
|
type Props = {
|
|
|
|
type Props = {
|
|
|
|
log: $ElementType<State, 'log'>,
|
|
|
|
log: $ElementType<State, 'log'>,
|
|
|
|
toggle: typeof LogActions.toggle,
|
|
|
|
toggle: typeof LogActions.toggle,
|
|
|
|
|
|
|
|
copyToClipboard: typeof LogActions.copyToClipboard,
|
|
|
|
|
|
|
|
resetCopyState: typeof LogActions.resetCopyState,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const Wrapper = styled.div`
|
|
|
|
const Wrapper = styled.div`
|
|
|
@ -59,8 +63,20 @@ const LogWrapper = styled.div`
|
|
|
|
overflow: scroll;
|
|
|
|
overflow: scroll;
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CopyWrapper = styled.div``;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ButtonCopy = styled(Button)`
|
|
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const Log = (props: Props): ?React$Element<string> => {
|
|
|
|
const Log = (props: Props): ?React$Element<string> => {
|
|
|
|
if (!props.log.opened) return null;
|
|
|
|
if (!props.log.opened) return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const copyBtn = (
|
|
|
|
|
|
|
|
<ButtonCopy onClick={() => props.copyToClipboard()}>
|
|
|
|
|
|
|
|
<FormattedMessage {...l10nMessages.TR_COPY_TO_CLIPBOARD} />
|
|
|
|
|
|
|
|
</ButtonCopy>
|
|
|
|
|
|
|
|
);
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Wrapper>
|
|
|
|
<Wrapper>
|
|
|
|
<Click onClick={props.toggle}>
|
|
|
|
<Click onClick={props.toggle}>
|
|
|
@ -75,6 +91,19 @@ const Log = (props: Props): ?React$Element<string> => {
|
|
|
|
<LogWrapper>
|
|
|
|
<LogWrapper>
|
|
|
|
<ReactJson src={props.log.entries} />
|
|
|
|
<ReactJson src={props.log.entries} />
|
|
|
|
</LogWrapper>
|
|
|
|
</LogWrapper>
|
|
|
|
|
|
|
|
{props.log.copied ? (
|
|
|
|
|
|
|
|
<Tooltip
|
|
|
|
|
|
|
|
defaultVisible
|
|
|
|
|
|
|
|
maxWidth={285}
|
|
|
|
|
|
|
|
placement="top"
|
|
|
|
|
|
|
|
content={<FormattedMessage {...l10nMessages.TR_COPIED} />}
|
|
|
|
|
|
|
|
afterVisibleChange={props.resetCopyState}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{copyBtn}
|
|
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<CopyWrapper>{copyBtn}</CopyWrapper>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</Wrapper>
|
|
|
|
</Wrapper>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -85,5 +114,7 @@ export default connect(
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
(dispatch: Dispatch) => ({
|
|
|
|
(dispatch: Dispatch) => ({
|
|
|
|
toggle: bindActionCreators(LogActions.toggle, dispatch),
|
|
|
|
toggle: bindActionCreators(LogActions.toggle, dispatch),
|
|
|
|
|
|
|
|
copyToClipboard: bindActionCreators(LogActions.copyToClipboard, dispatch),
|
|
|
|
|
|
|
|
resetCopyState: bindActionCreators(LogActions.resetCopyState, dispatch),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)(Log);
|
|
|
|
)(Log);
|
|
|
|