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

mendersoftware / gui / 897326496

pending completion
897326496

Pull #3752

gitlab-ci

mzedel
chore(e2e): made use of shared timeout & login checking values to remove code duplication

Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3752: chore(e2e-tests): slightly simplified log in test + separated log out test

4395 of 6392 branches covered (68.76%)

8060 of 9780 relevant lines covered (82.41%)

126.17 hits per line

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

63.33
/src/js/components/auditlogs/eventdetails/deviceconfiguration.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, { useEffect } from 'react';
15
import { connect } from 'react-redux';
16

17
import { useTheme } from '@mui/material/styles';
18

19
import { getDeviceById } from '../../../actions/deviceActions';
20
import { getIdAttribute, getUserCapabilities } from '../../../selectors';
21
import Loader from '../../common/loader';
22
import DeviceDetails, { DetailInformation } from './devicedetails';
23

24
export const DeviceConfiguration = ({ canReadDevices, device, idAttribute, item, getDeviceById, onClose }) => {
7✔
25
  const theme = useTheme();
1✔
26
  useEffect(() => {
1✔
27
    const { object } = item;
1✔
28
    if (!device && canReadDevices) {
1!
29
      getDeviceById(object.id);
×
30
    }
31
  }, []);
32

33
  if (canReadDevices && !device) {
1!
34
    return <Loader show={true} />;
×
35
  }
36

37
  const { actor, change } = item;
1✔
38

39
  let config;
40
  try {
1✔
41
    config = JSON.parse(change);
1✔
42
  } catch (error) {
43
    config = { error: `An error occurred processing the changed config:\n${error}` };
×
44
  }
45

46
  return (
1✔
47
    <div className="flexbox column" style={{ margin: theme.spacing(3), minWidth: 'min-content' }}>
48
      {canReadDevices && <DeviceDetails device={device} idAttribute={idAttribute} onClose={onClose} />}
2✔
49
      <DetailInformation title="changed configuration" details={config} />
50
      <DetailInformation title="change" details={{ User: actor.email }} />
51
    </div>
52
  );
53
};
54

55
const actionCreators = { getDeviceById };
7✔
56

57
const mapStateToProps = (state, ownProps) => {
7✔
58
  const { item = {} } = ownProps;
×
59
  const deviceId = item.object.id;
×
60
  const { canReadDevices } = getUserCapabilities(state);
×
61
  return {
×
62
    canReadDevices,
63
    device: state.devices.byId[deviceId],
64
    idAttribute: getIdAttribute(state).attribute
65
  };
66
};
67

68
export default connect(mapStateToProps, actionCreators)(DeviceConfiguration);
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