Skip to content

Commit

Permalink
Fixed type check
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Feb 18, 2020
1 parent 740e1ef commit 27718f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ export const AlertForm = ({
// temp hack of API result
alertTypes.push({
id: 'threshold',
actionGroups: ['alert', 'warning', 'ifUnacknowledged'],
actionGroups: [
{ id: 'alert', name: 'Alert' },
{ id: 'warning', name: 'Warning' },
{ id: 'ifUnacknowledged', name: 'If unacknowledged' },
],
name: 'threshold',
actionVariables: ['ctx.metadata.name', 'ctx.metadata.test'],
});
Expand All @@ -169,7 +173,7 @@ export const AlertForm = ({
index[alertTypeItem.id] = alertTypeItem;
}
if (!alertTypeModel?.defaultActionGroup && alert.alertTypeId && index[alert.alertTypeId]) {
setDefaultActionGroup(index[alert.alertTypeId].actionGroups[0]);
setDefaultActionGroup(index[alert.alertTypeId].actionGroups[0].id);
}
setAlertTypesIndex(index);
} catch (e) {
Expand Down Expand Up @@ -299,7 +303,7 @@ export const AlertForm = ({
alertTypesIndex[item.id] &&
alertTypesIndex[item.id].actionGroups.length > 0
) {
setDefaultActionGroup(alertTypesIndex[item.id].actionGroups[0]);
setDefaultActionGroup(alertTypesIndex[item.id].actionGroups[0].id);
}
}}
>
Expand Down
7 changes: 6 additions & 1 deletion x-pack/plugins/triggers_actions_ui/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,15 @@ export interface ActionConnectorTableItem extends ActionConnector {
actionType: ActionType['name'];
}

export interface ActionGroup {
id: string;
name: string;
}

export interface AlertType {
id: string;
name: string;
actionGroups: string[];
actionGroups: ActionGroup[];
actionVariables: string[];
}

Expand Down

0 comments on commit 27718f8

Please sign in to comment.