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

geosolutions-it / MapStore2 / 14448334283

14 Apr 2025 02:32PM UTC coverage: 76.927% (-0.006%) from 76.933%
14448334283

push

github

web-flow
#10970: Add configuration support to open resource in target from homepage (#10977) (#11019)

(cherry picked from commit b735d26a3)

31003 of 48275 branches covered (64.22%)

1 of 2 new or added lines in 2 files covered. (50.0%)

3 existing lines in 3 files now uncovered.

38522 of 50076 relevant lines covered (76.93%)

35.83 hits per line

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

60.0
/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, { useRef } 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
    getResourceId = () => '',
1✔
36
    target,
37
    ...props
38
}) {
39

40
    const containerNode = useRef();
1✔
41
    const dropdownClassName = 'ms-card-dropdown';
1✔
42
    const dropdownNode = containerNode?.current?.querySelector(`.${dropdownClassName}`);
1✔
43
    const isDropdownEmpty = (dropdownNode?.children?.length || 0) === 0;
1✔
44

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

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

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

89
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