Skip to content

Commit

Permalink
really best bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Dec 14, 2020
1 parent 497bef5 commit 3552e98
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
]);
const hasParent = useMemo(() => Object.prototype.hasOwnProperty.call(fields, 'parent'), [fields]);
const issueTypesSelectOptions: EuiSelectOption[] = useMemo(() => {
if (!incident.issueType && issueTypes.length > 0) {
const doesIssueTypeExist = issueTypes.some((t) => t.id === incident.issueType);
if ((!incident.issueType || !doesIssueTypeExist) && issueTypes.length > 0) {
editSubActionProperty('issueType', issueTypes[0].id ?? '');
}
return issueTypes.map((type) => ({
Expand All @@ -96,7 +97,8 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
const prioritiesSelectOptions: EuiSelectOption[] = useMemo(() => {
if (incident.issueType != null && fields != null) {
const priorities = fields.priority != null ? fields.priority.allowedValues : [];
if (!incident.priority && priorities.length > 0) {
const doesPriorityExist = priorities.some((p) => p.name === incident.priority);
if ((!incident.priority || !doesPriorityExist) && priorities.length > 0) {
editSubActionProperty('priority', priorities[0].name ?? '');
}
return priorities.map((p: { id: string; name: string }) => {
Expand Down Expand Up @@ -132,8 +134,18 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
if (!actionParams.subAction) {
editAction('subAction', 'pushToService', index);
}
if (!actionParams.subActionParams) {
editAction(
'subActionParams',
{
incident: {},
comments: [],
},
index
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [actionParams]);
return (
<Fragment>
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,18 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
if (!actionParams.subAction) {
editAction('subAction', 'pushToService', index);
}
if (!actionParams.subActionParams) {
editAction(
'subActionParams',
{
incident: {},
comments: [],
},
index
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [actionParams]);

return (
<Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,18 @@ const ServiceNowParamsFields: React.FunctionComponent<
if (!actionParams.subAction) {
editAction('subAction', 'pushToService', index);
}
if (!actionParams.subActionParams) {
editAction(
'subActionParams',
{
incident: {},
comments: [],
},
index
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [actionParams]);

return (
<Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const alertReducer = <AlertPhase extends InitialAlert | Alert>(
>;
if (
index === undefined ||
alert.actions.length === 0 ||
alert.actions[index] == null ||
isEqual(alert.actions[index][key], value)
) {
return state;
Expand Down

0 comments on commit 3552e98

Please sign in to comment.