• 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

64.71
/web/client/components/TOC/fragments/RefreshLayers.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 PropTypes from 'prop-types';
10
import React from 'react';
11
import { Glyphicon, Alert } from 'react-bootstrap';
12

13
import Dialog from '../../misc/Dialog';
14
import Portal from '../../misc/Portal';
15
import Message from '../../I18N/Message';
16
import Spinner from '../../misc/spinners/BasicSpinner/BasicSpinner';
17
import Button from '../../misc/Button';
18

19
class RefreshLayers extends React.Component {
20
    static propTypes = {
1✔
21
        id: PropTypes.string,
22
        show: PropTypes.bool,
23
        panelStyle: PropTypes.object,
24
        panelClassName: PropTypes.string,
25
        onClose: PropTypes.func,
26
        onRefresh: PropTypes.func,
27
        onUpdateOptions: PropTypes.func,
28
        layers: PropTypes.array,
29
        refreshing: PropTypes.array,
30
        availableOptions: PropTypes.array,
31
        options: PropTypes.object,
32
        error: PropTypes.array
33
    };
34

35
    static defaultProps= {
1✔
36
        id: "mapstore-refresh-layers",
37
        show: false,
38
        panelStyle: {minWidth: "300px",
39
            zIndex: 2000,
40
            position: "absolute",
41
            // overflow: "auto",
42
            top: "100px",
43
            left: "calc(50% - 150px)"
44
        },
45
        panelClassName: "toolbar-panel",
46
        onClose: () => {},
47
        onRefresh: () => {},
48
        onUpdateOptions: () => {},
49
        layers: [],
50
        refreshing: [],
51
        options: {},
52
        availableOptions: ['bbox', 'search', 'dimensions', 'title'],
53
        error: []
54
    };
55

56
    renderOptions = () => {
1✔
57
        return this.props.availableOptions.map((opt) => <div><label><input type="checkbox" checked={this.props.options[opt] || false} onChange={(e) => this.updateOption(opt, e.target.checked)}/><Message msgId={"toc.refreshOptions." + opt}/></label></div>);
4✔
58
    };
59

60
    renderError = () => {
1✔
61
        if (this.props.error && this.props.error.length) {
1!
UNCOV
62
            return (<Alert bsStyle="danger">
×
63
                <Message msgId="toc.refreshError" />
UNCOV
64
                {this.props.error.map((e) => e.layer).join(', ')}
×
65
            </Alert>);
66
        }
67
        return null;
1✔
68
    };
69

70
    render() {
71
        if (this.props.show) {
1!
72
            return (<Portal><Dialog id={this.props.id} style={this.props.panelStyle} className={this.props.panelClassName}>
1✔
73
                <span role="header">
74
                    <span className="refresh-layers-panel-title"><Message msgId="toc.refreshTitle"/></span>
75
                    <button onClick={this.props.onClose} className="refresh-layers-panel-close close"><Glyphicon glyph="1-close"/></button>
76
                </span>
77
                <div role="body">
78
                    <Message msgId="toc.refreshMessage"/>
79
                    {this.renderOptions()}
80
                    {this.renderError()}
81
                </div>
82
                <span role="footer">
83
                    <Button disabled={this.props.refreshing.length > 0} bsStyle="primary" onClick={this.refresh}>{this.props.refreshing.length > 0 ? <Spinner value={this.props.refreshing.length} sSize="sp-small" /> : null}<Message msgId="toc.refreshConfirm"/></Button>
1!
84
                </span>
85
            </Dialog></Portal>);
86
        }
UNCOV
87
        return null;
×
88
    }
89

90
    refresh = () => {
1✔
UNCOV
91
        this.props.onRefresh(this.props.layers, this.props.options);
×
92
    };
93

94
    updateOption = (opt, value) => {
1✔
UNCOV
95
        const options = Object.assign({}, this.props.options, {
×
96
            [opt]: value
97
        });
UNCOV
98
        this.props.onUpdateOptions(options);
×
99
    };
100
}
101

102
export default RefreshLayers;
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