foreman_acd 0.9.5 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/foreman_acd/version.rb +1 -1
- data/package.json +5 -3
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +210 -121
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +79 -91
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +30 -15
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +15 -15
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +96 -63
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +22 -11
- data/webpack/components/ApplicationDefinition/__fixtures__/{applicationDefinitionConfData_1.fixtures.js → applicationDefinitionConfData1.fixtures.js} +77 -105
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +49 -29
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +4 -4
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionHelper.test.js +16 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +0 -5
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +25 -25
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +9 -1
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +11 -11
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +30 -25
- data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +3 -3
- data/webpack/components/ApplicationDefinition/index.js +0 -1
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +91 -105
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +59 -84
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +12 -6
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +21 -27
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +14 -7
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/{applicationDefinitionImportConfData_1.fixtures.js → applicationDefinitionImportConfData1.fixtures.js} +32 -40
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +14 -16
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +38 -8
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +0 -2
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +9 -9
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +116 -2
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +3 -3
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +344 -193
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +92 -105
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +34 -17
- data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +4 -7
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +114 -74
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +18 -9
- data/webpack/components/ApplicationInstance/__fixtures__/{applicationInstanceConfData_1.fixtures.js → applicationInstanceConfData1.fixtures.js} +68 -86
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +24 -32
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +75 -10
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +0 -8
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +27 -27
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +606 -2
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +12 -12
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +32 -25
- data/webpack/components/ApplicationInstance/components/Service.js +7 -18
- data/webpack/components/ApplicationInstance/components/ServiceCounter.js +25 -18
- data/webpack/components/ApplicationInstance/index.js +0 -1
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +167 -110
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +20 -25
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +10 -5
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +9 -12
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +12 -6
- data/webpack/components/ApplicationInstanceReport/__fixtures__/{applicationInstanceReportData_1.fixtures.js → applicationInstanceReportData1.fixtures.js} +154 -101
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +3 -10
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +28 -22
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +5 -7
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +0 -1
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +2 -2
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +9 -5
- data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +1 -3
- data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +35 -56
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +21 -28
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +6 -3
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +16 -19
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -4
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData1.fixtures.js +187 -0
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +13 -24
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +3 -2
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +11 -14
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +5 -5
- data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +31 -25
- data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +3 -9
- data/webpack/components/ParameterSelection/ParameterSelection.js +258 -174
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +110 -100
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +22 -11
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +13 -11
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +63 -49
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +10 -5
- data/webpack/components/ParameterSelection/__fixtures__/{parameterSelectionData_1.fixtures.js → parameterSelectionData1.fixtures.js} +67 -104
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +22 -26
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +50 -36
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionHelper.test.js +76 -0
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +0 -2
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +23 -25
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +100 -0
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +99 -112
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +18 -19
- data/webpack/components/ParameterSelection/index.js +1 -4
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +124 -117
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +64 -74
- data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +17 -17
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData1.fixtures.js +7 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +10 -18
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +80 -6
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +9 -11
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +192 -1
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +4 -4
- data/webpack/components/SyncGitRepo/components/FormTextInput.js +26 -21
- data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +29 -24
- data/webpack/components/SyncGitRepo/index.js +2 -5
- data/webpack/components/common/AddTableEntry.js +3 -10
- data/webpack/components/common/DeleteTableEntry.js +7 -15
- data/webpack/components/common/EditTableEntry.js +7 -7
- data/webpack/components/common/ExtSelect.js +12 -8
- data/webpack/components/common/ExtTextInput.js +12 -7
- data/webpack/components/common/LockTableEntry.js +6 -6
- data/webpack/components/common/RailsData.js +6 -16
- data/webpack/components/common/__tests__/ExtSelect.test.js +2 -2
- data/webpack/components/common/__tests__/RailsData.test.js +0 -2
- data/webpack/global_test_setup.js +11 -0
- data/webpack/helper.js +10 -21
- data/webpack/helper.test.js +17 -29
- data/webpack/index.js +25 -7
- data/webpack/js-yaml.js +1563 -1135
- data/webpack/reducer.js +52 -27
- metadata +13 -11
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +0 -191
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +0 -153
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +0 -7
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import ExtSelect from '../../common/ExtSelect';
|
4
|
-
import RailsData from '../../common/RailsData'
|
4
|
+
import RailsData from '../../common/RailsData';
|
5
5
|
|
6
|
-
const AppDefinitionSelector= ({
|
6
|
+
const AppDefinitionSelector = ({
|
7
7
|
label,
|
8
8
|
hidden,
|
9
9
|
editable,
|
@@ -12,33 +12,32 @@ const AppDefinitionSelector= ({
|
|
12
12
|
onChange,
|
13
13
|
options,
|
14
14
|
additionalData,
|
15
|
-
}) =>
|
16
|
-
|
17
|
-
<
|
18
|
-
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
/>
|
35
|
-
</div>
|
15
|
+
}) => (
|
16
|
+
<div className="form-group">
|
17
|
+
<label className="col-md-2 control-label">{label}</label>
|
18
|
+
<div className="col-md-4">
|
19
|
+
<ExtSelect
|
20
|
+
hidden={hidden}
|
21
|
+
editable={editable}
|
22
|
+
viewText={viewText}
|
23
|
+
selectValue={selectValue}
|
24
|
+
onChange={onChange}
|
25
|
+
options={options}
|
26
|
+
additionalData={additionalData}
|
27
|
+
/>
|
28
|
+
<RailsData
|
29
|
+
key="app_instance_id"
|
30
|
+
view="app_instance"
|
31
|
+
parameter="app_definition_id"
|
32
|
+
value={selectValue}
|
33
|
+
/>
|
36
34
|
</div>
|
37
|
-
|
38
|
-
|
35
|
+
</div>
|
36
|
+
);
|
39
37
|
|
40
38
|
AppDefinitionSelector.propTypes = {
|
41
39
|
label: PropTypes.string.isRequired,
|
40
|
+
hidden: PropTypes.bool,
|
42
41
|
editable: PropTypes.bool.isRequired,
|
43
42
|
viewText: PropTypes.string,
|
44
43
|
selectValue: PropTypes.string,
|
@@ -47,4 +46,12 @@ AppDefinitionSelector.propTypes = {
|
|
47
46
|
additionalData: PropTypes.object,
|
48
47
|
};
|
49
48
|
|
49
|
+
AppDefinitionSelector.defaultProps = {
|
50
|
+
hidden: false,
|
51
|
+
viewText: undefined,
|
52
|
+
selectValue: undefined,
|
53
|
+
options: undefined,
|
54
|
+
additionalData: undefined,
|
55
|
+
};
|
56
|
+
|
50
57
|
export default AppDefinitionSelector;
|
@@ -1,24 +1,13 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
3
4
|
|
4
|
-
const Service= ({
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
return (
|
11
|
-
<div>
|
12
|
-
<label>{name}:</label> {currentCount} ({__("Min/Max")}: {minCount}/{maxCount})
|
13
|
-
</div>
|
14
|
-
);
|
15
|
-
};
|
16
|
-
|
17
|
-
Service.defaultProps = {
|
18
|
-
minCount: 0,
|
19
|
-
maxCount: 0,
|
20
|
-
currentCount: 0,
|
21
|
-
};
|
5
|
+
const Service = ({ name, currentCount, minCount, maxCount }) => (
|
6
|
+
<div>
|
7
|
+
<label>{name}:</label> {currentCount} ({__('Min/Max')}: {minCount}/
|
8
|
+
{maxCount})
|
9
|
+
</div>
|
10
|
+
);
|
22
11
|
|
23
12
|
Service.propTypes = {
|
24
13
|
name: PropTypes.string.isRequired,
|
@@ -1,37 +1,44 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import Service from './Service';
|
4
|
-
import { arrayToObjectObj } from '../../../helper';
|
5
|
-
import { cloneDeep } from 'lodash';
|
6
4
|
|
7
|
-
const ServiceCounter= ({
|
8
|
-
|
9
|
-
serviceList,
|
10
|
-
}) =>{
|
11
|
-
if (serviceList == undefined || serviceList.length == 0) {
|
5
|
+
const ServiceCounter = ({ title, serviceList }) => {
|
6
|
+
if (serviceList === undefined || serviceList.length === 0) {
|
12
7
|
return null;
|
13
8
|
}
|
14
|
-
const services =
|
9
|
+
const services = serviceList.map(service => (
|
10
|
+
<Service
|
11
|
+
key={service.id}
|
12
|
+
name={service.name}
|
13
|
+
currentCount={service.currentCount}
|
14
|
+
minCount={Number(service.minCount)}
|
15
|
+
maxCount={Number(service.maxCount)}
|
16
|
+
/>
|
17
|
+
));
|
15
18
|
|
16
19
|
return (
|
17
20
|
<div>
|
18
21
|
<label className="service-counter-title">{title}</label>
|
19
|
-
|
20
|
-
<Service
|
21
|
-
key={services[key].id}
|
22
|
-
name={services[key].name}
|
23
|
-
currentCount={services[key].currentCount}
|
24
|
-
minCount={Number(services[key].minCount)}
|
25
|
-
maxCount={Number(services[key].maxCount)}
|
26
|
-
/>)
|
27
|
-
)}
|
22
|
+
{services}
|
28
23
|
</div>
|
29
24
|
);
|
30
25
|
};
|
31
26
|
|
32
27
|
ServiceCounter.propTypes = {
|
33
28
|
title: PropTypes.string.isRequired,
|
34
|
-
serviceList: PropTypes.
|
29
|
+
serviceList: PropTypes.arrayOf(
|
30
|
+
PropTypes.shape({
|
31
|
+
id: PropTypes.number.isRequired,
|
32
|
+
name: PropTypes.string.isRequired,
|
33
|
+
currentCount: PropTypes.number.isRequired,
|
34
|
+
minCount: PropTypes.string.isRequired,
|
35
|
+
maxCount: PropTypes.string.isRequired,
|
36
|
+
})
|
37
|
+
),
|
38
|
+
};
|
39
|
+
|
40
|
+
ServiceCounter.defaultProps = {
|
41
|
+
serviceList: undefined,
|
35
42
|
};
|
36
43
|
|
37
44
|
export default ServiceCounter;
|
@@ -1,48 +1,46 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
|
4
|
-
import {
|
5
|
-
Icon,
|
6
|
-
Spinner,
|
7
|
-
} from 'patternfly-react';
|
4
|
+
import { Icon, Spinner } from 'patternfly-react';
|
8
5
|
|
9
|
-
import {
|
10
|
-
VerticalTabs,
|
11
|
-
} from 'patternfly-react-extensions';
|
6
|
+
import { VerticalTabs } from 'patternfly-react-extensions';
|
12
7
|
|
13
|
-
import {
|
14
|
-
translate as __
|
15
|
-
} from 'foremanReact/common/I18n';
|
8
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
16
9
|
|
17
10
|
import PowerStatus from 'foremanReact/components/hosts/powerStatus';
|
18
11
|
import ReportViewer from './components/ReportViewer';
|
19
12
|
|
20
13
|
class ApplicationInstanceReport extends React.Component {
|
21
|
-
|
22
|
-
constructor(props) {
|
23
|
-
super(props);
|
24
|
-
}
|
25
|
-
|
26
14
|
componentDidMount() {
|
27
15
|
const {
|
28
|
-
data: {
|
16
|
+
data: {
|
17
|
+
hosts,
|
18
|
+
deploymentState,
|
19
|
+
initialConfigureState,
|
20
|
+
initialConfigureJobUrl,
|
21
|
+
},
|
29
22
|
initApplicationInstanceReport,
|
30
|
-
setActiveHost,
|
31
23
|
} = this.props;
|
32
24
|
|
33
|
-
initApplicationInstanceReport(
|
25
|
+
initApplicationInstanceReport(
|
26
|
+
hosts,
|
27
|
+
deploymentState,
|
28
|
+
initialConfigureState,
|
29
|
+
initialConfigureJobUrl
|
30
|
+
);
|
34
31
|
this.reloadReportData();
|
35
|
-
}
|
32
|
+
}
|
36
33
|
|
37
34
|
reloadReportData() {
|
38
35
|
const {
|
39
36
|
data: { appInstanceId, reportDataUrl },
|
40
|
-
deploymentState,
|
37
|
+
deploymentState,
|
38
|
+
initialConfigureState,
|
41
39
|
loadReportData,
|
42
40
|
} = this.props;
|
43
41
|
|
44
42
|
// if both states are unknown, it means, that the component was just loaded. try again after a short timeout.
|
45
|
-
if (deploymentState
|
43
|
+
if (deploymentState === 'unknown' && initialConfigureState === 'unknown') {
|
46
44
|
setTimeout(() => {
|
47
45
|
this.reloadReportData();
|
48
46
|
}, 1000);
|
@@ -50,9 +48,14 @@ class ApplicationInstanceReport extends React.Component {
|
|
50
48
|
return;
|
51
49
|
}
|
52
50
|
|
53
|
-
if (
|
54
|
-
|
55
|
-
|
51
|
+
if (
|
52
|
+
(deploymentState !== 'new' &&
|
53
|
+
deploymentState !== 'finished' &&
|
54
|
+
deploymentState !== 'failed') ||
|
55
|
+
initialConfigureState === 'unconfigured' ||
|
56
|
+
initialConfigureState === 'scheduled' ||
|
57
|
+
initialConfigureState === 'pending'
|
58
|
+
) {
|
56
59
|
loadReportData(reportDataUrl, appInstanceId);
|
57
60
|
|
58
61
|
setTimeout(() => {
|
@@ -62,85 +65,104 @@ class ApplicationInstanceReport extends React.Component {
|
|
62
65
|
}
|
63
66
|
|
64
67
|
isActive(id) {
|
65
|
-
return
|
68
|
+
return this.props.activeHostId === id;
|
66
69
|
}
|
67
70
|
|
68
71
|
collectLastReportData(hosts) {
|
69
|
-
const {
|
70
|
-
setActiveHost,
|
71
|
-
} = this.props;
|
72
|
+
const { setActiveHost } = this.props;
|
72
73
|
|
73
|
-
const tabs = []
|
74
|
-
for (const [index, value] of hosts.entries()) {
|
74
|
+
const tabs = [];
|
75
|
+
// for (const [index, value] of hosts.entries()) {
|
76
|
+
hosts.forEach((value, index) => {
|
75
77
|
tabs.push(
|
76
78
|
<VerticalTabs.Tab
|
77
79
|
id={index}
|
78
|
-
key={
|
79
|
-
title={
|
80
|
-
wrapStyle=
|
80
|
+
key={`vt_tab_${index}`}
|
81
|
+
title={value.name}
|
82
|
+
wrapStyle="nowrap"
|
81
83
|
onActivate={() => setActiveHost(index)}
|
82
84
|
active={this.isActive(index)}
|
83
85
|
/>
|
84
86
|
);
|
85
|
-
}
|
87
|
+
});
|
86
88
|
|
87
89
|
return tabs;
|
88
90
|
}
|
89
91
|
|
92
|
+
// eslint-disable-next-line class-methods-use-this
|
90
93
|
lastReportStatus(host) {
|
91
|
-
if (!host
|
94
|
+
if (!host.id) {
|
92
95
|
return (
|
93
96
|
<div>
|
94
|
-
<span>Host: {
|
97
|
+
<span>Host: {host.name}</span>
|
95
98
|
<span> | </span>
|
96
|
-
<span>State: {
|
99
|
+
<span>State: {__('not build')}</span>
|
97
100
|
<span> | </span>
|
98
|
-
<span>Power Status: {
|
101
|
+
<span>Power Status: {__('unknown')}</span>
|
99
102
|
</div>
|
100
|
-
)
|
101
|
-
} else {
|
102
|
-
const already_deployed_msg = __("Already existing host which was added to the application instance");
|
103
|
-
return (
|
104
|
-
<div>
|
105
|
-
<span>Host: <a href={ host['hostUrl'] }>{ host['name'] }</a></span>
|
106
|
-
<span> | </span>
|
107
|
-
<span>State: { host['build'] == true ? "in Build" : "Deployed" }</span>
|
108
|
-
<span> | </span>
|
109
|
-
<span>Power Status: <PowerStatus key={ "power_status_"+ host['id'] } id={ host['id'] } url={ host['powerStatusUrl'] } data={{ id: host['id'], url: host['powerStatusUrl'] }} /></span>
|
110
|
-
{host['isExistingHost'] ? (
|
111
|
-
<span>
|
112
|
-
| Existing host
|
113
|
-
<Icon style={{marginRight: 8, marginLeft: 2}} type="pf" name="info" title={already_deployed_msg} />
|
114
|
-
</span>
|
115
|
-
) : (<span></span>)}
|
116
|
-
</div>
|
117
|
-
)
|
103
|
+
);
|
118
104
|
}
|
105
|
+
const alreadyDeployedMsg = __(
|
106
|
+
'Already existing host which was added to the application instance'
|
107
|
+
);
|
108
|
+
return (
|
109
|
+
<div>
|
110
|
+
<span>
|
111
|
+
Host: <a href={host.hostUrl}>{host.name}</a>
|
112
|
+
</span>
|
113
|
+
<span> | </span>
|
114
|
+
<span>State: {host.build === true ? 'in Build' : 'Deployed'}</span>
|
115
|
+
<span> | </span>
|
116
|
+
<span>
|
117
|
+
Power Status:{' '}
|
118
|
+
<PowerStatus
|
119
|
+
key={`power_status_${host.id}`}
|
120
|
+
id={host.id}
|
121
|
+
url={host.powerStatusUrl}
|
122
|
+
data={{ id: host.id, url: host.powerStatusUrl }}
|
123
|
+
/>
|
124
|
+
</span>
|
125
|
+
{host.isExistingHost ? (
|
126
|
+
<span>
|
127
|
+
| Existing host
|
128
|
+
<Icon
|
129
|
+
style={{ marginRight: 8, marginLeft: 2 }}
|
130
|
+
type="pf"
|
131
|
+
name="info"
|
132
|
+
title={alreadyDeployedMsg}
|
133
|
+
/>
|
134
|
+
</span>
|
135
|
+
) : (
|
136
|
+
<span />
|
137
|
+
)}
|
138
|
+
</div>
|
139
|
+
);
|
119
140
|
}
|
120
141
|
|
121
142
|
render() {
|
122
143
|
const {
|
123
|
-
data: {
|
124
|
-
activeHostId,
|
144
|
+
data: { deployTaskUrl, configureJobUrl },
|
145
|
+
activeHostId,
|
125
146
|
deploymentState,
|
126
|
-
|
127
|
-
|
147
|
+
hosts,
|
148
|
+
initialConfigureJobUrl,
|
149
|
+
initialConfigureState,
|
150
|
+
loading,
|
151
|
+
showInitialConfigureJob,
|
128
152
|
} = this.props;
|
129
153
|
|
130
|
-
let
|
131
|
-
let reportStatus = undefined;
|
132
|
-
let report = undefined;
|
154
|
+
let report;
|
133
155
|
|
134
156
|
// This handles the first call to render() in which the state hosts is always empty
|
135
|
-
if (hosts.length
|
136
|
-
return
|
157
|
+
if (hosts.length === 0) {
|
158
|
+
return <span>No host</span>;
|
137
159
|
}
|
138
160
|
|
139
|
-
tabs = this.collectLastReportData(hosts);
|
140
|
-
reportStatus = this.lastReportStatus(hosts[activeHostId]);
|
161
|
+
const tabs = this.collectLastReportData(hosts);
|
162
|
+
const reportStatus = this.lastReportStatus(hosts[activeHostId]);
|
141
163
|
|
142
|
-
if (hosts[activeHostId]
|
143
|
-
report = hosts[activeHostId]
|
164
|
+
if (hosts[activeHostId].progress_report) {
|
165
|
+
report = hosts[activeHostId].progress_report;
|
144
166
|
}
|
145
167
|
|
146
168
|
return (
|
@@ -149,75 +171,110 @@ class ApplicationInstanceReport extends React.Component {
|
|
149
171
|
<div>
|
150
172
|
<div className="deploy_status_head">Host deployment state</div>
|
151
173
|
<div className="deploy_status_content">
|
152
|
-
{
|
153
|
-
|
174
|
+
{loading ||
|
175
|
+
(deploymentState !== 'new' &&
|
176
|
+
deploymentState !== 'finished' &&
|
177
|
+
deploymentState !== 'failed') ? (
|
178
|
+
<span>
|
179
|
+
<Spinner loading size="sm" />
|
180
|
+
</span>
|
181
|
+
) : (
|
182
|
+
<span />
|
183
|
+
)}
|
184
|
+
{deploymentState}
|
154
185
|
</div>
|
155
186
|
</div>
|
156
187
|
<div>
|
157
188
|
<div className="deploy_status_head">Deployment task</div>
|
158
|
-
<div className="deploy_status_content"><a href={ deployTaskUrl } >Last deployment task</a></div>
|
159
|
-
</div>
|
160
|
-
{ (showInitialConfigureJob == true) ? (
|
161
|
-
<div>
|
162
|
-
<div className="deploy_status_head">Configuration job</div>
|
163
189
|
<div className="deploy_status_content">
|
164
|
-
|
165
|
-
{ (initialConfigureState != 'unconfigured' && initialConfigureState != 'scheduled') ? (<a href={ initialConfigureJobUrl }>Configuration job</a>) : (<span></span>) }
|
166
|
-
{ (initialConfigureState != 'unconfigured') ? (<span> State: { initialConfigureState }</span>) : (<span></span>) }
|
190
|
+
<a href={deployTaskUrl}>Last deployment task</a>
|
167
191
|
</div>
|
168
192
|
</div>
|
193
|
+
{showInitialConfigureJob === true ? (
|
194
|
+
<div>
|
195
|
+
<div className="deploy_status_head">Configuration job</div>
|
196
|
+
<div className="deploy_status_content">
|
197
|
+
{initialConfigureState === 'scheduled' ||
|
198
|
+
initialConfigureState === 'pending' ? (
|
199
|
+
<span>
|
200
|
+
<Spinner loading size="sm" />
|
201
|
+
</span>
|
202
|
+
) : (
|
203
|
+
<span />
|
204
|
+
)}
|
205
|
+
{initialConfigureState !== 'unconfigured' &&
|
206
|
+
initialConfigureState !== 'scheduled' ? (
|
207
|
+
<a href={initialConfigureJobUrl}>Configuration job</a>
|
208
|
+
) : (
|
209
|
+
<span />
|
210
|
+
)}
|
211
|
+
{initialConfigureState !== 'unconfigured' ? (
|
212
|
+
<span> State: {initialConfigureState}</span>
|
213
|
+
) : (
|
214
|
+
<span />
|
215
|
+
)}
|
216
|
+
</div>
|
217
|
+
</div>
|
169
218
|
) : (
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
219
|
+
<div>
|
220
|
+
<div className="deploy_status_head">Configuration job</div>
|
221
|
+
<div className="deploy_status_content">
|
222
|
+
<a href={configureJobUrl}>Configuration jobs</a>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
)}
|
175
226
|
</div>
|
176
227
|
<div className="deploy_report_hosts">
|
177
228
|
Hosts
|
178
|
-
<VerticalTabs id="vertical_tabs">
|
179
|
-
{tabs}
|
180
|
-
</VerticalTabs>
|
181
|
-
</div>
|
182
|
-
<div className="deploy_report_status">
|
183
|
-
{reportStatus}
|
229
|
+
<VerticalTabs id="vertical_tabs">{tabs}</VerticalTabs>
|
184
230
|
</div>
|
231
|
+
<div className="deploy_report_status">{reportStatus}</div>
|
185
232
|
<div className="deploy_report_tasks">
|
186
233
|
<ReportViewer report={report} />
|
187
234
|
</div>
|
188
235
|
</span>
|
189
|
-
)
|
236
|
+
);
|
237
|
+
}
|
190
238
|
}
|
191
239
|
|
192
240
|
ApplicationInstanceReport.defaultProps = {
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
configureJobUrl: '',
|
197
|
-
hosts: [],
|
198
|
-
report: [],
|
241
|
+
data: {
|
242
|
+
initialConfigureJobUrl: undefined,
|
243
|
+
},
|
199
244
|
activeHostId: 0,
|
245
|
+
configureJobUrl: '',
|
200
246
|
deploymentState: 'unknown',
|
201
|
-
|
247
|
+
deployTaskUrl: '',
|
248
|
+
hosts: [],
|
202
249
|
initialConfigureJobUrl: '',
|
250
|
+
initialConfigureState: 'unknown',
|
251
|
+
loading: false,
|
203
252
|
showInitialConfigureJob: false,
|
204
|
-
}
|
253
|
+
};
|
205
254
|
|
206
255
|
ApplicationInstanceReport.propTypes = {
|
207
|
-
|
208
|
-
|
209
|
-
|
256
|
+
data: PropTypes.shape({
|
257
|
+
hosts: PropTypes.array.isRequired,
|
258
|
+
deploymentState: PropTypes.string.isRequired,
|
259
|
+
appInstanceId: PropTypes.number.isRequired,
|
260
|
+
reportDataUrl: PropTypes.string.isRequired,
|
261
|
+
deployTaskUrl: PropTypes.string.isRequired,
|
262
|
+
configureJobUrl: PropTypes.string.isRequired,
|
263
|
+
initialConfigureState: PropTypes.string.isRequired,
|
264
|
+
initialConfigureJobUrl: PropTypes.string,
|
265
|
+
}),
|
266
|
+
activeHostId: PropTypes.number,
|
210
267
|
configureJobUrl: PropTypes.string,
|
211
268
|
deploymentState: PropTypes.string,
|
212
|
-
|
269
|
+
deployTaskUrl: PropTypes.string,
|
270
|
+
hosts: PropTypes.array,
|
213
271
|
initialConfigureJobUrl: PropTypes.string,
|
272
|
+
initialConfigureState: PropTypes.string,
|
273
|
+
loading: PropTypes.bool,
|
214
274
|
showInitialConfigureJob: PropTypes.bool,
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
setActiveHost: PropTypes.func,
|
219
|
-
loadReportData: PropTypes.func,
|
220
|
-
activeHostId: PropTypes.number,
|
275
|
+
initApplicationInstanceReport: PropTypes.func.isRequired,
|
276
|
+
loadReportData: PropTypes.func.isRequired,
|
277
|
+
setActiveHost: PropTypes.func.isRequired,
|
221
278
|
};
|
222
279
|
|
223
280
|
export default ApplicationInstanceReport;
|
@@ -1,15 +1,5 @@
|
|
1
|
-
import React from 'react';
|
2
1
|
import api from 'foremanReact/API';
|
3
2
|
|
4
|
-
import {
|
5
|
-
actionHeaderCellFormatter,
|
6
|
-
} from 'patternfly-react';
|
7
|
-
|
8
|
-
import {
|
9
|
-
propsToSnakeCase,
|
10
|
-
propsToCamelCase,
|
11
|
-
} from 'foremanReact/common/helpers';
|
12
|
-
|
13
3
|
import {
|
14
4
|
APPLICATION_INSTANCE_REPORT_INIT,
|
15
5
|
APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST,
|
@@ -19,7 +9,10 @@ import {
|
|
19
9
|
} from './ApplicationInstanceReportConstants';
|
20
10
|
|
21
11
|
export const initApplicationInstanceReport = (
|
22
|
-
hosts,
|
12
|
+
hosts,
|
13
|
+
deploymentState,
|
14
|
+
initialConfigureState,
|
15
|
+
initialConfigureJobUrl
|
23
16
|
) => dispatch => {
|
24
17
|
const initialState = {};
|
25
18
|
|
@@ -30,7 +23,7 @@ export const initApplicationInstanceReport = (
|
|
30
23
|
|
31
24
|
// Decide if it should show only the initial Configure job state + URL or
|
32
25
|
// the URL to all configuration jobs
|
33
|
-
if (initialConfigureState
|
26
|
+
if (initialConfigureState === 'unconfigured') {
|
34
27
|
initialState.showInitialConfigureJob = true;
|
35
28
|
} else {
|
36
29
|
initialState.showInitialConfigureJob = false;
|
@@ -44,22 +37,24 @@ export const initApplicationInstanceReport = (
|
|
44
37
|
|
45
38
|
export const loadReportData = (
|
46
39
|
reportDataUrl,
|
47
|
-
appInstanceId
|
48
|
-
) => dispatch => {
|
40
|
+
appInstanceId
|
41
|
+
) => async dispatch => {
|
49
42
|
dispatch({ type: APPLICATION_INSTANCE_REPORT_LOAD_REPORT_REQUEST });
|
50
43
|
|
51
44
|
const baseUrl = reportDataUrl;
|
52
|
-
const realUrl = baseUrl.replace(
|
45
|
+
const realUrl = baseUrl.replace('__id__', appInstanceId);
|
53
46
|
|
54
|
-
|
55
|
-
.get(realUrl, {}, {})
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
try {
|
48
|
+
const { data } = await api.get(realUrl, {}, {});
|
49
|
+
dispatch({
|
50
|
+
type: APPLICATION_INSTANCE_REPORT_LOAD_REPORT_SUCCESS,
|
51
|
+
payload: { ...data },
|
52
|
+
});
|
53
|
+
} catch (error) {
|
54
|
+
dispatch(
|
55
|
+
errorHandler(APPLICATION_INSTANCE_REPORT_LOAD_REPORT_FAILURE, error)
|
56
|
+
);
|
57
|
+
}
|
63
58
|
};
|
64
59
|
|
65
60
|
const errorHandler = (msg, err) => {
|
@@ -70,7 +65,7 @@ const errorHandler = (msg, err) => {
|
|
70
65
|
return { type: msg, payload: { error } };
|
71
66
|
};
|
72
67
|
|
73
|
-
export const setActiveHost =
|
68
|
+
export const setActiveHost = id => ({
|
74
69
|
type: APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST,
|
75
70
|
payload: { activeHostId: id },
|
76
71
|
});
|
@@ -1,5 +1,10 @@
|
|
1
|
-
export const APPLICATION_INSTANCE_REPORT_INIT =
|
2
|
-
|
3
|
-
export const
|
4
|
-
|
5
|
-
export const
|
1
|
+
export const APPLICATION_INSTANCE_REPORT_INIT =
|
2
|
+
'APPLICATION_INSTANCE_REPORT_INIT';
|
3
|
+
export const APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST =
|
4
|
+
'APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST';
|
5
|
+
export const APPLICATION_INSTANCE_REPORT_LOAD_REPORT_REQUEST =
|
6
|
+
'APPLICATION_INSTANCE_REPORT_LOAD_REPORT_REQUEST';
|
7
|
+
export const APPLICATION_INSTANCE_REPORT_LOAD_REPORT_SUCCESS =
|
8
|
+
'APPLICATION_INSTANCE_REPORT_LOAD_REPORT_SUCCESS';
|
9
|
+
export const APPLICATION_INSTANCE_REPORT_LOAD_REPORT_FAILURE =
|
10
|
+
'APPLICATION_INSTANCE_REPORT_LOAD_REPORT_FAILURE';
|