• 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

80.0
/web/client/components/geostory/media/Image.jsx
1
/*
2
 * Copyright 2019, 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
import React, { Component } from 'react';
9
import PropTypes from 'prop-types';
10
import Lightbox from 'react-image-lightbox';
11
import { compose, withState } from 'recompose';
12

13
/**
14
 * Image media component
15
 * @class
16
 * @name Image
17
 * @prop {string} src source of the image
18
 * @prop {string} fit one of 'cover' or 'contain'
19
 * @prop {boolean} enableFullscreen enable fullscreen preview with pan and zoom options
20
 * @prop {string} description description of media resource
21
 * @prop {string} caption caption of current content
22
 * @prop {boolean} showCaption display/hide caption
23
 * @prop {element} loaderComponent render loader component
24
 * @prop {element} errorComponent render error component
25
 */
26
class Image extends Component {
27

28
    static propTypes = {
1✔
29
        src: PropTypes.string,
30
        id: PropTypes.string,
31
        fit: PropTypes.string,
32
        description: PropTypes.string,
33
        showCaption: PropTypes.bool,
34
        credits: PropTypes.string,
35
        altText: PropTypes.string,
36
        enableFullscreen: PropTypes.bool,
37
        fullscreen: PropTypes.bool,
38
        onClick: PropTypes.func,
39
        onChangeStatus: PropTypes.func,
40
        status: PropTypes.string,
41
        loaderComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
42
        errorComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
43
        caption: PropTypes.string,
44
        loaderStyle: PropTypes.object
45
    };
46

47
    render() {
48
        const {
49
            id,
50
            src,
51
            fit = 'cover',
130✔
52
            enableFullscreen = true,
80✔
53
            fullscreen,
54
            onClick,
55
            description,
56
            showCaption,
57
            caption = description,
142✔
58
            credits,
59
            loaderStyle
60
        } = this.props;
142✔
61

62
        const LoaderComponent = this.props.loaderComponent;
142✔
63
        const ErrorComponent = this.props.errorComponent;
142✔
64

65
        return (
142✔
66
            <div
67
                id={id}
68
                className="ms-media ms-media-image">
69
                {src && this.props.status !== 'error' && <img
255✔
70
                    ref={node => { this._node = node; }}
112✔
71
                    src={src}
72
                    onLoad={() => this.props.onChangeStatus('loaded')}
22✔
73
                    onError={() => this.props.onChangeStatus('error')}
1✔
UNCOV
74
                    onClick={enableFullscreen ? () => onClick(true) : undefined}
✔
75
                    style={{
76
                        objectFit: fit,
77
                        // polyfill ie11
78
                        fontFamily: `object-fit: ${fit}`,
79
                        cursor: enableFullscreen ? 'pointer' : 'default'
56✔
80
                    }}/>}
81
                {(src && !this.props.status) && LoaderComponent && <LoaderComponent style={{...loaderStyle}} />}
231!
82
                {(this.props.status === 'error') && ErrorComponent && <ErrorComponent />}
143!
83
                {credits && <div className="ms-media-credits">
142!
84
                    <small>
85
                        {credits}
86
                    </small>
87
                </div>}
88
                {showCaption && caption && <div className="ms-media-caption">
142!
89
                    <small>
90
                        {caption}
91
                    </small>
92
                </div>}
93
                {enableFullscreen && fullscreen ?
364!
94
                    <Lightbox
95
                        mainSrc={src}
UNCOV
96
                        onCloseRequest={() => onClick(false)}/>
×
97
                    : null}
98
            </div>
99
        );
100
    }
101
}
102

103
export default compose(
104
    withState('fullscreen', 'onClick', false),
105
    withState('status', 'onChangeStatus', '')
106
)(Image);
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