Fix hide action options section (#3088)

- add actionLookup object for easy action type lookup
- add conditional render to the Action Options section
This commit is contained in:
Eyuel Berga Woldemichael 2022-05-25 05:36:37 +03:00 committed by GitHub
parent 50f5b9fa77
commit 450a4841c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,8 @@ export const EventManager = ({
return { name: action.name, value: action.id };
});
const actionLookup = Object.fromEntries(ActionTypes.map((actionType) => [actionType.id, actionType]));
let alertTypes = [
{
name: 'Info',
@ -157,9 +159,11 @@ export const EventManager = ({
</div>
</div>
<div className="hr-text" data-cy="action-option">
Action options
</div>
{actionLookup[event.actionId].options?.length > 0 && (
<div className="hr-text" data-cy="action-option">
Action options
</div>
)}
<div>
{event.actionId === 'show-alert' && (
<>