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

mendersoftware / gui / 951400782

pending completion
951400782

Pull #3900

gitlab-ci

web-flow
chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 5.17.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v5.17.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #3900: chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

4446 of 6414 branches covered (69.32%)

8342 of 10084 relevant lines covered (82.73%)

186.0 hits per line

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

62.5
/src/js/components/settings/reportinglimits.js
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import React, { useEffect, useState } from 'react';
15
import { useDispatch, useSelector } from 'react-redux';
16

17
import { ArrowDropDown as ArrowDropDownIcon, ArrowDropUp as ArrowDropUpIcon, Info as InfoIcon } from '@mui/icons-material';
18
// material ui
19
import {
20
  Accordion,
21
  AccordionDetails,
22
  AccordionSummary,
23
  IconButton,
24
  InputLabel,
25
  LinearProgress,
26
  List,
27
  ListItem,
28
  ListItemText,
29
  ListSubheader,
30
  accordionClasses,
31
  listSubheaderClasses
32
} from '@mui/material';
33
import { makeStyles } from 'tss-react/mui';
34

35
import { getReportingLimits } from '../../actions/deviceActions';
36
import { toggle } from '../../helpers';
37
import { getFeatures } from '../../selectors';
38
import { MenderTooltipClickable } from '../common/mendertooltip';
39

40
const useStyles = makeStyles()(theme => ({
6✔
41
  accordion: {
42
    ul: {
43
      paddingInlineStart: 0
44
    },
45
    [`&.${accordionClasses.disabled}, &.${accordionClasses.expanded}`]: {
46
      backgroundColor: theme.palette.background.paper
47
    }
48
  },
49
  attributesList: {
50
    overflow: 'auto',
51
    maxHeight: 250,
52
    background: 'white',
53
    width: '100%',
54
    position: 'relative',
55
    [`.${listSubheaderClasses.root}`]: {
56
      top: -10
57
    },
58
    'li > ul': {
59
      overflow: 'initial'
60
    }
61
  },
62
  limitBar: { backgroundColor: theme.palette.grey[500], margin: '15px 0' },
63
  summary: { padding: 0, marginBottom: theme.spacing() }
64
}));
65

66
export const ReportingLimits = () => {
6✔
67
  const [open, setOpen] = useState(false);
2✔
68
  const { classes } = useStyles();
2✔
69
  const dispatch = useDispatch();
2✔
70
  const { isHosted = false } = useSelector(getFeatures);
2!
71
  const { attributes = {}, count = 0, limit = 100 } = useSelector(state => state.devices.filteringAttributesConfig);
3!
72

73
  useEffect(() => {
2✔
74
    dispatch(getReportingLimits());
1✔
75
  }, []);
76

77
  const toggleOpen = () => setOpen(toggle);
2✔
78

79
  const tooltipContent = () => {
2✔
80
    return isHosted ? (
2!
81
      <div style={{ maxWidth: 350 }}>
82
        Expand to see the list of attributes currently in use. Please{' '}
83
        <a href="mailto:contact@mender.io" target="_blank" rel="noopener noreferrer">
84
          contact our team
85
        </a>{' '}
86
        if your use case requires a different set of attributes.
87
      </div>
88
    ) : (
89
      <div style={{ maxWidth: 350 }}>Expand to see the list of attributes currently in use.</div>
90
    );
91
  };
92

93
  return (
2✔
94
    <>
95
      <InputLabel className="margin-top" shrink id="filterable-attributes-usage-and-limit">
96
        Filterable attributes usage & limit ({count}/{limit}){' '}
97
        <MenderTooltipClickable className="inline-block" style={{ verticalAlign: -5 }} disableHoverListener={false} placement="top" title={tooltipContent()}>
98
          <InfoIcon />
99
        </MenderTooltipClickable>
100
      </InputLabel>
101
      <Accordion className={classes.accordion} square expanded={open} onChange={toggleOpen} disabled={!count}>
102
        <AccordionSummary className={classes.summary}>
103
          <LinearProgress className={classes.limitBar} variant="determinate" value={(count * 100) / limit} style={{ width: '100%' }} />
104
          <IconButton className="margin-left-small expandButton" size="large">
105
            {open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}
2!
106
          </IconButton>
107
        </AccordionSummary>
108
        <AccordionDetails>
109
          <List className={classes.attributesList}>
110
            {Object.entries(attributes).map(([scope, values = []]) => (
×
111
              <li key={scope}>
×
112
                <ul>
113
                  <ListSubheader>{scope}</ListSubheader>
114
                  {values.map(item => (
115
                    <ListItem key={`item-${scope}-${item}`}>
×
116
                      <ListItemText primary={item} />
117
                    </ListItem>
118
                  ))}
119
                </ul>
120
              </li>
121
            ))}
122
          </List>
123
        </AccordionDetails>
124
      </Accordion>
125
    </>
126
  );
127
};
128

129
export default ReportingLimits;
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