Fix default filtering for query log
This commit is contained in:
parent
6a90efe957
commit
6de0871f2c
|
@ -42,14 +42,9 @@ class Logs extends Component {
|
||||||
toggleBlocking = (type, domain) => {
|
toggleBlocking = (type, domain) => {
|
||||||
const { userRules } = this.props.filtering;
|
const { userRules } = this.props.filtering;
|
||||||
const lineEnding = !endsWith(userRules, '\n') ? '\n' : '';
|
const lineEnding = !endsWith(userRules, '\n') ? '\n' : '';
|
||||||
let blockingRule = `@@||${domain}^$important`;
|
const baseRule = `||${domain}^$important`;
|
||||||
let unblockingRule = `||${domain}^$important`;
|
const blockingRule = type === 'block' ? `@@${baseRule}` : baseRule;
|
||||||
|
const unblockingRule = type === 'block' ? baseRule : `@@${baseRule}`;
|
||||||
if (type === 'unblock') {
|
|
||||||
blockingRule = `||${domain}^$important`;
|
|
||||||
unblockingRule = `@@||${domain}^$important`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const preparedBlockingRule = new RegExp(`(^|\n)${escapeRegExp(blockingRule)}($|\n)`);
|
const preparedBlockingRule = new RegExp(`(^|\n)${escapeRegExp(blockingRule)}($|\n)`);
|
||||||
const preparedUnblockingRule = new RegExp(`(^|\n)${escapeRegExp(unblockingRule)}($|\n)`);
|
const preparedUnblockingRule = new RegExp(`(^|\n)${escapeRegExp(unblockingRule)}($|\n)`);
|
||||||
|
|
||||||
|
@ -189,6 +184,11 @@ class Logs extends Component {
|
||||||
defaultPageSize={50}
|
defaultPageSize={50}
|
||||||
minRows={7}
|
minRows={7}
|
||||||
noDataText="No logs found"
|
noDataText="No logs found"
|
||||||
|
defaultFilterMethod={(filter, row) => {
|
||||||
|
const id = filter.pivotId || filter.id;
|
||||||
|
return row[id] !== undefined ?
|
||||||
|
String(row[id]).indexOf(filter.value) !== -1 : true;
|
||||||
|
}}
|
||||||
defaultSorted={[
|
defaultSorted={[
|
||||||
{
|
{
|
||||||
id: 'time',
|
id: 'time',
|
||||||
|
|
Loading…
Reference in New Issue