foreman_rh_cloud 3.0.15 → 3.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +8 -0
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +0 -6
- data/app/services/foreman_rh_cloud/cloud_connector.rb +2 -1
- data/config/Gemfile.lock.gh_test +81 -66
- data/config/package-lock.json.gh_test +1261 -1455
- data/config/routes.rb +0 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +6 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +2 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +6 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +6 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js +1 -7
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js +16 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorSelectors.js +16 -11
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +20 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js +2 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +4 -0
- metadata +2 -2
data/config/routes.rb
CHANGED
@@ -11,7 +11,6 @@ Rails.application.routes.draw do
|
|
11
11
|
post 'installed_packages_inclusion', to: 'uploads#installed_packages_inclusion'
|
12
12
|
post 'ips_obfuscation', to: 'uploads#ips_obfuscation'
|
13
13
|
|
14
|
-
get 'cloud_connector', to: 'uploads#cloud_connector_status'
|
15
14
|
post 'cloud_connector', to: 'uploads#enable_cloud_connector'
|
16
15
|
|
17
16
|
resources :tasks, only: [:create]
|
@@ -42,6 +42,11 @@ export const cloudToken = 'some-cloud-token';
|
|
42
42
|
|
43
43
|
export const excludePackages = false;
|
44
44
|
|
45
|
+
export const CloudConnectorStatus = {
|
46
|
+
id: 7,
|
47
|
+
task: { id: 11 },
|
48
|
+
};
|
49
|
+
|
45
50
|
export const props = {
|
46
51
|
accounts,
|
47
52
|
fetchAccountsStatus: noop,
|
@@ -57,6 +62,7 @@ export const pollingResponse = {
|
|
57
62
|
ipsObfuscationEnabled,
|
58
63
|
cloudToken,
|
59
64
|
excludePackages,
|
65
|
+
CloudConnectorStatus,
|
60
66
|
};
|
61
67
|
|
62
68
|
export const fetchAccountsStatusResponse = {
|
@@ -29,6 +29,7 @@ export default (state = initialState, action) => {
|
|
29
29
|
ipsObfuscationEnabled,
|
30
30
|
cloudToken,
|
31
31
|
excludePackages,
|
32
|
+
CloudConnectorStatus,
|
32
33
|
} = {},
|
33
34
|
} = action;
|
34
35
|
|
@@ -42,6 +43,7 @@ export default (state = initialState, action) => {
|
|
42
43
|
ipsObfuscationEnabled,
|
43
44
|
cloudToken,
|
44
45
|
excludePackages,
|
46
|
+
CloudConnectorStatus,
|
45
47
|
error: null,
|
46
48
|
});
|
47
49
|
case INVENTORY_ACCOUNT_STATUS_POLLING_ERROR:
|
@@ -20,6 +20,12 @@ Object {
|
|
20
20
|
|
21
21
|
exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING 1`] = `
|
22
22
|
Object {
|
23
|
+
"CloudConnectorStatus": Object {
|
24
|
+
"id": 7,
|
25
|
+
"task": Object {
|
26
|
+
"id": 11,
|
27
|
+
},
|
28
|
+
},
|
23
29
|
"accounts": Object {
|
24
30
|
"Account1": Object {
|
25
31
|
"generate_report_status": "running",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { translate as __ } from 'foremanReact/common/I18n';
|
3
|
-
import {
|
3
|
+
import { post } from 'foremanReact/redux/API';
|
4
4
|
import { CONFIGURE_CLOUD_CONNECTOR } from './CloudConnectorConstants';
|
5
5
|
import { inventoryUrl } from '../../../../ForemanInventoryHelpers';
|
6
6
|
import { foremanUrl } from '../../../../../ForemanRhCloudHelpers';
|
@@ -19,9 +19,3 @@ export const configureCloudConnector = () =>
|
|
19
19
|
),
|
20
20
|
errorToast: error => `${__('Cloud connector setup has failed: ')} ${error}`,
|
21
21
|
});
|
22
|
-
|
23
|
-
export const getCloudConnector = () =>
|
24
|
-
get({
|
25
|
-
key: CONFIGURE_CLOUD_CONNECTOR,
|
26
|
-
url: inventoryUrl('cloud_connector'),
|
27
|
-
});
|
@@ -1,35 +1,43 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { useState } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import { Spinner, Button, Popover } from '@patternfly/react-core';
|
4
4
|
import { translate as __ } from 'foremanReact/common/I18n';
|
5
5
|
import { CONNECTOR_STATUS } from './CloudConnectorConstants';
|
6
6
|
|
7
7
|
export const CloudConnectorButton = ({ status, onClick, jobLink }) => {
|
8
|
+
const [isPopoverVisible, setIsPopoverVisible] = useState(false);
|
8
9
|
if (status === CONNECTOR_STATUS.PENDING) {
|
9
10
|
return (
|
10
11
|
<Popover
|
12
|
+
isVisible={isPopoverVisible}
|
13
|
+
shouldClose={() => setIsPopoverVisible(false)}
|
11
14
|
bodyContent={
|
12
15
|
<div>
|
13
|
-
{__('Cloud connector
|
16
|
+
{__('Cloud connector setup has started: ')}
|
14
17
|
<a href={jobLink} target="_blank" rel="noopener noreferrer">
|
15
|
-
{__('
|
18
|
+
{__('view the job in progress')}
|
16
19
|
</a>
|
17
20
|
</div>
|
18
21
|
}
|
19
22
|
aria-label="Popover with Link to cloud connector job"
|
20
23
|
closeBtnAriaLabel="Close cloud connector Popover"
|
21
24
|
>
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
+
<div
|
26
|
+
className="cloud-connector-pending-button"
|
27
|
+
onMouseEnter={() => setIsPopoverVisible(true)}
|
28
|
+
>
|
29
|
+
<Button variant="secondary" isDisabled>
|
30
|
+
<Spinner size="sm" /> {__('Cloud Connector is in progress')}
|
31
|
+
</Button>
|
32
|
+
</div>
|
25
33
|
</Popover>
|
26
34
|
);
|
27
35
|
}
|
28
36
|
|
29
37
|
if (status === CONNECTOR_STATUS.RESOLVED) {
|
30
38
|
return (
|
31
|
-
<Button variant="secondary"
|
32
|
-
{__('Cloud Connector
|
39
|
+
<Button variant="secondary" onClick={onClick}>
|
40
|
+
{__('Reconfigure Cloud Connector')}
|
33
41
|
</Button>
|
34
42
|
);
|
35
43
|
}
|
@@ -1,14 +1,19 @@
|
|
1
|
-
import {
|
1
|
+
import { foremanUrl } from '../../../../../ForemanRhCloudHelpers';
|
2
|
+
import { selectAccountsList } from '../../../AccountList/AccountListSelectors';
|
3
|
+
import { CONNECTOR_STATUS } from './CloudConnectorConstants';
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
CONNECTOR_STATUS,
|
6
|
-
} from './CloudConnectorConstants';
|
5
|
+
export const SelectCloudConnectorStatus = state =>
|
6
|
+
selectAccountsList(state).CloudConnectorStatus || {};
|
7
7
|
|
8
|
-
export const selectStatus = state =>
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
export const selectStatus = state => {
|
9
|
+
const { task } = SelectCloudConnectorStatus(state);
|
10
|
+
if (!task) return CONNECTOR_STATUS.NOT_RESOLVED;
|
11
|
+
if (task.result === 'pending') return CONNECTOR_STATUS.PENDING;
|
12
|
+
if (task.result === 'success') return CONNECTOR_STATUS.RESOLVED;
|
13
|
+
return CONNECTOR_STATUS.NOT_RESOLVED;
|
14
|
+
};
|
12
15
|
|
13
|
-
export const selectJobLink = state =>
|
14
|
-
|
16
|
+
export const selectJobLink = state => {
|
17
|
+
const { id } = SelectCloudConnectorStatus(state);
|
18
|
+
return id ? foremanUrl(`/job_invocations/${id}`) : '';
|
19
|
+
};
|
@@ -14,35 +14,43 @@ exports[`CloudConnectorButton render pending connector 1`] = `
|
|
14
14
|
aria-label="Popover with Link to cloud connector job"
|
15
15
|
bodyContent={
|
16
16
|
<div>
|
17
|
-
Cloud connector
|
17
|
+
Cloud connector setup has started:
|
18
18
|
<a
|
19
19
|
href="/job-link"
|
20
20
|
rel="noopener noreferrer"
|
21
21
|
target="_blank"
|
22
22
|
>
|
23
|
-
|
23
|
+
view the job in progress
|
24
24
|
</a>
|
25
25
|
</div>
|
26
26
|
}
|
27
27
|
closeBtnAriaLabel="Close cloud connector Popover"
|
28
|
+
isVisible={false}
|
29
|
+
shouldClose={[Function]}
|
28
30
|
>
|
29
|
-
<
|
30
|
-
|
31
|
+
<div
|
32
|
+
className="cloud-connector-pending-button"
|
33
|
+
onMouseEnter={[Function]}
|
31
34
|
>
|
32
|
-
<
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
<Button
|
36
|
+
isDisabled={true}
|
37
|
+
variant="secondary"
|
38
|
+
>
|
39
|
+
<Spinner
|
40
|
+
size="sm"
|
41
|
+
/>
|
42
|
+
|
43
|
+
Cloud Connector is in progress
|
44
|
+
</Button>
|
45
|
+
</div>
|
38
46
|
</Popover>
|
39
47
|
`;
|
40
48
|
|
41
49
|
exports[`CloudConnectorButton render resolved cloud connector 1`] = `
|
42
50
|
<Button
|
43
|
-
|
51
|
+
onClick={[MockFunction]}
|
44
52
|
variant="secondary"
|
45
53
|
>
|
46
|
-
Cloud Connector
|
54
|
+
Reconfigure Cloud Connector
|
47
55
|
</Button>
|
48
56
|
`;
|
data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react';
|
2
2
|
import { useSelector, useDispatch } from 'react-redux';
|
3
3
|
import { CloudConnectorButton } from './CloudConnectorButton';
|
4
|
-
import {
|
5
|
-
configureCloudConnector,
|
6
|
-
getCloudConnector,
|
7
|
-
} from './CloudConnectorActions';
|
4
|
+
import { configureCloudConnector } from './CloudConnectorActions';
|
8
5
|
import { selectStatus, selectJobLink } from './CloudConnectorSelectors';
|
9
6
|
|
10
7
|
const ConnectedCloudConnectorButton = () => {
|
@@ -12,9 +9,6 @@ const ConnectedCloudConnectorButton = () => {
|
|
12
9
|
const jobLink = useSelector(selectJobLink);
|
13
10
|
const dispatch = useDispatch();
|
14
11
|
|
15
|
-
useEffect(() => {
|
16
|
-
dispatch(getCloudConnector());
|
17
|
-
}, [dispatch]);
|
18
12
|
return (
|
19
13
|
<CloudConnectorButton
|
20
14
|
status={status}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|