foreman_ansible 11.1.0 → 11.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -9
  3. data/app/helpers/foreman_ansible/smart_proxies_helper.rb +7 -1
  4. data/app/views/foreman_ansible/config_reports/_ansible.html.erb +1 -1
  5. data/app/views/foreman_ansible/job_templates/capsule_upgrade_-_ansible_default.erb +4 -32
  6. data/app/views/foreman_ansible/job_templates/smart_proxy_upgrade_-_ansible_default.erb +59 -0
  7. data/lib/foreman_ansible/version.rb +1 -1
  8. data/locale/ca/foreman_ansible.edit.po +1162 -0
  9. data/locale/ca/foreman_ansible.po.time_stamp +0 -0
  10. data/locale/cs_CZ/foreman_ansible.edit.po +1207 -0
  11. data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
  12. data/locale/de/foreman_ansible.edit.po +1148 -0
  13. data/locale/de/foreman_ansible.po.time_stamp +0 -0
  14. data/locale/en/foreman_ansible.edit.po +1146 -0
  15. data/locale/en/foreman_ansible.po.time_stamp +0 -0
  16. data/locale/en_GB/foreman_ansible.edit.po +1155 -0
  17. data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
  18. data/locale/es/foreman_ansible.edit.po +1148 -0
  19. data/locale/es/foreman_ansible.po.time_stamp +0 -0
  20. data/locale/fr/foreman_ansible.edit.po +1148 -0
  21. data/locale/fr/foreman_ansible.po.time_stamp +0 -0
  22. data/locale/gl/foreman_ansible.edit.po +1156 -0
  23. data/locale/gl/foreman_ansible.po.time_stamp +0 -0
  24. data/locale/it/foreman_ansible.edit.po +1148 -0
  25. data/locale/it/foreman_ansible.po.time_stamp +0 -0
  26. data/locale/ja/foreman_ansible.edit.po +1148 -0
  27. data/locale/ja/foreman_ansible.po.time_stamp +0 -0
  28. data/locale/ko/foreman_ansible.edit.po +1148 -0
  29. data/locale/ko/foreman_ansible.po.time_stamp +0 -0
  30. data/locale/nl_NL/foreman_ansible.edit.po +1168 -0
  31. data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
  32. data/locale/pl/foreman_ansible.edit.po +1180 -0
  33. data/locale/pl/foreman_ansible.po.time_stamp +0 -0
  34. data/locale/pt_BR/foreman_ansible.edit.po +1148 -0
  35. data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
  36. data/locale/ru/foreman_ansible.edit.po +1149 -0
  37. data/locale/ru/foreman_ansible.po.time_stamp +0 -0
  38. data/locale/sv_SE/foreman_ansible.edit.po +1180 -0
  39. data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
  40. data/locale/zh_CN/foreman_ansible.edit.po +1148 -0
  41. data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
  42. data/locale/zh_TW/foreman_ansible.edit.po +1148 -0
  43. data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
  44. data/package.json +7 -7
  45. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTableHelper.js +6 -2
  46. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +151 -0
  47. data/webpack/formHelper.js +9 -4
  48. metadata +52 -14
File without changes
data/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "test": "test"
8
8
  },
9
9
  "peerDependencies": {
10
- "@theforeman/vendor": ">= 8.16.0"
10
+ "@theforeman/vendor": ">= 12.0.1"
11
11
  },
12
12
  "dependencies": {
13
13
  "react-json-tree": "^0.11.0"
@@ -15,12 +15,12 @@
15
15
  "devDependencies": {
16
16
  "@babel/core": "^7.7.0",
17
17
  "@testing-library/user-event": "^13.2.1",
18
- "@theforeman/builder": "^10.0",
19
- "@theforeman/eslint-plugin-foreman": "^10.0",
20
- "@theforeman/find-foreman": "^10.0",
21
- "@theforeman/stories": "^10.0",
22
- "@theforeman/test": "^10.0",
23
- "@theforeman/vendor-dev": "^10.0",
18
+ "@theforeman/builder": ">= 12.0.1",
19
+ "@theforeman/eslint-plugin-foreman": ">= 12.0.1",
20
+ "@theforeman/find-foreman": ">= 12.0.1",
21
+ "@theforeman/stories": ">= 12.0.1",
22
+ "@theforeman/test": ">= 12.0.1",
23
+ "@theforeman/vendor-dev": ">= 12.0.1",
24
24
  "babel-eslint": "^10.0.3",
25
25
  "eslint": "^6.7.2",
26
26
  "prettier": "^1.13.5"
@@ -86,12 +86,16 @@ const validateRegexp = (variable, value) => {
86
86
  };
87
87
 
88
88
  const validateList = (variable, value) => {
89
- if (variable.validatorRule.split(',').find(item => item.trim() === value)) {
89
+ let { validatorRule } = variable;
90
+ if (typeof validatorRule !== 'string') {
91
+ validatorRule = validatorRule.toString();
92
+ }
93
+ if (validatorRule.split(',').find(item => item.trim() === value)) {
90
94
  return validationSuccess;
91
95
  }
92
96
  return {
93
97
  key: 'error',
94
- msg: sprintf(__('Invalid, expected one of: %s'), variable.validatorRule),
98
+ msg: sprintf(__('Invalid, expected one of: %s'), validatorRule),
95
99
  };
96
100
  };
97
101
 
@@ -0,0 +1,151 @@
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
+ &nbsp;
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);
@@ -88,11 +88,12 @@ SelectField.defaultProps = {
88
88
  blankLabel: '',
89
89
  };
90
90
 
91
- const pickerWithHandlers = Component => {
91
+ const pickerWithHandlers = ComponentType => {
92
92
  const Subcomponent = ({ form, field, isRequired, label, ...rest }) => {
93
93
  const { onChange, onBlur } = wrapPickerProps(field);
94
94
  const valid = shouldValidate(form, field.name);
95
95
 
96
+ const Component = ComponentType === 'date' ? DatePicker : TimePicker;
96
97
  return (
97
98
  <FormGroup
98
99
  label={label}
@@ -103,7 +104,11 @@ const pickerWithHandlers = Component => {
103
104
  >
104
105
  <Component
105
106
  aria-label={field.name}
106
- onChange={onChange}
107
+ onChange={(a, b) => {
108
+ // datepicker: onChange (event: React.FormEvent<HTMLInputElement>, value: string, date?: Date) => void
109
+ // timepicker: onChange (time: string, hour?: number, minute?: number, seconds?: number, isValid?: boolean ) => void
110
+ ComponentType === 'date' ? onChange(b, a) : onChange(a);
111
+ }}
107
112
  onBlur={onBlur}
108
113
  {...rest}
109
114
  validated={valid}
@@ -127,5 +132,5 @@ const pickerWithHandlers = Component => {
127
132
  return Subcomponent;
128
133
  };
129
134
 
130
- export const DatePickerField = pickerWithHandlers(DatePicker);
131
- export const TimePickerField = pickerWithHandlers(TimePicker);
135
+ export const DatePickerField = pickerWithHandlers('date');
136
+ export const TimePickerField = pickerWithHandlers('time');
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: 11.1.0
4
+ version: 11.1.1
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: 2023-02-14 00:00:00.000000000 Z
11
+ date: 2023-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -201,6 +201,7 @@ files:
201
201
  - app/views/foreman_ansible/job_templates/run_playbook-ansible_default.erb
202
202
  - app/views/foreman_ansible/job_templates/service_action_-_ansible_default.erb
203
203
  - app/views/foreman_ansible/job_templates/service_action_-_enable_web_console.erb
204
+ - app/views/foreman_ansible/job_templates/smart_proxy_upgrade_-_ansible_default.erb
204
205
  - app/views/job_templates/_job_template_callback_tab_content.html.erb
205
206
  - app/views/job_templates/_job_template_callback_tab_headers.html.erb
206
207
  - app/views/ui_ansible_roles/index.json.rabl
@@ -236,45 +237,81 @@ files:
236
237
  - locale/Makefile
237
238
  - locale/action_names.rb
238
239
  - locale/ca/LC_MESSAGES/foreman_ansible.mo
240
+ - locale/ca/foreman_ansible.edit.po
239
241
  - locale/ca/foreman_ansible.po
242
+ - locale/ca/foreman_ansible.po.time_stamp
240
243
  - locale/cs_CZ/LC_MESSAGES/foreman_ansible.mo
244
+ - locale/cs_CZ/foreman_ansible.edit.po
241
245
  - locale/cs_CZ/foreman_ansible.po
246
+ - locale/cs_CZ/foreman_ansible.po.time_stamp
242
247
  - locale/de/LC_MESSAGES/foreman_ansible.mo
248
+ - locale/de/foreman_ansible.edit.po
243
249
  - locale/de/foreman_ansible.po
250
+ - locale/de/foreman_ansible.po.time_stamp
244
251
  - locale/en/LC_MESSAGES/foreman_ansible.mo
252
+ - locale/en/foreman_ansible.edit.po
245
253
  - locale/en/foreman_ansible.po
254
+ - locale/en/foreman_ansible.po.time_stamp
246
255
  - locale/en_GB/LC_MESSAGES/foreman_ansible.mo
256
+ - locale/en_GB/foreman_ansible.edit.po
247
257
  - locale/en_GB/foreman_ansible.po
258
+ - locale/en_GB/foreman_ansible.po.time_stamp
248
259
  - locale/es/LC_MESSAGES/foreman_ansible.mo
260
+ - locale/es/foreman_ansible.edit.po
249
261
  - locale/es/foreman_ansible.po
262
+ - locale/es/foreman_ansible.po.time_stamp
250
263
  - locale/foreman_ansible.pot
251
264
  - locale/fr/LC_MESSAGES/foreman_ansible.mo
265
+ - locale/fr/foreman_ansible.edit.po
252
266
  - locale/fr/foreman_ansible.po
267
+ - locale/fr/foreman_ansible.po.time_stamp
253
268
  - locale/gemspec.rb
254
269
  - locale/gl/LC_MESSAGES/foreman_ansible.mo
270
+ - locale/gl/foreman_ansible.edit.po
255
271
  - locale/gl/foreman_ansible.po
272
+ - locale/gl/foreman_ansible.po.time_stamp
256
273
  - locale/it/LC_MESSAGES/foreman_ansible.mo
274
+ - locale/it/foreman_ansible.edit.po
257
275
  - locale/it/foreman_ansible.po
276
+ - locale/it/foreman_ansible.po.time_stamp
258
277
  - locale/ja/LC_MESSAGES/foreman_ansible.mo
278
+ - locale/ja/foreman_ansible.edit.po
259
279
  - locale/ja/foreman_ansible.po
280
+ - locale/ja/foreman_ansible.po.time_stamp
260
281
  - locale/ka/LC_MESSAGES/foreman_ansible.mo
261
282
  - locale/ka/foreman_ansible.po
262
283
  - locale/ko/LC_MESSAGES/foreman_ansible.mo
284
+ - locale/ko/foreman_ansible.edit.po
263
285
  - locale/ko/foreman_ansible.po
286
+ - locale/ko/foreman_ansible.po.time_stamp
264
287
  - locale/nl_NL/LC_MESSAGES/foreman_ansible.mo
288
+ - locale/nl_NL/foreman_ansible.edit.po
265
289
  - locale/nl_NL/foreman_ansible.po
290
+ - locale/nl_NL/foreman_ansible.po.time_stamp
266
291
  - locale/pl/LC_MESSAGES/foreman_ansible.mo
292
+ - locale/pl/foreman_ansible.edit.po
267
293
  - locale/pl/foreman_ansible.po
294
+ - locale/pl/foreman_ansible.po.time_stamp
268
295
  - locale/pt_BR/LC_MESSAGES/foreman_ansible.mo
296
+ - locale/pt_BR/foreman_ansible.edit.po
269
297
  - locale/pt_BR/foreman_ansible.po
298
+ - locale/pt_BR/foreman_ansible.po.time_stamp
270
299
  - locale/ru/LC_MESSAGES/foreman_ansible.mo
300
+ - locale/ru/foreman_ansible.edit.po
271
301
  - locale/ru/foreman_ansible.po
302
+ - locale/ru/foreman_ansible.po.time_stamp
272
303
  - locale/sv_SE/LC_MESSAGES/foreman_ansible.mo
304
+ - locale/sv_SE/foreman_ansible.edit.po
273
305
  - locale/sv_SE/foreman_ansible.po
306
+ - locale/sv_SE/foreman_ansible.po.time_stamp
274
307
  - locale/zh_CN/LC_MESSAGES/foreman_ansible.mo
308
+ - locale/zh_CN/foreman_ansible.edit.po
275
309
  - locale/zh_CN/foreman_ansible.po
310
+ - locale/zh_CN/foreman_ansible.po.time_stamp
276
311
  - locale/zh_TW/LC_MESSAGES/foreman_ansible.mo
312
+ - locale/zh_TW/foreman_ansible.edit.po
277
313
  - locale/zh_TW/foreman_ansible.po
314
+ - locale/zh_TW/foreman_ansible.po.time_stamp
278
315
  - package.json
279
316
  - test/factories/ansible_proxy.rb
280
317
  - test/factories/ansible_roles.rb
@@ -347,6 +384,7 @@ files:
347
384
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js
348
385
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss
349
386
  - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js
387
+ - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig
350
388
  - webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js
351
389
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.fixtures.js
352
390
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.test.js
@@ -467,7 +505,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
467
505
  - !ruby/object:Gem::Version
468
506
  version: '0'
469
507
  requirements: []
470
- rubygems_version: 3.1.4
508
+ rubygems_version: 3.3.26
471
509
  signing_key:
472
510
  specification_version: 4
473
511
  summary: Ansible integration with Foreman (theforeman.org)
@@ -482,31 +520,23 @@ test_files:
482
520
  - test/fixtures/sample_playbooks.json
483
521
  - test/fixtures/report.json
484
522
  - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
485
- - test/functional/ansible_roles_controller_test.rb
486
- - test/functional/ansible_variables_controller_test.rb
487
- - test/functional/api/v2/ansible_inventories_controller_test.rb
488
523
  - test/functional/api/v2/ansible_playbooks_controller_test.rb
489
524
  - test/functional/api/v2/ansible_roles_controller_test.rb
490
525
  - test/functional/api/v2/ansible_variables_controller_test.rb
491
526
  - test/functional/api/v2/hostgroups_controller_test.rb
492
527
  - test/functional/api/v2/hosts_controller_test.rb
528
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
529
+ - test/functional/ansible_roles_controller_test.rb
530
+ - test/functional/ansible_variables_controller_test.rb
493
531
  - test/functional/hosts_controller_test.rb
494
532
  - test/functional/ui_ansible_roles_controller_test.rb
495
533
  - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
496
534
  - test/graphql/queries/ansible_roles_query_test.rb
497
535
  - test/graphql/queries/host_ansible_roles_query_test.rb
498
- - test/test_plugin_helper.rb
499
- - test/unit/ansible_role_test.rb
500
- - test/unit/ansible_variable_test.rb
501
536
  - test/unit/concerns/host_managed_extensions_test.rb
502
537
  - test/unit/concerns/hostgroup_extensions_test.rb
503
538
  - test/unit/concerns/config_reports_extensions_test.rb
504
539
  - test/unit/helpers/ansible_reports_helper_test.rb
505
- - test/unit/host_ansible_role_test.rb
506
- - test/unit/hostgroup_ansible_role_test.rb
507
- - test/unit/ignore_roles_test.rb
508
- - test/unit/import_playbooks_test.rb
509
- - test/unit/import_roles_and_variables.rb
510
540
  - test/unit/lib/proxy_api/ansible_test.rb
511
541
  - test/unit/services/ansible_report_importer_test.rb
512
542
  - test/unit/services/ansible_variables_importer_test.rb
@@ -516,5 +546,13 @@ test_files:
516
546
  - test/unit/services/override_resolver_test.rb
517
547
  - test/unit/services/roles_importer_test.rb
518
548
  - test/unit/services/ui_roles_importer_test.rb
549
+ - test/unit/ansible_role_test.rb
550
+ - test/unit/ansible_variable_test.rb
551
+ - test/unit/host_ansible_role_test.rb
552
+ - test/unit/hostgroup_ansible_role_test.rb
553
+ - test/unit/ignore_roles_test.rb
554
+ - test/unit/import_playbooks_test.rb
555
+ - test/unit/import_roles_and_variables.rb
519
556
  - test/unit/ansible_provider_test.rb
557
+ - test/test_plugin_helper.rb
520
558
  - test/integration/hostgroup_js_test.rb