forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Rules migration] UI updates (elastic#207789)
## Summary [Internal link](elastic/security-team#10820) to the feature details This PR includes next improvements and fixes ### Improvements 1. Updated copies 2. Added `Last updated` label in Translation Rule details flyout <img width="1274" alt="Screenshot 2025-01-22 at 14 15 24 copy" src="https://github.com/user-attachments/assets/6974698f-3a26-48f1-96fc-d5458aa81a0a" /> 3. Added rule installation information callout in Translation Rule details flyout <img width="1274" alt="Screenshot 2025-01-22 at 14 15 24" src="https://github.com/user-attachments/assets/c350f0c2-8acf-4821-99a8-f6b510ae8dc5" /> 4. Added horizontal line underneath the Translation Rules header > [!NOTE] > This feature needs `siemMigrationsEnabled` experimental flag enabled to work.
- Loading branch information
Showing
10 changed files
with
158 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...solution/public/siem_migrations/rules/components/rule_details_flyout/updated_by/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { useMemo } from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { EuiText } from '@elastic/eui'; | ||
|
||
import { FormattedDate } from '../../../../../common/components/formatted_date'; | ||
import { useBulkGetUserProfiles } from '../../../../../common/components/user_profiles/use_bulk_get_user_profiles'; | ||
import type { RuleMigration } from '../../../../../../common/siem_migrations/model/rule_migration.gen'; | ||
|
||
import * as i18n from './translations'; | ||
|
||
interface UpdatedByLabelProps { | ||
ruleMigration: RuleMigration; | ||
} | ||
|
||
export const UpdatedByLabel: React.FC<UpdatedByLabelProps> = React.memo( | ||
({ ruleMigration }: UpdatedByLabelProps) => { | ||
const userProfileId = useMemo( | ||
() => new Set([ruleMigration.updated_by ?? ruleMigration.created_by]), | ||
[ruleMigration.created_by, ruleMigration.updated_by] | ||
); | ||
const { isLoading: isLoadingUserProfiles, data: userProfiles } = useBulkGetUserProfiles({ | ||
uids: userProfileId, | ||
}); | ||
|
||
if (isLoadingUserProfiles || !userProfiles?.length) { | ||
return null; | ||
} | ||
|
||
const userProfile = userProfiles[0]; | ||
const updatedBy = userProfile.user.full_name ?? userProfile.user.username; | ||
const updatedAt = ruleMigration.updated_at ?? ruleMigration['@timestamp']; | ||
return ( | ||
<EuiText size="xs"> | ||
<FormattedMessage | ||
id="xpack.securitySolution.siemMigrations.rules.translationDetails.updatedByLabel" | ||
defaultMessage="{updated}: {by} on {date}" | ||
values={{ | ||
updated: <b>{i18n.LAST_UPDATED_LABEL}</b>, | ||
by: updatedBy, | ||
date: <FormattedDate value={updatedAt} fieldName="updated_at" />, | ||
}} | ||
/> | ||
</EuiText> | ||
); | ||
} | ||
); | ||
UpdatedByLabel.displayName = 'UpdatedByLabel'; |
15 changes: 15 additions & 0 deletions
15
...on/public/siem_migrations/rules/components/rule_details_flyout/updated_by/translations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const LAST_UPDATED_LABEL = i18n.translate( | ||
'xpack.securitySolution.siemMigrations.rules.translationDetails.lastUpdated.label', | ||
{ | ||
defaultMessage: 'Last updated', | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters