foreman_acd 0.0.6 → 0.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/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +1 -2
- data/app/controllers/foreman_acd/app_definitions_controller.rb +29 -1
- data/app/controllers/foreman_acd/app_instances_controller.rb +70 -21
- data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
- data/app/controllers/ui_acd_controller.rb +0 -1
- data/app/models/foreman_acd/app_definition.rb +0 -1
- data/app/views/foreman_acd/app_definitions/_form.html.erb +6 -14
- data/app/views/foreman_acd/app_definitions/import.html.erb +18 -0
- data/app/views/foreman_acd/app_definitions/index.html.erb +9 -5
- data/app/views/foreman_acd/app_instances/_form.html.erb +5 -5
- data/app/views/foreman_acd/app_instances/deploy.html.erb +19 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +6 -5
- data/app/views/foreman_acd/app_instances/report.html.erb +19 -0
- data/app/views/ui_acd/app_definition.json.rabl +1 -1
- data/config/routes.rb +7 -0
- data/db/migrate/20190610202252_create_app_definitions.rb +1 -3
- data/db/migrate/20190625140305_create_app_instances.rb +1 -1
- data/lib/foreman_acd/plugin.rb +19 -2
- data/lib/foreman_acd/version.rb +1 -1
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +261 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.scss +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +211 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +9 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +147 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +6 -0
- data/webpack/components/ApplicationDefinition/index.js +29 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +342 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.scss +11 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +210 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +12 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +223 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +8 -0
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +49 -0
- data/webpack/components/ApplicationInstance/components/Service.js +30 -0
- data/webpack/components/ApplicationInstance/components/ServiceCounter.js +37 -0
- data/webpack/components/ApplicationInstance/index.js +33 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +155 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +27 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +86 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +4 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +52 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +5 -0
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +26 -0
- data/webpack/components/ApplicationInstanceReport/index.js +27 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +65 -161
- data/webpack/components/ParameterSelection/ParameterSelection.scss +9 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +42 -71
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +12 -19
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +3 -3
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +76 -75
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -6
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +12 -21
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +1 -1
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +3 -45
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +20 -0
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +22 -46
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +40 -265
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +11 -96
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +3 -9
- data/webpack/components/ParameterSelection/index.js +4 -6
- data/webpack/components/common/AddTableEntry.js +30 -0
- data/webpack/components/common/DeleteTableEntry.js +39 -0
- data/webpack/components/common/ExtSelect.js +43 -0
- data/webpack/components/common/RailsData.js +27 -0
- data/webpack/components/common/__tests__/AddTableEntry.test.js +26 -0
- data/webpack/components/common/__tests__/DeleteTableEntry.test.js +29 -0
- data/webpack/components/common/__tests__/ExtSelect.test.js +38 -0
- data/webpack/components/common/__tests__/RailsData.test.js +16 -0
- data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +35 -0
- data/webpack/components/common/__tests__/__snapshots__/AddTableEntry.test.js.snap +35 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +41 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +41 -0
- data/webpack/components/common/__tests__/__snapshots__/ExtSelect.test.js.snap +18 -0
- data/webpack/components/common/__tests__/__snapshots__/RailsData.test.js.snap +10 -0
- data/webpack/helper.js +20 -0
- data/webpack/index.js +6 -0
- data/webpack/reducer.js +40 -3
- metadata +47 -46
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const applicationInstanceReport = state => state.foremanAcd.applicationInstanceReport;
|
|
2
|
+
|
|
3
|
+
export const selectHosts = state => applicationInstanceReport(state).hosts;
|
|
4
|
+
export const selectReport = state => applicationInstanceReport(state).report;
|
|
5
|
+
export const selectActiveHostId = state => applicationInstanceReport(state).activeHostId;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
const ReportViewer= ({
|
|
5
|
+
hidden,
|
|
6
|
+
report,
|
|
7
|
+
}) =>{
|
|
8
|
+
if (hidden) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (report === undefined) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return report.map((task, id) => (
|
|
17
|
+
<div key={"report_task_"+id} className="report_task">{task.name}</div>
|
|
18
|
+
));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
ReportViewer.propTypes = {
|
|
22
|
+
hidden: PropTypes.bool,
|
|
23
|
+
report: PropTypes.array,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default ReportViewer;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { bindActionCreators } from 'redux';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
import './ApplicationInstanceReport.scss';
|
|
5
|
+
import ApplicationInstanceReport from './ApplicationInstanceReport';
|
|
6
|
+
import * as ApplicationInstanceReportActions from './ApplicationInstanceReportActions';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
selectHosts,
|
|
10
|
+
selectReport,
|
|
11
|
+
selectActiveHostId,
|
|
12
|
+
} from './ApplicationInstanceReportSelectors';
|
|
13
|
+
|
|
14
|
+
const mapStateToProps = state => ({
|
|
15
|
+
hosts: selectHosts(state),
|
|
16
|
+
report: selectReport(state),
|
|
17
|
+
activeHostId: selectActiveHostId(state),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const mapDispatchToProps = dispatch =>
|
|
21
|
+
bindActionCreators(ApplicationInstanceReportActions, dispatch);
|
|
22
|
+
|
|
23
|
+
export default connect(
|
|
24
|
+
mapStateToProps,
|
|
25
|
+
mapDispatchToProps
|
|
26
|
+
)(ApplicationInstanceReport);
|
|
27
|
+
|
|
@@ -5,6 +5,9 @@ import * as sort from 'sortabular';
|
|
|
5
5
|
import { orderBy } from 'lodash';
|
|
6
6
|
import * as resolve from 'table-resolver';
|
|
7
7
|
import Select from 'foremanReact/components/common/forms/Select';
|
|
8
|
+
import AddTableEntry from '../common/AddTableEntry';
|
|
9
|
+
import DeleteTableEntry from '../common/DeleteTableEntry';
|
|
10
|
+
import ExtSelect from '../common/ExtSelect';
|
|
8
11
|
|
|
9
12
|
import {
|
|
10
13
|
isNewDefinition,
|
|
@@ -22,9 +25,8 @@ import {
|
|
|
22
25
|
cloneDeep,
|
|
23
26
|
} from 'lodash';
|
|
24
27
|
|
|
25
|
-
|
|
26
28
|
import {
|
|
27
|
-
|
|
29
|
+
PARAMETER_SELECTION_TYPES,
|
|
28
30
|
} from './ParameterSelectionConstants';
|
|
29
31
|
|
|
30
32
|
import {
|
|
@@ -43,86 +45,12 @@ const theme = {
|
|
|
43
45
|
base00: 'rgba(0, 0, 0, 0)',
|
|
44
46
|
};
|
|
45
47
|
|
|
46
|
-
|
|
47
48
|
class ParameterSelection extends React.Component {
|
|
48
49
|
|
|
49
50
|
constructor(props) {
|
|
50
51
|
super(props);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
renderAddButton(mode, addParameter) {
|
|
54
|
-
if (isInstance(mode))
|
|
55
|
-
return null;
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<Button bsStyle="default" disabled={ this.props.editMode || this.props.hostgroupId <= 0 } onClick={() => addParameter()}>
|
|
59
|
-
<Icon type="fa" name="plus" />
|
|
60
|
-
</Button>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
renderDeleteButton(mode, deleteParameter, additionalData, disabled=false) {
|
|
65
|
-
if (isInstance(mode))
|
|
66
|
-
return null;
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<span>
|
|
70
|
-
|
|
71
|
-
<Button
|
|
72
|
-
bsStyle="default"
|
|
73
|
-
disabled={disabled}
|
|
74
|
-
onClick={() => window.confirm("Are you sure you wish to delete this item?") && deleteParameter(additionalData) }
|
|
75
|
-
>
|
|
76
|
-
<Icon type="pf" name="delete" />
|
|
77
|
-
</Button>
|
|
78
|
-
</span>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
renderSelectApplication(applications, url, loadParameterSelection, appDefinition) {
|
|
83
|
-
return (
|
|
84
|
-
<Select
|
|
85
|
-
value={appDefinition.id.toString()}
|
|
86
|
-
onChange={e => loadParameterSelection(url, e.target.value) }
|
|
87
|
-
options={applications}
|
|
88
|
-
allowClear
|
|
89
|
-
key="key"
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
renderSelectHostgroup(hostgroups, url, loadForemanData, hostgroupId) {
|
|
95
|
-
return (
|
|
96
|
-
<Select
|
|
97
|
-
value={hostgroupId.toString()}
|
|
98
|
-
onChange={e => loadForemanData(url, e.target.value, true) }
|
|
99
|
-
options={hostgroups}
|
|
100
|
-
allowClear
|
|
101
|
-
key="key"
|
|
102
|
-
/>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
renderRailsInputHidden(view, parameter, value) {
|
|
107
|
-
var id = "foreman_acd_"+ view +"_"+ parameter;
|
|
108
|
-
var name = "foreman_acd_"+ view +"["+ parameter +"]";
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<input
|
|
112
|
-
id={id}
|
|
113
|
-
name={name}
|
|
114
|
-
value={value}
|
|
115
|
-
type="hidden"
|
|
116
|
-
/>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
renderShowDivText(text) {
|
|
121
|
-
return (
|
|
122
|
-
<div>{text}</div>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
54
|
isEditing({rowData}) {
|
|
127
55
|
return (rowData.backup !== undefined);
|
|
128
56
|
}
|
|
@@ -130,17 +58,12 @@ class ParameterSelection extends React.Component {
|
|
|
130
58
|
// enables our custom header formatters extensions to reactabular
|
|
131
59
|
customHeaderFormatters = customHeaderFormattersDefinition;
|
|
132
60
|
|
|
133
|
-
validateRows() {
|
|
134
|
-
var result = (this.props.rows.map(e => e.value).filter(i => i == "").length == 0);
|
|
135
|
-
if (result === false) {
|
|
136
|
-
window.alert("All parameters need to have a value!");
|
|
137
|
-
}
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
61
|
componentDidMount() {
|
|
142
62
|
const {
|
|
143
|
-
data: { mode,
|
|
63
|
+
data: { mode, parameters, serviceDefinition },
|
|
64
|
+
location,
|
|
65
|
+
organization,
|
|
66
|
+
loadForemanDataUrl,
|
|
144
67
|
initParameterSelection,
|
|
145
68
|
sortParameter,
|
|
146
69
|
deleteParameter,
|
|
@@ -149,13 +72,7 @@ class ParameterSelection extends React.Component {
|
|
|
149
72
|
loadForemanData,
|
|
150
73
|
} = this.props;
|
|
151
74
|
|
|
152
|
-
|
|
153
|
-
loadForemanData(loadForemanDataUrl, appDefinition.hostgroup_id);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (isInstance(mode)) {
|
|
157
|
-
$('input[type="submit"][name="commit"]').on('click', () => this.validateRows());
|
|
158
|
-
}
|
|
75
|
+
loadForemanData(serviceDefinition.hostgroup_id, { url: loadForemanDataUrl, clearParameters: false });
|
|
159
76
|
|
|
160
77
|
const inlineEditButtonsFormatter = inlineEditFormatterFactory({
|
|
161
78
|
isEditing: additionalData => this.props.editMode,
|
|
@@ -167,7 +84,12 @@ class ParameterSelection extends React.Component {
|
|
|
167
84
|
>
|
|
168
85
|
<Icon type="pf" name="edit" />
|
|
169
86
|
</Button>
|
|
170
|
-
|
|
87
|
+
<DeleteTableEntry
|
|
88
|
+
hidden={isInstance(mode)}
|
|
89
|
+
disabled={false}
|
|
90
|
+
onDeleteTableEntry={deleteParameter}
|
|
91
|
+
additionalData={additionalData}
|
|
92
|
+
/>
|
|
171
93
|
</td>
|
|
172
94
|
),
|
|
173
95
|
renderEdit: (value, additionalData) => (
|
|
@@ -175,7 +97,12 @@ class ParameterSelection extends React.Component {
|
|
|
175
97
|
<Button bsStyle="default" disabled>
|
|
176
98
|
<Icon type="pf" name="edit" />
|
|
177
99
|
</Button>
|
|
178
|
-
|
|
100
|
+
<DeleteTableEntry
|
|
101
|
+
hidden={isInstance(mode)}
|
|
102
|
+
disabled={true}
|
|
103
|
+
onDeleteTableEntry={deleteParameter}
|
|
104
|
+
additionalData={additionalData}
|
|
105
|
+
/>
|
|
179
106
|
</td>
|
|
180
107
|
)
|
|
181
108
|
});
|
|
@@ -228,9 +155,9 @@ class ParameterSelection extends React.Component {
|
|
|
228
155
|
const inlineEditFormatter = inlineEditFormatterFactory({
|
|
229
156
|
isEditing: additionalData => this.isEditing(additionalData),
|
|
230
157
|
renderValue: (value, additionalData) => {
|
|
231
|
-
|
|
158
|
+
let prettyValue = value;
|
|
232
159
|
if (additionalData.property == 'type') {
|
|
233
|
-
prettyValue =
|
|
160
|
+
prettyValue = PARAMETER_SELECTION_TYPES[value];
|
|
234
161
|
} else if (additionalData.property == 'value') {
|
|
235
162
|
switch (additionalData.rowData.type) {
|
|
236
163
|
case 'computeprofile':
|
|
@@ -245,6 +172,9 @@ class ParameterSelection extends React.Component {
|
|
|
245
172
|
case 'ptable':
|
|
246
173
|
prettyValue = transformForemanData(this.props.foremanData['ptables'])[value]
|
|
247
174
|
break;
|
|
175
|
+
case 'password':
|
|
176
|
+
prettyValue = '****************'
|
|
177
|
+
break;
|
|
248
178
|
case 'puppetenv':
|
|
249
179
|
prettyValue = transformForemanData(this.props.foremanData['environments'])[value]
|
|
250
180
|
break;
|
|
@@ -258,7 +188,7 @@ class ParameterSelection extends React.Component {
|
|
|
258
188
|
if (additionalData.rowData.newEntry === true) {
|
|
259
189
|
return inlineEditFormatterImpl.renderEditSelect(value, additionalData, this.props.parameterTypes);
|
|
260
190
|
}
|
|
261
|
-
return inlineEditFormatterImpl.renderValue(
|
|
191
|
+
return inlineEditFormatterImpl.renderValue(PARAMETER_SELECTION_TYPES[value], additionalData)
|
|
262
192
|
case 'value':
|
|
263
193
|
switch (additionalData.rowData.type) {
|
|
264
194
|
case 'computeprofile':
|
|
@@ -271,6 +201,8 @@ class ParameterSelection extends React.Component {
|
|
|
271
201
|
return inlineEditFormatterImpl.renderEditSelect(value, additionalData, transformForemanData(this.props.foremanData['environments']));
|
|
272
202
|
case 'ptable':
|
|
273
203
|
return inlineEditFormatterImpl.renderEditSelect(value, additionalData, transformForemanData(this.props.foremanData['ptables']));
|
|
204
|
+
case 'password':
|
|
205
|
+
return inlineEditFormatterImpl.renderEditText(value, additionalData, 'password');
|
|
274
206
|
case 'text':
|
|
275
207
|
default:
|
|
276
208
|
return inlineEditFormatterImpl.renderEditText(value, additionalData);
|
|
@@ -284,7 +216,7 @@ class ParameterSelection extends React.Component {
|
|
|
284
216
|
|
|
285
217
|
initParameterSelection(
|
|
286
218
|
mode,
|
|
287
|
-
|
|
219
|
+
serviceDefinition,
|
|
288
220
|
parameters,
|
|
289
221
|
this.sortingFormatter,
|
|
290
222
|
this.sortableTransform,
|
|
@@ -298,84 +230,59 @@ class ParameterSelection extends React.Component {
|
|
|
298
230
|
|
|
299
231
|
render() {
|
|
300
232
|
const {
|
|
301
|
-
data: { mode, applications
|
|
302
|
-
|
|
233
|
+
data: { mode, applications },
|
|
234
|
+
location,
|
|
235
|
+
organization,
|
|
236
|
+
loadForemanDataUrl,
|
|
237
|
+
parameters,
|
|
303
238
|
columns,
|
|
304
239
|
sortingColumns,
|
|
305
240
|
loading,
|
|
306
241
|
addParameter,
|
|
307
242
|
confirmEditParameter,
|
|
308
243
|
cancelEditParameter,
|
|
309
|
-
loadParameterSelection,
|
|
310
244
|
loadForemanData,
|
|
311
|
-
|
|
312
|
-
hostgroupId,
|
|
245
|
+
serviceDefinition,
|
|
313
246
|
} = this.props;
|
|
314
247
|
|
|
315
|
-
|
|
316
|
-
|
|
248
|
+
let sortedParameters;
|
|
249
|
+
const newEntryIndex = findIndex(parameters, 'newEntry');
|
|
317
250
|
|
|
318
251
|
if (newEntryIndex >= 0) {
|
|
319
|
-
|
|
252
|
+
const newEntry = parameters[newEntryIndex];
|
|
320
253
|
// sort all elements, besides the newEntry which will be
|
|
321
254
|
// added to the end of the Array
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
255
|
+
const tmpParameters = cloneDeep(parameters);
|
|
256
|
+
tmpParameters.splice(newEntryIndex, 1);
|
|
257
|
+
sortedParameters = this.compose(
|
|
325
258
|
sort.sorter({
|
|
326
259
|
columns,
|
|
327
260
|
sortingColumns,
|
|
328
261
|
sort: orderBy,
|
|
329
262
|
strategy: sort.strategies.byProperty
|
|
330
263
|
})
|
|
331
|
-
)(
|
|
332
|
-
|
|
264
|
+
)(tmpParameters);
|
|
265
|
+
sortedParameters.push(newEntry);
|
|
333
266
|
} else {
|
|
334
|
-
|
|
267
|
+
sortedParameters = this.compose(
|
|
335
268
|
sort.sorter({
|
|
336
269
|
columns,
|
|
337
270
|
sortingColumns,
|
|
338
271
|
sort: orderBy,
|
|
339
272
|
strategy: sort.strategies.byProperty
|
|
340
273
|
})
|
|
341
|
-
)(
|
|
274
|
+
)(parameters);
|
|
342
275
|
}
|
|
343
276
|
|
|
344
277
|
return(
|
|
345
278
|
<div>
|
|
346
|
-
{isDefinition(mode) ? (
|
|
347
|
-
<div className="clearfix">
|
|
348
|
-
<div className="form-group">
|
|
349
|
-
<label className="col-md-2 control-label">Host Group</label>
|
|
350
|
-
<div className="col-md-4">
|
|
351
|
-
{isNewDefinition(mode) && this.renderSelectHostgroup(hostgroups, loadForemanDataUrl, loadForemanData, hostgroupId) }
|
|
352
|
-
{isEditDefinition(mode) && this.renderShowDivText(hostgroups[hostgroupId]) }
|
|
353
|
-
{this.renderRailsInputHidden('app_definition', 'hostgroup_id', hostgroupId) }
|
|
354
|
-
</div>
|
|
355
|
-
</div>
|
|
356
|
-
</div>
|
|
357
|
-
) : (
|
|
358
|
-
<div className="clearfix">
|
|
359
|
-
<div className="form-group">
|
|
360
|
-
<label className="col-md-2 control-label">Application Definition</label>
|
|
361
|
-
<div className="col-md-4">
|
|
362
|
-
{isNewInstance(mode) && this.renderSelectApplication(applications, loadParameterSelectionUrl, loadParameterSelection, appDefinition)}
|
|
363
|
-
{isEditInstance(mode) && this.renderShowDivText(appDefinition.name)}
|
|
364
|
-
{isInstance(mode) && this.renderRailsInputHidden('app_instance', 'app_definition_id', appDefinition.id)}
|
|
365
|
-
</div>
|
|
366
|
-
</div>
|
|
367
|
-
</div>
|
|
368
|
-
)}
|
|
369
|
-
<div className="clearfix">
|
|
370
|
-
<div className="form-group">
|
|
371
|
-
<label className="col-md-1 control-label">Application parameters</label>
|
|
372
|
-
<div className="col-md-5"> </div>
|
|
373
|
-
</div>
|
|
374
|
-
</div>
|
|
375
|
-
|
|
376
279
|
<div className="clearfix">
|
|
377
280
|
<div className="form-group">
|
|
378
|
-
|
|
281
|
+
<AddTableEntry
|
|
282
|
+
hidden={isInstance(mode)}
|
|
283
|
+
disabled={ this.props.editMode }
|
|
284
|
+
onAddTableEntry={ addParameter }
|
|
285
|
+
/>
|
|
379
286
|
<Table.PfProvider
|
|
380
287
|
striped
|
|
381
288
|
bordered
|
|
@@ -400,20 +307,23 @@ class ParameterSelection extends React.Component {
|
|
|
400
307
|
>
|
|
401
308
|
<Table.Header headerRows={resolve.headerRows({ columns })} />
|
|
402
309
|
<Table.Body
|
|
403
|
-
rows={
|
|
310
|
+
rows={sortedParameters}
|
|
404
311
|
rowKey="id"
|
|
405
312
|
onRow={(rowData, { rowIndex }) => ({
|
|
406
313
|
role: 'row',
|
|
407
314
|
isEditing: () => this.isEditing({ rowData }),
|
|
408
315
|
onCancel: () => cancelEditParameter({ rowData, rowIndex }),
|
|
409
316
|
onConfirm: () => confirmEditParameter({ rowData, rowIndex }),
|
|
410
|
-
last: rowIndex ===
|
|
317
|
+
last: rowIndex === sortedParameters.length - 1
|
|
411
318
|
})}
|
|
412
319
|
/>
|
|
413
320
|
</Table.PfProvider>
|
|
414
|
-
|
|
321
|
+
<AddTableEntry
|
|
322
|
+
hidden={isInstance(mode)}
|
|
323
|
+
disabled={ this.props.editMode }
|
|
324
|
+
onAddTableEntry={ addParameter }
|
|
325
|
+
/>
|
|
415
326
|
</div>
|
|
416
|
-
{this.renderRailsInputHidden(isDefinition(mode) ? 'app_definition' : 'app_instance', 'parameters', JSON.stringify(this.props.rows))}
|
|
417
327
|
</div>
|
|
418
328
|
</div>
|
|
419
329
|
);
|
|
@@ -425,31 +335,27 @@ ParameterSelection.defaultProps = {
|
|
|
425
335
|
editMode: false,
|
|
426
336
|
loading: false,
|
|
427
337
|
foremanData: {},
|
|
428
|
-
|
|
338
|
+
parameters: [],
|
|
429
339
|
columns: [],
|
|
430
340
|
sortingColumns: {},
|
|
431
|
-
appDefinition: { "id": '', "name": '', "hostgroup_id": '', "parameters": [] },
|
|
432
|
-
hostgroupId: -1,
|
|
433
341
|
};
|
|
434
342
|
|
|
435
343
|
ParameterSelection.propTypes = {
|
|
436
344
|
data: PropTypes.shape({
|
|
437
345
|
mode: PropTypes.string.isRequired,
|
|
438
|
-
location: PropTypes.string.isRequired,
|
|
439
|
-
organization: PropTypes.string.isRequired,
|
|
440
346
|
parameters: PropTypes.array,
|
|
441
|
-
|
|
347
|
+
serviceDefinition: PropTypes.object,
|
|
442
348
|
applications: PropTypes.object,
|
|
443
|
-
hostgroups: PropTypes.object,
|
|
444
|
-
loadParameterSelectionUrl: PropTypes.string,
|
|
445
|
-
loadForemanDataUrl: PropTypes.string,
|
|
446
349
|
}).isRequired,
|
|
350
|
+
location: PropTypes.string.isRequired,
|
|
351
|
+
organization: PropTypes.string.isRequired,
|
|
352
|
+
loadForemanDataUrl: PropTypes.string,
|
|
447
353
|
initParameterSelection: PropTypes.func,
|
|
448
354
|
editMode: PropTypes.bool.isRequired,
|
|
449
355
|
loading: PropTypes.bool.isRequired,
|
|
450
356
|
foremanData: PropTypes.object.isRequired,
|
|
451
357
|
parameterTypes: PropTypes.object,
|
|
452
|
-
|
|
358
|
+
parameters: PropTypes.array,
|
|
453
359
|
sortingColumns: PropTypes.object,
|
|
454
360
|
columns: PropTypes.array,
|
|
455
361
|
sortParameter: PropTypes.func,
|
|
@@ -459,10 +365,8 @@ ParameterSelection.propTypes = {
|
|
|
459
365
|
confirmEditParameter: PropTypes.func,
|
|
460
366
|
cancelEditParameter: PropTypes.func,
|
|
461
367
|
changeEditParameter: PropTypes.func,
|
|
462
|
-
loadParameterSelection: PropTypes.func,
|
|
463
368
|
loadForemanData: PropTypes.func,
|
|
464
|
-
|
|
465
|
-
hostgroupId: PropTypes.number,
|
|
369
|
+
serviceDefinition: PropTypes.object,
|
|
466
370
|
};
|
|
467
371
|
|
|
468
372
|
export default ParameterSelection;
|