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

mendersoftware / gui / 1057188406

01 Nov 2023 04:24AM UTC coverage: 82.824% (-17.1%) from 99.964%
1057188406

Pull #4134

gitlab-ci

web-flow
chore: Bump uuid from 9.0.0 to 9.0.1

Bumps [uuid](https://github.com/uuidjs/uuid) from 9.0.0 to 9.0.1.
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #4134: chore: Bump uuid from 9.0.0 to 9.0.1

4349 of 6284 branches covered (0.0%)

8313 of 10037 relevant lines covered (82.82%)

200.97 hits per line

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

61.11
/src/js/components/devices/group-management/create-group.js
1
// Copyright 2016 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, { useState } from 'react';
15
import { useSelector } from 'react-redux';
16

17
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
18

19
import { UNGROUPED_GROUP } from '../../../constants/deviceConstants';
20
import { getSelectedGroupInfo } from '../../../selectors';
21
import GroupDefinition from './group-definition';
22

23
export const CreateGroup = ({ addListOfDevices, fromFilters, isCreation, onClose, selectedDevices }) => {
5✔
24
  const isCreationDynamic = isCreation && fromFilters;
1!
25
  const [invalid, setInvalid] = useState(true);
1✔
26
  const [isModification, setIsModification] = useState(!isCreation);
1✔
27
  const [newGroup, setNewGroup] = useState('');
1✔
28
  const [title, setTitle] = useState(isCreationDynamic ? 'Create a new group' : `Add ${selectedDevices.length ? 'selected ' : ''}devices to group`);
1!
29

30
  const { selectedGroup } = useSelector(getSelectedGroupInfo);
1✔
31
  // ensure that existing dynamic groups are only listed if a dynamic group should be created
32
  const groups = useSelector(state =>
1✔
33
    Object.keys(state.devices.groups.byId).filter(group => (fromFilters ? group !== UNGROUPED_GROUP.id : !state.devices.groups.byId[group].filters.length))
4!
34
  );
35

36
  const onNameChange = (isInvalid, newGroupName, isModification) => {
1✔
37
    const title = !isCreationDynamic ? `Add ${selectedDevices.length ? 'selected ' : ''}devices to group` : 'Create a new group';
×
38
    setTitle(title);
×
39
    setInvalid(isInvalid);
×
40
    setIsModification(isModification);
×
41
    setNewGroup(newGroupName);
×
42
  };
43

44
  return (
1✔
45
    <Dialog disableEscapeKeyDown open={true} scroll="paper" fullWidth={true} maxWidth="sm">
46
      <DialogTitle style={{ paddingBottom: '15px', marginBottom: 0 }}>{title}</DialogTitle>
47
      <DialogContent className="dialog">
48
        <GroupDefinition
49
          groups={groups}
50
          isCreationDynamic={isCreationDynamic}
51
          newGroup={newGroup}
52
          onInputChange={(invalidName, name, isModification) => onNameChange(invalidName, name, isModification)}
×
53
          selectedDevices={selectedDevices}
54
          selectedGroup={selectedGroup}
55
        />
56
      </DialogContent>
57
      <DialogActions style={{ marginTop: 0 }}>
58
        <Button style={{ marginRight: 10 }} onClick={onClose}>
59
          Cancel
60
        </Button>
61
        <Button variant="contained" color="primary" onClick={() => addListOfDevices(selectedDevices, newGroup)} disabled={!newGroup.length || invalid}>
×
62
          {!isModification || isCreationDynamic || groups.length === 0 ? 'Create group' : 'Add to group'}
4!
63
        </Button>
64
      </DialogActions>
65
    </Dialog>
66
  );
67
};
68

69
export default CreateGroup;
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