) => {
const { scrollElement } = this.props;
this.onContextToggle(e);
if (scrollElement && this.logRowRef.current) {
scrollElement.scroll({
behavior: 'smooth',
top: scrollElement.scrollTop + this.logRowRef.current.getBoundingClientRect().top - window.innerHeight / 2,
});
}
};
render() {
const {
row,
theme,
errors,
hasMoreContextRows,
updateLimit,
context,
contextIsOpen,
showRowMenu,
wrapLogMessage,
prettifyLogMessage,
onToggleContext,
app,
logsSortOrder,
showContextToggle,
} = this.props;
const style = getLogRowStyles(theme, row.logLevel);
const { hasAnsi, raw } = row;
const restructuredEntry = restructureLog(raw, prettifyLogMessage);
const shouldShowContextToggle = showContextToggle ? showContextToggle(row) : false;
const styles = getStyles(theme, shouldShowContextToggle, app === CoreApp.Dashboard);
return (
<>
{
// When context is open, the position has to be NOT relative. // Setting the postion as inline-style to
// overwrite the more sepecific style definition from `style.logsRowMessage`.
}
|
{contextIsOpen && context && (
{
if (updateLimit) {
updateLimit();
}
}}
/>
)}
{renderLogMessage(hasAnsi, restructuredEntry, row.searchWords, style.logsRowMatchHighLight)}
|
{showRowMenu && (
e.stopPropagation()}>
{shouldShowContextToggle && (
)}
navigator.clipboard.writeText(restructuredEntry)} />
|
)}
>
);
}
}
export const LogRowMessage = withTheme2(UnThemedLogRowMessage);
LogRowMessage.displayName = 'LogRowMessage';