• 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

63.64
/web/client/plugins/ResourcesCatalog/components/DetailsThumbnail.jsx
1
/*
2
 * Copyright 2024, 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, { useRef } from 'react';
10
import { Glyphicon } from 'react-bootstrap';
11

12
import Thumbnail from '../../../components/misc/Thumbnail';
13
import Button from '../../../components/layout/Button';
14
import tooltip from '../../../components/misc/enhancers/tooltip';
15
import FlexBox from '../../../components/layout/FlexBox';
16
import Text from '../../../components/layout/Text';
17
import { THUMBNAIL_DATA_KEY } from '../../../utils/GeostoreUtils';
18

19
const ButtonWithToolTip = tooltip(Button);
1✔
20

21
function DetailsThumbnail({
22
    icon,
23
    editing,
24
    thumbnail: thumbnailProp,
25
    width,
26
    height,
27
    onChange,
28
    resource
29
}) {
30

31
    const thumbnail = resource?.attributes?.[THUMBNAIL_DATA_KEY] ?? thumbnailProp;
10✔
32

33
    const thumbnailRef = useRef(null);
10✔
34
    const handleUpload = () => {
10✔
UNCOV
35
        const input = thumbnailRef?.current?.querySelector('input');
×
UNCOV
36
        if (input) {
×
UNCOV
37
            input.click();
×
38
        }
39
    };
40

41
    return (
10✔
42
        <FlexBox
43
            ref={thumbnailRef}
44
            classNames={[
45
                'ms-details-thumbnail',
46
                'ms-resource-card-img',
47
                'ms-image-colors',
48
                '_relative'
49
            ]}
50
            centerChildren
51
        >
52
            {icon && !thumbnail ? <Text fontSize="xxl"><Glyphicon {...icon} /></Text> : null}
21!
53
            {editing
10✔
54
                ? <>
55
                    <Thumbnail
56
                        style={{ position: 'absolute', width: '100%', height: '100%' }}
57
                        thumbnail={thumbnail}
58
                        onUpdate={(data) => {
59
                            onChange(data);
2✔
60
                        }}
61
                        thumbnailOptions={{
62
                            contain: false,
63
                            width,
64
                            height,
65
                            type: 'image/jpg',
66
                            quality: 0.5
67
                        }}
68
                    />
69
                    <FlexBox className="_absolute _margin-sm _corner-tl">
70
                        <ButtonWithToolTip
71
                            variant="primary"
72
                            square
UNCOV
73
                            onClick={() => handleUpload()}
×
74
                            tooltipId="resourcesCatalog.uploadImage"
75
                            tooltipPosition={"top"}
76
                        >
77
                            <Glyphicon glyph="upload" />
78
                        </ButtonWithToolTip>
79
                        <ButtonWithToolTip
80
                            variant="primary"
81
                            size="xs"
82
                            square
83
                            onClick={() => onChange('')}
1✔
84
                            tooltipId="resourcesCatalog.removeThumbnail"
85
                            tooltipPosition={"top"}
86
                        >
87
                            <Glyphicon glyph="trash" />
88
                        </ButtonWithToolTip>
89
                    </FlexBox>
90
                </>
91
                : <>
92
                    {thumbnail ? <img src={thumbnail}/> : null}
7✔
93
                </>}
94
        </FlexBox>
95
    );
96
}
97

98
export default DetailsThumbnail;
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