Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetching the list of formats is disabled for a no-vendor WMS service #10480 #10594

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading