• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 19710972030

26 Nov 2025 03:38PM UTC coverage: 76.665% (-0.3%) from 76.929%
19710972030

Pull #11119

github

web-flow
Fix maven publish (#11739)
Pull Request #11119: Layer Selection Plugin on ArcGIS, WFS & WMS layers

32272 of 50209 branches covered (64.28%)

3 of 3 new or added lines in 2 files covered. (100.0%)

3018 existing lines in 249 files now uncovered.

40157 of 52380 relevant lines covered (76.66%)

37.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.22
/web/client/components/mapcontrols/searchservicesconfig/ResultsProps.jsx
1
/*
2
 * Copyright 2017, GeoSolutions Sas.
3
 * All rights reserved.
4
 *
5
 * This source code is licensed under the BSD-style license found in the
6
 * LICENSE file in the root directory of this source tree.
7
 */
8

9
import React from 'react';
10

11
import { get } from 'lodash';
12
import { FormGroup, ControlLabel, FormControl, Label, Checkbox } from 'react-bootstrap';
13
import Slider from 'react-nouislider';
14
import PropTypes from 'prop-types';
15
import Select from 'react-select';
16
import Message from '../../I18N/Message';
17
import { getMessageById } from '../../../utils/LocaleUtils';
18

19
function validate(service = {}) {
×
UNCOV
20
    return service.displayName && service.displayName.length > 0;
×
21
}
22

23
class ResultsProps extends React.Component {
24
    static propTypes = {
1✔
25
        service: PropTypes.object,
26
        launchInfoPanelOptions: PropTypes.array,
27
        launchInfoPanelDefault: PropTypes.string,
28
        launchInfoPanelSelectOptions: PropTypes.object,
29
        onPropertyChange: PropTypes.func
30
    };
31

32
    static contextTypes = {
1✔
33
        messages: PropTypes.object
34
    };
35

36
    static defaultProps = {
1✔
37
        service: {},
38
        launchInfoPanelDefault: "no_info",
39
        launchInfoPanelSelectOptions: {},
40
        onPropertyChange: () => {}
41
    };
42

43
    render() {
44
        const {service} = this.props;
4✔
45
        const launchInfoPanelOptions = this.props.launchInfoPanelOptions || [
4✔
46
            {
47
                label: getMessageById(this.context.messages, `search.s_launch_info_panel.no_info`),
48
                value: "no_info"
49
            },
50
            {
51
                label: getMessageById(this.context.messages, `search.s_launch_info_panel.all_layers`),
52
                value: "all_layers"
53
            },
54
            {
55
                label: getMessageById(this.context.messages, `search.s_launch_info_panel.single_layer`),
56
                value: "single_layer"
57
            }
58
        ];
59
        const currentLaunchInfoPanel = service?.launchInfoPanel || this.props.launchInfoPanelDefault;
4✔
60

61
        return (
4✔
62
            <form>
63
                <span className="wfs-required-props-title"><Message msgId="search.s_result_props_label" /></span>
64
                <FormGroup>
65
                    <ControlLabel>
66
                        <Message msgId="search.s_title" />
67
                    </ControlLabel>
68
                    <FormControl
69
                        value={service.displayName}
70
                        key="displayName"
71
                        type="text"
72
                        placeholder={'e.g. "${properties.name}\"'}
73
                        onChange={this.updateProp.bind(null, "displayName", null)}/>
74
                </FormGroup>
75
                <FormGroup>
76
                    <ControlLabel>
77
                        <Message msgId="search.s_description" />
78
                    </ControlLabel>
79
                    <FormControl
80
                        value={service.subTitle}
81
                        key="subTitle"
82
                        type="text"
83
                        onChange={this.updateProp.bind(null, "subTitle", null)}/>
84
                </FormGroup>
85
                <FormGroup>
86
                    <ControlLabel>
87
                        <Message msgId="search.s_priority" />
88
                        <Label key="priority-label" className="slider-label">{parseInt(service.priority || 1, 10)}</Label>
6✔
89
                    </ControlLabel>
90
                    <Slider key="priority"
91
                        start={[service.priority || 1]}
6✔
92
                        step={1}
93
                        range={{min: 1, max: 10}}
94
                        onSlide={this.updatePriority}
95
                    />
96
                    <span className="priority-info"><Message msgId="search.s_priority_info" /></span>
97
                </FormGroup>
98
                <FormGroup>
99
                    <ControlLabel>
100
                        <Message msgId="search.s_launch_info_panel.label" />
101
                    </ControlLabel>
102
                    <Select
103
                        options={launchInfoPanelOptions}
104
                        clearable={false}
105
                        value={currentLaunchInfoPanel}
106
                        onChange={this.updateLaunchInfoPanel}
107
                        {...this.props.launchInfoPanelSelectOptions}
108
                    />
109
                    {currentLaunchInfoPanel === 'single_layer' ? <FormGroup>
4✔
110
                        <Checkbox checked={service?.openFeatureInfoButtonEnabled ?? false} onChange={this.updateProp.bind(null, 'openFeatureInfoButtonEnabled', 'target.checked')}>
2!
111
                            <Message msgId="search.s_launch_info_panel.openFeatureInfoButtonCheckbox"/>
112
                        </Checkbox>
113
                        <Checkbox checked={service?.forceSearchLayerVisibility ?? false} onChange={this.updateProp.bind(null, 'forceSearchLayerVisibility', 'target.checked')}>
3✔
114
                            <Message msgId="search.s_launch_info_panel.forceSearchLayerVisibility"/>
115
                        </Checkbox>
116
                    </FormGroup> : null}
117
                    <span className="priority-info with-top-margin">
118
                        <Message msgId={`search.s_launch_info_panel.${currentLaunchInfoPanel}_description`} />
119
                    </span>
120
                </FormGroup>
121
            </form>);
122
    }
123

124
    updateProp = (prop, path, event) => {
4✔
UNCOV
125
        const value = get(event, path || 'target.value');
×
126
        this.props.onPropertyChange("service", Object.assign({}, this.props.service, {[prop]: value}));
×
127
    };
128

129
    updatePriority = (val) => {
4✔
UNCOV
130
        this.props.onPropertyChange("service", Object.assign({}, this.props.service, {priority: parseFloat(val[0], 10)}));
×
131
    };
132
    updateLaunchInfoPanel = (val) => {
4✔
133
        // determine launchInfoPanel value
134
        let launchInfoPanel = val && val.value ? val.value : "";
1!
135
        if ( launchInfoPanel === "no_info" ) {
1!
136
            // avoid to use a value for default behaviour i.e. without record search
UNCOV
137
            launchInfoPanel = undefined;
×
138
        }
139
        this.props.onPropertyChange("service", {
1✔
140
            ...this.props.service,
141
            launchInfoPanel,
142
            openFeatureInfoButtonEnabled: false,
143
            forceSearchLayerVisibility: false
144
        });
145
    };
146
}
147

148
export default { Element: ResultsProps, validate};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc