From 9f8e1e96d06eb2107db7d99378b27f3861ee7280 Mon Sep 17 00:00:00 2001 From: Rahul Barwal Date: Thu, 27 Jun 2024 13:47:32 +0530 Subject: [PATCH] fix: Disable custom widgets for airgapped environments (#34540) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: bf3b40a5c3c51a2271347967516a53655721f7a2 > Cypress dashboard. > Tags: `@tag.Widget` ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] 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. --- .../Widgets/Custom/CustomWidgetDefaultComponent_spec.ts | 3 +-- .../Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts | 2 +- app/client/src/widgets/CustomWidget/widget/index.tsx | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetDefaultComponent_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetDefaultComponent_spec.ts index 4affed344f..94b7402645 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetDefaultComponent_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetDefaultComponent_spec.ts @@ -6,14 +6,13 @@ import { propPane, } from "../../../../../support/Objects/ObjectsCore"; -import { featureFlagIntercept } from "../../../../../support/Objects/FeatureFlags"; import EditorNavigation, { EntityType, } from "../../../../../support/Pages/EditorNavigation"; describe( "Custom widget Tests", - { tags: ["@tag.Widget", "@tag.Custom"] }, + { tags: ["@tag.Widget", "@tag.excludeForAirgap"] }, function () { before(() => { entityExplorer.DragDropWidgetNVerify("customwidget", 550, 100); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts index fb8c2636ce..6805ad3288 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Custom/CustomWidgetEditorPropertyPane_spec.ts @@ -7,7 +7,7 @@ import { describe( "Custom widget Tests", - { tags: ["@tag.Widget", "@tag.Custom"] }, + { tags: ["@tag.Widget", "@tag.excludeForAirgap"] }, function () { before(() => { agHelper.AddDsl("customWidget"); diff --git a/app/client/src/widgets/CustomWidget/widget/index.tsx b/app/client/src/widgets/CustomWidget/widget/index.tsx index 58f7a3320a..86657aae51 100644 --- a/app/client/src/widgets/CustomWidget/widget/index.tsx +++ b/app/client/src/widgets/CustomWidget/widget/index.tsx @@ -34,6 +34,7 @@ import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; import { Colors } from "constants/Colors"; import AnalyticsUtil from "@appsmith/utils/AnalyticsUtil"; import { DynamicHeight, type WidgetFeatures } from "utils/WidgetFeatures"; +import { isAirgapped } from "@appsmith/utils/airgapHelpers"; const StyledLink = styled(Link)` display: inline-block; @@ -55,6 +56,7 @@ class CustomWidget extends BaseWidget { tags: [WIDGET_TAGS.DISPLAY], searchTags: ["external"], isSearchWildcard: true, + hideCard: isAirgapped(), }; }