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

mendersoftware / gui / 1235064739

01 Apr 2024 05:03AM UTC coverage: 83.603% (-16.4%) from 99.964%
1235064739

Pull #4368

gitlab-ci

web-flow
chore: Bump the development-dependencies group with 18 updates

Bumps the development-dependencies group with 18 updates:

| Package | From | To |
| --- | --- | --- |
| [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) | `7.24.0` | `7.24.3` |
| [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) | `7.23.10` | `7.24.1` |
| [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-runtime) | `7.24.0` | `7.24.3` |
| [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) | `7.24.0` | `7.24.3` |
| [@babel/preset-react](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-react) | `7.23.3` | `7.24.1` |
| [@testing-library/react](https://github.com/testing-library/react-testing-library) | `14.2.1` | `14.2.2` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `7.1.0` | `7.4.0` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `7.1.0` | `7.4.0` |
| [autoprefixer](https://github.com/postcss/autoprefixer) | `10.4.17` | `10.4.19` |
| [core-js](https://github.com/zloirock/core-js/tree/HEAD/packages/core-js) | `3.36.0` | `3.36.1` |
| [esbuild-loader](https://github.com/privatenumber/esbuild-loader) | `4.0.3` | `4.1.0` |
| [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) | `7.33.2` | `7.34.1` |
| [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) | `0.24.0` | `0.25.0` |
| [eslint-webpack-plugin](https://github.com/webpack-contrib/eslint-webpack-plugin) | `4.0.1` | `4.1.0` |
| [msw](https://github.com/mswjs/msw) | `2.2.2` | `2.2.13` |
| [postcss](https://github.com/postcss/postcss) | `8.4.35` | `8.4.38` |
| [webpack](https://github.com/webpack/webpack) | `5.90.3` | `5.91.0` |
| [yarn](https://github.com/yarnpkg/yarn) | ... (continued)
Pull Request #4368: chore: Bump the development-dependencies group with 18 updates

4434 of 6325 branches covered (70.1%)

8408 of 10057 relevant lines covered (83.6%)

140.68 hits per line

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

94.29
/src/js/components/helptips/baseonboardingtip.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, useRef, useState } from 'react';
15
import { useDispatch, useSelector } from 'react-redux';
16

17
import {
18
  ArrowBack as ArrowBackIcon,
19
  ArrowDownward as ArrowDownwardIcon,
20
  ArrowForward as ArrowForwardIcon,
21
  ArrowUpward as ArrowUpwardIcon
22
} from '@mui/icons-material';
23
import { buttonBaseClasses, buttonClasses } from '@mui/material';
24
import { makeStyles } from 'tss-react/mui';
25

26
import { setShowDismissOnboardingTipsDialog } from '../../actions/onboardingActions';
27
import { TIMEOUTS } from '../../constants/appConstants';
28
import { toggle } from '../../helpers';
29
import Tracking from '../../tracking';
30
import { OnboardingTooltip } from '../common/mendertooltip';
31

32
const iconWidth = 30;
183✔
33

34
export const orientations = {
183✔
35
  top: {
36
    arrow: <ArrowUpwardIcon />,
37
    placement: 'bottom',
38
    offsetStyle: style => {
39
      style.left = style.left - iconWidth / 2;
5✔
40
      return style;
5✔
41
    }
42
  },
43
  right: {
44
    arrow: <ArrowBackIcon />,
45
    placement: 'right',
46
    offsetStyle: style => {
47
      style.top = style.top - iconWidth / 2;
1✔
48
      style.left = style.left + iconWidth / 2;
1✔
49
      return style;
1✔
50
    }
51
  },
52
  bottom: {
53
    arrow: <ArrowDownwardIcon />,
54
    placement: 'top',
55
    offsetStyle: style => {
56
      style.left = style.left - iconWidth / 2;
1✔
57
      return style;
1✔
58
    }
59
  },
60
  left: {
61
    arrow: <ArrowForwardIcon />,
62
    placement: 'left',
63
    offsetStyle: style => {
64
      style.top = style.top - iconWidth / 2;
1✔
65
      return style;
1✔
66
    }
67
  }
68
};
69

70
const useStyles = makeStyles()(theme => ({
183✔
71
  root: {
72
    [`.${buttonBaseClasses.root}.${buttonClasses.text}`]: { color: theme.palette.background.paper, paddingRight: 0 }
73
  }
74
}));
75

76
export const BaseOnboardingTooltip = ({ anchor = { left: 0, top: 0 }, icon, children, id = '1', place = 'top', ...props }) => {
183✔
77
  const [open, setOpen] = useState(false);
4✔
78
  const showDismissHelptipsDialog = useSelector(state => state.onboarding.showTipsDialog);
8✔
79
  const showDeviceConnectionDialog = useSelector(state => state.users.showConnectDeviceDialog);
8✔
80
  const delayTimer = useRef();
4✔
81

82
  const { classes } = useStyles();
4✔
83

84
  useEffect(() => {
4✔
85
    Tracking.event({ category: 'onboarding', action: id });
4✔
86
    clearTimeout(delayTimer.current);
4✔
87
    delayTimer.current = setTimeout(() => setOpen(true), TIMEOUTS.debounceShort);
4✔
88
    return () => {
4✔
89
      clearTimeout(delayTimer.current);
4✔
90
    };
91
  }, [id]);
92

93
  const toggleVisibility = () => setOpen(toggle);
4✔
94

95
  const hide = () => setOpen(false);
4✔
96

97
  if (showDismissHelptipsDialog || showDeviceConnectionDialog) {
4!
98
    return null;
×
99
  }
100

101
  const orientation = orientations[place];
4✔
102
  const style = orientation.offsetStyle({ left: anchor.left, top: anchor.top, overflow: 'initial' });
4✔
103
  return (
4✔
104
    <OnboardingTooltip
105
      disableFocusListener
106
      disableHoverListener
107
      disableTouchListener
108
      id={id}
109
      onClose={hide}
110
      open={open}
111
      placement={orientation.placement}
112
      PopperProps={{
113
        className: classes.root,
114
        disablePortal: true,
115
        popperOptions: {
116
          strategy: 'fixed',
117
          modifiers: [
118
            { name: 'flip', enabled: false },
119
            { name: 'preventOverflow', enabled: true, options: { boundary: window, altBoundary: false } }
120
          ]
121
        }
122
      }}
123
      title={children}
124
      className={classes.root}
125
      {...props}
126
    >
127
      <div className="onboard-tip" onClick={toggleVisibility} style={style}>
128
        <div className={`tooltip onboard-icon ${orientation.placement}`}>{icon ?? orientation.arrow}</div>
7✔
129
      </div>
130
    </OnboardingTooltip>
131
  );
132
};
133

134
export const BaseOnboardingTip = ({ anchor, icon, component, place, id, ...others }) => {
183✔
135
  const dispatch = useDispatch();
2✔
136
  return (
2✔
137
    <BaseOnboardingTooltip anchor={anchor} icon={icon} place={place} id={id}>
138
      <div className="content">
139
        {React.cloneElement(component, others)}
140
        <div>
141
          <b className="clickable" onClick={() => dispatch(setShowDismissOnboardingTipsDialog(true))}>
×
142
            Dismiss the tutorial
143
          </b>
144
        </div>
145
      </div>
146
    </BaseOnboardingTooltip>
147
  );
148
};
149

150
export default BaseOnboardingTip;
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