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

geosolutions-it / MapStore2 / 15022192473

14 May 2025 01:37PM UTC coverage: 76.899% (-0.09%) from 76.993%
15022192473

Pull #10515

github

web-flow
Merge 76310647b into d76ffd67a
Pull Request #10515: #10514 - FeatureEditor filter by geometric area

30971 of 48268 branches covered (64.16%)

27 of 42 new or added lines in 6 files covered. (64.29%)

532 existing lines in 55 files now uncovered.

38582 of 50172 relevant lines covered (76.9%)

35.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/web/client/plugins/ResourcesCatalog/components/ResourceCardActionButtons.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, { useLayoutEffect, useRef, useState } from 'react';
10
import PropTypes from 'prop-types';
11
import Icon from './Icon';
12
import { Dropdown, MenuItem } from 'react-bootstrap';
13
import Message from '../../../components/I18N/Message';
14

15
const ActionMenuItem = ({
1✔
16
    glyph,
17
    iconType,
18
    children,
19
    labelId,
20
    ...props
21
}) => {
22
    return (
×
23
        <MenuItem {...props}>
24
            {glyph ? <><Icon type={iconType} glyph={glyph}/>{' '}</> : null}
×
25
            {labelId ? <Message msgId={labelId} /> : null}
×
26
        </MenuItem>
27
    );
28
};
29

30
function ResourceCardActionButtons({
31
    options,
32
    viewerUrl,
33
    resource,
34
    className,
35
    target,
36
    ...props
37
}) {
38

39
    const containerNode = useRef();
1✔
40
    const dropdownClassName = 'ms-card-dropdown';
1✔
41
    const [isDropdownEmpty, setIsDropdownEmpty] = useState(true);
1✔
42
    useLayoutEffect(() => {
1✔
43
        const dropdownNode = containerNode?.current?.querySelector(`.${dropdownClassName}`);
1✔
44
        setIsDropdownEmpty((dropdownNode?.children?.length || 0) === 0);
1✔
45
    });
46
    return (
1✔
47
        <div
48
            {...props}
49
            ref={containerNode}
50
            className={`ms-resource-card-action-buttons${className ? ` ${className}` : ''}`}
1!
UNCOV
51
            onClick={event => event.stopPropagation()}
×
52
            style={isDropdownEmpty ? { display: 'none' } : {}}
1!
53
        >
54
            <Dropdown
55
                pullRight
56
                id={`ms-resource-card-action-buttons-${resource?.id}`}
57
            >
58
                <Dropdown.Toggle
59
                    variant="default"
60
                    size="xs"
61
                    noCaret
62
                    className="_border-transparent"
63
                >
64
                    <Icon glyph="ellipsis-v" />
65
                </Dropdown.Toggle>
66
                <Dropdown.Menu className={dropdownClassName}>
67
                    {options.map((option) => {
68
                        if (option.Component) {
×
69
                            const { Component } = option;
×
UNCOV
70
                            return <Component key={option.name} resource={resource} viewerUrl={viewerUrl} renderType="menuItem" target={target} component={ActionMenuItem}/>;
×
71
                        }
UNCOV
72
                        return null;
×
73
                    })}
74
                </Dropdown.Menu>
75
            </Dropdown>
76
        </div>
77
    );
78
}
79

80
ResourceCardActionButtons.propTypes = {
1✔
81
    options: PropTypes.array,
82
    resource: PropTypes.object
83
};
84

85
ResourceCardActionButtons.defaultProps = {
1✔
86
    options: [],
87
    resource: {}
88
};
89

90
export default ResourceCardActionButtons;
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