• 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

67.27
/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 || {};
21✔
49
  let content = { title: 'Entry details', content: FallbackComponent };
21✔
50
  if (type === changeTypes.user) {
21✔
51
    content = { title: `${item.action}d user`, content: UserChange };
1✔
52
  } else if (type === changeTypes.device && item.action.includes('terminal')) {
20✔
53
    content = { title: 'Remote session log', content: TerminalSession };
2✔
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;
21✔
64
};
65

66
export const EventDetailsDrawer = ({ eventItem = {}, onClose, open }) => {
6✔
67
  const theme = useTheme();
21✔
68
  const { title, content: Component } = mapChangeToContent(eventItem);
21✔
69
  return (
21✔
70
    <Drawer className={`${open ? 'fadeIn' : 'fadeOut'}`} anchor="right" open={open} onClose={onClose}>
21✔
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