Skip to content

chore: Removing the hook for create actions permission#39470

Merged
ankitakinger merged 1 commit intoreleasefrom
chore/remove-create-action-perm-hook
Feb 27, 2025
Merged

chore: Removing the hook for create actions permission#39470
ankitakinger merged 1 commit intoreleasefrom
chore/remove-create-action-perm-hook

Conversation

@ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Feb 27, 2025

Description

Removing the hook for create actions permission as its no longer required.

Fixes #39035

Automation

/ok-to-test tags="@tag.Datasource, @tag.JS"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13561142790
Commit: 7a64f7b
Cypress dashboard.
Tags: @tag.Datasource, @tag.JS
Spec:


Thu, 27 Feb 2025 08:40:44 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Refactor
    • Updated the logic for evaluating permissions when creating actions within the Integrated Development Environment.
    • Replaced the previous approach with a refined method that combines feature flag checks and current page permissions for more granular and consistent user access control.

@github-actions github-actions bot added IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product potential-duplicate This label marks issues that are potential duplicates of already open issues Task A simple Todo skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Feb 27, 2025
@ankitakinger ankitakinger added the ok-to-test Required label for CI label Feb 27, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2025

Walkthrough

This pull request removes the custom useCreateActionsPermissions hook from both the CE and EE codebases. Its functionality is replaced with direct permission checks in component files using feature flag and page permission selectors. Specifically, the permission logic in the JSExplorer/JSSegmentList.tsx and QuerySegmentList.tsx components has been updated to use a combination of the useFeatureFlag hook, the useSelector hook with getPagePermissions, and the getHasCreateActionPermission function.

Changes

File(s) Change Summary
app/client/src/.../hooks/useCreateActionsPermissions.ts (CE & EE) Removed the custom hook that managed action creation permissions using feature flags and page permissions.
app/client/src/.../JSExplorer/JSSegmentList.tsx
app/client/src/.../QueryExplorer/QuerySegmentList.tsx
Updated permission logic: replaced the removed hook with direct calls to useFeatureFlag, useSelector(getPagePermissions), and getHasCreateActionPermission to determine if actions can be created.

Sequence Diagram(s)

sequenceDiagram
  participant Component
  participant FeatureFlag
  participant Redux
  participant PermissionHelper

  Component->>FeatureFlag: check FEATURE_FLAG.license_gac_enabled
  FeatureFlag-->>Component: returns isEnabled (boolean)
  Component->>Redux: select pagePermissions
  Redux-->>Component: returns pagePermissions
  Component->>PermissionHelper: getHasCreateActionPermission(isEnabled, pagePermissions)
  PermissionHelper-->>Component: returns permission (boolean)
Loading

Possibly related PRs

Suggested labels

Platform Administration Pod, RBAC Product

Suggested reviewers

  • ankitakinger
  • albinAppsmith
  • hetunandu

Poem

In code's vast realm, we refine our art,
A hook is gone, yet ideas still impart.
Feature flags light the way to permissions so true,
Like a digital bard, we sing something new.
Cheers to clarity and progress—code, we renew! 🚀✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fdf63a9 and 7a64f7b.

📒 Files selected for processing (4)
  • app/client/src/ce/entities/IDE/hooks/useCreateActionsPermissions.ts (0 hunks)
  • app/client/src/ee/entities/IDE/hooks/useCreateActionsPermissions.ts (0 hunks)
  • app/client/src/pages/AppIDE/components/JSExplorer/JSSegmentList.tsx (2 hunks)
  • app/client/src/pages/AppIDE/components/QueryExplorer/QuerySegmentList.tsx (2 hunks)
💤 Files with no reviewable changes (2)
  • app/client/src/ee/entities/IDE/hooks/useCreateActionsPermissions.ts
  • app/client/src/ce/entities/IDE/hooks/useCreateActionsPermissions.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
🔇 Additional comments (4)
app/client/src/pages/AppIDE/components/JSExplorer/JSSegmentList.tsx (2)

28-29: Appropriate new imports added.

The addition of these imports is necessary to support the new permission checking logic that replaces the removed hook.


46-51: Correctly implemented permission check.

This change replaces the removed useCreateActionsPermissions hook with direct permission checks using feature flags and selectors. The implementation correctly:

  1. Checks if the license feature flag is enabled
  2. Retrieves page permissions from Redux
  3. Determines permissions using the helper function

This approach provides more transparency into how permissions are calculated.

app/client/src/pages/AppIDE/components/QueryExplorer/QuerySegmentList.tsx (2)

29-30: Appropriate new imports added.

The same imports added to JSSegmentList are correctly added here, maintaining consistency across components.


40-45: Permission logic consistently implemented.

The same permission checking logic from JSSegmentList is correctly implemented here, ensuring:

  1. Consistent behavior between JS and Query components
  2. Proper replacement of the removed permissions hook
  3. Clear and direct permission derivation

This maintains feature parity while simplifying the codebase by removing an abstraction layer.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ankitakinger ankitakinger merged commit 4b2a420 into release Feb 27, 2025
51 checks passed
@ankitakinger ankitakinger deleted the chore/remove-create-action-perm-hook branch February 27, 2025 08:55
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
…9470)

## Description

Removing the hook for create actions permission as its no longer
required.

Fixes [appsmithorg#39035](appsmithorg#39035)

## Automation

/ok-to-test tags="@tag.Datasource, @tag.JS"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13561142790>
> Commit: 7a64f7b
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13561142790&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Datasource, @tag.JS`
> Spec:
> <hr>Thu, 27 Feb 2025 08:40:44 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Updated the logic for evaluating permissions when creating actions
within the Integrated Development Environment.
- Replaced the previous approach with a refined method that combines
feature flag checks and current page permissions for more granular and
consistent user access control.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI potential-duplicate This label marks issues that are potential duplicates of already open issues skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: Implement Query list component for Package IDE

2 participants