• 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

80.0
/src/js/components/devices/device-details/authstatus.js
1
// Copyright 2021 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, { useRef } from 'react';
15
import { useSelector } from 'react-redux';
16

17
import { Block as BlockIcon, CheckCircle as CheckCircleIcon, Check as CheckIcon } from '@mui/icons-material';
18
import { Chip, Icon } from '@mui/material';
19

20
import pendingIcon from '../../../../assets/img/pending_status.png';
21
import { DEVICE_STATES } from '../../../constants/deviceConstants';
22
import { onboardingSteps } from '../../../constants/onboardingConstants';
23
import { getOnboardingState } from '../../../selectors';
24
import { getOnboardingComponentFor } from '../../../utils/onboardingmanager';
25
import { HELPTOOLTIPS, MenderHelpTooltip } from '../../helptips/helptooltips';
26
import Authsets from './authsets/authsets';
27
import DeviceDataCollapse from './devicedatacollapse';
28

29
const iconStyle = { margin: 12 };
11✔
30

31
const states = {
11✔
32
  default: <Icon style={iconStyle} component="img" src={pendingIcon} />,
33
  pending: <Icon style={iconStyle} component="img" src={pendingIcon} />,
34
  accepted: <CheckCircleIcon className="green" style={iconStyle} />,
35
  rejected: <BlockIcon className="red" style={iconStyle} />,
36
  preauthorized: <CheckIcon style={iconStyle} />
37
};
38

39
export const AuthStatus = ({ decommission, device }) => {
11✔
40
  const listRef = useRef();
2✔
41
  const statusRef = useRef();
2✔
42
  const onboardingState = useSelector(getOnboardingState);
2✔
43
  const { auth_sets = [], status = DEVICE_STATES.accepted } = device;
2!
44

45
  let hasPending = '';
2✔
46
  if (status === DEVICE_STATES.accepted && auth_sets.length > 1) {
2✔
47
    hasPending = auth_sets.reduce((accu, set) => {
1✔
48
      return set.status === DEVICE_STATES.pending ? 'This device has a pending authentication set' : accu;
2✔
49
    }, hasPending);
50
  }
51

52
  const statusIcon = states[status] ? states[status] : states.default;
2!
53
  const requestNotification = !!hasPending && <Chip size="small" label="new request" color="primary" />;
2✔
54
  let onboardingComponent;
55
  if (listRef.current?.querySelector('.action-buttons')) {
2!
56
    const anchor = {
×
57
      top: listRef.current.offsetTop + listRef.current.offsetHeight,
58
      left: listRef.current.offsetLeft + listRef.current.querySelector('.action-buttons').offsetLeft + 15
59
    };
60
    onboardingComponent = getOnboardingComponentFor(
×
61
      onboardingSteps.DEVICES_PENDING_ACCEPTING_ONBOARDING,
62
      onboardingState,
63
      { anchor, place: 'top' },
64
      onboardingComponent
65
    );
66
  }
67
  if (statusRef.current) {
2!
68
    const anchor = {
×
69
      top: statusRef.current.offsetTop + statusRef.current.offsetHeight,
70
      left: statusRef.current.offsetLeft + statusRef.current.offsetWidth / 2
71
    };
72
    onboardingComponent = getOnboardingComponentFor(
×
73
      onboardingSteps.DEVICES_ACCEPTED_ONBOARDING,
74
      onboardingState,
75
      { anchor, place: 'top' },
76
      onboardingComponent
77
    );
78
  }
79
  return (
2✔
80
    <DeviceDataCollapse
81
      title={
82
        <div className="flexbox center-aligned">
83
          <h4>Authentication status</h4>
84
          <div className="flexbox center-aligned margin-left margin-right" ref={statusRef}>
85
            <div className="capitalized">{status}</div>
86
            {statusIcon}
87
          </div>
88
          {requestNotification}
89
          {status === DEVICE_STATES.pending && <MenderHelpTooltip id={HELPTOOLTIPS.authButton.id} style={{ marginTop: 5 }} />}
2!
90
        </div>
91
      }
92
    >
93
      <Authsets decommission={decommission} device={device} listRef={listRef} />
94
      {onboardingComponent}
95
    </DeviceDataCollapse>
96
  );
97
};
98

99
export default AuthStatus;
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