Skip to content

fix: Disable custom widgets for airgapped environments#34540

Merged
rahulbarwal merged 2 commits intoreleasefrom
fix/disable-custom-widgets-for-airgap
Jun 27, 2024
Merged

fix: Disable custom widgets for airgapped environments#34540
rahulbarwal merged 2 commits intoreleasefrom
fix/disable-custom-widgets-for-airgap

Conversation

@rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented Jun 27, 2024

Description

Since custom widgets rely on react delievered from https://cdn.jsdelivr.net, it can't work in airgapped edition.

Fixes #34504
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9692258525
Commit: bf3b40a
Cypress dashboard.
Tags: @tag.Widget

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Custom widgets will now hide specific cards if the environment is air-gapped.
  • Tests

    • Updated test tags for custom widgets to exclude tests in air-gapped environments.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

Walkthrough

The set of changes enhances the CustomWidget component to support environments where internet connectivity is restricted, known as "airgapped" environments. It includes a new utility to determine if the environment is airgapped and updates the widget configuration and related Cypress tests based on this status.

Changes

Files/Paths Change Summary
app/client/src/widgets/CustomWidget/widget/index.tsx Added import for isAirgapped and updated the hideCard property to use isAirgapped function.
app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetDefaultComponent_spec.ts Modified test description tags from @tag.Custom to @tag.excludeForAirgap.
app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts Updated tags in test descriptions from ["@tag.Widget", "@tag.Custom"] to ["@tag.Widget", "@tag.excludeForAirgap"].

Poem

In realms where internet's not found,
Custom Widgets silently abound.
The airgapped check now makes its call,
Keeping widgets from view, one and all.
Cypress tests in the quiet night,
Tag their presence out of sight.
For airgapped modes, we're shining bright!


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@rahulbarwal rahulbarwal self-assigned this Jun 27, 2024
@github-actions github-actions bot added the Bug Something isn't working label Jun 27, 2024
@rahulbarwal rahulbarwal added the ok-to-test Required label for CI label Jun 27, 2024
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

Outside diff range and nitpick comments (1)
app/client/src/widgets/CustomWidget/widget/index.tsx (1)

Line range hint 397-397: Replace hasOwnProperty with Object.hasOwn().

Using Object.hasOwn() is recommended over hasOwnProperty for checking property existence due to improved safety and alignment with modern JavaScript practices.

- if (this.props.hasOwnProperty(eventName)) {
+ if (Object.hasOwn(this.props, eventName)) {
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cb3ddf1 and 9f3c2d0.

Files selected for processing (1)
  • app/client/src/widgets/CustomWidget/widget/index.tsx (2 hunks)
Additional context used
Biome
app/client/src/widgets/CustomWidget/widget/index.tsx

[error] 106-108: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 397-397: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)

Additional comments not posted (3)
app/client/src/widgets/CustomWidget/widget/index.tsx (3)

37-37: Import statement looks correct.

The import of isAirgapped from "@appsmith/utils/airgapHelpers" is correctly placed and used in the configuration to dynamically set the hideCard property based on the environment.


59-59: Dynamic setting of hideCard property is a smart implementation.

Setting hideCard based on isAirgapped() aligns with the PR's objective to disable custom widgets in airgapped environments. Consider adding a comment explaining why this property is set dynamically for clarity and maintainability.


Line range hint 106-108: Static analysis hint about else clause cannot be addressed.

The hint regarding the else clause cannot be addressed as the specific code segment is not visible in the provided code.

@rahulbarwal rahulbarwal requested a review from ashit-rath June 27, 2024 07:09
@rahulbarwal rahulbarwal added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 27, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9f3c2d0 and bf3b40a.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetDefaultComponent_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetDefaultComponent_spec.ts
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts

@rahulbarwal rahulbarwal merged commit 2f12030 into release Jun 27, 2024
@rahulbarwal rahulbarwal deleted the fix/disable-custom-widgets-for-airgap branch June 27, 2024 08:17
@github-actions github-actions bot added Airgap Tickets related to supporting air-gapped Appsmith instances Widgets Product This label groups issues related to widgets Custom Widgets For all issues related to the custom widget project High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Production Release Blocker This issue must be resolved before the release Platform Administration Pod Issues related to platform administration & management labels Jun 27, 2024
nidhi-nair pushed a commit that referenced this pull request Jun 27, 2024
## Description
Since custom widgets rely on react delievered from
`https://cdn.jsdelivr.net`, it can't work in airgapped edition.

Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

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

### 🔍 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/9692258525>
> Commit: bf3b40a
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9692258525&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Widget`

<!-- end of auto-generated comment: Cypress test results  -->




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


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

- **New Features**
- Custom widgets will now hide specific cards if the environment is
air-gapped.

- **Tests**
- Updated test tags for custom widgets to exclude tests in air-gapped
environments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
sharat87 pushed a commit that referenced this pull request Jul 2, 2024
…t removal from Airgapped (#34612)

## Description
This [PR](#34540) removed
custom widgets from Airgapped versions and this caused the widget
sidebar tests to fail. This PR updated the required tests to account for
this change.


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`

## Automation

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

### 🔍 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/9757281541>
> Commit: bd1e5ed
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9757281541&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Widget`
<!-- end of auto-generated comment: Cypress test results  -->




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


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

- **New Features**
- Updated widgets catalog to display different widgets based on the
airgapped environment.
- Adjusted widget search behavior to align with the airgapped
environment, enhancing search accuracy and display.

- **Bug Fixes**
- Fixed widget card display consistency when the `AIRGAPPED` environment
variable is enabled.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Jul 10, 2024
…4540)

## Description
Since custom widgets rely on react delievered from
`https://cdn.jsdelivr.net`, it can't work in airgapped edition.

Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

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

### 🔍 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/9692258525>
> Commit: bf3b40a
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9692258525&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Widget`

<!-- end of auto-generated comment: Cypress test results  -->




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


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

- **New Features**
- Custom widgets will now hide specific cards if the environment is
air-gapped.

- **Tests**
- Updated test tags for custom widgets to exclude tests in air-gapped
environments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Jul 10, 2024
…t removal from Airgapped (appsmithorg#34612)

## Description
This [PR](appsmithorg#34540) removed
custom widgets from Airgapped versions and this caused the widget
sidebar tests to fail. This PR updated the required tests to account for
this change.


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`

## Automation

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

### 🔍 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/9757281541>
> Commit: bd1e5ed
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9757281541&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Widget`
<!-- end of auto-generated comment: Cypress test results  -->




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


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

- **New Features**
- Updated widgets catalog to display different widgets based on the
airgapped environment.
- Adjusted widget search behavior to align with the airgapped
environment, enhancing search accuracy and display.

- **Bug Fixes**
- Fixed widget card display consistency when the `AIRGAPPED` environment
variable is enabled.

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

Airgap Tickets related to supporting air-gapped Appsmith instances Bug Something isn't working Custom Widgets For all issues related to the custom widget project High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Platform Administration Pod Issues related to platform administration & management Production Release Blocker This issue must be resolved before the release Widgets Product This label groups issues related to widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Custom widget isn't loading on airgapped instance

2 participants