foreman_acd 0.5.0 → 0.6.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 +82 -86
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +13 -11
- data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +4 -3
- data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +1 -0
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +9 -1
- data/app/controllers/foreman_acd/app_definitions_controller.rb +14 -9
- data/app/controllers/foreman_acd/app_instances_controller.rb +97 -25
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +1 -1
- 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/foreman_acd/remote_execution_controller.rb +3 -6
- data/app/controllers/ui_acd_controller.rb +9 -0
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +42 -0
- data/app/lib/actions/foreman_acd/run_configurator.rb +41 -0
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +51 -0
- data/app/models/foreman_acd/acd_provider.rb +3 -0
- data/app/models/foreman_acd/ansible_playbook.rb +30 -13
- data/app/models/foreman_acd/app_definition.rb +24 -1
- data/app/models/foreman_acd/app_instance.rb +40 -5
- data/app/models/foreman_acd/foreman_host.rb +23 -0
- data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +7 -10
- data/app/services/foreman_acd/app_deployer.rb +59 -47
- data/app/services/foreman_acd/inventory_creator.rb +12 -25
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +11 -2
- data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +9 -1
- data/app/views/foreman_acd/ansible_playbooks/index.html.erb +3 -3
- data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +6 -0
- data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +6 -0
- data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +3 -1
- data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +2 -0
- data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +2 -0
- data/app/views/foreman_acd/app_definitions/_form.html.erb +8 -0
- data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -5
- data/app/views/foreman_acd/app_definitions/index.html.erb +4 -4
- data/app/views/foreman_acd/app_instances/_form.html.erb +3 -3
- data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +87 -14
- data/app/views/foreman_acd/app_instances/report.html.erb +5 -2
- data/app/views/templates/job/run_acd_ansible_playbook.erb +14 -1
- data/app/views/ui_acd/app_definition.json.rabl +1 -1
- data/config/routes.rb +1 -2
- data/db/migrate/20200917120220_add_ansible_playbook_id.rb +1 -1
- data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +3 -0
- data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +3 -0
- data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
- data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
- data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
- data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
- data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
- data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
- data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
- data/db/seeds.d/62_acd_proxy_feature.rb +1 -3
- data/db/seeds.d/75-job_templates.rb +6 -1
- data/lib/foreman_acd/engine.rb +14 -3
- data/lib/foreman_acd/plugin.rb +49 -28
- data/lib/foreman_acd/version.rb +1 -1
- data/locale/en/foreman_acd.edit.po +326 -0
- data/locale/en/foreman_acd.po +232 -2
- data/{app/controllers/foreman_acd/api/v2/app_playbooks_controller.rb → locale/en/foreman_acd.po.time_stamp} +0 -0
- data/locale/foreman_acd.pot +343 -8
- data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +31 -18
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +8 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +26 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +1 -0
- data/webpack/components/ApplicationDefinition/index.js +2 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +67 -30
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +8 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +1 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +16 -2
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +1 -0
- data/webpack/components/ApplicationInstance/components/Service.js +1 -1
- data/webpack/components/ApplicationInstance/index.js +2 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +53 -60
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +17 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +7 -51
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +2 -4
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +4 -18
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +0 -1
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +1 -1
- data/webpack/components/ApplicationInstanceReport/index.js +0 -2
- data/webpack/components/ParameterSelection/ParameterSelection.js +10 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +8 -7
- data/webpack/components/common/DeleteTableEntry.js +3 -2
- data/webpack/components/common/EditTableEntry.js +2 -1
- data/webpack/components/common/LockTableEntry.js +2 -1
- metadata +48 -6
- data/app/views/foreman_acd/app_instances/deploy.html.erb +0 -19
@@ -5,6 +5,10 @@ import {
|
|
5
5
|
VerticalTabs,
|
6
6
|
} from 'patternfly-react-extensions';
|
7
7
|
|
8
|
+
import {
|
9
|
+
translate as __
|
10
|
+
} from 'foremanReact/common/I18n';
|
11
|
+
|
8
12
|
import PowerStatus from 'foremanReact/components/hosts/powerStatus';
|
9
13
|
import ReportViewer from './components/ReportViewer';
|
10
14
|
|
@@ -18,54 +22,20 @@ class ApplicationInstanceReport extends React.Component {
|
|
18
22
|
const {
|
19
23
|
data: { hosts, mode },
|
20
24
|
initApplicationInstanceReport,
|
21
|
-
|
25
|
+
setActiveHost,
|
22
26
|
} = this.props;
|
23
27
|
|
24
28
|
initApplicationInstanceReport(hosts);
|
25
|
-
|
26
|
-
if (mode == 'liveReport') {
|
27
|
-
if (hosts.length > 0) {
|
28
|
-
const index = 0;
|
29
|
-
const url = `/api/v2/orchestration/${hosts[index].progress_report_id}/tasks`;
|
30
|
-
setActiveAndLoadLiveReport(index, url);
|
31
|
-
}
|
32
|
-
}
|
33
29
|
};
|
34
30
|
|
35
31
|
isActive(id) {
|
36
32
|
return (this.props.activeHostId === id);
|
37
33
|
}
|
38
34
|
|
39
|
-
collectLiveData(hosts) {
|
40
|
-
const {
|
41
|
-
setActiveAndLoadLiveReport,
|
42
|
-
} = this.props;
|
43
|
-
const tabs = []
|
44
|
-
|
45
|
-
for (const [index, value] of hosts.entries()) {
|
46
|
-
const url = `/api/v2/orchestration/${hosts[index].progress_report_id}/tasks`
|
47
|
-
|
48
|
-
tabs.push(
|
49
|
-
<VerticalTabs.Tab
|
50
|
-
id={index}
|
51
|
-
key={"vt_tab_"+index}
|
52
|
-
title={ value.name }
|
53
|
-
wrapStyle='nowrap'
|
54
|
-
onActivate={() => setActiveAndLoadLiveReport(index, url)}
|
55
|
-
active={this.isActive(index)}
|
56
|
-
/>
|
57
|
-
);
|
58
|
-
}
|
59
|
-
|
60
|
-
return tabs;
|
61
|
-
}
|
62
|
-
|
63
35
|
collectLastReportData(hosts) {
|
64
36
|
const {
|
65
|
-
|
37
|
+
setActiveHost,
|
66
38
|
} = this.props;
|
67
|
-
// FIXME
|
68
|
-
const url = undefined;
|
69
39
|
|
70
40
|
const tabs = []
|
71
41
|
for (const [index, value] of hosts.entries()) {
|
@@ -75,7 +45,7 @@ class ApplicationInstanceReport extends React.Component {
|
|
75
45
|
key={"vt_tab_"+index}
|
76
46
|
title={ value.name }
|
77
47
|
wrapStyle='nowrap'
|
78
|
-
onActivate={() =>
|
48
|
+
onActivate={() => setActiveHost(index)}
|
79
49
|
active={this.isActive(index)}
|
80
50
|
/>
|
81
51
|
);
|
@@ -84,43 +54,61 @@ class ApplicationInstanceReport extends React.Component {
|
|
84
54
|
return tabs;
|
85
55
|
}
|
86
56
|
|
87
|
-
liveReportStatus(host) {
|
88
|
-
return (
|
89
|
-
<span>Host: <a href={ host['hostUrl'] }>{ host['hostname'] }</a></span>
|
90
|
-
);
|
91
|
-
}
|
92
|
-
|
93
57
|
lastReportStatus(host) {
|
94
|
-
|
95
|
-
|
96
|
-
<
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
58
|
+
if (!host['id']) {
|
59
|
+
return (
|
60
|
+
<div>
|
61
|
+
<span>Host: { host['name'] }</span>
|
62
|
+
<span> | </span>
|
63
|
+
<span>State: { __('not build') }</span>
|
64
|
+
<span> | </span>
|
65
|
+
<span>Power Status: { __('unknown') }</span>
|
66
|
+
</div>
|
67
|
+
)
|
68
|
+
} else {
|
69
|
+
return (
|
70
|
+
<div>
|
71
|
+
<span>Host: <a href={ host['hostUrl'] }>{ host['name'] }</a></span>
|
72
|
+
<span> | </span>
|
73
|
+
<span>State: { host['build'] == true ? "in Build" : "Deployed" }</span>
|
74
|
+
<span> | </span>
|
75
|
+
<span>Power Status: <PowerStatus key={ "power_status_"+ host['id'] } data={{ id: host['id'], url: host['powerStatusUrl'] }} /></span>
|
76
|
+
</div>
|
77
|
+
)
|
78
|
+
}
|
101
79
|
}
|
102
80
|
|
103
81
|
render() {
|
104
82
|
const {
|
105
|
-
data: { hosts, mode },
|
106
|
-
report,
|
83
|
+
data: { hosts, mode, appInstanceName, deployTaskUrl, configureJobUrl },
|
107
84
|
activeHostId,
|
108
85
|
} = this.props;
|
109
86
|
|
110
87
|
let tabs = [];
|
111
88
|
let reportStatus = undefined;
|
89
|
+
let report = undefined;
|
112
90
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
reportStatus = this.lastReportStatus(hosts[activeHostId])
|
91
|
+
tabs = this.collectLastReportData(hosts);
|
92
|
+
reportStatus = this.lastReportStatus(hosts[activeHostId]);
|
93
|
+
|
94
|
+
if (hosts[activeHostId]['progress_report']) {
|
95
|
+
report = hosts[activeHostId]['progress_report'];
|
119
96
|
}
|
120
97
|
|
121
98
|
return (
|
122
99
|
<span>
|
100
|
+
<div className="deploy_status">
|
101
|
+
<div>
|
102
|
+
<div className="deploy_status_head">Deployment task</div>
|
103
|
+
<div className="deploy_status_content"><a href={ deployTaskUrl } >Last deployment task</a></div>
|
104
|
+
</div>
|
105
|
+
<div>
|
106
|
+
<div className="deploy_status_head">Configuration job</div>
|
107
|
+
<div className="deploy_status_content"><a href={ configureJobUrl }>Configuration jobs</a></div>
|
108
|
+
</div>
|
109
|
+
</div>
|
123
110
|
<div className="deploy_report_hosts">
|
111
|
+
Hosts
|
124
112
|
<VerticalTabs id="vertical_tabs">
|
125
113
|
{tabs}
|
126
114
|
</VerticalTabs>
|
@@ -137,6 +125,9 @@ class ApplicationInstanceReport extends React.Component {
|
|
137
125
|
|
138
126
|
ApplicationInstanceReport.defaultProps = {
|
139
127
|
error: {},
|
128
|
+
appInstanceName: '',
|
129
|
+
deployTaskUrl: '',
|
130
|
+
configureJobUrl: '',
|
140
131
|
hosts: [],
|
141
132
|
report: [],
|
142
133
|
activeHostId: 0,
|
@@ -144,10 +135,12 @@ ApplicationInstanceReport.defaultProps = {
|
|
144
135
|
|
145
136
|
ApplicationInstanceReport.propTypes = {
|
146
137
|
initApplicationInstanceReport: PropTypes.func,
|
138
|
+
appInstanceName: PropTypes.string,
|
139
|
+
deployTaskUrl: PropTypes.string,
|
140
|
+
configureJobUrl: PropTypes.string,
|
147
141
|
hosts: PropTypes.array,
|
148
142
|
report: PropTypes.array,
|
149
|
-
|
150
|
-
setActiveAndLoadLastReport: PropTypes.func,
|
143
|
+
setActiveHost: PropTypes.func,
|
151
144
|
activeHostId: PropTypes.number,
|
152
145
|
|
153
146
|
};
|
@@ -1,5 +1,21 @@
|
|
1
1
|
@import '~@theforeman/vendor/scss/variables';
|
2
2
|
|
3
|
+
.deploy_status {
|
4
|
+
padding-bottom: 80px;
|
5
|
+
}
|
6
|
+
|
7
|
+
.deploy_status_head {
|
8
|
+
float:left;
|
9
|
+
width:25%;
|
10
|
+
height:10%;
|
11
|
+
}
|
12
|
+
|
13
|
+
.deploy_status_content {
|
14
|
+
float:left;
|
15
|
+
width:75%;
|
16
|
+
height:10%;
|
17
|
+
}
|
18
|
+
|
3
19
|
.deploy_report_hosts {
|
4
20
|
float:left;
|
5
21
|
width:25%;
|
@@ -11,6 +27,7 @@
|
|
11
27
|
width:75%;
|
12
28
|
min-height: 300px;
|
13
29
|
background-color: #ecf9fe;
|
30
|
+
padding: 10px;
|
14
31
|
border: 1px solid #3dbff3;
|
15
32
|
}
|
16
33
|
|
@@ -11,10 +11,8 @@ import {
|
|
11
11
|
} from 'foremanReact/common/helpers';
|
12
12
|
|
13
13
|
import {
|
14
|
-
|
15
|
-
|
16
|
-
APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS,
|
17
|
-
APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE,
|
14
|
+
APPLICATION_INSTANCE_REPORT_INIT,
|
15
|
+
APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST,
|
18
16
|
} from './ApplicationInstanceReportConstants';
|
19
17
|
|
20
18
|
export const initApplicationInstanceReport = (
|
@@ -25,7 +23,7 @@ export const initApplicationInstanceReport = (
|
|
25
23
|
initialState.hosts = hosts;
|
26
24
|
|
27
25
|
dispatch({
|
28
|
-
type:
|
26
|
+
type: APPLICATION_INSTANCE_REPORT_INIT,
|
29
27
|
payload: initialState,
|
30
28
|
});
|
31
29
|
};
|
@@ -38,49 +36,7 @@ const errorHandler = (msg, err) => {
|
|
38
36
|
return { type: msg, payload: { error } };
|
39
37
|
};
|
40
38
|
|
41
|
-
export const
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
if (live) {
|
46
|
-
if ((reportState.activeHostId == id) || (initial == true)) {
|
47
|
-
setTimeout(() => {
|
48
|
-
loadReport(dispatch, getState, id, url, live, false);
|
49
|
-
}, 1600)
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
return api
|
54
|
-
.get(url, {}, {})
|
55
|
-
.then(({ data }) =>
|
56
|
-
dispatch({
|
57
|
-
type: APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS,
|
58
|
-
payload: data.results,
|
59
|
-
})
|
60
|
-
)
|
61
|
-
.catch(error => dispatch(errorHandler(APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE, error)));
|
62
|
-
};
|
63
|
-
|
64
|
-
export const setActiveAndLoadLiveReport = (
|
65
|
-
id,
|
66
|
-
url,
|
67
|
-
) => (dispatch, getState) => {
|
68
|
-
dispatch({
|
69
|
-
payload: { activeHostId: id },
|
70
|
-
type: APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_REQUEST
|
71
|
-
});
|
72
|
-
|
73
|
-
return loadReport(dispatch, getState, id, url, true, true);
|
74
|
-
}
|
75
|
-
|
76
|
-
export const setActiveAndLoadLastReport = (
|
77
|
-
id,
|
78
|
-
url,
|
79
|
-
) => (dispatch, getState) => {
|
80
|
-
dispatch({
|
81
|
-
payload: { activeHostId: id },
|
82
|
-
type: APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_REQUEST
|
83
|
-
});
|
84
|
-
|
85
|
-
return loadReport(dispatch, getState, id, url, false, true);
|
86
|
-
};
|
39
|
+
export const setActiveHost = (id) => ({
|
40
|
+
type: APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST,
|
41
|
+
payload: { activeHostId: id },
|
42
|
+
});
|
@@ -1,4 +1,2 @@
|
|
1
|
-
export const
|
2
|
-
export const
|
3
|
-
export const APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS = 'APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS';
|
4
|
-
export const APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE = 'APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE';
|
1
|
+
export const APPLICATION_INSTANCE_REPORT_INIT = 'APPLICATION_INSTANCE_REPORT_INIT';
|
2
|
+
export const APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST = 'APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST';
|
@@ -7,10 +7,8 @@ import {
|
|
7
7
|
} from 'lodash';
|
8
8
|
|
9
9
|
import {
|
10
|
-
|
11
|
-
|
12
|
-
APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS,
|
13
|
-
APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE,
|
10
|
+
APPLICATION_INSTANCE_REPORT_INIT,
|
11
|
+
APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST,
|
14
12
|
} from './ApplicationInstanceReportConstants';
|
15
13
|
|
16
14
|
export const initialState = Immutable({
|
@@ -22,27 +20,15 @@ const applicationInstanceReport = (state = initialState, action) => {
|
|
22
20
|
const { payload } = action;
|
23
21
|
|
24
22
|
switch (action.type) {
|
25
|
-
case
|
23
|
+
case APPLICATION_INSTANCE_REPORT_INIT: {
|
26
24
|
return state.merge(payload);
|
27
25
|
}
|
28
|
-
case
|
26
|
+
case APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST: {
|
29
27
|
return state.merge({
|
30
28
|
loading: true,
|
31
29
|
activeHostId: payload.activeHostId,
|
32
30
|
})
|
33
31
|
}
|
34
|
-
case APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS: {
|
35
|
-
return state.merge({
|
36
|
-
report: payload,
|
37
|
-
loading: false,
|
38
|
-
});
|
39
|
-
}
|
40
|
-
case APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE: {
|
41
|
-
return state.merge({
|
42
|
-
error: payload.error,
|
43
|
-
loading: false
|
44
|
-
});
|
45
|
-
}
|
46
32
|
default: {
|
47
33
|
return state;
|
48
34
|
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
const applicationInstanceReport = state => state.foremanAcd.applicationInstanceReport;
|
2
2
|
|
3
3
|
export const selectHosts = state => applicationInstanceReport(state).hosts;
|
4
|
-
export const selectReport = state => applicationInstanceReport(state).report;
|
5
4
|
export const selectActiveHostId = state => applicationInstanceReport(state).activeHostId;
|
@@ -7,13 +7,11 @@ import * as ApplicationInstanceReportActions from './ApplicationInstanceReportAc
|
|
7
7
|
|
8
8
|
import {
|
9
9
|
selectHosts,
|
10
|
-
selectReport,
|
11
10
|
selectActiveHostId,
|
12
11
|
} from './ApplicationInstanceReportSelectors';
|
13
12
|
|
14
13
|
const mapStateToProps = state => ({
|
15
14
|
hosts: selectHosts(state),
|
16
|
-
report: selectReport(state),
|
17
15
|
activeHostId: selectActiveHostId(state),
|
18
16
|
});
|
19
17
|
|
@@ -117,6 +117,7 @@ class ParameterSelection extends React.Component {
|
|
117
117
|
/>
|
118
118
|
|
119
119
|
<LockTableEntry
|
120
|
+
hidden={!allowRowAdjustment}
|
120
121
|
disabled={true}
|
121
122
|
onLockTableEntry={lockParameter}
|
122
123
|
additionalData={additionalData}
|
@@ -273,6 +274,7 @@ class ParameterSelection extends React.Component {
|
|
273
274
|
addParameter,
|
274
275
|
confirmEditParameter,
|
275
276
|
cancelEditParameter,
|
277
|
+
editModeCallback,
|
276
278
|
} = this.props;
|
277
279
|
|
278
280
|
let sortedParameters;
|
@@ -304,6 +306,12 @@ class ParameterSelection extends React.Component {
|
|
304
306
|
)(parameters);
|
305
307
|
}
|
306
308
|
|
309
|
+
// Make sure that the component which includes the
|
310
|
+
// ParameterSelection is aware of the current editMode state
|
311
|
+
if (editModeCallback !== undefined) {
|
312
|
+
editModeCallback(this.props.editMode);
|
313
|
+
}
|
314
|
+
|
307
315
|
return(
|
308
316
|
<div>
|
309
317
|
<div className="clearfix">
|
@@ -363,6 +371,7 @@ ParameterSelection.defaultProps = {
|
|
363
371
|
parameters: [],
|
364
372
|
columns: [],
|
365
373
|
sortingColumns: {},
|
374
|
+
editModeCallback: undefined,
|
366
375
|
};
|
367
376
|
|
368
377
|
ParameterSelection.propTypes = {
|
@@ -381,6 +390,7 @@ ParameterSelection.propTypes = {
|
|
381
390
|
parameterTypes: PropTypes.object,
|
382
391
|
parameters: PropTypes.array,
|
383
392
|
sortingColumns: PropTypes.object,
|
393
|
+
editModeCallback: PropTypes.func,
|
384
394
|
columns: PropTypes.array,
|
385
395
|
sortParameter: PropTypes.func,
|
386
396
|
addParameter: PropTypes.func,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import * as sort from 'sortabular';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
3
4
|
|
4
5
|
import {
|
5
6
|
actionHeaderCellFormatter,
|
@@ -59,9 +60,9 @@ export const initParameterSelection = (
|
|
59
60
|
};
|
60
61
|
initialState.paramDefinition = paramDefinition;
|
61
62
|
|
62
|
-
let valueLabel = 'Value';
|
63
|
+
let valueLabel = __('Value');
|
63
64
|
if (useDefaultValue) {
|
64
|
-
valueLabel = 'Default value';
|
65
|
+
valueLabel = __('Default value');
|
65
66
|
}
|
66
67
|
|
67
68
|
initialState.columns = []
|
@@ -74,7 +75,7 @@ export const initParameterSelection = (
|
|
74
75
|
addToColumns( {
|
75
76
|
property: 'name',
|
76
77
|
header: {
|
77
|
-
label: 'Name',
|
78
|
+
label: __('Name'),
|
78
79
|
props: {
|
79
80
|
sort: true,
|
80
81
|
style: {
|
@@ -93,7 +94,7 @@ export const initParameterSelection = (
|
|
93
94
|
addToColumns( {
|
94
95
|
property: 'description',
|
95
96
|
header: {
|
96
|
-
label: 'Description',
|
97
|
+
label: __('Description'),
|
97
98
|
props: {
|
98
99
|
sort: true,
|
99
100
|
style: {
|
@@ -116,7 +117,7 @@ export const initParameterSelection = (
|
|
116
117
|
addToColumns( {
|
117
118
|
property: 'type',
|
118
119
|
header: {
|
119
|
-
label: 'Type',
|
120
|
+
label: __('Type'),
|
120
121
|
props: {
|
121
122
|
sort: true,
|
122
123
|
style: {
|
@@ -157,7 +158,7 @@ export const initParameterSelection = (
|
|
157
158
|
addToColumns( {
|
158
159
|
property: 'actions',
|
159
160
|
header: {
|
160
|
-
label: 'Actions',
|
161
|
+
label: __('Actions'),
|
161
162
|
props: {
|
162
163
|
style: {
|
163
164
|
width: '10%'
|
@@ -184,7 +185,7 @@ export const initParameterSelection = (
|
|
184
185
|
|
185
186
|
const errorHandler = (msg, err) => {
|
186
187
|
const error = {
|
187
|
-
errorMsg: 'Failed to fetch data from server.',
|
188
|
+
errorMsg: __('Failed to fetch data from server.'),
|
188
189
|
statusText: err,
|
189
190
|
};
|
190
191
|
return { type: msg, payload: { error } };
|