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

geosolutions-it / MapStore2 / 14473195766

15 Apr 2025 03:21PM UTC coverage: 76.914% (-0.01%) from 76.927%
14473195766

push

github

web-flow
[Backport 2025.01.xx] #10820 Refactored Admin Ui section like HomePage using ResourceGrid Plugin (#10973) (#11023)

* fix: merge conflict in index:ResourceCatalog

* fix: conflict : removed ResourcesSearch

30943 of 48197 branches covered (64.2%)

53 of 54 new or added lines in 8 files covered. (98.15%)

4 existing lines in 3 files now uncovered.

38437 of 49974 relevant lines covered (76.91%)

35.81 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 assign from 'object-assign';
10
import PropTypes from 'prop-types';
11
import React from 'react';
12
import Draggable from 'react-draggable';
13
import Spinner from 'react-spinkit';
14

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

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

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

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

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

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

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

112

113
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

© 2026 Coveralls, Inc