-
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.
- Loading branch information
1 parent
abc7e07
commit 68c6e13
Showing
8 changed files
with
126 additions
and
21 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
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
21 changes: 21 additions & 0 deletions
21
x-pack/plugins/uptime/public/state/actions/selected_filters.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,21 @@ | ||
/* | ||
* 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 { createAction } from 'redux-actions'; | ||
|
||
export interface SelectedFilters { | ||
locations: string[]; | ||
ports: number[]; | ||
schemes: string[]; | ||
tags: string[]; | ||
} | ||
|
||
export type SelectedFiltersPayload = SelectedFilters; | ||
|
||
export const getSelectedFilters = createAction<void>('GET SELECTED FILTERS'); | ||
export const setSelectedFilters = createAction<SelectedFiltersPayload | null>( | ||
'SET_SELECTED_FILTERS' | ||
); |
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
32 changes: 32 additions & 0 deletions
32
x-pack/plugins/uptime/public/state/reducers/selected_filters.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,32 @@ | ||
/* | ||
* 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 { Action } from 'redux-actions'; | ||
import { | ||
getSelectedFilters, | ||
setSelectedFilters, | ||
SelectedFilters, | ||
} from '../actions/selected_filters'; | ||
|
||
const initialState = null; | ||
|
||
export function selectedFiltersReducer( | ||
state = initialState, | ||
action: Action<any> | ||
): SelectedFilters | null { | ||
switch (action.type) { | ||
case String(getSelectedFilters): | ||
return state; | ||
case String(setSelectedFilters): | ||
if (state === null) return { ...action.payload }; | ||
return { | ||
...(state || {}), | ||
...action.payload, | ||
}; | ||
default: | ||
return state; | ||
} | ||
} |
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