Skip to content
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

chore: Changes for introducing disabled states for package pull in application #38222

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

ashit-rath
Copy link
Contributor

@ashit-rath ashit-rath commented Dec 18, 2024

Description

This PR introduces certain changes to facilitate disabled states when package pull is in progress.

EE PR -> #37841

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12425304652
Commit: 3c3aed7
Cypress dashboard.
Tags: @tag.Git
Spec:


Fri, 20 Dec 2024 04:56:17 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a GitActionsWrapper component for wrapping child elements.
    • Added a new function for improved error messaging during package upgrades.
    • Implemented a selector to check package upgrading status.
    • Enhanced the Header component to manage deployment state based on package upgrades.
    • Updated the Disabler component to visually indicate a disabled state.
  • Bug Fixes

    • Improved tooltip functionality for the deploy button when disabled.

@ashit-rath ashit-rath self-assigned this Dec 18, 2024
Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

Walkthrough

This pull request introduces enhancements to package upgrade handling and UI interactions in the application. The changes primarily focus on adding infrastructure for managing package upgrade states, including a new GitActionsWrapper component, package upgrade status messaging, and updates to the deployment header to disable actions during package updates. The modifications span multiple files in the client-side codebase, introducing new selectors, constants, and UI components to support package upgrade workflows.

Changes

File Change Summary
app/client/src/ce/components/BottomBar/GitActionsWrapper.tsx Added new functional component to wrap children, preparing for package upgrade handling
app/client/src/ce/constants/messages.ts Introduced PACKAGE_UPGRADING_ACTION_STATUS function for generating upgrade-related error messages
app/client/src/ce/selectors/packageSelectors.ts Added getIsPackageUpgrading selector (currently returning false)
app/client/src/ee/components/BottomBar/GitActionsWrapper.tsx Re-exported CE GitActionsWrapper component for Enterprise Edition
app/client/src/pages/Editor/IDE/Header/index.tsx Updated deployment header to handle package upgrading state
app/client/src/pages/common/Disabler.tsx Added cursor: not-allowed style to disabled containers

Suggested labels

enhancement, ide-product, package-management, ui-update, ok-to-test

Suggested reviewers

  • sharat87
  • ankitakinger
  • hetunandu

Possibly related PRs

Poem

🚀 Packages dance, upgrades in flight,
Code pauses, awaiting updates bright
Buttons rest, a momentary pause
Smooth transitions without a clause
Engineering magic, smooth and light! 🛠️

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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. (Beta)
  • @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.

@ashit-rath ashit-rath added the ok-to-test Required label for CI label Dec 18, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 18, 2024
@ashit-rath
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12389998439.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38222.
recreate: .

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/selectors/packageSelectors.ts (1)

20-21: Add JSDoc documentation for the selector function

Add documentation to clarify this is a CE implementation and describe the expected behavior in EE.

+/**
+ * Selector to check if a package upgrade is in progress.
+ * Note: This is the CE implementation that always returns false.
+ * The EE implementation provides the actual package upgrade state.
+ */
 export const getIsPackageUpgrading = (state: AppState): boolean => false;
app/client/src/ce/components/BottomBar/GitActionsWrapper.tsx (1)

1-5: Enhance type safety and performance

Consider the following improvements:

  1. Define a proper interface for props
  2. Memoize the component to prevent unnecessary re-renders
  3. Add proper React import
+import React, { memo } from "react";
+
+interface GitActionsWrapperProps {
+  children: React.ReactElement;
+}
+
 // This function is used to wrap the children in a disabled container if the package is upgrading
 // It's implemented in EE, but not in CE
-function GitActionsWrapper({ children }: { children: React.ReactElement }) {
+function GitActionsWrapper({ children }: GitActionsWrapperProps) {
   return children;
 }
+
+export default memo(GitActionsWrapper);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 836b544 and 3c3aed7.

📒 Files selected for processing (6)
  • app/client/src/ce/components/BottomBar/GitActionsWrapper.tsx (1 hunks)
  • app/client/src/ce/constants/messages.ts (1 hunks)
  • app/client/src/ce/selectors/packageSelectors.ts (1 hunks)
  • app/client/src/ee/components/BottomBar/GitActionsWrapper.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/Header/index.tsx (4 hunks)
  • app/client/src/pages/common/Disabler.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/ee/components/BottomBar/GitActionsWrapper.tsx
🔇 Additional comments (6)
app/client/src/pages/common/Disabler.tsx (1)

15-15: LGTM: Appropriate cursor style for disabled state

The addition of cursor: not-allowed enhances the user experience by providing clear visual feedback.

app/client/src/ce/components/BottomBar/GitActionsWrapper.tsx (1)

1-7: Verify the implementation difference in EE

The comments indicate different behavior in EE. Let's verify the EE implementation to ensure consistency.

app/client/src/ce/constants/messages.ts (1)

480-481: LGTM! Clear and consistent message implementation.

The message provides good user feedback during package updates.

app/client/src/pages/Editor/IDE/Header/index.tsx (3)

83-83: LGTM! Well-documented styled component implementation.

The StyledTooltipTarget component is properly documented and solves the pointer-events issue for disabled button tooltips.

Also applies to: 91-96


141-141: LGTM! Clean implementation of package upgrading state.

The package upgrading state is properly integrated with existing protected mode check, and the tooltip text is appropriately dynamic.

Also applies to: 149-152


341-356: Verify the deploy button's disabled state behavior.

The deploy button's disabled state and tooltip implementation looks correct, but let's verify the integration.

✅ Verification successful

Let me verify the implementation of the protected mode integration.


Based on the search results, I can now verify the integration of the deploy button's disabled state. Let me check one more aspect of the implementation.


Deploy button's disabled state and tooltip implementation is correctly integrated.

The implementation properly handles:

  • Disabled state through isDeployDisabled combining both package upgrading and protected mode states
  • Dynamic tooltip text that changes based on package upgrading status
  • Proper button state management through the isDisabled prop
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the package upgrading selector integration and deploy button usage

# Check for other usages of package upgrading selector
rg "getIsPackageUpgrading"

# Check for deploy button disabled state usage
rg "isDeployDisabled"

Length of output: 616


Script:

#!/bin/bash
# Check for protected mode usage and its implementation
rg "isProtectedMode" -A 3

# Check for any other conditions that might affect deploy button state
ast-grep --pattern 'const isDeployDisabled = $_'

Length of output: 118636


Script:

# Check for tooltip text implementation
rg "deployTooltipText" -A 2

Length of output: 621

Copy link

Deploy-Preview-URL: https://ce-38222.dp.appsmith.com

@ashit-rath ashit-rath added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 20, 2024
@ashit-rath ashit-rath requested a review from brayn003 December 20, 2024 04:03
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.

1 participant