-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
183 additions
and
166 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,3 @@ | |
*/ | ||
|
||
export const UNNAMED_LOCATION = 'Unnamed-location'; | ||
|
||
export const UPTIME_INDEX_PATTERN = 'heartbeat-8*'; |
93 changes: 93 additions & 0 deletions
93
...legacy/plugins/uptime/public/components/connected/filter_group/filter_group_container.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,93 @@ | ||
/* | ||
* 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, { useEffect } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { useUrlParams } from '../../../hooks'; | ||
import { parseFiltersMap } from '../../functional/filter_group/parse_filter_map'; | ||
import { AppState } from '../../../state'; | ||
import { fetchOverviewFilters, GetOverviewFiltersPayload } from '../../../state/actions'; | ||
import { FilterGroupComponent } from '../../functional/filter_group'; | ||
import { OverviewFilters } from '../../../../common/runtime_types/overview_filters'; | ||
|
||
interface OwnProps { | ||
esFilters?: string; | ||
} | ||
|
||
interface StoreProps { | ||
esKuery: string; | ||
lastRefresh: number; | ||
loading: boolean; | ||
overviewFilters: OverviewFilters; | ||
} | ||
|
||
interface DispatchProps { | ||
loadFilterGroup: typeof fetchOverviewFilters; | ||
} | ||
|
||
type Props = OwnProps & StoreProps & DispatchProps; | ||
|
||
export const Container: React.FC<Props> = ({ | ||
esKuery, | ||
esFilters, | ||
loading, | ||
loadFilterGroup, | ||
overviewFilters, | ||
}: Props) => { | ||
const [getUrlParams, updateUrl] = useUrlParams(); | ||
|
||
const { dateRangeStart, dateRangeEnd, statusFilter, filters: urlFilters } = getUrlParams(); | ||
|
||
useEffect(() => { | ||
const filterSelections = parseFiltersMap(urlFilters); | ||
loadFilterGroup({ | ||
dateRangeStart, | ||
dateRangeEnd, | ||
locations: filterSelections.locations ?? [], | ||
ports: filterSelections.ports ?? [], | ||
schemes: filterSelections.schemes ?? [], | ||
search: esKuery, | ||
statusFilter, | ||
tags: filterSelections.tags ?? [], | ||
}); | ||
}, [dateRangeStart, dateRangeEnd, esKuery, esFilters, statusFilter, urlFilters, loadFilterGroup]); | ||
|
||
// update filters in the URL from filter group | ||
const onFilterUpdate = (filtersKuery: string) => { | ||
if (urlFilters !== filtersKuery) { | ||
updateUrl({ filters: filtersKuery, pagination: '' }); | ||
} | ||
}; | ||
|
||
return ( | ||
<FilterGroupComponent | ||
currentFilter={urlFilters} | ||
overviewFilters={overviewFilters} | ||
loading={loading} | ||
onFilterUpdate={onFilterUpdate} | ||
/> | ||
); | ||
}; | ||
|
||
const mapStateToProps = ({ | ||
overviewFilters: { loading, filters }, | ||
ui: { esKuery, lastRefresh }, | ||
}: AppState): StoreProps => ({ | ||
esKuery, | ||
overviewFilters: filters, | ||
lastRefresh, | ||
loading, | ||
}); | ||
|
||
const mapDispatchToProps = (dispatch: any): DispatchProps => ({ | ||
loadFilterGroup: (payload: GetOverviewFiltersPayload) => dispatch(fetchOverviewFilters(payload)), | ||
}); | ||
|
||
export const FilterGroup = connect<StoreProps, DispatchProps, OwnProps>( | ||
// @ts-ignore connect is expecting null | undefined for some reason | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Container); |
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
10 changes: 10 additions & 0 deletions
10
...ents/functional/__tests__/__snapshots__/overview_page_parsing_error_callout.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.