foreman_ansible 7.0.3 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/ansible_playbooks_controller.rb +66 -0
- data/app/jobs/sync_playbooks.rb +25 -0
- data/app/lib/proxy_api/ansible.rb +13 -0
- data/app/services/foreman_ansible/import_playbooks_error_notification.rb +38 -0
- data/app/services/foreman_ansible/import_playbooks_success_notification.rb +33 -0
- data/app/services/foreman_ansible/playbooks_importer.rb +73 -0
- data/app/services/foreman_ansible/proxy_api.rb +3 -4
- data/app/views/ansible_roles/index.html.erb +2 -0
- data/app/views/api/v2/ansible_playbooks/sync.json.rabl +5 -0
- data/app/views/foreman_ansible/job_templates/ansible_windows_updates.erb +160 -0
- data/config/routes.rb +7 -0
- data/db/seeds.d/90_notification_blueprints.rb +14 -0
- data/lib/foreman_ansible/register.rb +3 -1
- data/lib/foreman_ansible/version.rb +1 -1
- data/test/fixtures/playbooks_example_output.json +1 -0
- data/test/fixtures/sample_playbooks.json +10 -0
- data/test/functional/api/v2/ansible_playbooks_controller_test.rb +65 -0
- data/test/functional/hosts_controller_test.rb +2 -2
- data/test/unit/import_playbooks_test.rb +51 -0
- data/test/unit/lib/proxy_api/ansible_test.rb +6 -0
- data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTable.js +58 -75
- data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js +44 -58
- data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js +32 -55
- data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/index.js +1 -1
- data/webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js +29 -42
- data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.js +27 -38
- data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesActions.js +2 -1
- data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesConstants.js +1 -0
- data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesSelectors.js +6 -0
- data/webpack/components/AnsibleRolesAndVariables/index.js +7 -1
- data/webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js +2 -2
- data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AvailableRolesList.test.js.snap +9 -6
- data/webpack/helpers/pageParamsHelper.js +3 -3
- metadata +42 -29
- data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +0 -151
- data/webpack/components/withPagination.js +0 -0
- data/webpack/helpers/paginationHelper.js +0 -9
@@ -12,9 +12,8 @@ import {
|
|
12
12
|
ToolbarContent,
|
13
13
|
ToolbarItem,
|
14
14
|
Checkbox,
|
15
|
-
Pagination,
|
16
15
|
} from '@patternfly/react-core';
|
17
|
-
|
16
|
+
import Pagination from 'foremanReact/components/Pagination';
|
18
17
|
import PropTypes from 'prop-types';
|
19
18
|
import { DEFAULT_PER_PAGE } from './AnsibleRolesAndVariablesConstants';
|
20
19
|
import './AnsibleRolesAndVariables.scss';
|
@@ -25,6 +24,7 @@ const ImportRolesAndVariablesTable = ({
|
|
25
24
|
proxy,
|
26
25
|
onSubmit,
|
27
26
|
onCancel,
|
27
|
+
isImporting,
|
28
28
|
}) => {
|
29
29
|
const columns = columnsData.map(col => ({
|
30
30
|
...col,
|
@@ -34,10 +34,13 @@ const ImportRolesAndVariablesTable = ({
|
|
34
34
|
|
35
35
|
const [isChecked, setIsChecked] = useState(false);
|
36
36
|
const [selectedRowsCount, setSelectRowsCount] = useState(0);
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
const [pagination, setPagination] = useState({
|
38
|
+
page: 1,
|
39
|
+
per_page: DEFAULT_PER_PAGE,
|
40
|
+
});
|
41
|
+
const [paginatedRows, setPaginatedRows] = useState(
|
42
|
+
rows.slice(0, pagination.per_page)
|
43
|
+
);
|
41
44
|
|
42
45
|
const onSelect = (event, isSelected, rowId, row) => {
|
43
46
|
const selectableRowLength = rows.filter(
|
@@ -68,43 +71,22 @@ const ImportRolesAndVariablesTable = ({
|
|
68
71
|
onSelect(null, checked, -1);
|
69
72
|
};
|
70
73
|
|
71
|
-
const handleSetPage =
|
72
|
-
const startIdx = (
|
74
|
+
const handleSetPage = args => {
|
75
|
+
const startIdx = (args.page - 1) * args.per_page;
|
73
76
|
const endIdx =
|
74
|
-
rows.length <
|
75
|
-
|
77
|
+
rows.length < args.page * args.per_page
|
78
|
+
? rows.length
|
79
|
+
: args.page * args.per_page;
|
80
|
+
setPagination(args);
|
76
81
|
setPaginatedRows(rows.slice(startIdx, endIdx));
|
77
82
|
};
|
78
83
|
|
79
|
-
const
|
80
|
-
event,
|
81
|
-
newPerPage,
|
82
|
-
newPage,
|
83
|
-
startIdx,
|
84
|
-
endIdx
|
85
|
-
) => {
|
86
|
-
setPerPage(newPerPage);
|
87
|
-
setPage(newPage);
|
88
|
-
setPaginatedRows(rows.slice(startIdx, endIdx));
|
89
|
-
};
|
90
|
-
|
91
|
-
const renderPagination = (variant = 'top') => (
|
84
|
+
const renderPagination = () => (
|
92
85
|
<Pagination
|
93
86
|
isCompact
|
94
87
|
itemCount={rows.length}
|
95
|
-
|
96
|
-
|
97
|
-
defaultToFullPage
|
98
|
-
onSetPage={handleSetPage}
|
99
|
-
onPerPageSelect={handlePerPageSelect}
|
100
|
-
perPageOptions={[
|
101
|
-
{ title: '3', value: 3 },
|
102
|
-
{ title: '5', value: 5 },
|
103
|
-
{ title: '10', value: 10 },
|
104
|
-
]}
|
105
|
-
titles={{
|
106
|
-
paginationTitle: `${variant} pagination`,
|
107
|
-
}}
|
88
|
+
perPage={pagination.per_page}
|
89
|
+
onChange={args => handleSetPage(args)}
|
108
90
|
/>
|
109
91
|
);
|
110
92
|
|
@@ -131,10 +113,15 @@ const ImportRolesAndVariablesTable = ({
|
|
131
113
|
<div className="submit-cancel-btns">
|
132
114
|
<br />
|
133
115
|
<br />
|
134
|
-
<Button
|
116
|
+
<Button
|
117
|
+
variant="primary"
|
118
|
+
onClick={() => onSubmit(rows, proxy)}
|
119
|
+
isLoading={isImporting}
|
120
|
+
isDisabled={isImporting || selectedRowsCount === 0}
|
121
|
+
>
|
135
122
|
Submit
|
136
123
|
</Button>
|
137
|
-
<Button variant="secondary" onClick={onCancel}>
|
124
|
+
<Button variant="secondary" onClick={onCancel} isDisabled={isImporting}>
|
138
125
|
Cancel
|
139
126
|
</Button>
|
140
127
|
</div>
|
@@ -165,6 +152,7 @@ ImportRolesAndVariablesTable.defaultProps = {
|
|
165
152
|
proxy: undefined,
|
166
153
|
onSubmit: undefined,
|
167
154
|
onCancel: undefined,
|
155
|
+
isImporting: false,
|
168
156
|
};
|
169
157
|
|
170
158
|
ImportRolesAndVariablesTable.propTypes = {
|
@@ -173,6 +161,7 @@ ImportRolesAndVariablesTable.propTypes = {
|
|
173
161
|
proxy: PropTypes.number,
|
174
162
|
onSubmit: PropTypes.func,
|
175
163
|
onCancel: PropTypes.func,
|
164
|
+
isImporting: PropTypes.bool,
|
176
165
|
};
|
177
166
|
|
178
167
|
export default ImportRolesAndVariablesTable;
|
@@ -4,6 +4,7 @@ import { post } from 'foremanReact/redux/API';
|
|
4
4
|
import { push } from 'connected-react-router';
|
5
5
|
import { prepareResult } from './AnsibleRolesAndVariablesHelpers';
|
6
6
|
import {
|
7
|
+
IMPORT_ANSIBLE_V_R,
|
7
8
|
ANSIBLE_ROLE_CONFIRM_IMPORT_PATH,
|
8
9
|
ANSIBLE_ROLES_INDEX,
|
9
10
|
} from './AnsibleRolesAndVariablesConstants';
|
@@ -14,7 +15,7 @@ export const onSubmit = (rows, proxy) => dispatch => {
|
|
14
15
|
const params = prepareResult(rows);
|
15
16
|
dispatch(
|
16
17
|
post({
|
17
|
-
key:
|
18
|
+
key: IMPORT_ANSIBLE_V_R,
|
18
19
|
url: ANSIBLE_ROLE_CONFIRM_IMPORT_PATH,
|
19
20
|
params: { changed: params, proxy },
|
20
21
|
handleSuccess: () => {
|
@@ -1,10 +1,13 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { useDispatch } from 'react-redux';
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
3
3
|
import { push } from 'connected-react-router';
|
4
4
|
|
5
|
+
import { STATUS } from 'foremanReact/constants';
|
6
|
+
|
5
7
|
import ImportRolesAndVariablesTable from './AnsibleRolesAndVariables';
|
6
8
|
import { onSubmit } from './AnsibleRolesAndVariablesActions';
|
7
9
|
import { ANSIBLE_ROLES_INDEX } from './AnsibleRolesAndVariablesConstants';
|
10
|
+
import { selectApiImportStatus } from './AnsibleRolesAndVariablesSelectors';
|
8
11
|
|
9
12
|
const WrappedImportRolesAndVariables = props => {
|
10
13
|
const cols = [
|
@@ -19,12 +22,15 @@ const WrappedImportRolesAndVariables = props => {
|
|
19
22
|
const onCancel = () => {
|
20
23
|
dispatch(push(ANSIBLE_ROLES_INDEX));
|
21
24
|
};
|
25
|
+
const apiImportStatus = useSelector(selectApiImportStatus);
|
26
|
+
|
22
27
|
return (
|
23
28
|
<ImportRolesAndVariablesTable
|
24
29
|
{...props}
|
25
30
|
columnsData={cols}
|
26
31
|
onSubmit={submit}
|
27
32
|
onCancel={onCancel}
|
33
|
+
isImporting={apiImportStatus === STATUS.PENDING}
|
28
34
|
/>
|
29
35
|
);
|
30
36
|
};
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
|
4
4
|
import { ListView, LoadingState } from 'patternfly-react';
|
5
|
-
import
|
5
|
+
import Pagination from 'foremanReact/components/Pagination';
|
6
6
|
|
7
7
|
import AnsibleRole from './AnsibleRole';
|
8
8
|
|
@@ -16,7 +16,7 @@ const AvailableRolesList = ({
|
|
16
16
|
}) => (
|
17
17
|
<ListView>
|
18
18
|
<div className="sticky-pagination">
|
19
|
-
<
|
19
|
+
<Pagination
|
20
20
|
viewType="list"
|
21
21
|
itemCount={itemCount}
|
22
22
|
pagination={pagination}
|
@@ -7,21 +7,24 @@ exports[`AvailableRolesList should render 1`] = `
|
|
7
7
|
<div
|
8
8
|
className="sticky-pagination"
|
9
9
|
>
|
10
|
-
<
|
11
|
-
className=
|
12
|
-
disableNext={false}
|
13
|
-
disablePrev={false}
|
10
|
+
<Pagination
|
11
|
+
className={null}
|
14
12
|
dropdownButtonId="available-ansible-roles-pagination-row-dropdown"
|
15
13
|
itemCount={2}
|
14
|
+
noSidePadding={false}
|
16
15
|
onChange={[Function]}
|
17
|
-
|
18
|
-
|
16
|
+
onPerPageSelect={null}
|
17
|
+
onSetPage={null}
|
18
|
+
page={1}
|
19
19
|
pagination={
|
20
20
|
Object {
|
21
21
|
"page": 1,
|
22
22
|
"perPage": 25,
|
23
23
|
}
|
24
24
|
}
|
25
|
+
perPage={null}
|
26
|
+
updateParamsByUrl={true}
|
27
|
+
variant="bottom"
|
25
28
|
viewType="list"
|
26
29
|
/>
|
27
30
|
</div>
|
@@ -14,7 +14,7 @@ export const addSearch = (basePath, params) => {
|
|
14
14
|
|
15
15
|
export const useCurrentPagination = (
|
16
16
|
history,
|
17
|
-
keys = { page: 'page', perPage: '
|
17
|
+
keys = { page: 'page', perPage: 'per_page' }
|
18
18
|
) => {
|
19
19
|
const pageParams = parsePageParams(history);
|
20
20
|
const uiSettings = useForemanSettings();
|
@@ -28,7 +28,7 @@ export const useCurrentPagination = (
|
|
28
28
|
|
29
29
|
export const pageToVars = (
|
30
30
|
pagination,
|
31
|
-
keys = { page: 'page', perPage: '
|
31
|
+
keys = { page: 'page', perPage: 'per_page' }
|
32
32
|
) => ({
|
33
33
|
first: pagination[keys.page] * pagination[keys.perPage],
|
34
34
|
last: pagination[keys.perPage],
|
@@ -36,5 +36,5 @@ export const pageToVars = (
|
|
36
36
|
|
37
37
|
export const useParamsToVars = (
|
38
38
|
history,
|
39
|
-
keys = { page: 'page', perPage: '
|
39
|
+
keys = { page: 'page', perPage: 'per_page' }
|
40
40
|
) => pageToVars(useCurrentPagination(history, keys), keys);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_ansible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lobato Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_list
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- app/controllers/ansible_variables_controller.rb
|
82
82
|
- app/controllers/api/v2/ansible_inventories_controller.rb
|
83
83
|
- app/controllers/api/v2/ansible_override_values_controller.rb
|
84
|
+
- app/controllers/api/v2/ansible_playbooks_controller.rb
|
84
85
|
- app/controllers/api/v2/ansible_roles_controller.rb
|
85
86
|
- app/controllers/api/v2/ansible_variables_controller.rb
|
86
87
|
- app/controllers/concerns/foreman/controller/parameters/ansible_override_value.rb
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- app/helpers/foreman_ansible/ansible_roles_data_preparations.rb
|
114
115
|
- app/helpers/foreman_ansible/ansible_roles_helper.rb
|
115
116
|
- app/helpers/foreman_ansible/hosts_helper_extensions.rb
|
117
|
+
- app/jobs/sync_playbooks.rb
|
116
118
|
- app/jobs/sync_roles_and_variables.rb
|
117
119
|
- app/lib/actions/foreman_ansible/helpers/play_roles_description.rb
|
118
120
|
- app/lib/proxy_api/ansible.rb
|
@@ -131,6 +133,8 @@ files:
|
|
131
133
|
- app/services/foreman_ansible/ansible_report_importer.rb
|
132
134
|
- app/services/foreman_ansible/ansible_report_scanner.rb
|
133
135
|
- app/services/foreman_ansible/api_roles_importer.rb
|
136
|
+
- app/services/foreman_ansible/import_playbooks_error_notification.rb
|
137
|
+
- app/services/foreman_ansible/import_playbooks_success_notification.rb
|
134
138
|
- app/services/foreman_ansible/import_roles_and_variables_error_notification.rb
|
135
139
|
- app/services/foreman_ansible/import_roles_and_variables_success_notification.rb
|
136
140
|
- app/services/foreman_ansible/insights_notification_builder.rb
|
@@ -138,6 +142,7 @@ files:
|
|
138
142
|
- app/services/foreman_ansible/inventory_creator.rb
|
139
143
|
- app/services/foreman_ansible/override_resolver.rb
|
140
144
|
- app/services/foreman_ansible/playbook_creator.rb
|
145
|
+
- app/services/foreman_ansible/playbooks_importer.rb
|
141
146
|
- app/services/foreman_ansible/proxy_api.rb
|
142
147
|
- app/services/foreman_ansible/renderer_methods.rb
|
143
148
|
- app/services/foreman_ansible/roles_importer.rb
|
@@ -152,6 +157,7 @@ files:
|
|
152
157
|
- app/views/ansible_variables/new.html.erb
|
153
158
|
- app/views/api/v2/ansible_override_values/index.json.rabl
|
154
159
|
- app/views/api/v2/ansible_override_values/show.json.rabl
|
160
|
+
- app/views/api/v2/ansible_playbooks/sync.json.rabl
|
155
161
|
- app/views/api/v2/ansible_roles/import.json.rabl
|
156
162
|
- app/views/api/v2/ansible_roles/index.json.rabl
|
157
163
|
- app/views/api/v2/ansible_roles/obsolete.json.rabl
|
@@ -178,6 +184,7 @@ files:
|
|
178
184
|
- app/views/foreman_ansible/job_templates/ansible_roles_-_ansible_default.erb
|
179
185
|
- app/views/foreman_ansible/job_templates/ansible_roles_-_install_from_galaxy.erb
|
180
186
|
- app/views/foreman_ansible/job_templates/ansible_roles_-_install_from_git.erb
|
187
|
+
- app/views/foreman_ansible/job_templates/ansible_windows_updates.erb
|
181
188
|
- app/views/foreman_ansible/job_templates/capsule_upgrade_-_ansible_default.erb
|
182
189
|
- app/views/foreman_ansible/job_templates/configure_cloud_connector_-_ansible_default.erb
|
183
190
|
- app/views/foreman_ansible/job_templates/convert_to_rhel.erb
|
@@ -265,12 +272,15 @@ files:
|
|
265
272
|
- test/factories/ansible_variables.rb
|
266
273
|
- test/factories/host_ansible_enhancements.rb
|
267
274
|
- test/fixtures/insights_playbook.yaml
|
275
|
+
- test/fixtures/playbooks_example_output.json
|
268
276
|
- test/fixtures/report.json
|
269
277
|
- test/fixtures/sample_facts.json
|
278
|
+
- test/fixtures/sample_playbooks.json
|
270
279
|
- test/foreman_ansible/helpers/ansible_roles_helper_test.rb
|
271
280
|
- test/functional/ansible_roles_controller_test.rb
|
272
281
|
- test/functional/ansible_variables_controller_test.rb
|
273
282
|
- test/functional/api/v2/ansible_inventories_controller_test.rb
|
283
|
+
- test/functional/api/v2/ansible_playbooks_controller_test.rb
|
274
284
|
- test/functional/api/v2/ansible_roles_controller_test.rb
|
275
285
|
- test/functional/api/v2/ansible_variables_controller_test.rb
|
276
286
|
- test/functional/api/v2/hostgroups_controller_test.rb
|
@@ -292,6 +302,7 @@ files:
|
|
292
302
|
- test/unit/host_ansible_role_test.rb
|
293
303
|
- test/unit/hostgroup_ansible_role_test.rb
|
294
304
|
- test/unit/ignore_roles_test.rb
|
305
|
+
- test/unit/import_playbooks_test.rb
|
295
306
|
- test/unit/import_roles_and_variables.rb
|
296
307
|
- test/unit/lib/proxy_api/ansible_test.rb
|
297
308
|
- test/unit/services/ansible_report_importer_test.rb
|
@@ -327,7 +338,6 @@ files:
|
|
327
338
|
- webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js
|
328
339
|
- webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss
|
329
340
|
- webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js
|
330
|
-
- webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig
|
331
341
|
- webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js
|
332
342
|
- webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.fixtures.js
|
333
343
|
- webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.test.js
|
@@ -354,6 +364,7 @@ files:
|
|
354
364
|
- webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesActions.js
|
355
365
|
- webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesConstants.js
|
356
366
|
- webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesHelpers.js
|
367
|
+
- webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesSelectors.js
|
357
368
|
- webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesHelpers.test.js
|
358
369
|
- webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesImport.test.js
|
359
370
|
- webpack/components/AnsibleRolesAndVariables/index.js
|
@@ -402,7 +413,6 @@ files:
|
|
402
413
|
- webpack/components/ErrorState.js
|
403
414
|
- webpack/components/ReportJsonViewer.js
|
404
415
|
- webpack/components/withLoading.js
|
405
|
-
- webpack/components/withPagination.js
|
406
416
|
- webpack/formHelper.js
|
407
417
|
- webpack/globalIdHelper.js
|
408
418
|
- webpack/global_index.js
|
@@ -420,7 +430,6 @@ files:
|
|
420
430
|
- webpack/graphql/queries/hostVariableOverrides.gql
|
421
431
|
- webpack/graphql/queries/recurringJobs.gql
|
422
432
|
- webpack/helpers/pageParamsHelper.js
|
423
|
-
- webpack/helpers/paginationHelper.js
|
424
433
|
- webpack/index.js
|
425
434
|
- webpack/permissionsHelper.js
|
426
435
|
- webpack/reducer.js
|
@@ -449,50 +458,54 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
449
458
|
- !ruby/object:Gem::Version
|
450
459
|
version: '0'
|
451
460
|
requirements: []
|
452
|
-
rubygems_version: 3.3.
|
461
|
+
rubygems_version: 3.3.4
|
453
462
|
signing_key:
|
454
463
|
specification_version: 4
|
455
464
|
summary: Ansible integration with Foreman (theforeman.org)
|
456
465
|
test_files:
|
457
|
-
- test/functional/
|
466
|
+
- test/functional/ansible_variables_controller_test.rb
|
467
|
+
- test/functional/ansible_roles_controller_test.rb
|
468
|
+
- test/functional/api/v2/ansible_variables_controller_test.rb
|
458
469
|
- test/functional/api/v2/ansible_roles_controller_test.rb
|
459
470
|
- test/functional/api/v2/hostgroups_controller_test.rb
|
460
|
-
- test/functional/api/v2/
|
471
|
+
- test/functional/api/v2/ansible_playbooks_controller_test.rb
|
461
472
|
- test/functional/api/v2/ansible_inventories_controller_test.rb
|
462
|
-
- test/functional/hosts_controller_test.rb
|
463
|
-
- test/functional/ansible_roles_controller_test.rb
|
464
|
-
- test/functional/ansible_variables_controller_test.rb
|
473
|
+
- test/functional/api/v2/hosts_controller_test.rb
|
465
474
|
- test/functional/ui_ansible_roles_controller_test.rb
|
466
|
-
- test/
|
467
|
-
- test/
|
475
|
+
- test/functional/hosts_controller_test.rb
|
476
|
+
- test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
|
477
|
+
- test/graphql/queries/ansible_roles_query_test.rb
|
478
|
+
- test/foreman_ansible/helpers/ansible_roles_helper_test.rb
|
479
|
+
- test/unit/actions/run_ansible_job_test.rb
|
480
|
+
- test/unit/actions/run_proxy_ansible_command_test.rb
|
481
|
+
- test/unit/services/api_roles_importer_test.rb
|
468
482
|
- test/unit/services/ui_roles_importer_test.rb
|
483
|
+
- test/unit/services/ansible_report_importer_test.rb
|
484
|
+
- test/unit/services/insights_plan_runner_test.rb
|
485
|
+
- test/unit/services/override_resolver_test.rb
|
469
486
|
- test/unit/services/roles_importer_test.rb
|
487
|
+
- test/unit/services/inventory_creator_test.rb
|
470
488
|
- test/unit/services/ansible_variables_importer_test.rb
|
471
|
-
- test/unit/
|
472
|
-
- test/unit/services/api_roles_importer_test.rb
|
473
|
-
- test/unit/services/insights_plan_runner_test.rb
|
489
|
+
- test/unit/lib/proxy_api/ansible_test.rb
|
474
490
|
- test/unit/ansible_role_test.rb
|
475
|
-
- test/unit/host_ansible_role_test.rb
|
476
491
|
- test/unit/hostgroup_ansible_role_test.rb
|
492
|
+
- test/unit/ansible_variable_test.rb
|
493
|
+
- test/unit/host_ansible_role_test.rb
|
477
494
|
- test/unit/helpers/ansible_reports_helper_test.rb
|
478
495
|
- test/unit/ansible_provider_test.rb
|
479
|
-
- test/unit/concerns/host_managed_extensions_test.rb
|
480
|
-
- test/unit/concerns/config_reports_extensions_test.rb
|
481
|
-
- test/unit/concerns/hostgroup_extensions_test.rb
|
482
496
|
- test/unit/ignore_roles_test.rb
|
483
|
-
- test/unit/
|
497
|
+
- test/unit/import_playbooks_test.rb
|
484
498
|
- test/unit/import_roles_and_variables.rb
|
485
|
-
- test/unit/
|
486
|
-
- test/unit/
|
487
|
-
- test/unit/
|
488
|
-
- test/foreman_ansible/helpers/ansible_roles_helper_test.rb
|
489
|
-
- test/test_plugin_helper.rb
|
499
|
+
- test/unit/concerns/config_reports_extensions_test.rb
|
500
|
+
- test/unit/concerns/host_managed_extensions_test.rb
|
501
|
+
- test/unit/concerns/hostgroup_extensions_test.rb
|
490
502
|
- test/factories/ansible_proxy.rb
|
491
|
-
- test/factories/ansible_variables.rb
|
492
503
|
- test/factories/host_ansible_enhancements.rb
|
504
|
+
- test/factories/ansible_variables.rb
|
493
505
|
- test/factories/ansible_roles.rb
|
494
506
|
- test/fixtures/report.json
|
495
507
|
- test/fixtures/sample_facts.json
|
496
508
|
- test/fixtures/insights_playbook.yaml
|
497
|
-
- test/
|
498
|
-
- test/
|
509
|
+
- test/fixtures/playbooks_example_output.json
|
510
|
+
- test/fixtures/sample_playbooks.json
|
511
|
+
- test/test_plugin_helper.rb
|
@@ -1,151 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
-
import { usePaginationOptions } from 'foremanReact/components/Pagination/PaginationHooks';
|
5
|
-
|
6
|
-
import RelativeDateTime from 'foremanReact/components/common/dates/RelativeDateTime';
|
7
|
-
|
8
|
-
import {
|
9
|
-
TableComposable,
|
10
|
-
Thead,
|
11
|
-
Tbody,
|
12
|
-
Tr,
|
13
|
-
Th,
|
14
|
-
Td,
|
15
|
-
} from '@patternfly/react-table';
|
16
|
-
import { Flex, FlexItem, Pagination } from '@patternfly/react-core';
|
17
|
-
|
18
|
-
import { decodeId } from '../../../../globalIdHelper';
|
19
|
-
import withLoading from '../../../withLoading';
|
20
|
-
<<<<<<< HEAD
|
21
|
-
import { readableCron } from './JobsTabHelper';
|
22
|
-
import {
|
23
|
-
preparePerPageOptions,
|
24
|
-
refreshPage,
|
25
|
-
} from '../../../../helpers/paginationHelper';
|
26
|
-
=======
|
27
|
-
import { readableCron, readablePurpose } from './JobsTabHelper';
|
28
|
-
>>>>>>> 5b01704 (Fixes #34458 - Show Hostgroup jobs on the Host Detail page)
|
29
|
-
|
30
|
-
const PreviousJobsTable = ({ history, totalCount, jobs, pagination }) => {
|
31
|
-
const columns = [
|
32
|
-
__('Description'),
|
33
|
-
__('Result'),
|
34
|
-
__('State'),
|
35
|
-
__('Executed at'),
|
36
|
-
__('Schedule'),
|
37
|
-
];
|
38
|
-
|
39
|
-
const handlePerPageSelected = (event, perPage) => {
|
40
|
-
refreshPage(history, { page: 1, perPage });
|
41
|
-
};
|
42
|
-
|
43
|
-
const handlePageSelected = (event, page) => {
|
44
|
-
refreshPage(history, { ...pagination, page });
|
45
|
-
};
|
46
|
-
|
47
|
-
const perPageOptions = preparePerPageOptions(usePaginationOptions());
|
48
|
-
|
49
|
-
return (
|
50
|
-
<React.Fragment>
|
51
|
-
<h3>{__('Previously executed jobs')}</h3>
|
52
|
-
<<<<<<< HEAD
|
53
|
-
<Flex className="pf-u-pt-md">
|
54
|
-
=======
|
55
|
-
<Flex direction={{ default: 'column' }} className="pf-u-pt-md">
|
56
|
-
<FlexItem align={{ default: 'alignRight' }}>
|
57
|
-
<Pagination updateParamsByUrl itemCount={totalCount} variant="top" />
|
58
|
-
</FlexItem>
|
59
|
-
<FlexItem>
|
60
|
-
<TableComposable variant="compact">
|
61
|
-
<Thead>
|
62
|
-
<Tr>
|
63
|
-
{columns.map(col => (
|
64
|
-
<Th key={col}>{col}</Th>
|
65
|
-
))}
|
66
|
-
</Tr>
|
67
|
-
</Thead>
|
68
|
-
<Tbody>
|
69
|
-
{jobs.map(job => (
|
70
|
-
<Tr key={job.id}>
|
71
|
-
<Td>
|
72
|
-
<a
|
73
|
-
onClick={() =>
|
74
|
-
window.tfm.nav.pushUrl(
|
75
|
-
`/job_invocations/${decodeId(job.id)}`
|
76
|
-
)
|
77
|
-
}
|
78
|
-
>
|
79
|
-
{job.description}
|
80
|
-
</a>
|
81
|
-
|
82
|
-
{readablePurpose(job.recurringLogic.purpose)}
|
83
|
-
</Td>
|
84
|
-
<Td>{job.task.result}</Td>
|
85
|
-
<Td>{job.task.state}</Td>
|
86
|
-
<Td>
|
87
|
-
<RelativeDateTime date={job.startAt} />
|
88
|
-
</Td>
|
89
|
-
<Td>{readableCron(job.recurringLogic.cronLine)}</Td>
|
90
|
-
</Tr>
|
91
|
-
))}
|
92
|
-
</Tbody>
|
93
|
-
</TableComposable>
|
94
|
-
</FlexItem>
|
95
|
-
>>>>>>> 5b01704 (Fixes #34458 - Show Hostgroup jobs on the Host Detail page)
|
96
|
-
<FlexItem align={{ default: 'alignRight' }}>
|
97
|
-
<Pagination
|
98
|
-
itemCount={totalCount}
|
99
|
-
page={pagination.page}
|
100
|
-
perPage={pagination.perPage}
|
101
|
-
onSetPage={handlePageSelected}
|
102
|
-
onPerPageSelect={handlePerPageSelected}
|
103
|
-
perPageOptions={perPageOptions}
|
104
|
-
variant="top"
|
105
|
-
/>
|
106
|
-
</FlexItem>
|
107
|
-
</Flex>
|
108
|
-
<TableComposable variant="compact">
|
109
|
-
<Thead>
|
110
|
-
<Tr>
|
111
|
-
{columns.map(col => (
|
112
|
-
<Th key={col}>{col}</Th>
|
113
|
-
))}
|
114
|
-
</Tr>
|
115
|
-
</Thead>
|
116
|
-
<Tbody>
|
117
|
-
{jobs.map(job => (
|
118
|
-
<Tr key={job.id}>
|
119
|
-
<Td>
|
120
|
-
<a
|
121
|
-
onClick={() =>
|
122
|
-
window.tfm.nav.pushUrl(
|
123
|
-
`/job_invocations/${decodeId(job.id)}`
|
124
|
-
)
|
125
|
-
}
|
126
|
-
>
|
127
|
-
{job.description}
|
128
|
-
</a>
|
129
|
-
</Td>
|
130
|
-
<Td>{job.task.result}</Td>
|
131
|
-
<Td>{job.task.state}</Td>
|
132
|
-
<Td>
|
133
|
-
<RelativeDateTime date={job.startAt} />
|
134
|
-
</Td>
|
135
|
-
<Td>{readableCron(job.recurringLogic.cronLine)}</Td>
|
136
|
-
</Tr>
|
137
|
-
))}
|
138
|
-
</Tbody>
|
139
|
-
</TableComposable>
|
140
|
-
</React.Fragment>
|
141
|
-
);
|
142
|
-
};
|
143
|
-
|
144
|
-
PreviousJobsTable.propTypes = {
|
145
|
-
jobs: PropTypes.array.isRequired,
|
146
|
-
history: PropTypes.object.isRequired,
|
147
|
-
totalCount: PropTypes.number.isRequired,
|
148
|
-
pagination: PropTypes.object.isRequired,
|
149
|
-
};
|
150
|
-
|
151
|
-
export default withLoading(PreviousJobsTable);
|
File without changes
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { addSearch } from './pageParamsHelper';
|
2
|
-
|
3
|
-
export const preparePerPageOptions = opts =>
|
4
|
-
opts.map(item => ({ title: item.toString(), value: item }));
|
5
|
-
|
6
|
-
export const refreshPage = (history, params = {}) => {
|
7
|
-
const url = addSearch(history.location.pathname, params);
|
8
|
-
history.push(url);
|
9
|
-
};
|