-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Siem migrations] Implement UI service and migrations polling #201503
Conversation
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!! We will need to add route handler to be able to open a specific migration.
|
||
const SuccessToastContent: React.FC<{ migration: RuleMigrationStats }> = ({ migration }) => { | ||
const { migration_id: path, rules } = migration; | ||
const navigation = { deepLinkId: SecurityPageName.siemMigrationsRules, path }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to add a route to handle migration_id
as a path parameter (somewhere here x-pack/plugins/security_solution/public/siem_migrations/routes.tsx
). Right now we only open a default page where we would pick the first available migration and use it.
@semd looks great! I'll work with @benironside on copy. When possible it would be great to update the styling. |
@@ -226,30 +229,34 @@ export class RuleMigrationsDataRulesClient extends RuleMigrationsDataBaseClient | |||
throw error; | |||
}); | |||
|
|||
const { pending, processing, completed, lastUpdatedAt, failed } = result.aggregations ?? {}; | |||
// const { pending, processing, completed, lastUpdatedAt, createdAt, failed } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this line anymore, right?
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsasync chunk count
ESLint disabled line counts
Total ESLint disabled count
History
cc @semd |
Starting backport for target branches: 8.x |
…c#201503) ## Summary Sends "Rule migration complete" notifications from anywhere in the Security Solution app, whenever a rule migration finishes, with a link to the migrated rules. The polling logic has been encapsulated in the new `siemMigrations.rules` service so the request loop is centralized in one place. The value updates are broadcasted using the `latestStats$` observable. It will only keep requesting while there are _running_ migrations and will stop automatically when no more migrations are _running_. The reusable `useLatestStats` hook has been created for the UI components to consume. This approach allows multiple components to listen and update their content automatically with every rule migration stats update, having only one request loop running. The polling will only start if it's not already running and only if the SIEM migration functionality is available, which includes: - Experimental flag enabled - _Enterprise_ license - TODO: feature capability check (RBAC [issue](elastic/security-team#11262)) The polling will try to start when: - Automatically with the Security Solution application starts - The first render of every page that uses `useLatestStats` hook. - TODO: A new migration is created from the onboarding page ([issue](elastic/security-team#10667)) Tests will be implemented in [this task](elastic/security-team#11256) ## Example A Rule migration finishes while using Timeline in the Alerts page: https://github.com/user-attachments/assets/aac2b2c8-27fe-40d5-9f32-0bee74c9dc6a (cherry picked from commit b6586a9)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…201503) (#201664) # Backport This will backport the following commits from `main` to `8.x`: - [[Siem migrations] Implement UI service and migrations polling (#201503)](#201503) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sergi Massaneda","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-25T17:48:02Z","message":"[Siem migrations] Implement UI service and migrations polling (#201503)\n\n## Summary\r\n\r\nSends \"Rule migration complete\" notifications from anywhere in the\r\nSecurity Solution app, whenever a rule migration finishes, with a link\r\nto the migrated rules.\r\n\r\nThe polling logic has been encapsulated in the new\r\n`siemMigrations.rules` service so the request loop is centralized in one\r\nplace. The value updates are broadcasted using the `latestStats# Backport This will backport the following commits from `main` to `8.x`: - [[Siem migrations] Implement UI service and migrations polling (#201503)](#201503) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT \r\nobservable.\r\nIt will only keep requesting while there are _running_ migrations and\r\nwill stop automatically when no more migrations are _running_.\r\n\r\nThe reusable `useLatestStats` hook has been created for the UI\r\ncomponents to consume. This approach allows multiple components to\r\nlisten and update their content automatically with every rule migration\r\nstats update, having only one request loop running.\r\n\r\nThe polling will only start if it's not already running and only if the\r\nSIEM migration functionality is available, which includes:\r\n- Experimental flag enabled\r\n- _Enterprise_ license \r\n- TODO: feature capability check (RBAC\r\n[issue](https://github.com/elastic/security-team/issues/11262))\r\n\r\nThe polling will try to start when:\r\n- Automatically with the Security Solution application starts\r\n- The first render of every page that uses `useLatestStats` hook.\r\n- TODO: A new migration is created from the onboarding page\r\n([issue](https://github.com/elastic/security-team/issues/10667))\r\n\r\nTests will be implemented in [this\r\ntask](https://github.com/elastic/security-team/issues/11256)\r\n\r\n## Example\r\n\r\nA Rule migration finishes while using Timeline in the Alerts page:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/aac2b2c8-27fe-40d5-9f32-0bee74c9dc6a","sha":"b6586a95f2f5fb0bd79a5d79bfd6ae85d91adbe4","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat Hunting","backport:version","v8.18.0"],"title":"[Siem migrations] Implement UI service and migrations polling","number":201503,"url":"https://github.com/elastic/kibana/pull/201503","mergeCommit":{"message":"[Siem migrations] Implement UI service and migrations polling (#201503)\n\n## Summary\r\n\r\nSends \"Rule migration complete\" notifications from anywhere in the\r\nSecurity Solution app, whenever a rule migration finishes, with a link\r\nto the migrated rules.\r\n\r\nThe polling logic has been encapsulated in the new\r\n`siemMigrations.rules` service so the request loop is centralized in one\r\nplace. The value updates are broadcasted using the `latestStats# Backport This will backport the following commits from `main` to `8.x`: - [[Siem migrations] Implement UI service and migrations polling (#201503)](#201503) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT \r\nobservable.\r\nIt will only keep requesting while there are _running_ migrations and\r\nwill stop automatically when no more migrations are _running_.\r\n\r\nThe reusable `useLatestStats` hook has been created for the UI\r\ncomponents to consume. This approach allows multiple components to\r\nlisten and update their content automatically with every rule migration\r\nstats update, having only one request loop running.\r\n\r\nThe polling will only start if it's not already running and only if the\r\nSIEM migration functionality is available, which includes:\r\n- Experimental flag enabled\r\n- _Enterprise_ license \r\n- TODO: feature capability check (RBAC\r\n[issue](https://github.com/elastic/security-team/issues/11262))\r\n\r\nThe polling will try to start when:\r\n- Automatically with the Security Solution application starts\r\n- The first render of every page that uses `useLatestStats` hook.\r\n- TODO: A new migration is created from the onboarding page\r\n([issue](https://github.com/elastic/security-team/issues/10667))\r\n\r\nTests will be implemented in [this\r\ntask](https://github.com/elastic/security-team/issues/11256)\r\n\r\n## Example\r\n\r\nA Rule migration finishes while using Timeline in the Alerts page:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/aac2b2c8-27fe-40d5-9f32-0bee74c9dc6a","sha":"b6586a95f2f5fb0bd79a5d79bfd6ae85d91adbe4"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201503","number":201503,"mergeCommit":{"message":"[Siem migrations] Implement UI service and migrations polling (#201503)\n\n## Summary\r\n\r\nSends \"Rule migration complete\" notifications from anywhere in the\r\nSecurity Solution app, whenever a rule migration finishes, with a link\r\nto the migrated rules.\r\n\r\nThe polling logic has been encapsulated in the new\r\n`siemMigrations.rules` service so the request loop is centralized in one\r\nplace. The value updates are broadcasted using the `latestStats# Backport This will backport the following commits from `main` to `8.x`: - [[Siem migrations] Implement UI service and migrations polling (#201503)](#201503) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT \r\nobservable.\r\nIt will only keep requesting while there are _running_ migrations and\r\nwill stop automatically when no more migrations are _running_.\r\n\r\nThe reusable `useLatestStats` hook has been created for the UI\r\ncomponents to consume. This approach allows multiple components to\r\nlisten and update their content automatically with every rule migration\r\nstats update, having only one request loop running.\r\n\r\nThe polling will only start if it's not already running and only if the\r\nSIEM migration functionality is available, which includes:\r\n- Experimental flag enabled\r\n- _Enterprise_ license \r\n- TODO: feature capability check (RBAC\r\n[issue](https://github.com/elastic/security-team/issues/11262))\r\n\r\nThe polling will try to start when:\r\n- Automatically with the Security Solution application starts\r\n- The first render of every page that uses `useLatestStats` hook.\r\n- TODO: A new migration is created from the onboarding page\r\n([issue](https://github.com/elastic/security-team/issues/10667))\r\n\r\nTests will be implemented in [this\r\ntask](https://github.com/elastic/security-team/issues/11256)\r\n\r\n## Example\r\n\r\nA Rule migration finishes while using Timeline in the Alerts page:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/aac2b2c8-27fe-40d5-9f32-0bee74c9dc6a","sha":"b6586a95f2f5fb0bd79a5d79bfd6ae85d91adbe4"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Sergi Massaneda <[email protected]>
…c#201503) ## Summary Sends "Rule migration complete" notifications from anywhere in the Security Solution app, whenever a rule migration finishes, with a link to the migrated rules. The polling logic has been encapsulated in the new `siemMigrations.rules` service so the request loop is centralized in one place. The value updates are broadcasted using the `latestStats$` observable. It will only keep requesting while there are _running_ migrations and will stop automatically when no more migrations are _running_. The reusable `useLatestStats` hook has been created for the UI components to consume. This approach allows multiple components to listen and update their content automatically with every rule migration stats update, having only one request loop running. The polling will only start if it's not already running and only if the SIEM migration functionality is available, which includes: - Experimental flag enabled - _Enterprise_ license - TODO: feature capability check (RBAC [issue](elastic/security-team#11262)) The polling will try to start when: - Automatically with the Security Solution application starts - The first render of every page that uses `useLatestStats` hook. - TODO: A new migration is created from the onboarding page ([issue](elastic/security-team#10667)) Tests will be implemented in [this task](elastic/security-team#11256) ## Example A Rule migration finishes while using Timeline in the Alerts page: https://github.com/user-attachments/assets/aac2b2c8-27fe-40d5-9f32-0bee74c9dc6a
…c#201503) ## Summary Sends "Rule migration complete" notifications from anywhere in the Security Solution app, whenever a rule migration finishes, with a link to the migrated rules. The polling logic has been encapsulated in the new `siemMigrations.rules` service so the request loop is centralized in one place. The value updates are broadcasted using the `latestStats$` observable. It will only keep requesting while there are _running_ migrations and will stop automatically when no more migrations are _running_. The reusable `useLatestStats` hook has been created for the UI components to consume. This approach allows multiple components to listen and update their content automatically with every rule migration stats update, having only one request loop running. The polling will only start if it's not already running and only if the SIEM migration functionality is available, which includes: - Experimental flag enabled - _Enterprise_ license - TODO: feature capability check (RBAC [issue](elastic/security-team#11262)) The polling will try to start when: - Automatically with the Security Solution application starts - The first render of every page that uses `useLatestStats` hook. - TODO: A new migration is created from the onboarding page ([issue](elastic/security-team#10667)) Tests will be implemented in [this task](elastic/security-team#11256) ## Example A Rule migration finishes while using Timeline in the Alerts page: https://github.com/user-attachments/assets/aac2b2c8-27fe-40d5-9f32-0bee74c9dc6a
Summary
Sends "Rule migration complete" notifications from anywhere in the Security Solution app, whenever a rule migration finishes, with a link to the migrated rules.
The polling logic has been encapsulated in the new
siemMigrations.rules
service so the request loop is centralized in one place. The value updates are broadcasted using thelatestStats$
observable.It will only keep requesting while there are running migrations and will stop automatically when no more migrations are running.
The reusable
useLatestStats
hook has been created for the UI components to consume. This approach allows multiple components to listen and update their content automatically with every rule migration stats update, having only one request loop running.The polling will only start if it's not already running and only if the SIEM migration functionality is available, which includes:
The polling will try to start when:
useLatestStats
hook.Tests will be implemented in this task
Example
A Rule migration finishes while using Timeline in the Alerts page:
rule_migrations_notifications.mov