forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filters
: Use default index pattern when data_source
is not specified
- Loading branch information
1 parent
e672f3b
commit cc068bf
Showing
7 changed files
with
83 additions
and
12 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
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
...ic/detection_engine/rule_management/components/rule_details/use_default_index_pattern.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,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { useKibana } from '../../../../common/lib/kibana/kibana_react'; | ||
import { DEFAULT_INDEX_KEY, DEFAULT_INDEX_PATTERN } from '../../../../../common/constants'; | ||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; | ||
|
||
/** | ||
* Gets the default index pattern for cases when rule has neither index patterns or data view. | ||
* First checks the config value. If it's not present falls back to the hardcoded default value. | ||
*/ | ||
export function useDefaultIndexPattern() { | ||
const { services } = useKibana(); | ||
const isPrebuiltRulesCustomizationEnabled = useIsExperimentalFeatureEnabled( | ||
'prebuiltRulesCustomizationEnabled' | ||
); | ||
|
||
if (isPrebuiltRulesCustomizationEnabled) { | ||
return services.settings.client.get(DEFAULT_INDEX_KEY, DEFAULT_INDEX_PATTERN); | ||
} | ||
|
||
return []; | ||
} |