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

[Entity Store] Add enablement errors to entity store management page #198668

Merged
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 @@ -55,7 +55,7 @@ const EntityStoreDashboardPanelsComponent = () => {

const { mutate: initRiskEngine } = useInitRiskEngineMutation();

const callouts = entityStore.errors.map((err, i) => (
const callouts = entityStore.errors.map((err) => (
<EuiCallOut
title={
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,21 @@ export const EntityStoreManagementPage = () => {
stopEntityEngineMutation.isLoading ||
deleteEntityEngineMutation.isLoading;

const callouts = entityStoreStatus.errors.map((error) => (
<EuiCallOut
title={
<FormattedMessage
id="xpack.securitySolution.entityAnalytics.entityStoreManagementPage.errors.title"
defaultMessage={'An error occurred during entity store resource initialization'}
/>
}
color="danger"
iconType="alert"
>
<p>{error.message}</p>
</EuiCallOut>
));

return (
<>
<EuiPageHeader
Expand Down Expand Up @@ -300,6 +315,39 @@ export const EntityStoreManagementPage = () => {
<FileUploadSection />
<EuiFlexItem grow={2}>
<EuiFlexGroup direction="column">
{initEntityEngineMutation.isError && (
<EuiCallOut
title={
<FormattedMessage
id="xpack.securitySolution.entityAnalytics.entityStoreManagementPage.errors.initErrorTitle"
defaultMessage={'There was a problem initializing the entity store'}
/>
}
color="danger"
iconType="alert"
>
<p>
{(initEntityEngineMutation.error as { body: { message: string } }).body.message}
</p>
</EuiCallOut>
)}
{deleteEntityEngineMutation.isError && (
<EuiCallOut
title={
<FormattedMessage
id="xpack.securitySolution.entityAnalytics.entityStoreManagementPage.errors.deleteErrorTitle"
defaultMessage={'There was a problem deleting the entity store'}
/>
}
color="danger"
iconType="alert"
>
<p>
{(deleteEntityEngineMutation.error as { body: { message: string } }).body.message}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can add this to the mutation typing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably, there's a refactor issue already here

I'll add a comment there

Copy link
Member

@machadoum machadoum Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useMutation<DataType, ErrorType> receive accepts types, the first is the data and the second the error.
So, the change would be on useInitEntityEngineMutation function.

</p>
</EuiCallOut>
)}
{callouts}
<WhatIsAssetCriticalityPanel />
{!isEntityStoreFeatureFlagDisabled && canDeleteEntityEngine && <ClearEntityDataPanel />}
</EuiFlexGroup>
Expand Down