Skip to content

Commit

Permalink
fetching the list of formats is disabled for a no-vendor WMS service g…
Browse files Browse the repository at this point in the history
  • Loading branch information
rowheat02 committed Oct 8, 2024
1 parent 118fc2e commit 4dd64dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export default ({

const tileSelectOptions = getTileSizeSelectOptions(tileSizeOptions);
const serverTypeOptions = getServerTypeOptions();
// for CSW services with no vendor options, disable format and info format options
const canLoadInfo = !(['csw'].includes(service.type) && service.layerOptions?.serverType === ServerTypes.NO_VENDOR);
return (<CommonAdvancedSettings {...props} onChangeServiceProperty={onChangeServiceProperty} service={service} >
{(isLocalizedLayerStylesEnabled && !isNil(service.type) ? service.type === "wms" : false) && (<FormGroup controlId="localized-styles" key="localized-styles">
<Checkbox data-qa="service-lacalized-layer-styles-option"
Expand Down Expand Up @@ -196,7 +198,8 @@ export default ({
title={<Message msgId="errorTitleDefault"/>}
text={<Message msgId="layerProperties.formatError" />} /> : null}
<Button
disabled={props.formatsLoading || service.layerOptions?.serverType === ServerTypes.NO_VENDOR}
disabled={props.formatsLoading || !canLoadInfo
}
tooltipId="catalog.format.refresh"
className="square-button-md no-border"
onClick={() => onFormatOptionsFetch(service.url, true)}
Expand All @@ -209,7 +212,7 @@ export default ({
<ControlLabel><Message msgId="layerProperties.format.tile" /></ControlLabel>
<InputGroup>
<Select
disabled={service.layerOptions?.serverType === ServerTypes.NO_VENDOR}
disabled={!canLoadInfo}
isLoading={props.formatsLoading}
onOpen={() => onFormatOptionsFetch(service.url)}
value={service && service.format}
Expand All @@ -224,7 +227,7 @@ export default ({
<ControlLabel><Message msgId="layerProperties.format.information" /></ControlLabel>
<InputGroup>
<Select
disabled={service.layerOptions?.serverType === ServerTypes.NO_VENDOR}
disabled={!canLoadInfo}
isLoading={props.formatsLoading}
onOpen={() => onFormatOptionsFetch(service.url)}
value={service && service.infoFormat}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ describe('Test Raster advanced settings', () => {
expect(advancedSettingPanel).toBeTruthy();
const fields = document.querySelectorAll(".form-group");
expect(fields.length).toBe(15);
// check disabled refresh button

});
it('test wms advanced options with no vendor serverType', () => {
ReactDOM.render(<RasterAdvancedSettings service={{type: "wms", autoload: false, layerOptions: {serverType: 'no-vendor'}}} isLocalizedLayerStylesEnabled/>, document.getElementById("container"));
const advancedSettingPanel = document.getElementsByClassName("mapstore-switch-panel");
expect(advancedSettingPanel).toBeTruthy();
const fields = document.querySelectorAll(".form-group");
expect(fields.length).toBe(13);
const refreshButton = document.querySelectorAll('button')[0];
expect(refreshButton).toBeTruthy();
expect(refreshButton.disabled).toBe(false);
});
it('test csw advanced options', () => {
ReactDOM.render(<RasterAdvancedSettings service={{type: "csw", autoload: false}}/>, document.getElementById("container"));
Expand All @@ -66,6 +71,9 @@ describe('Test Raster advanced settings', () => {
expect(fields.length).toBe(12);
expect(cswFilters).toBeTruthy();
expect(sortBy).toBeTruthy();
const refreshButton = document.querySelectorAll('button')[0];
expect(refreshButton).toBeTruthy();
expect(refreshButton.disabled).toBe(true);
});
it('test component onChangeServiceProperty autoload', () => {
const action = {
Expand Down

0 comments on commit 4dd64dc

Please sign in to comment.