• 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

94.44
/web/client/components/misc/Dialog.jsx
1
/*
2
 * Copyright 2016, 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 Draggable from 'react-draggable';
12
import Spinner from 'react-spinkit';
13

14
import Message from '../I18N/Message';
15

16
class Dialog extends React.Component {
17
    static propTypes = {
1✔
18
        id: PropTypes.string.isRequired,
19
        style: PropTypes.object,
20
        backgroundStyle: PropTypes.object,
21
        className: PropTypes.string,
22
        maskLoading: PropTypes.bool,
23
        containerClassName: PropTypes.string,
24
        headerClassName: PropTypes.string,
25
        bodyClassName: PropTypes.string,
26
        footerClassName: PropTypes.string,
27
        onClickOut: PropTypes.func,
28
        modal: PropTypes.bool,
29
        start: PropTypes.object,
30
        draggable: PropTypes.bool,
31
        bounds: PropTypes.oneOfType([PropTypes.string, PropTypes.object])
32
    };
33

34
    static defaultProps = {
1✔
35
        style: {},
36
        backgroundStyle: {
37
            background: "rgba(0,0,0,.5)"
38
        },
39
        start: {x: 0, y: 150},
40
        className: "modal-dialog modal-content",
41
        maskLoading: false,
42
        containerClassName: "",
43
        headerClassName: "modal-header",
44
        bodyClassName: "modal-body",
45
        footerClassName: "modal-footer",
46
        modal: false,
47
        draggable: true,
48
        bounds: 'parent'
49
    };
50

51
    renderLoading = () => {
169✔
52
        if (this.props.maskLoading) {
269✔
53
            return (<div style={{
3✔
54
                width: "100%",
55
                height: "100%",
56
                position: "absolute",
57
                overflow: "visible",
58
                margin: "auto",
59
                verticalAlign: "center",
60
                left: "0",
61
                background: "rgba(255, 255, 255, 0.5)",
62
                zIndex: 2
63
            }}><div style={{
64
                    position: "absolute",
65
                    top: "50%",
66
                    left: "50%",
67
                    transform: "translate(-50%, -40%)"
68
                }}><Message msgId="loading" /><Spinner spinnerName="circle" noFadeIn overrideSpinnerClassName="spinner"/></div></div>);
69
        }
70
        return null;
266✔
71
    };
72

73
    renderRole = (role) => {
169✔
74
        return React.Children.toArray(this.props.children).filter((child) => child.props.role === role);
1,921✔
75
    };
76

77
    render() {
78
        const body = (<div id={this.props.id} style={{ ...this.props.style}} className={`${this.props.draggable ? 'modal-dialog-draggable' : ''} ${this.props.className} modal-dialog-container`}>
269✔
79
            <div className={this.props.headerClassName + " draggable-header"}>
80
                {this.renderRole('header')}
81
            </div>
82
            <div className={this.props.bodyClassName}>
83
                {this.renderLoading()}
84
                {this.renderRole('body')}
85
            </div>
86
            {this.hasRole('footer') ? <div className={this.props.footerClassName}>
269✔
87
                {this.renderRole('footer')}
88
            </div> : <span/>}
89
        </div>);
90
        const dialog = this.props.draggable ? (<Draggable defaultPosition={this.props.start} bounds={this.props.bounds} handle=".draggable-header, .draggable-header *">
269✔
91
            {body}
92
        </Draggable>) : body;
93
        let containerStyle = Object.assign({}, this.props.style.display ? {display: this.props.style.display} : {}, this.props.backgroundStyle);
269✔
94
        return this.props.modal ?
269✔
95
            <div ref={(mask) => { this.mask = mask; }} onClick={this.onClickOut} style={containerStyle} className={"fade in modal " + this.props.containerClassName} role="dialog">
350✔
96
                {dialog}
97
            </div> :
98
            dialog;
99
    }
100

101
    hasRole = (role) => {
169✔
102
        return React.Children.toArray(this.props.children).filter((child) => child.props.role === role).length > 0;
707✔
103
    };
104
    onClickOut = (e) => {
169✔
105
        if (this.props.onClickOut && this.mask === e.target) {
46!
UNCOV
106
            this.props.onClickOut(e);
×
107
        }
108
    };
109
}
110

111

112
export default Dialog;
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