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

mendersoftware / gui / 951400782

pending completion
951400782

Pull #3900

gitlab-ci

web-flow
chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 5.17.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v5.17.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #3900: chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

4446 of 6414 branches covered (69.32%)

8342 of 10084 relevant lines covered (82.73%)

186.0 hits per line

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

82.67
/src/js/components/common/dialogs/deviceconnectiondialog.js
1
// Copyright 2019 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
import { useNavigate } from 'react-router-dom';
17

18
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
19
import { makeStyles } from 'tss-react/mui';
20

21
import docker from '../../../../assets/img/docker.png';
22
import raspberryPi4 from '../../../../assets/img/raspberrypi4.png';
23
import raspberryPi from '../../../../assets/img/raspberrypi.png';
24
import { setDeviceListState } from '../../../actions/deviceActions';
25
import { advanceOnboarding } from '../../../actions/onboardingActions';
26
import { TIMEOUTS } from '../../../constants/appConstants';
27
import { DEVICE_STATES } from '../../../constants/deviceConstants';
28
import { onboardingSteps } from '../../../constants/onboardingConstants';
29
import { getDeviceCountsByStatus, getOnboardingState, getTenantCapabilities } from '../../../selectors';
30
import InfoText from '../../common/infotext';
31
import { DeviceSupportTip } from '../../helptips/helptooltips';
32
import DocsLink from '../docslink';
33
import PhysicalDeviceOnboarding from './physicaldeviceonboarding';
34
import VirtualDeviceOnboarding from './virtualdeviceonboarding';
35

36
const useStyles = makeStyles()(theme => ({
3✔
37
  rpiQuickstart: {
38
    backgroundColor: theme.palette.background.lightgrey
39
  },
40
  virtualLogo: { height: 40, marginLeft: theme.spacing(2) }
41
}));
42

43
const DeviceConnectionExplainer = ({ hasMonitor, setOnDevice, setVirtualDevice }) => {
3✔
44
  const { classes } = useStyles();
3✔
45
  return (
3✔
46
    <>
47
      <p>
48
        You can connect almost any device and Linux OS with Mender, but to make things simple during evaluation we recommend you use a Raspberry Pi as a test
49
        device.
50
      </p>
51
      <div className={`padding-small padding-top-none rpi-quickstart ${classes.rpiQuickstart}`}>
52
        <h3>Raspberry Pi quick start</h3>
53
        <p>We&apos;ll walk you through the steps to connect a Raspberry Pi and deploy your first update with Mender.</p>
54
        <div className="flexbox column centered">
55
          <div className="flexbox centered os-list">
56
            {[raspberryPi, raspberryPi4].map((tile, index) => (
57
              <img key={`tile-${index}`} src={tile} />
6✔
58
            ))}
59
          </div>
60
          <Button variant="contained" color="secondary" onClick={() => setOnDevice(true)}>
1✔
61
            Get Started
62
          </Button>
63
        </div>
64
      </div>
65
      <div className="two-columns margin-top">
66
        <div className="padding-small padding-top-none">
67
          <div className="flexbox center-aligned">
68
            <h3>Use a virtual device</h3>
69
            <img src={docker} className={classes.virtualLogo} />
70
          </div>
71
          <p className="margin-top-none">Don&apos;t have a Raspberry Pi?</p>
72
          <p>You can use our Docker-run virtual device to go through the same tutorial.</p>
73
          {hasMonitor && (
3!
74
            <InfoText className="slightly-smaller">
75
              If you want to evaluate our commercial components such as mender-monitor, please use a physical device instead as the virtual client does not
76
              support these components at this time.
77
            </InfoText>
78
          )}
79
          <a onClick={() => setVirtualDevice(true)}>Try a virtual device</a>
1✔
80
        </div>
81
        <div className="padding-small padding-top-none">
82
          <h3>Other devices</h3>
83
          <div>See the documentation to integrate the following with Mender:</div>
84
          <ul>
85
            {[
86
              { key: 'debian', target: 'operating-system-updates-debian-family', title: 'Debian family' },
87
              { key: 'yocto', target: 'operating-system-updates-yocto-project', title: 'Yocto OSes' }
88
            ].map(item => (
89
              <li key={item.key}>
6✔
90
                <DocsLink path={item.target} title={item.title} />
91
              </li>
92
            ))}
93
          </ul>
94
          Or visit{' '}
95
          <a href="https://hub.mender.io/c/board-integrations" target="_blank" rel="noopener noreferrer">
96
            Mender Hub
97
          </a>{' '}
98
          and search integrations for your device and OS.
99
        </div>
100
      </div>
101
      <DeviceSupportTip />
102
    </>
103
  );
104
};
105

106
export const DeviceConnectionDialog = ({ onCancel }) => {
3✔
107
  const [onDevice, setOnDevice] = useState(false);
7✔
108
  const [progress, setProgress] = useState(1);
7✔
109
  const [virtualDevice, setVirtualDevice] = useState(false);
7✔
110
  const { pending: pendingCount } = useSelector(getDeviceCountsByStatus);
7✔
111
  const [pendingDevicesCount] = useState(pendingCount);
7✔
112
  const [hasMoreDevices, setHasMoreDevices] = useState(false);
7✔
113
  const { hasMonitor } = useSelector(getTenantCapabilities);
7✔
114
  const { complete: onboardingComplete, deviceType: onboardingDeviceType } = useSelector(getOnboardingState);
7✔
115
  const dispatch = useDispatch();
7✔
116
  const navigate = useNavigate();
7✔
117

118
  useEffect(() => {
7✔
119
    setHasMoreDevices(pendingCount > pendingDevicesCount);
2✔
120
  }, [pendingDevicesCount, pendingCount]);
121

122
  useEffect(() => {
7✔
123
    if ((virtualDevice || progress >= 2) && hasMoreDevices && !window.location.hash.includes('pending')) {
3!
124
      dispatch(advanceOnboarding(onboardingSteps.DASHBOARD_ONBOARDING_START));
×
125
      dispatch(setDeviceListState({ state: DEVICE_STATES.pending }));
×
126
      navigate('/devices/pending');
×
127
    }
128
  }, [advanceOnboarding, hasMoreDevices, progress, virtualDevice]);
129

130
  const onBackClick = () => {
7✔
131
    let updatedProgress = progress - 1;
1✔
132
    if (!updatedProgress) {
1!
133
      updatedProgress = 1;
1✔
134
      setOnDevice(false);
1✔
135
      setVirtualDevice(false);
1✔
136
    }
137
    setProgress(updatedProgress);
1✔
138
  };
139

140
  const onAdvance = () => {
7✔
141
    dispatch(advanceOnboarding(onboardingSteps.DASHBOARD_ONBOARDING_START));
×
142
    setProgress(progress + 1);
×
143
  };
144

145
  let content = <DeviceConnectionExplainer hasMonitor={hasMonitor} setOnDevice={setOnDevice} setVirtualDevice={setVirtualDevice} />;
7✔
146
  if (onDevice) {
7✔
147
    content = <PhysicalDeviceOnboarding progress={progress} />;
2✔
148
  } else if (virtualDevice) {
5✔
149
    content = <VirtualDeviceOnboarding />;
2✔
150
  }
151

152
  if (hasMoreDevices && !onboardingComplete) {
7!
153
    setTimeout(onCancel, TIMEOUTS.twoSeconds);
×
154
  }
155

156
  return (
7✔
157
    <Dialog open={true} PaperProps={{ sx: { maxWidth: '720px' } }}>
158
      <DialogTitle>Connecting a device</DialogTitle>
159
      <DialogContent className="onboard-dialog" style={{ margin: '0 30px' }}>
160
        {content}
161
      </DialogContent>
162
      <DialogActions>
163
        <Button onClick={onCancel}>Cancel</Button>
164
        <div style={{ flexGrow: 1 }} />
165
        {(onDevice || virtualDevice) && (
16✔
166
          <div>
167
            <Button onClick={onBackClick}>Back</Button>
168
            {progress < 2 && (!virtualDevice || progress < 1) ? (
14✔
169
              <Button variant="contained" disabled={!(virtualDevice || (onDevice && onboardingDeviceType))} onClick={onAdvance}>
6✔
170
                Next
171
              </Button>
172
            ) : (
173
              <Button variant="contained" disabled={!onboardingComplete} onClick={onCancel}>
174
                {onboardingComplete ? 'Close' : 'Waiting for device'}
2!
175
              </Button>
176
            )}
177
          </div>
178
        )}
179
      </DialogActions>
180
    </Dialog>
181
  );
182
};
183

184
export default DeviceConnectionDialog;
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