-
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.
respect existing query params when opening or closing flyouyt
disable test i broke. lets rethink this
- Loading branch information
oatkiller
committed
Feb 20, 2020
1 parent
5a30168
commit 626e2fb
Showing
4 changed files
with
85 additions
and
95 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
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
27 changes: 27 additions & 0 deletions
27
x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/url_from_query_params.ts
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,27 @@ | ||
/* | ||
* 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 querystring from 'querystring'; | ||
import { AlertingIndexUIQueryParams } from '../../types'; | ||
|
||
/** | ||
* Return a relative URL for `AlertingIndexUIQueryParams`. | ||
* usage: | ||
* | ||
* ```ts | ||
* // Replace this with however you get state, e.g. useSelector in react | ||
* const queryParams = selectors.uiQueryParams(store.getState()) | ||
* | ||
* // same as current url, but page_index is now 3 | ||
* const relativeURL = urlFromQueryParams({ ...queryParams, page_index: 3 }) | ||
* | ||
* // now use relativeURL in the 'href' of a link, the 'to' of a react-router-dom 'Link' or history.push, history.replace | ||
* ``` | ||
*/ | ||
export function urlFromQueryParams(queryParams: AlertingIndexUIQueryParams): string { | ||
const search = querystring.stringify(queryParams); | ||
return search === '' ? '' : '?' + search; | ||
} |