• 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

69.49
/src/js/components/deployments/deployment-report/overview.js
1
// Copyright 2020 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
import { Link } from 'react-router-dom';
16

17
import { Launch as LaunchIcon, ArrowDropDownCircleOutlined as ScrollDownIcon } from '@mui/icons-material';
18
import { Chip } from '@mui/material';
19
import { makeStyles } from 'tss-react/mui';
20

21
import pluralize from 'pluralize';
22
import isUUID from 'validator/lib/isUUID';
23

24
import failImage from '../../../../assets/img/largeFail.png';
25
import successImage from '../../../../assets/img/largeSuccess.png';
26
import { DEPLOYMENT_STATES, DEPLOYMENT_TYPES } from '../../../constants/deploymentConstants';
27
import { groupDeploymentStats, isEmpty } from '../../../helpers';
28
import { TwoColumnData } from '../../common/configurationobject';
29
import DeviceIdentityDisplay from '../../common/deviceidentity';
30
import Time from '../../common/time';
31
import { getDevicesLink } from '../deployment-wizard/softwaredevices';
32
import { defaultColumnDataProps } from '../report';
33

34
const useStyles = makeStyles()(theme => ({
11✔
35
  chip: {
36
    opacity: 0.5,
37
    fontSize: '0.675rem',
38
    height: 18
39
  },
40
  scheduleLink: {
41
    marginLeft: theme.spacing(12),
42
    '&svg': {
43
      marginLeft: theme.spacing()
44
    }
45
  },
46
  statusWrapper: {
47
    backgroundColor: theme.palette.background.lightgrey,
48
    ['&:after']: {
49
      borderRight: '20px solid',
50
      borderRightColor: theme.palette.background.lightgrey
51
    }
52
  }
53
}));
54

55
const defaultLinkProps = {
11✔
56
  className: 'flexbox centered',
57
  style: { fontWeight: '500' },
58
  target: '_blank',
59
  rel: 'noopener noreferrer'
60
};
61

62
export const DeploymentOverview = ({ creator, deployment, devicesById, onScheduleClick, tenantCapabilities }) => {
11✔
63
  const { classes } = useStyles();
5✔
64
  const {
65
    artifact_name,
66
    created: creationTime = new Date().toISOString(),
2✔
67
    devices = {},
2✔
68
    filter,
69
    group,
70
    name = '',
2✔
71
    status,
72
    totalDeviceCount,
73
    type = DEPLOYMENT_TYPES.software
5✔
74
  } = deployment;
5✔
75
  const { failures, successes } = groupDeploymentStats(deployment);
5✔
76
  const finished = deployment.finished || status === DEPLOYMENT_STATES.finished;
5✔
77
  const isDeviceDeployment = isUUID(name) && (isEmpty(devices) || Object.keys(devices).length === 1);
5!
78
  const isSoftwareDeployment = type === DEPLOYMENT_TYPES.software;
5✔
79
  const { hasFullFiltering } = tenantCapabilities;
5✔
80

81
  let deploymentRelease = (
82
    <Link {...defaultLinkProps} to={`/releases/${encodeURIComponent(artifact_name)}`}>
5✔
83
      {artifact_name}
84
      <LaunchIcon className="margin-left-small" fontSize="small" />
85
    </Link>
86
  );
87

88
  const devicesLink = getDevicesLink({ devices: Object.values(devices), group, hasFullFiltering, name });
5✔
89
  let targetDevices = (
90
    <Link {...defaultLinkProps} to={devicesLink}>
5✔
91
      {isDeviceDeployment && devicesById[name] ? (
10!
92
        <DeviceIdentityDisplay device={devicesById[name]} isEditable={false} />
93
      ) : isUUID(name) ? (
5!
94
        Object.keys(devices).join(', ')
95
      ) : (
96
        name
97
      )}
98
      <LaunchIcon className="margin-left-small" fontSize="small" />
99
      <Chip className={`margin-left uppercased ${classes.chip}`} label={filter ? 'dynamic' : 'static'} size="small" />
5!
100
    </Link>
101
  );
102

103
  if (!isSoftwareDeployment) {
5!
104
    deploymentRelease = type;
×
105
    targetDevices = Object.keys(devices).join(', ') || name;
×
106
  }
107

108
  const deploymentInfo = {
5✔
109
    'Release': deploymentRelease,
110
    'Target device(s)': targetDevices,
111
    'Category': isSoftwareDeployment ? 'Software update' : 'Configuration'
5!
112
  };
113
  const createdBy = creator ? { 'Created by': creator } : {};
5!
114
  const deploymentInfo2 = {
5✔
115
    ...createdBy,
116
    'Created at': <Time value={creationTime} />
117
  };
118

119
  return (
5✔
120
    <div className="report-container margin-top-large margin-bottom-large">
121
      <TwoColumnData config={deploymentInfo} {...defaultColumnDataProps} />
122
      <div className="flexbox column">
123
        <TwoColumnData config={deploymentInfo2} {...defaultColumnDataProps} />
124
        <a className={`margin-top-small flexbox center-aligned ${classes.scheduleLink}`} onClick={onScheduleClick}>
125
          Schedule details <ScrollDownIcon fontSize="small" />
126
        </a>
127
      </div>
128

129
      {finished && (
6✔
130
        <div className="statusLarge flexbox centered">
131
          <img src={successes ? successImage : failImage} />
1!
132
          <div className={`statusWrapper flexbox centered ${classes.statusWrapper}`}>
133
            <div className="statusWrapperMessage">
134
              {(!!successes || !failures) && (
3✔
135
                <>
136
                  <b className={successes ? 'green' : 'red'}>
1!
137
                    {successes === totalDeviceCount && totalDeviceCount > 1 && <>All </>}
1!
138
                    {successes}
139
                  </b>{' '}
140
                  {pluralize('devices', successes)} updated successfully
141
                </>
142
              )}
143
              {!!failures && (
1!
144
                <>
145
                  <b className="red">{failures}</b> {pluralize('devices', failures)} failed to update
146
                </>
147
              )}
148
            </div>
149
          </div>
150
        </div>
151
      )}
152
    </div>
153
  );
154
};
155

156
export default DeploymentOverview;
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