Skip to content

Commit

Permalink
fix: WDS widgets not showing up in Air gapped instances. (#33035)
Browse files Browse the repository at this point in the history
[![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: 918fd45
> 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 -->
  • Loading branch information
marks0351 committed Apr 29, 2024
1 parent 0a06d18 commit d38e4b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/client/src/WidgetProvider/factory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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> = {};
Expand All @@ -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,
Expand Down
25 changes: 10 additions & 15 deletions app/client/src/selectors/editorSelectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down

0 comments on commit d38e4b0

Please sign in to comment.