Skip to content

Commit

Permalink
conditional render for euiCallout if no options selected
Browse files Browse the repository at this point in the history
  • Loading branch information
CAWilson94 committed Nov 8, 2024
1 parent a74f683 commit 54e0a9f
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,21 @@ export const EntityStoreEnablementModal: React.FC<EntityStoreEnablementModalProp
entityStore: !!entityStore.checked,
});
const { data: privileges, isLoading: isLoadingPrivileges } = useEntityEnginePrivileges();
const enablementOptions = enablements.riskScore || enablements.entityStore;

if (!visible) {
return null;
}
const proceedWarning = (
<EuiCallOut
color="danger"
css={css`
border-radius: ${euiTheme.border.radius.medium};
`}
>
<p>{ENABLEMENT_WARNING_SELECT_TO_PROCEED}</p>
</EuiCallOut>
);
return (
<EuiModal onClose={() => toggle(false)}>
<EuiModalHeader>
Expand Down Expand Up @@ -137,16 +148,7 @@ export const EntityStoreEnablementModal: React.FC<EntityStoreEnablementModalProp

<EuiModalFooter>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem>
<EuiCallOut
color="danger"
css={css`
border-radius: ${euiTheme.border.radius.medium};
`}
>
<p>{ENABLEMENT_WARNING_SELECT_TO_PROCEED}</p>
</EuiCallOut>
</EuiFlexItem>
<EuiFlexItem>{!enablementOptions && proceedWarning}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup direction="row">
<EuiButtonEmpty onClick={() => toggle(false)}>{'Cancel'}</EuiButtonEmpty>
Expand Down

0 comments on commit 54e0a9f

Please sign in to comment.