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

mendersoftware / gui / 914712491

pending completion
914712491

Pull #3798

gitlab-ci

mzedel
refac: refactored signup page to make better use of form capabilities

Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3798: MEN-3530 - refactored forms

4359 of 6322 branches covered (68.95%)

92 of 99 new or added lines in 11 files covered. (92.93%)

1715 existing lines in 159 files now uncovered.

8203 of 9941 relevant lines covered (82.52%)

150.06 hits per line

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

60.0
/src/js/components/helptips/deploymentcompletetip.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 } from 'react';
15
import { useDispatch, useSelector } from 'react-redux';
16
import { useNavigate } from 'react-router-dom';
17

18
import { CheckCircle as CheckCircleIcon } from '@mui/icons-material';
19
import { Button } from '@mui/material';
20
import { withStyles } from 'tss-react/mui';
21

22
import { getDevicesByStatus } from '../../actions/deviceActions';
23
import { advanceOnboarding, setOnboardingComplete, setShowCreateArtifactDialog } from '../../actions/onboardingActions';
24
import * as DeviceConstants from '../../constants/deviceConstants';
25
import { onboardingSteps } from '../../constants/onboardingConstants';
26
import { getDemoDeviceAddress } from '../../selectors';
27
import Tracking from '../../tracking';
28
import Loader from '../common/loader';
29
import { MenderTooltipClickable } from '../common/mendertooltip';
30

31
export const CompletionButton = withStyles(Button, ({ palette }) => ({
187✔
32
  root: {
33
    backgroundColor: palette.background.default,
34
    '&:hover': {
35
      backgroundColor: palette.background.default
36
    }
37
  }
38
}));
39

40
export const DeploymentCompleteTip = ({ anchor, targetUrl }) => {
187✔
41
  const navigate = useNavigate();
1✔
42
  const dispatch = useDispatch();
1✔
43
  const url = useSelector(getDemoDeviceAddress) || targetUrl;
1!
44

45
  useEffect(() => {
1✔
46
    dispatch(getDevicesByStatus(DeviceConstants.DEVICE_STATES.accepted));
1✔
47
    Tracking.event({ category: 'onboarding', action: onboardingSteps.DEPLOYMENTS_PAST_COMPLETED });
1✔
48
  }, []);
49

50
  const onClick = () => {
1✔
UNCOV
51
    const parametrizedAddress = `${url}/index.html?source=${encodeURIComponent(window.location)}`;
×
UNCOV
52
    window.open(parametrizedAddress, '_blank');
×
UNCOV
53
    dispatch(advanceOnboarding(onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE));
×
UNCOV
54
    dispatch(setOnboardingComplete(false));
×
UNCOV
55
    dispatch(setShowCreateArtifactDialog(true));
×
UNCOV
56
    navigate('/releases');
×
57
  };
58

59
  return (
1✔
60
    <MenderTooltipClickable
61
      className="tooltip onboard-icon onboard-tip"
62
      id={onboardingSteps.DEPLOYMENTS_PAST_COMPLETED}
63
      onboarding
64
      startOpen
65
      style={anchor}
66
      PopperProps={{ style: { marginLeft: -30, marginTop: -20 } }}
67
      title={
68
        <div className="content">
69
          <p>Fantastic! You completed your first deployment!</p>
70
          <p>Your deployment is finished and your device is now running the updated software!</p>
71
          <div className="flexbox centered">
72
            {!url ? <Loader show={true} /> : <CompletionButton variant="text" onClick={onClick}>{`Go to ${url}`}</CompletionButton>}
1!
73
          </div>
74
          <p>and you should see the demo web application actually being run on the device.</p>
75
          <p>NOTE: if you have local network restrictions, you may need to check them if you have difficulty loading the page.</p>
76
          <a onClick={onClick}>Visit the web app running your device</a>
77
        </div>
78
      }
79
    >
80
      <CheckCircleIcon />
81
    </MenderTooltipClickable>
82
  );
83
};
84

85
export default DeploymentCompleteTip;
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