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

mendersoftware / gui / 951400782

pending completion
951400782

Pull #3900

gitlab-ci

web-flow
chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 5.17.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v5.17.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #3900: chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0

4446 of 6414 branches covered (69.32%)

8342 of 10084 relevant lines covered (82.73%)

186.0 hits per line

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

88.46
/src/js/components/deployments/deployment-wizard/rolloutsteps.js
1
// Copyright 2021 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 from 'react';
15

16
import { Add as AddIcon, ArrowRight as ArrowRightIcon, PauseCircleOutline as PauseIcon } from '@mui/icons-material';
17
import { Chip } from '@mui/material';
18
import { makeStyles } from 'tss-react/mui';
19

20
import { TIMEOUTS } from '../../../constants/appConstants';
21
import DocsLink from '../../common/docslink';
22
import InfoHint from '../../common/info-hint';
23
import InfoText from '../../common/infotext';
24
import MenderTooltip from '../../common/mendertooltip';
25

26
const useStyles = makeStyles()(theme => ({
32✔
27
  chip: { marginLeft: theme.spacing(-3), marginRight: theme.spacing(-3) },
28
  connector: {
29
    backgroundColor: theme.palette.text.secondary,
30
    height: 3,
31
    width: '100%',
32
    marginRight: theme.spacing(-1),
33
    '& svg': { color: theme.palette.text.secondary }
34
  },
35
  connectorArrowWrapper: { height: theme.spacing(4), paddingLeft: theme.spacing(), width: '100%' },
36
  connectorWrapper: { minWidth: 120 },
37
  pauseConnector: { borderLeft: `${theme.palette.grey[500]} dashed 1px`, height: theme.spacing(6), margin: 4, marginTop: -10 },
38
  stepChip: { minWidth: theme.spacing(11) }
39
}));
40

41
const stepActions = {
13✔
42
  continue: 'continue',
43
  force_continue: 'force_continue',
44
  pause: 'pause',
45
  fail: 'fail'
46
};
47

48
const defaultStep = { action: stepActions.continue };
13✔
49

50
const defaultSteps = {
13✔
51
  ArtifactDownload: { ...defaultStep, title: 'Download', tooltip: 'The Artifact is downloaded (streamed) to the inactive partition.' },
52
  ArtifactInstall_Enter: {
53
    ...defaultStep,
54
    title: 'Install',
55
    tooltip: (
56
      <>
57
        For <b>operating system updates</b>, this means switching the <i>inactive</i> partition on the device to be <i>active</i> next time the device reboots.
58
        This means that on the next reboot the device will boot the updated software, regardless if it was rebooted by Mender, an external process or due to
59
        power loss.
60
        <br />
61
        For <b>application updates</b>, it depends on the Update Module but in general refers to the <i>system changing</i> effects; e.g. writing a file to its
62
        location, running a script, installing or starting a container.
63
      </>
64
    ),
65
    state: 'ArtifactInstall_Enter'
66
  },
67
  ArtifactReboot_Enter: {
68
    ...defaultStep,
69
    title: 'Reboot',
70
    tooltip:
71
      'The device will reboot and the installed update will be active when the device boots up again. As changes are not yet committed, the update is not persistent and the device will still roll back again on the next reboot.',
72
    state: 'ArtifactReboot_Enter'
73
  },
74
  ArtifactCommit_Enter: {
75
    ...defaultStep,
76
    title: 'Commit',
77
    tooltip:
78
      'If the update passes integrity checks, Mender will mark the update as successful and continue running from this partition. The commit makes the update persistent.',
79
    state: 'ArtifactCommit_Enter'
80
  }
81
};
82

83
const menderDemoArtifactName = 'mender-demo-artifact';
13✔
84

85
export const RolloutStepConnector = ({ disabled, step, onStepChange, release = {} }) => {
13✔
86
  const { classes } = useStyles();
729✔
87
  const onTogglePauseClick = () => {
729✔
88
    onStepChange({ ...step, action: step.action === stepActions.pause ? stepActions.continue : stepActions.pause });
×
89
  };
90

91
  let stepModifier = { props: {}, toggleButton: undefined };
729✔
92
  if (onStepChange) {
729✔
93
    stepModifier.props = { onDelete: onTogglePauseClick };
726✔
94
    stepModifier.toggleButton = <Chip className={classes.chip} icon={<AddIcon />} label="Add a pause" color="primary" onClick={onTogglePauseClick} />;
726✔
95
  }
96

97
  const pauseChip = <Chip className={classes.chip} icon={<PauseIcon />} label="Pause" {...stepModifier.props} />;
729✔
98
  const stepPauseChip =
99
    step.state === defaultSteps.ArtifactReboot_Enter.state && release.Name?.includes(menderDemoArtifactName) ? (
729!
100
      <MenderTooltip
101
        arrow
102
        leaveDelay={TIMEOUTS.oneSecond}
103
        placement="top"
104
        title="The demo artifact you selected does not require a reboot and will not pause before starting with the next stage."
105
      >
106
        {pauseChip}
107
      </MenderTooltip>
108
    ) : (
109
      pauseChip
110
    );
111

112
  return (
729✔
113
    <div className={`flexbox column center-aligned ${classes.connectorWrapper}`}>
114
      <div className={`flexbox centered ${classes.connectorArrowWrapper}`}>
115
        <div className={classes.connector} />
116
        <ArrowRightIcon fontSize="small" />
117
      </div>
118
      {!disabled && (
1,095✔
119
        <>
120
          {(onStepChange || step.action === stepActions.pause) && <div className={classes.pauseConnector} />}
732✔
121
          {step.action === stepActions.pause ? stepPauseChip : stepModifier.toggleButton}
366!
122
        </>
123
      )}
124
    </div>
125
  );
126
};
127

128
export const RolloutSteps = ({ disabled, onStepChange, release, steps = {} }) => {
13!
129
  const { classes } = useStyles();
243✔
130
  const mappableSteps = Object.entries(defaultSteps).reduce((accu, [key, step]) => [...accu, { ...step, ...steps[key] }], []);
972✔
131

132
  return (
243✔
133
    <div className={`flexbox margin-top ${onStepChange ? 'margin-left-large margin-right-large' : ''}`}>
243✔
134
      {mappableSteps.map((step, index) => (
135
        <React.Fragment key={step.title}>
972✔
136
          {index !== 0 && <RolloutStepConnector disabled={disabled} step={step} onStepChange={onStepChange} release={release} />}
1,701✔
137
          <MenderTooltip title={step.tooltip} arrow>
138
            <Chip className={classes.stepChip} disabled={disabled} label={step.title} variant="outlined" />
139
          </MenderTooltip>
140
        </React.Fragment>
141
      ))}
142
    </div>
143
  );
144
};
145

146
export const RolloutStepsContainer = ({ className = '', disabled, onStepChange, release, steps }) => (
13✔
147
  <div className={className}>
243✔
148
    <div className={disabled ? 'muted' : ''}>
243✔
149
      <RolloutSteps disabled={disabled} onStepChange={onStepChange} release={release} steps={steps} />
150
      {onStepChange && !disabled && (
606✔
151
        <InfoText>
152
          A &apos;pause&apos; means each device will pause its update after completing the previous step, and wait for approval before continuing. You can grant
153
          approval by clicking &quot;continue&quot; in the deployment progress UI. <DocsLink path="" title="Learn more" />
154
        </InfoText>
155
      )}
156
    </div>
157
    {disabled && (
364✔
158
      <InfoHint
159
        content={
160
          <>
161
            This feature is not available on <b>phased deployments</b>. If you&apos;d like to set pause states between update steps, go back and adjust the
162
            rollout schedule to a <b>single phase</b>.
163
          </>
164
        }
165
      />
166
    )}
167
  </div>
168
);
169

170
export default RolloutStepsContainer;
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