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

mendersoftware / gui / 901187442

pending completion
901187442

Pull #3795

gitlab-ci

mzedel
feat: increased chances of adopting our intended navigation patterns instead of unsupported browser navigation

Ticket: None
Changelog: None
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3795: feat: increased chances of adopting our intended navigation patterns instead of unsupported browser navigation

4389 of 6365 branches covered (68.96%)

5 of 5 new or added lines in 1 file covered. (100.0%)

1729 existing lines in 165 files now uncovered.

8274 of 10019 relevant lines covered (82.58%)

144.86 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 }) => ({
32
  root: {
33
    backgroundColor: palette.background.default,
34
    '&:hover': {
35
      backgroundColor: palette.background.default
36
    }
37
  }
38
}));
39

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

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

50
  const onClick = () => {
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 (
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