Skip to content

[ResponseOps][Rules]Hide rule actions instead of disabling them in the rules list #216783

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

Merged

Conversation

georgianaonoleata1904
Copy link
Contributor

@georgianaonoleata1904 georgianaonoleata1904 commented Apr 2, 2025

Closes #210979

Summary

  • This PR updates the rules list and rules details pages to hide actions for the users with read-only access. Previously, these actions were disabled, but now they are completely hidden. Specifically:
    • on the Rules List page, the snooze bell icon and the table row actions are now hidden for the users with read-only access
    • on the Rule Details page, the actions button is now hidden (previously, the users could click on it, but the options were disabled)
Screenshot 2025-04-02 at 14 06 53 Screenshot 2025-04-02 at 14 07 06

@georgianaonoleata1904 georgianaonoleata1904 self-assigned this Apr 2, 2025
@georgianaonoleata1904 georgianaonoleata1904 added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Apr 2, 2025
@georgianaonoleata1904 georgianaonoleata1904 marked this pull request as ready for review April 3, 2025 07:27
@georgianaonoleata1904 georgianaonoleata1904 requested a review from a team as a code owner April 3, 2025 07:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

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

LTGM! I tested and I found the following:

  • If there is a schedule I cannot see it with read permissions. I think we should show it but the button should be disabled and the user cannot change it.

Full permissions:
Screenshot 2025-04-03 at 4 58 10 PM

Stack read permissions. Solutions all permissions:

Screenshot 2025-04-03 at 4 58 37 PM
  • If I only have read access across all solutions (all rule types) the last column is an empty column. Maybe we can remove it entirely to save some space. Not sure how feasible it is or if it is straightforward. If not we can leave it as it is. Let's talk offline about it.
Screenshot 2025-04-03 at 5 02 43 PM

@georgianaonoleata1904
Copy link
Contributor Author

LTGM! I tested and I found the following:

  • If there is a schedule I cannot see it with read permissions. I think we should show it but the button should be disabled and the user cannot change it.

Full permissions: Screenshot 2025-04-03 at 4 58 10 PM

Stack read permissions. Solutions all permissions:

Screenshot 2025-04-03 at 4 58 37 PM * If I only have read access across all solutions (all rule types) the last column is an empty column. Maybe we can remove it entirely to save some space. Not sure how feasible it is or if it is straightforward. If not we can leave it as it is. Let's talk offline about it. Screenshot 2025-04-03 at 5 02 43 PM
  • I've implemented the change for the snooze schedule, so now the schedule is visible, but the button is disabled for users with read permissions, preventing any changes from being made

Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments! As we discussed offline there is no need to hide the actions column entirely if the user has read access to all rule types. I left some comments.

@@ -418,19 +418,20 @@ export const RuleDetails: React.FunctionComponent<RuleDetailsProps> = ({
</EuiFlexGroup>
}
rightSideItems={[
<RuleActionsPopover
canSaveRule={canSaveRule}
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep it just to be safe.

Comment on lines 328 to 331
if (isRuleEditable) {
return unsnoozedButton;
}
return null;
Copy link
Member

Choose a reason for hiding this comment

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

I found this a bit confusing. I think it is better if at the top of the useMemo we do:

 if (!isScheduled && !isSnoozed && !isSnoozedIndefinitely && !isRuleEditable) {
      return null;
    }

and leave the rest of the logic as it is. Wdyt?

isRuleEditable={false}
/>
);
expect(screen.queryByTestId('rulesListNotifyBadge-unsnoozed')).not.toBeInTheDocument();
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to check for rulesListNotifyBadge as the buttonWithToolTip will be undefined because the button will be null, right?

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
triggersActionsUi 1.4MB 1.4MB -2.0B

History

cc @georgianaonoleata1904

@georgianaonoleata1904 georgianaonoleata1904 merged commit afc5274 into elastic:main Apr 11, 2025
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17, 8.18, 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/14399400001

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 11, 2025
…e rules list (elastic#216783)

Closes elastic#210979

## Summary

- This PR updates the rules list and rules details pages to hide actions
for the users with read-only access. Previously, these actions were
disabled, but now they are completely hidden. Specifically:
- on the `Rules List` page, the snooze bell icon and the table row
actions are now hidden for the users with read-only access
- on the `Rule Details` page, the actions button is now hidden
(previously, the users could click on it, but the options were disabled)

<img width="1899" alt="Screenshot 2025-04-02 at 14 06 53"
src="https://github.com/user-attachments/assets/712297bf-b807-4ecc-87da-a32cd67d169f"
/>

<img width="1899" alt="Screenshot 2025-04-02 at 14 07 06"
src="https://github.com/user-attachments/assets/a88762fa-feeb-4117-9dc4-31744c752d82"
/>

(cherry picked from commit afc5274)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.17 Backport failed because of merge conflicts
8.18 Backport failed because of merge conflicts
8.x
9.0 Backport failed because of merge conflicts

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 216783

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 11, 2025
… in the rules list (#216783) (#217947)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][Rules]Hide rule actions instead of disabling them in
the rules list (#216783)](#216783)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Georgiana-Andreea
Onoleață","email":"georgiana.onoleata@elastic.co"},"sourceCommit":{"committedDate":"2025-04-11T08:52:35Z","message":"[ResponseOps][Rules]Hide
rule actions instead of disabling them in the rules list
(#216783)\n\nCloses
https://github.com/elastic/kibana/issues/210979\n\n## Summary\n\n- This
PR updates the rules list and rules details pages to hide actions\nfor
the users with read-only access. Previously, these actions
were\ndisabled, but now they are completely hidden. Specifically:\n- on
the `Rules List` page, the snooze bell icon and the table row\nactions
are now hidden for the users with read-only access\n- on the `Rule
Details` page, the actions button is now hidden\n(previously, the users
could click on it, but the options were disabled)\n \n<img
width=\"1899\" alt=\"Screenshot 2025-04-02 at 14 06
53\"\nsrc=\"https://github.com/user-attachments/assets/712297bf-b807-4ecc-87da-a32cd67d169f\"\n/>\n\n<img
width=\"1899\" alt=\"Screenshot 2025-04-02 at 14 07
06\"\nsrc=\"https://github.com/user-attachments/assets/a88762fa-feeb-4117-9dc4-31744c752d82\"\n/>","sha":"afc5274fb800b2e82dd0e389946ac3bab0415f57","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0","v8.17.5"],"title":"[ResponseOps][Rules]Hide
rule actions instead of disabling them in the rules
list","number":216783,"url":"https://github.com/elastic/kibana/pull/216783","mergeCommit":{"message":"[ResponseOps][Rules]Hide
rule actions instead of disabling them in the rules list
(#216783)\n\nCloses
https://github.com/elastic/kibana/issues/210979\n\n## Summary\n\n- This
PR updates the rules list and rules details pages to hide actions\nfor
the users with read-only access. Previously, these actions
were\ndisabled, but now they are completely hidden. Specifically:\n- on
the `Rules List` page, the snooze bell icon and the table row\nactions
are now hidden for the users with read-only access\n- on the `Rule
Details` page, the actions button is now hidden\n(previously, the users
could click on it, but the options were disabled)\n \n<img
width=\"1899\" alt=\"Screenshot 2025-04-02 at 14 06
53\"\nsrc=\"https://github.com/user-attachments/assets/712297bf-b807-4ecc-87da-a32cd67d169f\"\n/>\n\n<img
width=\"1899\" alt=\"Screenshot 2025-04-02 at 14 07
06\"\nsrc=\"https://github.com/user-attachments/assets/a88762fa-feeb-4117-9dc4-31744c752d82\"\n/>","sha":"afc5274fb800b2e82dd0e389946ac3bab0415f57"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x","8.17"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216783","number":216783,"mergeCommit":{"message":"[ResponseOps][Rules]Hide
rule actions instead of disabling them in the rules list
(#216783)\n\nCloses
https://github.com/elastic/kibana/issues/210979\n\n## Summary\n\n- This
PR updates the rules list and rules details pages to hide actions\nfor
the users with read-only access. Previously, these actions
were\ndisabled, but now they are completely hidden. Specifically:\n- on
the `Rules List` page, the snooze bell icon and the table row\nactions
are now hidden for the users with read-only access\n- on the `Rule
Details` page, the actions button is now hidden\n(previously, the users
could click on it, but the options were disabled)\n \n<img
width=\"1899\" alt=\"Screenshot 2025-04-02 at 14 06
53\"\nsrc=\"https://github.com/user-attachments/assets/712297bf-b807-4ecc-87da-a32cd67d169f\"\n/>\n\n<img
width=\"1899\" alt=\"Screenshot 2025-04-02 at 14 07
06\"\nsrc=\"https://github.com/user-attachments/assets/a88762fa-feeb-4117-9dc4-31744c752d82\"\n/>","sha":"afc5274fb800b2e82dd0e389946ac3bab0415f57"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Georgiana-Andreea Onoleață <georgiana.onoleata@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ResponseOps][Rules] Hide rule actions instead of disabling them in the rules list
4 participants