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

mendersoftware / gui / 1057188406

01 Nov 2023 04:24AM UTC coverage: 82.824% (-17.1%) from 99.964%
1057188406

Pull #4134

gitlab-ci

web-flow
chore: Bump uuid from 9.0.0 to 9.0.1

Bumps [uuid](https://github.com/uuidjs/uuid) from 9.0.0 to 9.0.1.
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #4134: chore: Bump uuid from 9.0.0 to 9.0.1

4349 of 6284 branches covered (0.0%)

8313 of 10037 relevant lines covered (82.82%)

200.97 hits per line

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

97.37
/src/js/components/deployments/deploymentitem.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, { useState } from 'react';
15

16
// material ui
17
import { CancelOutlined as CancelOutlinedIcon } from '@mui/icons-material';
18
import { Button, IconButton, Tooltip } from '@mui/material';
19
import { makeStyles } from 'tss-react/mui';
20

21
import { DEPLOYMENT_STATES, DEPLOYMENT_TYPES } from '../../constants/deploymentConstants';
22
import { FileSize, getDeploymentState } from '../../helpers';
23
import { useDeploymentDevice } from '../../utils/deploymentdevicehook';
24
import Confirm from '../common/confirm';
25
import { RelativeTime } from '../common/time';
26
import { PhaseProgressDisplay } from './deployment-report/phaseprogress';
27
import { getDeploymentTargetText } from './deployment-wizard/softwaredevices';
28
import DeploymentStats from './deploymentstatus';
29
import ProgressDisplay, { DeploymentStatusNotification } from './progressChart';
30

31
export const deploymentTypeClasses = {
12✔
32
  [DEPLOYMENT_STATES.finished]: 'past-item',
33
  [DEPLOYMENT_STATES.pending]: 'pending-item',
34
  [DEPLOYMENT_STATES.inprogress]: 'progress-item',
35
  [DEPLOYMENT_STATES.scheduled]: 'scheduled-item'
36
};
37

38
export const DeploymentDeviceCount = ({ className, deployment }) => (
12✔
39
  <div className={className} key="DeploymentDeviceCount">
1,123✔
40
    {Math.max(deployment.device_count || 0, deployment.max_devices || 0)}
3,376✔
41
  </div>
42
);
43
export const DeploymentDeviceGroup = ({ deployment, devicesById, idAttribute, wrappingClass }) => {
12✔
44
  const deploymentName = getDeploymentTargetText({ deployment, devicesById, idAttribute });
3,895✔
45
  return (
3,895✔
46
    <div className={wrappingClass} key="DeploymentDeviceGroup" title={deploymentName}>
47
      {deploymentName}
48
    </div>
49
  );
50
};
51
export const DeploymentEndTime = ({ deployment }) => <RelativeTime key="DeploymentEndTime" updateTime={deployment.finished} shouldCount="none" />;
1,123✔
52
export const DeploymentPhases = ({ deployment }) => <div key="DeploymentPhases">{deployment.phases ? deployment.phases.length : '-'}</div>;
12!
53
export const DeploymentProgress = ({ deployment, minimal = false }) => {
12✔
54
  const { phases = [], update_control_map } = deployment;
1,965✔
55
  const status = getDeploymentState(deployment);
1,965✔
56
  if (status === 'queued') {
1,965✔
57
    return <DeploymentStatusNotification status={status} />;
979✔
58
  } else if (phases.length > 1 || !update_control_map) {
986!
59
    return <ProgressDisplay key="DeploymentProgress" deployment={deployment} status={status} minimal={minimal} />;
986✔
60
  }
61
  return <PhaseProgressDisplay key="DeploymentProgress" deployment={deployment} status={status} minimal={minimal} />;
×
62
};
63
export const DeploymentRelease = ({ deployment: { artifact_name, type = DEPLOYMENT_TYPES.software }, wrappingClass }) => {
12✔
64
  const deploymentRelease = type === DEPLOYMENT_TYPES.configuration ? type : artifact_name;
1,123!
65
  return (
1,123✔
66
    <div className={wrappingClass} key="DeploymentRelease" title={deploymentRelease}>
67
      {deploymentRelease}
68
    </div>
69
  );
70
};
71
export const DeploymentStartTime = ({ direction = 'both', started }) => <RelativeTime key="DeploymentStartTime" updateTime={started} shouldCount={direction} />;
1,123✔
72

73
export const DeploymentStatus = ({ deployment }) => <DeploymentStats key="DeploymentStatus" deployment={deployment} />;
80✔
74

75
export const DeploymentSize = ({ deployment: { total_size } }) => <div className="align-right">{total_size ? <FileSize fileSize={total_size} /> : '-'}</div>;
80!
76

77
const useStyles = makeStyles()(theme => ({
34✔
78
  detailsButton: {
79
    backgroundColor: 'transparent',
80
    color: theme.palette.text.primary,
81
    justifySelf: 'center',
82
    textTransform: 'none',
83
    [`&:hover`]: {
84
      backgroundColor: 'transparent',
85
      color: theme.palette.text.primary
86
    }
87
  },
88
  textWrapping: { whiteSpace: 'initial' }
89
}));
90

91
export const DeploymentItem = ({
12✔
92
  abort: abortDeployment,
93
  canConfigure,
94
  canDeploy,
95
  columnHeaders,
96
  deployment,
97
  devices,
98
  idAttribute,
99
  isEnterprise,
100
  openReport,
101
  type
102
}) => {
103
  const [abort, setAbort] = useState(null);
1,123✔
104
  useDeploymentDevice(deployment.name);
1,123✔
105

106
  const { classes } = useStyles();
1,123✔
107

108
  const toggleConfirm = id => setTimeout(() => setAbort(abort ? null : id), 150);
1,123✔
109

110
  const { created, id, phases } = deployment;
1,123✔
111

112
  let confirmation;
113
  if (abort === id) {
1,123✔
114
    confirmation = <Confirm classes="flexbox centered confirmation-overlay" cancel={() => toggleConfirm(id)} action={() => abortDeployment(id)} type="abort" />;
6✔
115
  }
116
  const started = isEnterprise && phases?.length >= 1 ? phases[0].start_ts || created : created;
1,123✔
117
  const wrappingClass = `text-overflow ${type === DEPLOYMENT_STATES.inprogress ? classes.textWrapping : ''}`;
1,123✔
118
  return (
1,123✔
119
    <div className={`deployment-item ${deploymentTypeClasses[type]}`}>
120
      {!!confirmation && confirmation}
1,129✔
121
      {columnHeaders.map((column, i) => {
122
        const ColumnComponent = column.renderer;
6,818✔
123
        return (
6,818✔
124
          <div className={column.class} key={`deploy-item-${i}`}>
125
            {column.title && <span className="deployment-item-title muted">{column.title}</span>}
13,636✔
126
            <ColumnComponent
127
              className={column.class || ''}
12,513✔
128
              idAttribute={idAttribute}
129
              deployment={deployment}
130
              devicesById={devices}
131
              started={started}
132
              wrappingClass={wrappingClass}
133
              {...column.props}
134
            />
135
          </div>
136
        );
137
      })}
138
      <Button className={classes.detailsButton} variant="contained" onClick={() => openReport(type, deployment.id)}>
1✔
139
        View details
140
      </Button>
141
      {(canDeploy || (canConfigure && deployment.type === DEPLOYMENT_TYPES.configuration)) && type !== DEPLOYMENT_STATES.finished && (
3,286!
142
        <Tooltip className="columnHeader" title="Abort" placement="top-start">
143
          <IconButton onClick={() => toggleConfirm(id)} size="large">
1✔
144
            <CancelOutlinedIcon className="cancelButton muted" />
145
          </IconButton>
146
        </Tooltip>
147
      )}
148
    </div>
149
  );
150
};
151

152
export default DeploymentItem;
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