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

mendersoftware / gui / 901187442

pending completion
901187442

Pull #3795

gitlab-ci

mzedel
feat: increased chances of adopting our intended navigation patterns instead of unsupported browser navigation

Ticket: None
Changelog: None
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3795: feat: increased chances of adopting our intended navigation patterns instead of unsupported browser navigation

4389 of 6365 branches covered (68.96%)

5 of 5 new or added lines in 1 file covered. (100.0%)

1729 existing lines in 165 files now uncovered.

8274 of 10019 relevant lines covered (82.58%)

144.86 hits per line

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

88.46
/src/js/components/devices/groups.js
1
// Copyright 2015 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 from 'react';
15

16
// material ui
17
import { InfoOutlined as InfoIcon } from '@mui/icons-material';
18
import { List, ListItem, ListItemIcon, ListItemText, ListSubheader } from '@mui/material';
19
import { makeStyles } from 'tss-react/mui';
20

21
import { AddGroup } from '../helptips/helptooltips';
22

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

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

46
export const GroupItem = ({ changeGroup, groupname, selectedGroup, name }) => (
5✔
47
  <ListItem classes={{ root: 'grouplist' }} button selected={name === selectedGroup || groupname === selectedGroup} onClick={() => changeGroup(name)}>
5✔
48
    <ListItemText primary={decodeURIComponent(name)} />
49
  </ListItem>
50
);
51

52
export const Groups = ({ acceptedCount, changeGroup, className, groups, openGroupDialog, selectedGroup, showHelptips }) => {
5✔
53
  const { dynamic: dynamicGroups, static: staticGroups, ungrouped } = groups;
2✔
54
  return (
2✔
55
    <div className={className}>
56
      <div className="muted margin-bottom-small">Groups</div>
57
      <List>
UNCOV
58
        <ListItem classes={{ root: 'grouplist' }} button key="All" selected={!selectedGroup} onClick={() => changeGroup()}>
×
59
          <ListItemText primary="All devices" />
60
        </ListItem>
61
        {!!dynamicGroups.length && <GroupsSubheader heading="Dynamic" />}
4✔
62
        {dynamicGroups.map(({ groupId, name }, index) => (
63
          <GroupItem changeGroup={changeGroup} groupname={name} key={name + index} name={groupId} selectedGroup={selectedGroup} />
2✔
64
        ))}
65
        {!!staticGroups.length && <GroupsSubheader heading="Static" />}
4✔
66
        {staticGroups.map(({ groupId, name }, index) => (
67
          <GroupItem changeGroup={changeGroup} groupname={name} key={name + index} name={groupId} selectedGroup={selectedGroup} />
2✔
68
        ))}
69
        {!!staticGroups.length &&
4✔
70
          ungrouped.map(({ groupId, name }, index) => (
UNCOV
71
            <GroupItem changeGroup={changeGroup} groupname={name} key={name + index} name={groupId} selectedGroup={selectedGroup} />
×
72
          ))}
73
        <ListItem button classes={{ root: 'grouplist' }} style={{ marginTop: 30 }} onClick={openGroupDialog}>
74
          <ListItemIcon>
75
            <InfoIcon />
76
          </ListItemIcon>
77
          <ListItemText primary="Create a group" />
78
        </ListItem>
79
      </List>
80

81
      {showHelptips && acceptedCount && groups.length <= 1 ? <AddGroup /> : null}
6!
82
    </div>
83
  );
84
};
85

86
export default Groups;
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