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

mendersoftware / mender-server / 10423

11 Nov 2025 04:53PM UTC coverage: 74.435% (-0.1%) from 74.562%
10423

push

gitlab-ci

web-flow
Merge pull request #1071 from mendersoftware/dependabot/npm_and_yarn/frontend/main/development-dependencies-92732187be

3868 of 5393 branches covered (71.72%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 2 files covered. (100.0%)

176 existing lines in 95 files now uncovered.

64605 of 86597 relevant lines covered (74.6%)

7.74 hits per line

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

94.02
/frontend/src/js/utils/onboardingManager.tsx
1
// Copyright 2019 Northern.tech AS
2✔
2
//
2✔
3
//    Licensed under the Apache License, Version 2.0 (the "License");
2✔
4
//    you may not use this file except in compliance with the License.
2✔
5
//    You may obtain a copy of the License at
2✔
6
//
2✔
7
//        http://www.apache.org/licenses/LICENSE-2.0
2✔
8
//
2✔
9
//    Unless required by applicable law or agreed to in writing, software
2✔
10
//    distributed under the License is distributed on an "AS IS" BASIS,
2✔
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2✔
12
//    See the License for the specific language governing permissions and
2✔
13
//    limitations under the License.
2✔
14
import React from 'react';
2✔
15

2✔
16
import { DEPLOYMENT_STATES, onboardingSteps as stepNames, yes } from '@northern.tech/store/constants';
2✔
17

2✔
18
import BaseOnboardingTip from '../components/helptips/BaseOnoardingTip';
2✔
19
import OnboardingCompleteTip from '../components/helptips/OnboardingCompleteTip';
2✔
20
import {
2✔
21
  DashboardOnboardingPendings,
2✔
22
  DashboardOnboardingState,
2✔
23
  DeploymentUploadFinished,
2✔
24
  DeploymentsInprogress,
2✔
25
  DeploymentsPast,
2✔
26
  DeploymentsPastCompletedFailure,
2✔
27
  DevicePendingTip,
2✔
28
  DevicesAcceptedOnboarding,
2✔
29
  DevicesDeployReleaseOnboarding,
2✔
30
  DevicesDeployReleaseOnboardingStep2,
2✔
31
  DevicesPendingAcceptingOnboarding,
2✔
32
  DevicesPendingDelayed,
2✔
33
  GetStartedTip,
2✔
34
  SchedulingAllDevicesSelection,
2✔
35
  SchedulingArtifactSelection,
2✔
36
  SchedulingGroupSelection,
2✔
37
  SchedulingReleaseToDevices
2✔
38
} from '../components/helptips/OnboardingTips';
2✔
39

2✔
40
export const onboardingSteps = {
22✔
41
  [stepNames.DASHBOARD_ONBOARDING_START]: {
2✔
42
    specialComponent: <GetStartedTip />
2✔
43
  },
2✔
44
  [stepNames.DEVICES_PENDING_ONBOARDING_START]: {
2✔
45
    condition: { min: stepNames.DASHBOARD_ONBOARDING_START, max: stepNames.DEVICES_PENDING_ONBOARDING },
2✔
46
    fallbackStep: stepNames.DASHBOARD_ONBOARDING_START,
2✔
47
    specialComponent: <DevicePendingTip />
2✔
48
  },
2✔
49
  [stepNames.DEVICES_DELAYED_ONBOARDING]: {
2✔
50
    condition: { min: stepNames.DASHBOARD_ONBOARDING_START },
2✔
51
    component: DevicesPendingDelayed,
2✔
52
    fallbackStep: stepNames.DASHBOARD_ONBOARDING_START,
2✔
53
    extra: ({ deviceConnection }) => {
2✔
54
      const now = new Date();
2✔
55
      const then = new Date(deviceConnection);
2✔
56
      then.setMinutes(then.getMinutes() + 5);
2✔
57
      return !!deviceConnection && then < now;
2!
58
    }
2✔
59
  },
2✔
60
  [stepNames.DEVICES_PENDING_ONBOARDING]: {
2✔
61
    condition: { min: stepNames.DASHBOARD_ONBOARDING_START },
2✔
62
    component: DashboardOnboardingState,
2✔
63
    fallbackStep: stepNames.DASHBOARD_ONBOARDING_START
2✔
64
  },
2✔
65
  [stepNames.DEVICES_PENDING_ACCEPTING_ONBOARDING]: {
2✔
66
    condition: { min: stepNames.DEVICES_PENDING_ONBOARDING, max: stepNames.DEVICES_ACCEPTED_ONBOARDING },
2✔
67
    component: DevicesPendingAcceptingOnboarding
2✔
68
  },
2✔
69
  [stepNames.DASHBOARD_ONBOARDING_PENDINGS]: {
2✔
70
    condition: { min: stepNames.DEVICES_PENDING_ONBOARDING },
2✔
71
    component: DashboardOnboardingPendings
2✔
72
  },
2✔
73
  [stepNames.DEVICES_ACCEPTED_ONBOARDING]: {
2✔
74
    condition: { min: stepNames.DASHBOARD_ONBOARDING_PENDINGS },
2✔
75
    specialComponent: <DevicesAcceptedOnboarding />
2✔
76
  },
2✔
77
  [stepNames.DEVICES_DEPLOY_RELEASE_ONBOARDING]: {
2✔
78
    condition: {},
2✔
79
    component: DevicesDeployReleaseOnboarding
2✔
80
  },
2✔
81
  [stepNames.DEVICES_DEPLOY_RELEASE_ONBOARDING_STEP_2]: {
2✔
82
    condition: {},
2✔
83
    component: DevicesDeployReleaseOnboardingStep2
2✔
84
  },
2✔
85
  [stepNames.SCHEDULING_ALL_DEVICES_SELECTION]: {
2✔
86
    condition: { min: stepNames.DEVICES_ACCEPTED_ONBOARDING, max: stepNames.DEPLOYMENTS_INPROGRESS },
2✔
87
    component: SchedulingAllDevicesSelection
2✔
88
  },
2✔
89
  [stepNames.SCHEDULING_GROUP_SELECTION]: {
2✔
90
    condition: { min: stepNames.DEVICES_ACCEPTED_ONBOARDING, max: stepNames.DEPLOYMENTS_INPROGRESS },
2✔
91
    component: SchedulingGroupSelection
2✔
92
  },
2✔
93
  [stepNames.SCHEDULING_ARTIFACT_SELECTION]: {
2✔
94
    condition: { min: stepNames.SCHEDULING_ALL_DEVICES_SELECTION, max: stepNames.DEPLOYMENTS_INPROGRESS },
2✔
95
    component: SchedulingArtifactSelection
2✔
96
  },
2✔
97
  [stepNames.SCHEDULING_RELEASE_TO_DEVICES]: {
2✔
98
    condition: { min: stepNames.SCHEDULING_ARTIFACT_SELECTION, max: stepNames.DEPLOYMENTS_INPROGRESS },
2✔
99
    component: SchedulingReleaseToDevices
2✔
100
  },
2✔
101
  [stepNames.DEPLOYMENTS_INPROGRESS]: {
2✔
102
    condition: {},
2✔
103
    component: DeploymentsInprogress
2✔
104
  },
2✔
105
  [stepNames.DEPLOYMENTS_COMPLETED]: {
2✔
106
    condition: {},
2✔
107
    component: DeploymentUploadFinished
2✔
108
  },
2✔
109
  [stepNames.DEPLOYMENTS_PAST]: {
2✔
UNCOV
110
    condition: { min: stepNames.DEPLOYMENTS_INPROGRESS, extra: () => !window.location.pathname.includes(DEPLOYMENT_STATES.finished) },
2✔
111
    component: DeploymentsPast
2✔
112
  },
2✔
113
  [stepNames.DEPLOYMENTS_PAST_COMPLETED]: {
2✔
114
    condition: { max: stepNames.DEPLOYMENTS_PAST_COMPLETED_FAILURE },
2✔
115
    specialComponent: <OnboardingCompleteTip targetUrl="destination-unreachable" />
2✔
116
  },
2✔
117
  [stepNames.DEPLOYMENTS_PAST_COMPLETED_FAILURE]: {
2✔
118
    condition: { max: stepNames.ONBOARDING_CANCELED },
2✔
119
    component: DeploymentsPastCompletedFailure
2✔
120
  },
2✔
121
  [stepNames.ONBOARDING_CANCELED]: {
2✔
122
    condition: {},
2✔
123
    specialComponent: <div />
2✔
124
  }
2✔
125
};
2✔
126

2✔
127
const getOnboardingStepCompleted = (id, onboardingState) => {
22✔
128
  const { progress, complete, showTips } = onboardingState;
864✔
129
  const keys = Object.keys(onboardingSteps);
864✔
130
  const {
2✔
131
    condition: { min = id, max = id },
2✔
132
    extra,
2✔
133
    progressIndex
2✔
134
  } = Object.entries(onboardingSteps).reduce(
864✔
135
    (accu, [key, value], index) => {
2✔
136
      accu = key === id ? { ...accu, ...value } : accu;
16,380✔
137
      accu.progressIndex = key === progress ? index : accu.progressIndex;
16,380✔
138
      return accu;
16,380✔
139
    },
2✔
140
    { progressIndex: 0, extra: yes, condition: { min: id, max: id } }
2✔
141
  );
2✔
142
  return (
864✔
143
    !complete &&
2!
144
    showTips &&
2✔
145
    progressIndex >= keys.findIndex(step => step === min) &&
2✔
146
    progressIndex <= keys.findIndex(step => step === max) &&
2✔
147
    extra(onboardingState)
2✔
148
  );
2✔
149
};
2✔
150

2✔
151
export const getOnboardingComponentFor = (id, componentProps, params = {}, previousComponent = null) => {
22✔
152
  const step = onboardingSteps[id];
864✔
153
  const isValid = getOnboardingStepCompleted(id, componentProps);
864✔
154
  if (!isValid) {
864!
155
    return previousComponent;
864✔
156
  }
2✔
157
  if (step.specialComponent) {
2!
158
    return React.cloneElement(step.specialComponent, params);
2✔
159
  }
2✔
160
  const component = step.component(componentProps);
2✔
UNCOV
161
  return <BaseOnboardingTip id={id} component={component} progress={step.progress || params.progress || null} {...params} />;
2!
162
};
2✔
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