mirror of
https://github.com/elastic/kibana.git
synced 2025-07-15 03:38:48 -04:00
Add possibility to disable syncing controls with local storage
This commit is contained in:
parent
bc0970e8ce
commit
24bab210b0
6 changed files with 8 additions and 1 deletions
|
@ -60,6 +60,7 @@ export const FilterGroup = (props: PropsWithChildren<FilterGroupProps>) => {
|
||||||
Storage,
|
Storage,
|
||||||
ruleTypeIds,
|
ruleTypeIds,
|
||||||
storageKey,
|
storageKey,
|
||||||
|
disableLocalStorageSync = false,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const filterChangedSubscription = useRef<Subscription>();
|
const filterChangedSubscription = useRef<Subscription>();
|
||||||
|
@ -105,7 +106,7 @@ export const FilterGroup = (props: PropsWithChildren<FilterGroupProps>) => {
|
||||||
} = useControlGroupSyncToLocalStorage({
|
} = useControlGroupSyncToLocalStorage({
|
||||||
Storage,
|
Storage,
|
||||||
storageKey: localStoragePageFilterKey,
|
storageKey: localStoragePageFilterKey,
|
||||||
shouldSync: isViewMode,
|
shouldSync: !disableLocalStorageSync && isViewMode,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -74,4 +74,5 @@ export interface FilterGroupProps extends Pick<ControlGroupRuntimeState, 'chaini
|
||||||
ControlGroupRenderer: typeof ControlGroupRenderer;
|
ControlGroupRenderer: typeof ControlGroupRenderer;
|
||||||
Storage: typeof Storage;
|
Storage: typeof Storage;
|
||||||
storageKey?: string;
|
storageKey?: string;
|
||||||
|
disableLocalStorageSync?: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ const toastTitle = i18n.translate('xpack.observability.alerts.searchBar.invalidQ
|
||||||
export function ObservabilityAlertSearchBar({
|
export function ObservabilityAlertSearchBar({
|
||||||
appName,
|
appName,
|
||||||
defaultFilters = EMPTY_FILTERS,
|
defaultFilters = EMPTY_FILTERS,
|
||||||
|
disableLocalStorageSync,
|
||||||
onEsQueryChange,
|
onEsQueryChange,
|
||||||
onKueryChange,
|
onKueryChange,
|
||||||
onRangeFromChange,
|
onRangeFromChange,
|
||||||
|
@ -168,6 +169,7 @@ export function ObservabilityAlertSearchBar({
|
||||||
filters={[...filters, ...defaultFilters]}
|
filters={[...filters, ...defaultFilters]}
|
||||||
onFiltersChange={onFilterControlsChange}
|
onFiltersChange={onFilterControlsChange}
|
||||||
storageKey={filterControlsStorageKey}
|
storageKey={filterControlsStorageKey}
|
||||||
|
disableLocalStorageSync={disableLocalStorageSync}
|
||||||
services={{
|
services={{
|
||||||
http,
|
http,
|
||||||
notifications,
|
notifications,
|
||||||
|
|
|
@ -63,6 +63,7 @@ export interface ObservabilityAlertSearchBarProps
|
||||||
onFilterControlsChange: (controlConfigs: Filter[]) => void;
|
onFilterControlsChange: (controlConfigs: Filter[]) => void;
|
||||||
savedQuery?: SavedQuery;
|
savedQuery?: SavedQuery;
|
||||||
showFilterBar?: boolean;
|
showFilterBar?: boolean;
|
||||||
|
disableLocalStorageSync?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AlertSearchBarContainerState {
|
export interface AlertSearchBarContainerState {
|
||||||
|
|
|
@ -129,6 +129,7 @@ export function InternalRelatedAlerts({ alert }: Props) {
|
||||||
onEsQueryChange={setEsQuery}
|
onEsQueryChange={setEsQuery}
|
||||||
urlStorageKey={SEARCH_BAR_URL_STORAGE_KEY}
|
urlStorageKey={SEARCH_BAR_URL_STORAGE_KEY}
|
||||||
defaultFilters={defaultFilters.current}
|
defaultFilters={defaultFilters.current}
|
||||||
|
disableLocalStorageSync={true}
|
||||||
defaultState={{
|
defaultState={{
|
||||||
...defaultState,
|
...defaultState,
|
||||||
kuery,
|
kuery,
|
||||||
|
|
|
@ -92,6 +92,7 @@ export function RuleDetailsTabs({
|
||||||
onEsQueryChange={onEsQueryChange}
|
onEsQueryChange={onEsQueryChange}
|
||||||
urlStorageKey={RULE_DETAILS_SEARCH_BAR_URL_STORAGE_KEY}
|
urlStorageKey={RULE_DETAILS_SEARCH_BAR_URL_STORAGE_KEY}
|
||||||
defaultFilters={ruleFilters.current}
|
defaultFilters={ruleFilters.current}
|
||||||
|
disableLocalStorageSync={true}
|
||||||
/>
|
/>
|
||||||
<EuiSpacer size="s" />
|
<EuiSpacer size="s" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue