• 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

67.86
/src/js/components/auditlogs/eventdetailsdrawer.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 { HelpOutline as HelpOutlineIcon } from '@mui/icons-material';
17
import { Divider, Drawer } from '@mui/material';
18
import { useTheme } from '@mui/material/styles';
19

20
import { Code } from '../common/copy-code';
21
import DeviceConfiguration from './eventdetails/deviceconfiguration';
22
import FileTransfer from './eventdetails/filetransfer';
23
import PortForward from './eventdetails/portforward';
24
import TerminalSession from './eventdetails/terminalsession';
25
import UserChange from './eventdetails/userchange';
26

27
const FallbackComponent = ({ item }) => {
6✔
28
  let content = '';
×
29
  try {
×
30
    content = JSON.stringify(item, null, 2);
×
31
  } catch (error) {
32
    content = `error parsing the logged event:\n${error}`;
×
33
  }
34
  return <Code style={{ whiteSpace: 'pre' }}>{content}</Code>;
×
35
};
36

37
const changeTypes = {
6✔
38
  user: 'user',
39
  device: 'device'
40
};
41

42
const configChangeDescriptor = {
6✔
43
  set_configuration: 'definition',
44
  deploy_configuration: 'deployment'
45
};
46

47
const mapChangeToContent = item => {
6✔
48
  const { type } = item.object || {};
20✔
49
  let content = { title: 'Entry details', content: FallbackComponent };
20✔
50
  if (type === changeTypes.user) {
20✔
51
    content = { title: `${item.action}d user`, content: UserChange };
1✔
52
  } else if (type === changeTypes.device && item.action.includes('terminal')) {
19✔
53
    content = { title: 'Remote session log', content: TerminalSession };
1✔
54
  } else if (type === changeTypes.device && item.action.includes('file')) {
18!
55
    content = { title: 'File transfer', content: FileTransfer };
×
56
  } else if (type === changeTypes.device && item.action.includes('portforward')) {
18!
57
    content = { title: 'Port forward', content: PortForward };
×
58
  } else if (type === changeTypes.device && item.action.includes('configuration')) {
18!
59
    content = { title: `Device configuration ${configChangeDescriptor[item.action] || ''}`, content: DeviceConfiguration };
×
60
  } else if (type === changeTypes.device) {
18!
61
    content = { title: 'Device change', content: FallbackComponent };
×
62
  }
63
  return content;
20✔
64
};
65

66
export const EventDetailsDrawer = ({ eventItem = {}, onClose, open }) => {
6✔
67
  const theme = useTheme();
20✔
68
  const { title, content: Component } = mapChangeToContent(eventItem);
20✔
69
  return (
20✔
70
    <Drawer className={`${open ? 'fadeIn' : 'fadeOut'}`} anchor="right" open={open} onClose={onClose}>
20✔
71
      <div className="flexbox space-between margin-top-small margin-bottom">
72
        <b className="capitalized">{title}</b>
73
        <HelpOutlineIcon />
74
      </div>
75
      <Divider />
76
      <Component item={eventItem} onClose={onClose} />
77
      <Divider light style={{ marginTop: theme.spacing(2) }} />
78
    </Drawer>
79
  );
80
};
81

82
export default EventDetailsDrawer;
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