From b310d751e497c863917988f72b208f9db49aa174 Mon Sep 17 00:00:00 2001 From: Ashit Rath Date: Mon, 5 May 2025 12:56:09 +0530 Subject: [PATCH] chore: Added isRenameDisabled and filtered UI modules from widgets section (#40553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Adds support for disabling widget renaming in the property pane through a `isRenameDisabled` property. When enabled, it displays a tooltip explaining this limitation when hovering over the widget name. Additionally, this PR hides module widgets from the widget card selection by filtering out widgets whose type starts with "MODULE_WIDGET_". Fixes https://github.com/appsmithorg/appsmith/issues/40495 ## Automation /ok-to-test tags="@tag.Widget" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 3f94eafdef52b4d0543de99f9472fb3970ee415e > Cypress dashboard. > Tags: `@tag.Widget` > Spec: >
Fri, 02 May 2025 13:12:08 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Added the ability to disable renaming for certain widget titles, displaying a tooltip when renaming is not allowed. - **Improvements** - Widgets identified as module widgets are now excluded from the widget cards list in the UI. --- app/client/src/ce/constants/messages.ts | 2 + .../Editor/PropertyPane/PropertyPaneTitle.tsx | 51 +++++++++++++------ .../Editor/PropertyPane/PropertyPaneView.tsx | 1 + app/client/src/selectors/editorSelectors.tsx | 6 ++- 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index 7967bb21fb..e5e35b8558 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -1627,6 +1627,8 @@ export const PROPERTY_PANE_EMPTY_SEARCH_RESULT_MESSAGE = "No properties found based on your search"; export const PROPERTY_SEARCH_INPUT_PLACEHOLDER = "Search for controls, labels etc"; +export const PROPERTY_PANE_TITLE_RENAME_DISABLED = () => + "This widget cannot be renamed"; export const EXPLORER_BETA_ENTITY = () => "BETA"; export const BINDING_WIDGET_WALKTHROUGH_TITLE = () => "Widget properties"; export const BINDING_WIDGET_WALKTHROUGH_DESC = () => diff --git a/app/client/src/pages/Editor/PropertyPane/PropertyPaneTitle.tsx b/app/client/src/pages/Editor/PropertyPane/PropertyPaneTitle.tsx index 21ee25646f..8b059c69f3 100644 --- a/app/client/src/pages/Editor/PropertyPane/PropertyPaneTitle.tsx +++ b/app/client/src/pages/Editor/PropertyPane/PropertyPaneTitle.tsx @@ -23,6 +23,10 @@ import { getIsCurrentWidgetRecentlyAdded, getPropertyPaneWidth, } from "selectors/propertyPaneSelectors"; +import { + createMessage, + PROPERTY_PANE_TITLE_RENAME_DISABLED, +} from "ee/constants/messages"; interface PropertyPaneTitleProps { title: string; @@ -31,6 +35,7 @@ interface PropertyPaneTitleProps { updatePropertyTitle?: (title: string) => void; onBackClick?: () => void; isPanelTitle?: boolean; + isRenameDisabled?: boolean; actions: Array<{ tooltipContent: string; icon: ReactElement; @@ -186,22 +191,36 @@ const PropertyPaneTitle = memo(function PropertyPaneTitle( className="flex-grow" onKeyDown={handleTabKeyDown} > - + {props.isRenameDisabled ? ( +
+ +
{name}
+
+
+ ) : ( + + )} {/* ACTIONS */} diff --git a/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx index c6143c68bb..f1663bc579 100644 --- a/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx +++ b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx @@ -287,6 +287,7 @@ function PropertyPaneView( > [string], +) => config.type.startsWith("MODULE_WIDGET_"); + export const getWidgetCards = createSelector( getIsAutoLayout, getIsAnvilLayout, @@ -357,7 +361,7 @@ export const getWidgetCards = createSelector( return config.widgetName !== "Map" && !config.hideCard; } - return !config.hideCard; + return !config.hideCard && !isModuleWidget(config); }); const _cards: WidgetCardProps[] = cards.map((config) => {