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

mendersoftware / gui / 1015445845

25 Sep 2023 09:43AM UTC coverage: 82.537% (-17.4%) from 99.964%
1015445845

Pull #4028

gitlab-ci

mzedel
chore: aligned release retrieval with v2 api models

Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #4028: MEN-6455

4355 of 6315 branches covered (0.0%)

184 of 206 new or added lines in 19 files covered. (89.32%)

1724 existing lines in 164 files now uncovered.

8323 of 10084 relevant lines covered (82.54%)

208.49 hits per line

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

83.33
/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 } 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 { HELPTOOLTIPS, MenderHelpTooltip } from '../helptips/helptooltips';
38

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

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

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

75
  const toggleOpen = () => setOpen(toggle);
2✔
76

77
  return (
2✔
78
    <>
79
      <InputLabel className="margin-top" shrink id="filterable-attributes-usage-and-limit">
80
        Filterable attributes usage & limit ({count}/{limit}) <MenderHelpTooltip id={HELPTOOLTIPS.attributeLimit.id} placement="top" />
81
      </InputLabel>
82
      <Accordion className={classes.accordion} square expanded={open} onChange={toggleOpen} disabled={!count}>
83
        <AccordionSummary className={classes.summary}>
84
          <LinearProgress className={classes.limitBar} variant="determinate" value={(count * 100) / limit} style={{ width: '100%' }} />
85
          <IconButton className="margin-left-small expandButton" size="large">
86
            {open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}
2!
87
          </IconButton>
88
        </AccordionSummary>
89
        <AccordionDetails>
90
          <List className={classes.attributesList}>
91
            {Object.entries(attributes).map(([scope, values = []]) => (
×
UNCOV
92
              <li key={scope}>
×
93
                <ul>
94
                  <ListSubheader>{scope}</ListSubheader>
95
                  {values.map(item => (
UNCOV
96
                    <ListItem key={`item-${scope}-${item}`}>
×
97
                      <ListItemText primary={item} />
98
                    </ListItem>
99
                  ))}
100
                </ul>
101
              </li>
102
            ))}
103
          </List>
104
        </AccordionDetails>
105
      </Accordion>
106
    </>
107
  );
108
};
109

110
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