foreman_rh_cloud 14.2.0 → 14.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js +15 -6
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +1 -5
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +15 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +1 -5
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +2 -6
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +13 -10
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +30 -11
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +3 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +28 -22
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +4 -4
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +16 -3
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/MinimalInventoryDropdown.js +13 -14
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +7 -7
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +3 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +63 -46
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +4 -7
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageTitle.test.js +83 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +31 -38
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js +3 -1
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +29 -22
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/InventoryAutoUpload.test.js +6 -2
- data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js +6 -3
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +90 -23
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +1 -2
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +24 -30
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js +5 -6
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +193 -8
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableActions.test.js +4 -1
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js +8 -9
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +26 -13
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js +12 -10
- data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +21 -9
- data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +12 -19
- data/webpack/InsightsCloudSync/__tests__/InsightsCloudSyncActions.test.js +0 -1
- data/webpack/common/DropdownToggle.js +20 -6
- metadata +1 -44
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +0 -25
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +0 -17
- data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +0 -5
- data/webpack/ForemanInventoryUpload/Components/FileDownload/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +0 -20
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +0 -66
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +0 -69
- data/webpack/ForemanInventoryUpload/Components/NavContainer/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +0 -9
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +0 -4
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +0 -29
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +0 -33
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +0 -12
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +0 -13
- data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +0 -57
- data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +0 -30
- data/webpack/ForemanInventoryUpload/Components/StatusChart/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +0 -10
- data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js +0 -24
- data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +0 -15
- data/webpack/ForemanInventoryUpload/Components/TabContainer/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +0 -10
- data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js +0 -19
- data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +0 -15
- data/webpack/ForemanInventoryUpload/Components/TabFooter/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +0 -85
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +0 -114
- data/webpack/ForemanInventoryUpload/Components/TabHeader/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +0 -23
- data/webpack/common/Switcher/index.js +0 -80
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
-
import FileDownload from '../FileDownload';
|
|
4
|
-
|
|
5
|
-
describe('FileDownload', () => {
|
|
6
|
-
it('renders the download button', () => {
|
|
7
|
-
render(<FileDownload />);
|
|
8
|
-
expect(screen.getByRole('button', { name: /Download Report/ })).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('calls onClick when button is clicked', () => {
|
|
12
|
-
const onClick = jest.fn();
|
|
13
|
-
render(<FileDownload onClick={onClick} />);
|
|
14
|
-
fireEvent.click(screen.getByRole('button', { name: /Download Report/ }));
|
|
15
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './FileDownload';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { noop } from 'foremanReact/common/helpers';
|
|
3
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
4
|
-
|
|
5
|
-
export const props = {
|
|
6
|
-
items: [
|
|
7
|
-
{
|
|
8
|
-
icon: 'some-icon',
|
|
9
|
-
name: __('Generating'),
|
|
10
|
-
component: () => <p>test1</p>,
|
|
11
|
-
onClick: noop,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
icon: 'other-icon',
|
|
15
|
-
name: __('Uploading'),
|
|
16
|
-
component: () => <p>test2</p>,
|
|
17
|
-
onClick: noop,
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSelector } from 'react-redux';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
-
TabContainer,
|
|
6
|
-
Nav,
|
|
7
|
-
NavItem,
|
|
8
|
-
TabContent,
|
|
9
|
-
TabPane,
|
|
10
|
-
Icon,
|
|
11
|
-
} from 'patternfly-react';
|
|
12
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
13
|
-
import './navContainer.scss';
|
|
14
|
-
import { selectSubscriptionConnectionEnabled } from '../InventorySettings/InventorySettingsSelectors';
|
|
15
|
-
|
|
16
|
-
const NavContainer = ({ items }) => {
|
|
17
|
-
const subscriptionConnectionEnabled = useSelector(
|
|
18
|
-
selectSubscriptionConnectionEnabled
|
|
19
|
-
);
|
|
20
|
-
const navItems = items.map((item, index) => {
|
|
21
|
-
const { name, icon, onClick } = item;
|
|
22
|
-
if (name === __('Uploading') && !subscriptionConnectionEnabled) return null;
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<NavItem
|
|
26
|
-
key={index}
|
|
27
|
-
eventKey={index}
|
|
28
|
-
onClick={onClick}
|
|
29
|
-
className="nav_item"
|
|
30
|
-
>
|
|
31
|
-
<Icon name={icon} size="2x" />
|
|
32
|
-
<p>{name}</p>
|
|
33
|
-
</NavItem>
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
const tabComponents = items.map(({ component: Component, props }, index) => (
|
|
37
|
-
<TabPane key={index} eventKey={index}>
|
|
38
|
-
<Component {...props} />
|
|
39
|
-
</TabPane>
|
|
40
|
-
));
|
|
41
|
-
return (
|
|
42
|
-
<TabContainer id="basic-tabs-pf" defaultActiveKey={0}>
|
|
43
|
-
<div className="dashboard">
|
|
44
|
-
<Nav bsClass="nav nav-tabs nav-tabs-pf">{navItems}</Nav>
|
|
45
|
-
<TabContent animation>{tabComponents}</TabContent>
|
|
46
|
-
</div>
|
|
47
|
-
</TabContainer>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
NavContainer.propTypes = {
|
|
52
|
-
items: PropTypes.arrayOf(
|
|
53
|
-
PropTypes.shape({
|
|
54
|
-
icon: PropTypes.string,
|
|
55
|
-
name: PropTypes.string,
|
|
56
|
-
component: PropTypes.func,
|
|
57
|
-
onClick: PropTypes.func,
|
|
58
|
-
})
|
|
59
|
-
),
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
NavContainer.defaultProps = {
|
|
63
|
-
items: [],
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export default NavContainer;
|
|
File without changes
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Provider } from 'react-redux';
|
|
3
|
-
import configureMockStore from 'redux-mock-store';
|
|
4
|
-
import thunk from 'redux-thunk';
|
|
5
|
-
import { screen, render } from '@testing-library/react';
|
|
6
|
-
import { mount } from '@theforeman/test';
|
|
7
|
-
import NavContainer from '../NavContainer';
|
|
8
|
-
import { props } from '../NavContainer.fixtures';
|
|
9
|
-
|
|
10
|
-
const middlewares = [thunk];
|
|
11
|
-
const mockStore = configureMockStore(middlewares);
|
|
12
|
-
|
|
13
|
-
describe('NavContainer', () => {
|
|
14
|
-
const renderOptions = {
|
|
15
|
-
API: {
|
|
16
|
-
INVENTORY_SETTINGS: {
|
|
17
|
-
response: { subscriptionConnectionEnabled: false },
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
test('click should call onTabClick prop', () => {
|
|
23
|
-
const onTabClick = jest.fn();
|
|
24
|
-
const modifiedProps = {
|
|
25
|
-
...props,
|
|
26
|
-
};
|
|
27
|
-
modifiedProps.items[0].onClick = onTabClick;
|
|
28
|
-
const store = mockStore(renderOptions);
|
|
29
|
-
|
|
30
|
-
const wrapper = mount(
|
|
31
|
-
<Provider store={store}>
|
|
32
|
-
<NavContainer {...modifiedProps} />
|
|
33
|
-
</Provider>
|
|
34
|
-
);
|
|
35
|
-
wrapper.find('NavItem a').simulate('click');
|
|
36
|
-
expect(onTabClick).toBeCalled();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test('when subscription connection is enabled', () => {
|
|
40
|
-
const options = {
|
|
41
|
-
API: {
|
|
42
|
-
INVENTORY_SETTINGS: {
|
|
43
|
-
response: { subscriptionConnectionEnabled: true },
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
const store = mockStore(options);
|
|
48
|
-
render(
|
|
49
|
-
<Provider store={store}>
|
|
50
|
-
<NavContainer {...props} />
|
|
51
|
-
</Provider>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
expect(screen.queryAllByText('Generating')).toHaveLength(1);
|
|
55
|
-
expect(screen.queryAllByText('Uploading')).toHaveLength(1);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('when subscription connection is not enabled', () => {
|
|
59
|
-
const store = mockStore(renderOptions);
|
|
60
|
-
render(
|
|
61
|
-
<Provider store={store}>
|
|
62
|
-
<NavContainer {...props} />
|
|
63
|
-
</Provider>
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
expect(screen.queryAllByText('Generating')).toHaveLength(1);
|
|
67
|
-
expect(screen.queryAllByText('Uploading')).toHaveLength(0);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './NavContainer';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Icon, Grid } from 'patternfly-react';
|
|
4
|
-
import { FormattedRelative } from 'react-intl';
|
|
5
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
6
|
-
import './scheduledRun.scss';
|
|
7
|
-
|
|
8
|
-
const ScheduledRun = ({ date, autoUploadEnabled }) =>
|
|
9
|
-
autoUploadEnabled && date ? (
|
|
10
|
-
<Grid.Col sm={12} className="scheduled_run">
|
|
11
|
-
<p>
|
|
12
|
-
<Icon name="calendar" />
|
|
13
|
-
{__('Next run: ')}
|
|
14
|
-
<FormattedRelative value={date} />.
|
|
15
|
-
</p>
|
|
16
|
-
</Grid.Col>
|
|
17
|
-
) : null;
|
|
18
|
-
|
|
19
|
-
ScheduledRun.propTypes = {
|
|
20
|
-
date: PropTypes.string,
|
|
21
|
-
autoUploadEnabled: PropTypes.bool,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
ScheduledRun.defaultProps = {
|
|
25
|
-
date: null,
|
|
26
|
-
autoUploadEnabled: true,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default ScheduledRun;
|
|
File without changes
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { IntlProvider } from 'react-intl';
|
|
4
|
-
import ScheduledRun from '../ScheduledRun';
|
|
5
|
-
|
|
6
|
-
const renderWithIntl = ui =>
|
|
7
|
-
render(<IntlProvider locale="en">{ui}</IntlProvider>);
|
|
8
|
-
|
|
9
|
-
describe('ScheduledRun', () => {
|
|
10
|
-
it('renders next run info when autoUploadEnabled and date are set', () => {
|
|
11
|
-
renderWithIntl(
|
|
12
|
-
<ScheduledRun date="2019-08-21T16:14:16.520+03:00" autoUploadEnabled />
|
|
13
|
-
);
|
|
14
|
-
expect(screen.getByText(/Next run:/)).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('renders nothing when autoUploadEnabled is false', () => {
|
|
18
|
-
renderWithIntl(
|
|
19
|
-
<ScheduledRun
|
|
20
|
-
date="2019-08-21T16:14:16.520+03:00"
|
|
21
|
-
autoUploadEnabled={false}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
expect(screen.queryByText(/Next run:/)).toBeNull();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('renders nothing when date is null', () => {
|
|
28
|
-
renderWithIntl(
|
|
29
|
-
<ScheduledRun date={null} autoUploadEnabled />
|
|
30
|
-
);
|
|
31
|
-
expect(screen.queryByText(/Next run:/)).toBeNull();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { connect } from 'react-redux';
|
|
2
|
-
|
|
3
|
-
import ScheduledRun from './ScheduledRun';
|
|
4
|
-
import { selectAutoUploadEnabled } from '../InventorySettings/InventorySettingsSelectors';
|
|
5
|
-
|
|
6
|
-
// map state to props
|
|
7
|
-
const mapStateToProps = state => ({
|
|
8
|
-
autoUploadEnabled: selectAutoUploadEnabled(state),
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
// export connected component
|
|
12
|
-
export default connect(mapStateToProps)(ScheduledRun);
|
|
File without changes
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Grid, DonutChart } from 'patternfly-react';
|
|
4
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
5
|
-
import './statusChart.scss';
|
|
6
|
-
|
|
7
|
-
const StatusChart = ({ completed }) => {
|
|
8
|
-
const donutConfigData = {
|
|
9
|
-
columns: [
|
|
10
|
-
[__('Completed'), completed],
|
|
11
|
-
[__('Remain'), 100 - completed],
|
|
12
|
-
],
|
|
13
|
-
order: null,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const pfGetUtilizationDonutTooltipContents = d => {
|
|
17
|
-
const {
|
|
18
|
-
0: { name, value },
|
|
19
|
-
} = d;
|
|
20
|
-
return `<span class="donut-tooltip-pf" style="white-space: nowrap;">${value}% ${name}</span>`;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const donutConfigTooltip = {
|
|
24
|
-
contents: pfGetUtilizationDonutTooltipContents,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Grid.Col sm={4}>
|
|
29
|
-
<div className="status-chart">
|
|
30
|
-
<DonutChart
|
|
31
|
-
id="donut-chart-1"
|
|
32
|
-
size={{
|
|
33
|
-
width: 210,
|
|
34
|
-
height: 210,
|
|
35
|
-
}}
|
|
36
|
-
data={donutConfigData}
|
|
37
|
-
tooltip={donutConfigTooltip}
|
|
38
|
-
title={{
|
|
39
|
-
type: 'percent',
|
|
40
|
-
primary: `${completed}%`,
|
|
41
|
-
secondary: __('Completed'),
|
|
42
|
-
}}
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
</Grid.Col>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
StatusChart.propTypes = {
|
|
50
|
-
completed: PropTypes.number,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
StatusChart.defaultProps = {
|
|
54
|
-
completed: 0,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default StatusChart;
|
|
File without changes
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import StatusChart from '../StatusChart';
|
|
4
|
-
|
|
5
|
-
jest.mock('patternfly-react', () => ({
|
|
6
|
-
Grid: { Col: ({ children }) => <div>{children}</div> },
|
|
7
|
-
DonutChart: ({ title }) => (
|
|
8
|
-
<div data-testid="donut-chart">
|
|
9
|
-
<span>{title?.primary}</span>
|
|
10
|
-
<span>{title?.secondary}</span>
|
|
11
|
-
</div>
|
|
12
|
-
),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
describe('StatusChart', () => {
|
|
16
|
-
it('renders the status chart container', () => {
|
|
17
|
-
const { container } = render(<StatusChart />);
|
|
18
|
-
expect(container.querySelector('.status-chart')).toBeTruthy();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('passes the completed percentage to the chart', () => {
|
|
22
|
-
const { getByText } = render(<StatusChart completed={75} />);
|
|
23
|
-
expect(getByText('75%')).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('shows Completed label', () => {
|
|
27
|
-
const { getByText } = render(<StatusChart completed={50} />);
|
|
28
|
-
expect(getByText('Completed')).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './StatusChart';
|
|
File without changes
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Grid } from 'patternfly-react';
|
|
4
|
-
import './tabContainer.scss';
|
|
5
|
-
|
|
6
|
-
const TabContainer = ({ children, className }) => (
|
|
7
|
-
<div className={className}>
|
|
8
|
-
<Grid>
|
|
9
|
-
<Grid.Col>{children}</Grid.Col>
|
|
10
|
-
</Grid>
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
TabContainer.propTypes = {
|
|
15
|
-
children: PropTypes.node,
|
|
16
|
-
className: PropTypes.string,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
TabContainer.defaultProps = {
|
|
20
|
-
children: null,
|
|
21
|
-
className: '',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default TabContainer;
|
|
File without changes
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import TabContainer from '../TabContainer';
|
|
4
|
-
|
|
5
|
-
describe('TabContainer', () => {
|
|
6
|
-
it('renders children', () => {
|
|
7
|
-
render(<TabContainer><span>Tab content</span></TabContainer>);
|
|
8
|
-
expect(screen.getByText('Tab content')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('renders with custom className', () => {
|
|
12
|
-
const { container } = render(<TabContainer className="my-tab" />);
|
|
13
|
-
expect(container.querySelector('.my-tab')).toBeTruthy();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TabContainer';
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Grid } from 'patternfly-react';
|
|
4
|
-
|
|
5
|
-
const TabFooter = ({ children }) => (
|
|
6
|
-
<Grid.Row>
|
|
7
|
-
<div className="tab-footer">{children}</div>
|
|
8
|
-
</Grid.Row>
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
TabFooter.propTypes = {
|
|
12
|
-
children: PropTypes.node,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
TabFooter.defaultProps = {
|
|
16
|
-
children: null,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default TabFooter;
|
|
File without changes
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import TabFooter from '../TabFooter';
|
|
4
|
-
|
|
5
|
-
describe('TabFooter', () => {
|
|
6
|
-
it('renders children', () => {
|
|
7
|
-
render(<TabFooter><span>Footer content</span></TabFooter>);
|
|
8
|
-
expect(screen.getByText('Footer content')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('renders with the tab-footer class', () => {
|
|
12
|
-
const { container } = render(<TabFooter />);
|
|
13
|
-
expect(container.querySelector('.tab-footer')).toBeTruthy();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TabFooter';
|
|
File without changes
|
|
File without changes
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSelector } from 'react-redux';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { Grid, Button, Icon } from 'patternfly-react';
|
|
5
|
-
import { Tooltip } from '@patternfly/react-core';
|
|
6
|
-
import { noop } from 'foremanReact/common/helpers';
|
|
7
|
-
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
|
|
8
|
-
import { selectSubscriptionConnectionEnabled } from '../InventorySettings/InventorySettingsSelectors';
|
|
9
|
-
import { isExitCodeLoading } from '../../ForemanInventoryHelpers';
|
|
10
|
-
import { useIopConfig } from '../../../common/Hooks/ConfigHooks';
|
|
11
|
-
import './tabHeader.scss';
|
|
12
|
-
|
|
13
|
-
const TabHeader = ({
|
|
14
|
-
exitCode,
|
|
15
|
-
onRestart,
|
|
16
|
-
onDownload,
|
|
17
|
-
downloadButtonDisabled,
|
|
18
|
-
toggleFullScreen,
|
|
19
|
-
}) => {
|
|
20
|
-
const subscriptionConnectionEnabled = useSelector(
|
|
21
|
-
selectSubscriptionConnectionEnabled
|
|
22
|
-
);
|
|
23
|
-
const isIop = Boolean(useIopConfig());
|
|
24
|
-
const buttonGenerateLabel = subscriptionConnectionEnabled
|
|
25
|
-
? __('Generate and upload report')
|
|
26
|
-
: __('Generate report');
|
|
27
|
-
|
|
28
|
-
const isUploadDisabled = !isIop && !subscriptionConnectionEnabled;
|
|
29
|
-
const isButtonDisabled = isExitCodeLoading(exitCode) || isUploadDisabled;
|
|
30
|
-
const tooltipContent = __(
|
|
31
|
-
'Upload is disabled because subscription connection is not enabled. Enable it in Administer > Settings > Content.'
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const generateButton = onRestart ? (
|
|
35
|
-
<Button bsStyle="primary" onClick={onRestart} disabled={isButtonDisabled}>
|
|
36
|
-
{buttonGenerateLabel}
|
|
37
|
-
</Button>
|
|
38
|
-
) : null;
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Grid.Row className="tab-header">
|
|
42
|
-
<Grid.Col sm={6}>
|
|
43
|
-
<p>{sprintf(__('Exit Code: %s'), exitCode)}</p>
|
|
44
|
-
</Grid.Col>
|
|
45
|
-
<Grid.Col sm={6}>
|
|
46
|
-
<div className="tab-action-buttons">
|
|
47
|
-
{generateButton && isUploadDisabled ? (
|
|
48
|
-
<Tooltip content={tooltipContent}>
|
|
49
|
-
<div style={{ display: 'inline-block' }}>{generateButton}</div>
|
|
50
|
-
</Tooltip>
|
|
51
|
-
) : (
|
|
52
|
-
generateButton
|
|
53
|
-
)}
|
|
54
|
-
{onDownload ? (
|
|
55
|
-
<Button onClick={onDownload} disabled={downloadButtonDisabled()}>
|
|
56
|
-
{__('Download Report')} <Icon name="download" />
|
|
57
|
-
</Button>
|
|
58
|
-
) : null}
|
|
59
|
-
<Button onClick={toggleFullScreen}>
|
|
60
|
-
{__('Full Screen')}
|
|
61
|
-
<Icon name="arrows-alt" />
|
|
62
|
-
</Button>
|
|
63
|
-
</div>
|
|
64
|
-
</Grid.Col>
|
|
65
|
-
</Grid.Row>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
TabHeader.propTypes = {
|
|
70
|
-
onRestart: PropTypes.func,
|
|
71
|
-
onDownload: PropTypes.func,
|
|
72
|
-
exitCode: PropTypes.string,
|
|
73
|
-
downloadButtonDisabled: PropTypes.func,
|
|
74
|
-
toggleFullScreen: PropTypes.func,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
TabHeader.defaultProps = {
|
|
78
|
-
onRestart: null,
|
|
79
|
-
exitCode: '',
|
|
80
|
-
onDownload: null,
|
|
81
|
-
downloadButtonDisabled: noop,
|
|
82
|
-
toggleFullScreen: noop,
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default TabHeader;
|
|
File without changes
|