Skip to content

chore: UI package main pane relevant ce changes#39961

Merged
ashit-rath merged 3 commits intoreleasefrom
chore/chore/ui-package-main-pane-ce
Apr 2, 2025
Merged

chore: UI package main pane relevant ce changes#39961
ashit-rath merged 3 commits intoreleasefrom
chore/chore/ui-package-main-pane-ce

Conversation

@ashit-rath
Copy link
Contributor

@ashit-rath ashit-rath commented Mar 28, 2025

Description

This PR introduces several changes

  • Added isDeletable flag to widget canvas props
  • Modified Property Pane to hide delete buttons for protected widgets
  • Enhanced deletion sagas to filter out non-deletable widgets
  • Implemented context-specific widget initialization flows, i.e if in app editor then wait for app initialization else wait for package

PR for https://github.com/appsmithorg/appsmith-ee/pull/6805

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14123255944
Commit: 61de5b0
Cypress dashboard.
Tags: @tag.All
Spec:


Fri, 28 Mar 2025 07:47:43 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced support for a new editor package type, expanding available IDE options.
    • Updated widget configuration to include conditional deletion capabilities, ensuring delete actions appear only for eligible widgets.
  • Refactor

    • Enhanced navigation and initialization flows for a smoother editor experience.
    • Refined multi-widget deletion processes to safeguard against accidental removals.

@ashit-rath ashit-rath self-assigned this Mar 28, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 28, 2025

Walkthrough

This pull request introduces a new IDE type called UIPackage and updates related routing and helper functions to support the entry. It adds a new helper function to detect UIPackage paths and adjusts saga functions to export and differentiate initialization flows based on IDE type. Widget deletion logic is refined to consider an isDeletable flag, and a utility function is exported to improve modularity.

Changes

File(s) Change Summary
app/client/src/ce/IDE/Interfaces/IDETypes.ts
app/client/src/ce/IDE/constants/routes.ts
app/client/src/ce/pages/Editor/Explorer/helpers.tsx
Added new UIPackage entry in the IDE type constants and routing paths; introduced isUIPackageEditorPath helper function.
app/client/src/ce/sagas/NavigationSagas.ts
app/client/src/ce/sagas/moduleInterfaceSagas.ts
app/client/src/sagas/WidgetSelectionSagas.ts
Updated saga function exports and initialization flow; added waitForPackageInitialization and conditional logic in waitForInitialization to choose between UI package and app initialization.
app/client/src/sagas/WidgetDeletionSagas.ts
app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx
app/client/src/widgets/BaseWidget.tsx
Modified widget deletion logic by filtering on isDeletable; added conditional deletion actions and introduced an optional isDeletable property in widget interface.
app/client/src/utils/canvasStructureHelpers.ts Exported the getCanvasStructureFromDSL function to allow broader module accessibility.

Sequence Diagram(s)

sequenceDiagram
    participant S as Saga Caller
    participant W as waitForInitialization
    participant G as getIDETypeByUrl
    participant P as waitForPackageInitialization
    participant A as waitForAppInitialization

    S->>W: Invoke waitForInitialization(saga, action)
    W->>G: Determine IDE type from URL
    G-->>W: Return IDE type
    alt IDE_TYPE.UIPackage
        W->>P: Call waitForPackageInitialization(saga, action)
    else Other IDE type
        W->>A: Call waitForAppInitialization(saga, action)
    end
    Note right of W: Continue with widget selection saga
Loading

Possibly related PRs

Suggested labels

Bug, Task, IDE Pod, Debugger Product

Suggested reviewers

  • ankitakinger
  • sagar-qa007
  • rahulbarwal

Poem

In a realm of code so grand and bright,
A new type UIPackage comes to light.
Sagas now choose their rightful way,
Widgets dance in deletion's sway.
With each change, our code sings clear—
Cheers to progress and a bright frontier!
🚀📜

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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 plan to trigger planning for file edits and PR creation.
  • @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.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Mar 28, 2025
@ashit-rath ashit-rath marked this pull request as ready for review March 28, 2025 06:24
@ashit-rath ashit-rath requested review from a team as code owners March 28, 2025 06:24
@ashit-rath ashit-rath requested review from jacquesikot and removed request for a team March 28, 2025 06:24
@ashit-rath ashit-rath added the ok-to-test Required label for CI label Mar 28, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
app/client/src/ce/sagas/moduleInterfaceSagas.ts (1)

25-30: Placeholder saga for package initialization

This empty implementation provides the correct interface for the EE version to override. The ESLint directives appropriately suppress warnings for the unused parameters.

Would this function be called directly from other parts of the codebase? If so, consider adding a documentation comment explaining its purpose and expected EE behavior, similar to the file-level comment.

app/client/src/sagas/WidgetDeletionSagas.ts (1)

393-393: Confusing conditional logic could be simplified.

The double negative in the condition !(deletableWidgets && deletableWidgets.length !== 1) makes the code harder to read and understand. Consider rewriting this for clarity.

-if (!(deletableWidgets && deletableWidgets.length !== 1)) return;
+if (!deletableWidgets || deletableWidgets.length <= 1) return;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2b2d786 and 61de5b0.

📒 Files selected for processing (10)
  • app/client/src/ce/IDE/Interfaces/IDETypes.ts (1 hunks)
  • app/client/src/ce/IDE/constants/routes.ts (1 hunks)
  • app/client/src/ce/pages/Editor/Explorer/helpers.tsx (1 hunks)
  • app/client/src/ce/sagas/NavigationSagas.ts (1 hunks)
  • app/client/src/ce/sagas/moduleInterfaceSagas.ts (2 hunks)
  • app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx (3 hunks)
  • app/client/src/sagas/WidgetDeletionSagas.ts (1 hunks)
  • app/client/src/sagas/WidgetSelectionSagas.ts (3 hunks)
  • app/client/src/utils/canvasStructureHelpers.ts (1 hunks)
  • app/client/src/widgets/BaseWidget.tsx (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
app/client/src/sagas/WidgetSelectionSagas.ts (3)
app/client/src/ce/pages/Editor/Explorer/helpers.tsx (2)
  • isEditorPath (111-113)
  • isUIPackageEditorPath (121-123)
app/client/src/ce/IDE/Interfaces/IDETypes.ts (1)
  • IDE_TYPE (1-5)
app/client/src/ce/sagas/moduleInterfaceSagas.ts (1)
  • waitForPackageInitialization (25-30)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
🔇 Additional comments (14)
app/client/src/ce/IDE/Interfaces/IDETypes.ts (1)

4-4: New IDE type added appropriately

The addition of the UIPackage type in the IDE_TYPE constant is consistent with the PR objectives to introduce UI package functionality.

app/client/src/ce/pages/Editor/Explorer/helpers.tsx (1)

119-123: Placeholder implementation for EE extension

This function correctly provides a CE implementation that will be extended in EE. The comment and ESLint directive are appropriate for this pattern.

app/client/src/ce/IDE/constants/routes.ts (1)

44-44: Empty path array initialized for UI Package

The addition of an empty path array for IDE_TYPE.UIPackage is appropriate as a placeholder. This allows for future path definitions while maintaining type safety in the IDEBasePaths constant.

app/client/src/ce/sagas/moduleInterfaceSagas.ts (1)

10-12: Required imports for new function

These imports are necessary for the new waitForPackageInitialization function signature.

app/client/src/utils/canvasStructureHelpers.ts (1)

30-30: Appropriate export of utility function.

Exporting getCanvasStructureFromDSL makes it accessible for reuse across the application, improving code modularity. This is a good refactoring practice.

app/client/src/widgets/BaseWidget.tsx (1)

530-530: Good addition of widget deletion control.

The new isDeletable property enhances the widget framework by allowing certain widgets to be protected from deletion, aligning with the PR's objective of preventing accidental deletions of critical components.

app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx (1)

219-257: Correctly implements conditional deletion UI based on widget property.

The code now checks the isDeletable property before adding the delete button to widget actions, ensuring protected widgets cannot be accidentally deleted from the UI. This is consistent with the behavior defined in BaseWidget.tsx.

app/client/src/ce/sagas/NavigationSagas.ts (1)

140-140: Appropriate export of saga function.

Exporting setSelectedWidgetsSaga improves code modularity and allows for reuse in other sagas or components. This change supports the PR's objective of implementing context-specific widget initialization flows.

app/client/src/sagas/WidgetDeletionSagas.ts (2)

389-391: Good addition of the isDeletable filter for widget selection.

The implementation correctly filters out widgets that are explicitly marked as non-deletable, preventing their deletion even if they're selected. This is in line with the PR objective of enhancing protection for critical components.


396-396: Good implementation - using filtered widgets for deletion.

Using the filtered deletableWidgets array for mapping to ensure only deletable widgets are processed is the correct approach.

app/client/src/sagas/WidgetSelectionSagas.ts (4)

57-66: Appropriate imports for supporting UI Package feature.

These imports correctly add the necessary dependencies for supporting the new IDE type and initialization flow detection.


87-89: Improved editor path detection with UI Package support.

The updated condition now correctly checks for both regular editor paths and UI package editor paths, making the widget selection logic more flexible.


280-288: Well-structured conditional initialization based on IDE type.

The new implementation properly determines the IDE type from the URL and calls the appropriate initialization function. This clean separation of concerns supports the PR objective of context-specific widget initialization flows.


290-310: Appropriate extraction of app initialization logic.

The waitForAppInitialization function correctly preserves the original initialization logic while allowing for the new UI Package flow. The code maintains the necessary editor and page loading checks.

@ashit-rath ashit-rath merged commit 6c69d8d into release Apr 2, 2025
90 checks passed
@ashit-rath ashit-rath deleted the chore/chore/ui-package-main-pane-ce branch April 2, 2025 08:38
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
## Description
This PR introduces several changes 
- Added isDeletable flag to widget canvas props
- Modified Property Pane to hide delete buttons for protected widgets
- Enhanced deletion sagas to filter out non-deletable widgets
- Implemented context-specific widget initialization flows, i.e if in
app editor then wait for app initialization else wait for package


PR for appsmithorg/appsmith-ee#6805

## Automation

/ok-to-test tags="@tag.All"

### 🔍 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/14123255944>
> Commit: 61de5b0
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14123255944&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 28 Mar 2025 07:47:43 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

- **New Features**
- Introduced support for a new editor package type, expanding available
IDE options.
- Updated widget configuration to include conditional deletion
capabilities, ensuring delete actions appear only for eligible widgets.

- **Refactor**
- Enhanced navigation and initialization flows for a smoother editor
experience.
- Refined multi-widget deletion processes to safeguard against
accidental removals.

<!-- 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

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants