Skip to content

#12826: Add new card layout support to the Resources Catalog - #12836

Open
dsuren1 wants to merge 4 commits into
geosolutions-it:masterfrom
dsuren1:#12826_card
Open

#12826: Add new card layout support to the Resources Catalog#12836
dsuren1 wants to merge 4 commits into
geosolutions-it:masterfrom
dsuren1:#12826_card

Conversation

@dsuren1

@dsuren1 dsuren1 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a new card layout support to Resources Catalog.

  • Renamed existing layout of list to table
  • New layout is called list

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Enhancement

Issue

What is the current behavior?

What is the new behavior?

The new configurations supported are

  • cardLayoutStyles - array of card layout styles to support/show. Default is ['grid', 'table']
  • hideThumbnail - if true or { grid: false, list: true } hides the thumbnail on the card for all or specific layout styles
  • metadata.list - new layout support for resource catalog

image

With description
image

Sample cfg

{
  "metadata": {
    "list": [
      {
        "path": "name",
        "target": "header"
      },
      {
        "path": "creator",
        "target": "footer",
        "filter": "filter{creator.in}",
        "icon": {
          "glyph": "user"
        },
        "labelId": "resourcesCatalog.columnCreatedBy",
        "noDataLabelId": "resourcesCatalog.emptyUnknown",
        "disableIf": "{!state('userrole')}"
      },
      {
        "path": "tags",
        "filter": "filter{tag.in}",
        "itemValue": "name",
        "itemColor": "color",
        "type": "tag",
        "noDataLabelId": "resourcesCatalog.emptyNA",
        "labelId": "resourcesCatalog.columnTags"
      },
      {
        "path": "description",
        "target": "description"
      },
      {
        "items": [
          {
            "type": "text",
            "labelId": "resourcesCatalog.columnCreated"
          },
          {
            "path": "creation",
            "type": "date",
            "format": "MMMM D, YYYY"
          }
        ]
      },
      {
        "items": [
          {
            "type": "text",
            "labelId": "Edited by"
          },
          {
            "path": "editor",
            "filter": "filter{creator.in}"
          },
          {
            "icon": {
              "glyph": "user"
            }
          }
        ]
      }
    ]
  }
}

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

@dsuren1 dsuren1 added this to the 2026.03.00 milestone Aug 27, 2026
@dsuren1
dsuren1 requested a review from allyoucanmap August 27, 2026 07:06
@cla-bot cla-bot Bot added the CLA Ready label Aug 27, 2026
@dsuren1 dsuren1 linked an issue Aug 27, 2026 that may be closed by this pull request
3 tasks

@allyoucanmap allyoucanmap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional changes:

  • The change name from list to table needs to be documented in the migration guide
  • The default implementation should support all three types of layout, at the moment the new type is not visible. Please update the default configuration to support the new card layout
Image
  • Replace the cycle click with a drop down menu
Image
  • Replace the table icon with this new one table.zip

column,
resource,
target,
showNoData = false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are introducing showNoData? this will prevent grid and list type to display the noDataLabelId, this is a regression

storedParams
});

const cardLayoutStyles = cardLayoutStylesProp ?? (isArray(metadataProp) ? [] : Object.keys(metadataProp || {}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cardLayoutStylesProp already has a default, do we really need the fallback? The only case the fallback is needed is only when the cardLayoutStylesProp is passed explicitly as null

});
}

const mergedMetadata = isArray(metadata) ? metadata : { ...DEFAULT_METADATA, ...metadata };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not merge metadata with the default one, this will not allow to remove an existing config, please remove this merge, if a user want to override metadata they need to update the whole metadata


const content = renderEntryContent();
const hasIcon = !isHtml && (entry.image?.value || entry.icon);
if (!content && !hasIcon && !column?.width) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!content never catches empty arrays

import HtmlRenderer from '../../../components/misc/HtmlRenderer';
import { getTagColorVariables } from '../../../utils/ResourcesFiltersUtils';
import { replaceResourcePaths, getResourceInfo, getResourceStatus } from '../../../utils/ResourcesUtils';
import { CARD_LAYOUT_TYPES } from '../../../plugins/ResourcesCatalog/constants';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot import '../../../plugins/ResourcesCatalog/constants' inside the components folder, or the constant will be moved to utils or a local constants file in this folder is needed

Comment on lines +117 to +125
.ms-resource-card-img {
width: 220px;
min-width: 220px;
align-self: center;
border-radius: 2px;
margin: 4px;
height: 100%;
min-height: 130px;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not clear if the thumbnail is enabled or not inside the list type, here I'm seeing style but from the default configuration it seems hidden by default. Is it possible to enable thumbnail for list view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new layout support to the Resources Catalog

2 participants