diff --git a/web/client/components/TOC/fragments/settings/WMSCacheOptions.jsx b/web/client/components/TOC/fragments/settings/WMSCacheOptions.jsx index 04ac9fd5fc..0df967a465 100644 --- a/web/client/components/TOC/fragments/settings/WMSCacheOptions.jsx +++ b/web/client/components/TOC/fragments/settings/WMSCacheOptions.jsx @@ -198,7 +198,10 @@ function WMSCacheOptions({ }) { const [tileGridLoading, setTileGridLoading] = useState(false); - const [tileGridsResponseMsgId, setTileGridsResponseMsgId] = useState(''); + const [tileGridsResponseMsgId, setTileGridsResponseMsgId] = useState(() => { + const noTileGrids = layer?.tileGridStrategy === 'custom' && layer?.tiled && layer?.tileGrids?.length === 0; + return noTileGrids ? "layerProperties.noConfiguredGridSets" : ""; + }); const [tileGridsResponseMsgStyle, setTileGridsResponseMsgStyle] = useState(''); const [standardTileGridInfo, setStandardTileGridInfo] = useState({}); diff --git a/web/client/components/TOC/fragments/settings/__tests__/WMSCacheOptions-test.jsx b/web/client/components/TOC/fragments/settings/__tests__/WMSCacheOptions-test.jsx index fbe7f79991..882cea487a 100644 --- a/web/client/components/TOC/fragments/settings/__tests__/WMSCacheOptions-test.jsx +++ b/web/client/components/TOC/fragments/settings/__tests__/WMSCacheOptions-test.jsx @@ -1045,5 +1045,30 @@ describe('WMSCacheOptions', () => { .catch(done); }); + it('should display noConfiguredGridSets warning message if layer is configured from catalog to `Use Cache Options`, with no grid sets available', () => { + ReactDOM.render(, document.getElementById('container')); + expect(document.querySelector('.ms-wms-cache-options')).toBeTruthy(); + const inputs = document.querySelectorAll('input[type="checkbox"]'); + expect(inputs.length).toBe(1); + const buttons = document.querySelectorAll('button'); + expect(buttons.length).toBe(2); + expect([...buttons].map(button => button.querySelector('.glyphicon').getAttribute('class'))).toEqual([ + 'glyphicon glyphicon-refresh', + 'glyphicon glyphicon-grid-custom' + ]); + + const alert = document.querySelector('.alert'); + expect(alert.innerText).toBe('layerProperties.noConfiguredGridSets'); + }); }); diff --git a/web/client/epics/catalog.js b/web/client/epics/catalog.js index bb5020cd7f..015b78bbc8 100644 --- a/web/client/epics/catalog.js +++ b/web/client/epics/catalog.js @@ -287,6 +287,7 @@ export default (API) => ({ if (tileGridData) { const filteredTileGrids = tileGridData.tileGrids.filter(({ crs }) => isProjectionAvailable(CoordinatesUtils.normalizeSRS(crs))); tileGridProperties = tileGridData !== undefined ? { + tiled: true, tileGrids: tileGridData.tileGrids, tileGridStrategy: 'custom', tileGridCacheSupport: filteredTileGrids?.length > 0 ?