fix: WDS widgets not showing up in Air gapped instances. (#33035)

[![workerB](https://img.shields.io/endpoint?url=https%3A%2F%2Fworkerb.linearb.io%2Fv2%2Fbadge%2Fprivate%2FU2FsdGVkX19IVboRD3kaZRJNqi3vW6q9oNbSeq9tQI%2Fcollaboration.svg%3FcacheSeconds%3D60)](https://workerb.linearb.io/v2/badge/collaboration-page?magicLinkId=MfLLKnB)
## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


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.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/8877065723>
> Commit: 918fd45704546793524f2c97c05ab01e27063b6c
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8877065723&attempt=2"
target="_blank">Click here!</a>

<!-- 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**
- Enhanced widget configuration logic to better handle icons based on
widget methods.

- **Refactor**
- Improved the filtering logic for widget cards in the editor, now
supports different layout configurations more effectively.
- Renamed variables for better clarity in widget card selection based on
layout system.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Ashok Kumar M 2024-04-29 18:30:15 +05:30 committed by GitHub
parent 0a06d1820d
commit d38e4b0b38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 17 deletions

View File

@ -80,7 +80,7 @@ class WidgetFactory {
private static configureWidget(widget: typeof BaseWidget) {
const config = widget.getConfig();
const { IconCmp } = widget.getMethods();
const features = widget.getFeatures();
let enhancedFeatures: Record<string, unknown> = {};
@ -103,7 +103,7 @@ class WidgetFactory {
...enhancedFeatures,
searchTags: config.searchTags,
tags: config.tags,
hideCard: !!config.hideCard || !config.iconSVG,
hideCard: !!config.hideCard || !(config.iconSVG || IconCmp),
isDeprecated: !!config.isDeprecated,
replacement: config.replacement,
displayName: config.name,

View File

@ -309,25 +309,20 @@ export const getWidgetCards = createSelector(
getIsAnvilLayout,
(isAutoLayout, isAnvilLayout) => {
const widgetConfigs = WidgetFactory.getConfigs();
const cards = Object.values(widgetConfigs).filter((config) => {
// if anvil is not enabled, hide all wds widgets
if (
Object.values(WDS_V2_WIDGET_MAP).includes(config.type) &&
!isAnvilLayout
) {
return false;
const widgetConfigsArray = Object.values(widgetConfigs);
const layoutSystemBasesWidgets = widgetConfigsArray.filter((config) => {
const isAnvilWidget = Object.values(WDS_V2_WIDGET_MAP).includes(
config.type,
);
if (isAnvilLayout) {
return isAnvilWidget;
}
return !isAnvilWidget;
});
const cards = layoutSystemBasesWidgets.filter((config) => {
if (isAirgapped()) {
return config.widgetName !== "Map" && !config.hideCard;
}
// if anvil is enabled, only show the wds widgets
if (isAnvilLayout) {
return Object.values(WDS_V2_WIDGET_MAP).includes(config.type);
}
return !config.hideCard;
});