Add regex search to logs plugin

Summary:
Adds regex support to the logs plugin.

You can now do the same for any other SearchableTable, just by adding the prop `regexSupported={true}`

For other types of searchables, like maybe the layout hierarchy, we'll need to modify the class that does the filtering for that type.

I've done what I can with the UI to make it usable, though it would be awesome to have some proper regex syntax parsing and highlighting going on. It will go red if it's not valid at least.

Reviewed By: danielbuechele

Differential Revision: D15898806

fbshipit-source-id: 425edb1834dcc14ca741ac7fc8d566b4f2763c63
This commit is contained in:
John Knox
2019-06-20 02:42:56 -07:00
committed by Facebook Github Bot
parent 5a6d978536
commit b7229b40ac
4 changed files with 115 additions and 23 deletions

View File

@@ -8,6 +8,7 @@
import React from 'react';
import styled from '../styled/index.js';
import {colors} from './colors.js';
import Text from './Text';
export const StyledButton = styled('div')(props => ({
cursor: 'pointer',
@@ -31,6 +32,11 @@ export const StyledButton = styled('div')(props => ({
},
}));
const Label = styled(Text)({
marginLeft: 7,
marginRight: 7,
});
type Props = {
/**
* onClick handler.
@@ -41,6 +47,7 @@ type Props = {
*/
toggled?: boolean,
className?: string,
label?: string,
};
/**
@@ -56,11 +63,14 @@ type Props = {
export default class ToggleButton extends React.Component<Props> {
render() {
return (
<StyledButton
className={this.props.className}
toggled={this.props.toggled}
onClick={this.props.onClick}
/>
<>
<StyledButton
className={this.props.className}
toggled={this.props.toggled}
onClick={this.props.onClick}
/>
{this.props.label && <Label>{this.props.label}</Label>}
</>
);
}
}