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

mendersoftware / gui / 1314246978

01 Jun 2024 04:59AM UTC coverage: 83.437% (-16.5%) from 99.964%
1314246978

Pull #4437

gitlab-ci

web-flow
chore: Bump the playwright group in /tests/e2e_tests with 3 updates

Bumps the playwright group in /tests/e2e_tests with 3 updates: [@playwright/test](https://github.com/microsoft/playwright), [playwright](https://github.com/microsoft/playwright) and [playwright-chromium](https://github.com/microsoft/playwright).


Updates `@playwright/test` from 1.44.0 to 1.44.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.44.0...v1.44.1)

Updates `playwright` from 1.44.0 to 1.44.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.44.0...v1.44.1)

Updates `playwright-chromium` from 1.44.0 to 1.44.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.44.0...v1.44.1)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: playwright
- dependency-name: playwright
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: playwright
- dependency-name: playwright-chromium
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: playwright
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #4437: chore: Bump the playwright group in /tests/e2e_tests with 3 updates

4476 of 6391 branches covered (70.04%)

8488 of 10173 relevant lines covered (83.44%)

140.36 hits per line

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

94.59
/src/js/components/dashboard/devices.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, { useCallback, useEffect, useRef } from 'react';
15
import { useDispatch, useSelector } from 'react-redux';
16
import { useNavigate } from 'react-router-dom';
17

18
import { getDeviceCount } from '../../actions/deviceActions';
19
import { getIssueCountsByType } from '../../actions/monitorActions';
20
import { advanceOnboarding } from '../../actions/onboardingActions';
21
import { setShowConnectingDialog } from '../../actions/userActions';
22
import { DEVICE_STATES } from '../../constants/deviceConstants';
23
import { onboardingSteps } from '../../constants/onboardingConstants';
24
import {
25
  getAcceptedDevices,
26
  getAvailableIssueOptionsByType,
27
  getDeviceCountsByStatus,
28
  getOnboardingState,
29
  getTenantCapabilities,
30
  getUserCapabilities
31
} from '../../selectors';
32
import { getOnboardingComponentFor } from '../../utils/onboardingmanager';
33
import useWindowSize from '../../utils/resizehook';
34
import AcceptedDevices from './widgets/accepteddevices';
35
import ActionableDevices from './widgets/actionabledevices';
36
import PendingDevices from './widgets/pendingdevices';
37
import RedirectionWidget from './widgets/redirectionwidget';
38

39
export const Devices = ({ clickHandle }) => {
4✔
40
  // eslint-disable-next-line no-unused-vars
41
  const size = useWindowSize();
26✔
42
  const anchor = useRef();
26✔
43
  const pendingsRef = useRef();
26✔
44
  const navigate = useNavigate();
26✔
45
  const dispatch = useDispatch();
26✔
46
  const { total: acceptedDevicesCount } = useSelector(getAcceptedDevices);
26✔
47
  const availableIssueOptions = useSelector(getAvailableIssueOptionsByType);
26✔
48
  const { canManageDevices } = useSelector(getUserCapabilities);
26✔
49
  const { hasReporting, plan } = useSelector(getTenantCapabilities);
26✔
50
  const onboardingState = useSelector(getOnboardingState);
26✔
51
  const { pending: pendingDevicesCount } = useSelector(getDeviceCountsByStatus);
26✔
52

53
  const refreshDevices = useCallback(() => {
26✔
54
    const issueRequests = Object.keys(availableIssueOptions).map(key => dispatch(getIssueCountsByType(key, { filters: [], selectedIssues: [key] })));
18✔
55
    return Promise.all([dispatch(getDeviceCount(DEVICE_STATES.accepted)), dispatch(getDeviceCount(DEVICE_STATES.pending)), ...issueRequests]);
18✔
56
    // eslint-disable-next-line react-hooks/exhaustive-deps
57
  }, [JSON.stringify(availableIssueOptions), dispatch]);
58

59
  const showDismissHelptipsDialog = useSelector(state => !state.onboarding.complete && state.onboarding.showTipsDialog);
1,676✔
60
  const showDeviceConnectionDialog = useSelector(state => state.users.showConnectDeviceDialog);
1,676✔
61
  const showsDialog = showDismissHelptipsDialog || showDeviceConnectionDialog;
26✔
62

63
  useEffect(() => {
26✔
64
    // on render the store might not be updated so we resort to the API and let all later request go through the store
65
    // to be in sync with the rest of the UI
66
    refreshDevices();
9✔
67
  }, [refreshDevices]);
68

69
  useEffect(() => {
26✔
70
    refreshDevices();
9✔
71
    // eslint-disable-next-line react-hooks/exhaustive-deps
72
  }, [JSON.stringify(availableIssueOptions), refreshDevices]);
73

74
  const onConnectClick = () => {
26✔
75
    dispatch(setShowConnectingDialog(true));
×
76
    navigate('/devices/accepted');
×
77
  };
78

79
  let onboardingComponent = null;
26✔
80
  if (anchor.current && !showsDialog) {
26✔
81
    const element = anchor.current.children[anchor.current.children.length - 1];
17✔
82
    const deviceConnectionAnchor = { left: element.offsetLeft + element.offsetWidth / 2, top: element.offsetTop + element.offsetHeight - 50 };
17✔
83
    onboardingComponent = getOnboardingComponentFor(onboardingSteps.DASHBOARD_ONBOARDING_START, onboardingState, { anchor: deviceConnectionAnchor });
17✔
84
    if (pendingsRef.current) {
17✔
85
      const element = pendingsRef.current.lastChild;
11✔
86
      const pendingsAnchor = {
11✔
87
        left: pendingsRef.current.offsetLeft + element.offsetWidth / 2,
88
        top: pendingsRef.current.offsetTop + element.offsetHeight
89
      };
90
      onboardingComponent = getOnboardingComponentFor(onboardingSteps.DASHBOARD_ONBOARDING_PENDINGS, onboardingState, { anchor: pendingsAnchor });
11✔
91
    }
92
  }
93
  const shouldShowActionableDevices = plan !== 'os';
26✔
94
  return (
26✔
95
    <>
96
      <div className="dashboard" ref={anchor}>
97
        <AcceptedDevices devicesCount={acceptedDevicesCount} onClick={clickHandle} />
98
        {!!acceptedDevicesCount && shouldShowActionableDevices && <ActionableDevices issues={availableIssueOptions} />}
46✔
99
        {!!pendingDevicesCount && !(acceptedDevicesCount && hasReporting) && (
105✔
100
          <PendingDevices
101
            advanceOnboarding={step => dispatch(advanceOnboarding(step))}
1✔
102
            innerRef={pendingsRef}
103
            isActive={pendingDevicesCount > 0}
104
            onboardingState={onboardingState}
105
            onClick={clickHandle}
106
            pendingDevicesCount={pendingDevicesCount}
107
          />
108
        )}
109
        {canManageDevices && (
48✔
110
          <RedirectionWidget content={acceptedDevicesCount || pendingDevicesCount ? '+ connect more devices' : 'Connect a device'} onClick={onConnectClick} />
47✔
111
        )}
112
      </div>
113
      {onboardingComponent}
114
    </>
115
  );
116
};
117

118
export default Devices;
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