diff --git a/desktop/plugins/logs/LogWatcher.tsx b/desktop/plugins/logs/LogWatcher.tsx index 841917e73..5a29c8217 100644 --- a/desktop/plugins/logs/LogWatcher.tsx +++ b/desktop/plugins/logs/LogWatcher.tsx @@ -173,15 +173,8 @@ export default class LogWatcher extends PureComponent { }; onKeyDown = (e: React.KeyboardEvent) => { - if ( - (e.key === 'Delete' || e.key === 'Backspace') && - this.state.highlightedRow != null - ) { - this.props.onChange( - this.props.counters.filter( - ({label}) => label !== this.state.highlightedRow, - ), - ); + if (e.key === 'Delete' || e.key === 'Backspace') { + this.handleDelete(); } }; @@ -191,6 +184,16 @@ export default class LogWatcher extends PureComponent { } }; + handleDelete = () => { + if (this.state.highlightedRow != null) { + this.props.onChange( + this.props.counters.filter( + ({label}) => label !== this.state.highlightedRow, + ), + ); + } + }; + render() { return ( @@ -220,6 +223,9 @@ export default class LogWatcher extends PureComponent { autoHeight={true} floating={false} zebra={false} + buildContextMenuItems={() => { + return [{label: 'Delete', click: this.handleDelete}]; + }} />