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

mendersoftware / mender-server / 10423

11 Nov 2025 04:53PM UTC coverage: 74.435% (-0.1%) from 74.562%
10423

push

gitlab-ci

web-flow
Merge pull request #1071 from mendersoftware/dependabot/npm_and_yarn/frontend/main/development-dependencies-92732187be

3868 of 5393 branches covered (71.72%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 2 files covered. (100.0%)

176 existing lines in 95 files now uncovered.

64605 of 86597 relevant lines covered (74.6%)

7.74 hits per line

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

99.0
/frontend/src/js/components/devices/Groups.tsx
1
// Copyright 2015 Northern.tech AS
2✔
2
//
2✔
3
//    Licensed under the Apache License, Version 2.0 (the "License");
2✔
4
//    you may not use this file except in compliance with the License.
2✔
5
//    You may obtain a copy of the License at
2✔
6
//
2✔
7
//        http://www.apache.org/licenses/LICENSE-2.0
2✔
8
//
2✔
9
//    Unless required by applicable law or agreed to in writing, software
2✔
10
//    distributed under the License is distributed on an "AS IS" BASIS,
2✔
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2✔
12
//    See the License for the specific language governing permissions and
2✔
13
//    limitations under the License.
2✔
14
// material ui
2✔
15
import { InfoOutlined as InfoIcon } from '@mui/icons-material';
2✔
16
import { List, ListItemButton, ListItemIcon, ListItemText, ListSubheader } from '@mui/material';
2✔
17
import { makeStyles } from 'tss-react/mui';
2✔
18

2✔
19
import { ALL_DEVICES } from '@northern.tech/store/constants';
2✔
20

2✔
21
import { HELPTOOLTIPS } from '../helptips/HelpTooltips';
2✔
22
import { MenderHelpTooltip } from '../helptips/MenderTooltip';
2✔
23

2✔
24
const useStyles = makeStyles()(theme => ({
7✔
25
  header: {
2✔
26
    color: theme.palette.grey[800],
2✔
27
    height: theme.spacing(6)
2✔
28
  },
2✔
29
  groupBorder: {
2✔
30
    background: theme.palette.grey[50]
2✔
31
  },
2✔
32
  groupHeading: {
2✔
33
    background: theme.palette.background.default
2✔
34
  }
2✔
35
}));
2✔
36

2✔
37
export const GroupsSubheader = ({ heading }) => {
7✔
38
  const { classes } = useStyles();
23✔
39
  return (
23✔
40
    <ListSubheader classes={{ root: 'heading-lined' }} className={classes.header} disableGutters disableSticky key="static-groups-sub">
2✔
41
      <span className={classes.groupHeading}>{heading}</span>
2✔
42
      <div className={classes.groupBorder} />
2✔
43
    </ListSubheader>
2✔
44
  );
2✔
45
};
2✔
46

2✔
47
export const GroupItem = ({ changeGroup, groupname, selectedGroup, name }) => (
7✔
48
  <ListItemButton classes={{ root: 'grouplist' }} selected={name === selectedGroup || groupname === selectedGroup} onClick={() => changeGroup(name)}>
23✔
49
    <ListItemText primary={decodeURIComponent(name)} />
2✔
50
  </ListItemButton>
2✔
51
);
2✔
52

2✔
53
export const Groups = ({ acceptedCount, changeGroup, className, groups, openGroupDialog, selectedGroup }) => {
7✔
54
  const { dynamic: dynamicGroups, static: staticGroups, ungrouped } = groups;
12✔
55
  return (
12✔
56
    <div className={className}>
2✔
57
      <div className="flexbox margin-bottom-small margin-top-small">
2✔
58
        <div className="muted">Groups</div>
2✔
59
        {!!(acceptedCount && staticGroups.length + dynamicGroups.length <= 1) && <MenderHelpTooltip id={HELPTOOLTIPS.addGroup.id} className="margin-left" />}
2!
60
      </div>
2✔
61
      <List>
2✔
UNCOV
62
        <ListItemButton classes={{ root: 'grouplist' }} key="All" selected={!selectedGroup} onClick={() => changeGroup()}>
2✔
63
          <ListItemText primary={ALL_DEVICES} />
2✔
64
        </ListItemButton>
2✔
65
        {!!dynamicGroups.length && <GroupsSubheader heading="Dynamic" />}
2✔
66
        {dynamicGroups.map(({ groupId, name }, index) => (
2✔
67
          <GroupItem changeGroup={changeGroup} groupname={name} key={name + index} name={groupId} selectedGroup={selectedGroup} />
12✔
68
        ))}
2✔
69
        {!!staticGroups.length && <GroupsSubheader heading="Static" />}
2✔
70
        {staticGroups.map(({ groupId, name }, index) => (
2✔
71
          <GroupItem changeGroup={changeGroup} groupname={name} key={name + index} name={groupId} selectedGroup={selectedGroup} />
12✔
72
        ))}
2✔
73
        {!!staticGroups.length &&
2✔
74
          ungrouped.map(({ groupId, name }, index) => (
2✔
75
            <GroupItem changeGroup={changeGroup} groupname={name} key={name + index} name={groupId} selectedGroup={selectedGroup} />
2✔
76
          ))}
2✔
77
        <ListItemButton classes={{ root: 'grouplist' }} style={{ marginTop: 30 }} onClick={openGroupDialog}>
2✔
78
          <ListItemIcon>
2✔
79
            <InfoIcon />
2✔
80
          </ListItemIcon>
2✔
81
          <ListItemText primary="Create a group" />
2✔
82
        </ListItemButton>
2✔
83
      </List>
2✔
84
    </div>
2✔
85
  );
2✔
86
};
2✔
87

2✔
88
export default Groups;
2✔
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