• 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

95.0
/src/js/components/uploads.js
1
// Copyright 2022 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, { useCallback, useState } from 'react';
15
import { useDispatch, useSelector } from 'react-redux';
16

17
import { Cancel as CancelIcon } from '@mui/icons-material';
18
import { Drawer, IconButton, LinearProgress, Tooltip, drawerClasses } from '@mui/material';
19
import { makeStyles } from 'tss-react/mui';
20

21
import pluralize from 'pluralize';
22

23
import { cancelFileUpload } from '../actions/releaseActions';
24
import { FileSize } from '../helpers';
25

26
const useStyles = makeStyles()(theme => ({
29✔
27
  progress: {
28
    backgroundColor: theme.palette.grey[600],
29
    gridColumn: 1,
30
    margin: '15px 0'
31
  },
32
  drawer: {
33
    [`.${drawerClasses.paper}`]: {
34
      maxWidth: 'initial'
35
    }
36
  },
37
  progressBarContainer: {
38
    position: 'fixed',
39
    display: 'grid',
40
    bottom: 0,
41
    gridTemplateRows: 'min-content',
42
    height: 'max-content',
43
    padding: `0 ${theme.spacing(2)}px`,
44
    overflow: 'hidden',
45
    width: '100%',
46
    zIindex: 10000,
47
    transition: 'all 0.2s ease-in-out'
48
  },
49
  progressContainer: {
50
    backgroundColor: theme.palette.background.default,
51
    borderColor: theme.palette.grey[300],
52
    color: theme.palette.grey[600],
53
    display: 'grid',
54
    gridTemplateRows: '30px 30px',
55
    gridTemplateColumns: '1fr 60px',
56
    columnGap: theme.spacing(2),
57
    ['> .MuiIconButton-root']: {
58
      gridColumn: 2,
59
      gridRowStart: 1,
60
      gridRowEnd: 2,
61
      height: 60
62
    }
63
  }
64
}));
65

66
const UploadProgressBar = ({ classes, upload, uploadId }) => {
3✔
67
  const { name, size, uploadProgress } = upload;
1✔
68
  const dispatch = useDispatch();
1✔
69
  const onCancelClick = useCallback(() => dispatch(cancelFileUpload(uploadId)), [dispatch, uploadId]);
1✔
70
  return (
1✔
71
    <div className={classes.progressContainer}>
72
      <div className="info flexbox centered">
73
        {Math.round(uploadProgress)}% - {name} (<FileSize fileSize={size} />)
74
      </div>
75
      <LinearProgress className={classes.progress} variant="determinate" value={uploadProgress} />
76
      <Tooltip title="Abort" placement="top">
77
        <IconButton onClick={onCancelClick} size="large">
78
          <CancelIcon />
79
        </IconButton>
80
      </Tooltip>
81
    </div>
82
  );
83
};
84

85
const Uploads = () => {
3✔
86
  const [isHovering, setIsHovering] = useState(false);
30✔
87
  const { classes } = useStyles();
30✔
88

89
  const uploads = useSelector(state => state.app.uploadsById);
1,135✔
90

91
  const isUploading = !!Object.keys(uploads).length;
30✔
92
  const uploadProgress = Object.values(uploads).reduce((accu, item, currentIndex, items) => {
30✔
93
    accu += item.uploadProgress;
2✔
94
    if (currentIndex === items.length - 1) {
2!
95
      return accu / (currentIndex + 1);
2✔
96
    }
97
    return accu;
×
98
  }, 0);
99

100
  const onClose = () => setIsHovering(false);
30✔
101
  const onMouseOver = () => setIsHovering(true);
30✔
102

103
  return (
30✔
104
    <div className={classes.progressBarContainer} onMouseEnter={onMouseOver}>
105
      {isUploading && !isHovering && <LinearProgress className={classes.progress} variant="determinate" value={uploadProgress} />}
33✔
106
      <Drawer anchor="bottom" className={classes.drawer} open={isUploading && isHovering} onClose={onClose}>
32✔
107
        <h3>{pluralize('Upload', Object.keys(uploads).length)} in progress</h3>
108
        {Object.entries(uploads).map(([uploadId, upload]) => (
109
          <UploadProgressBar classes={classes} key={uploadId} upload={upload} uploadId={uploadId} />
2✔
110
        ))}
111
      </Drawer>
112
    </div>
113
  );
114
};
115

116
export default Uploads;
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