-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit c61f5b1.
- Loading branch information
Showing
6 changed files
with
53 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
x-pack/legacy/plugins/infra/public/containers/logs/log_filter/use_log_filter_url_state.tsx
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
x-pack/legacy/plugins/infra/public/containers/logs/log_filter/with_log_filter_url_state.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { useContext } from 'react'; | ||
import { LogFilterState, LogFilterStateParams } from './log_filter_state'; | ||
import { replaceStateKeyInQueryString, UrlStateContainer } from '../../../utils/url_state'; | ||
|
||
type LogFilterUrlState = LogFilterStateParams['filterQueryAsKuery']; | ||
|
||
export const WithLogFilterUrlState: React.FC = () => { | ||
const { filterQueryAsKuery, applyLogFilterQuery } = useContext(LogFilterState.Context); | ||
return ( | ||
<UrlStateContainer | ||
urlState={filterQueryAsKuery} | ||
urlStateKey="logFilter" | ||
mapToUrlState={mapToFilterQuery} | ||
onChange={urlState => { | ||
if (urlState) { | ||
applyLogFilterQuery(urlState.expression); | ||
} | ||
}} | ||
onInitialize={urlState => { | ||
if (urlState) { | ||
applyLogFilterQuery(urlState.expression); | ||
} | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
const mapToFilterQuery = (value: any): LogFilterUrlState | undefined => | ||
value?.kind === 'kuery' && typeof value.expression === 'string' | ||
? { | ||
kind: value.kind, | ||
expression: value.expression, | ||
} | ||
: undefined; | ||
|
||
export const replaceLogFilterInQueryString = (expression: string) => | ||
replaceStateKeyInQueryString<LogFilterUrlState>('logFilter', { | ||
kind: 'kuery', | ||
expression, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
x-pack/legacy/plugins/infra/public/utils/validate_url_rt.ts
This file was deleted.
Oops, something went wrong.