Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed errors which are happening if switch between alert types #60453

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const AlertForm = ({ alert, canChangeTrigger = true, dispatch, errors }:
onClick={() => {
setAlertProperty('alertTypeId', item.id);
setAlertTypeModel(item);
setAlertProperty('params', {});
if (alertTypesIndex && alertTypesIndex[item.id]) {
setDefaultActionGroupId(alertTypesIndex[item.id].defaultActionGroupId);
}
Expand Down Expand Up @@ -194,6 +195,7 @@ export const AlertForm = ({ alert, canChangeTrigger = true, dispatch, errors }:
onClick={() => {
setAlertProperty('alertTypeId', null);
setAlertTypeModel(null);
setAlertProperty('params', {});
}}
/>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
loadIndexPatterns,
getMatchingIndicesForThresholdAlertType,
getThresholdAlertTypeFields,
getSavedObjectsClient,
} from '../lib/index_threshold_api';

export interface IOption {
Expand All @@ -18,8 +19,12 @@ export interface IOption {
}

export const getIndexPatterns = async () => {
const indexPatternObjects = await loadIndexPatterns();
return indexPatternObjects.map((indexPattern: any) => indexPattern.attributes.title);
// TODO: Implement a possibility to retrive index patterns different way to be able to expose this in consumer plugins
if (getSavedObjectsClient()) {
const indexPatternObjects = await loadIndexPatterns();
return indexPatternObjects.map((indexPattern: any) => indexPattern.attributes.title);
}
return [];
};

export const getIndexOptions = async (
Expand Down