foreman_remote_execution 8.3.1 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby_ci.yml +3 -1
  3. data/app/controllers/api/v2/job_invocations_controller.rb +0 -1
  4. data/app/controllers/job_invocations_controller.rb +1 -20
  5. data/app/controllers/ui_job_wizard_controller.rb +1 -3
  6. data/app/helpers/remote_execution_helper.rb +1 -1
  7. data/app/lib/actions/remote_execution/run_host_job.rb +1 -1
  8. data/app/views/api/v2/job_invocations/base.json.rabl +1 -1
  9. data/app/views/job_invocations/_form.html.erb +1 -1
  10. data/app/views/job_invocations/show.html.erb +1 -1
  11. data/app/views/job_invocations/welcome.html.erb +1 -1
  12. data/config/routes.rb +0 -1
  13. data/db/migrate/20210816100932_rex_setting_category_to_dsl.rb +1 -1
  14. data/extra/cockpit/foreman-cockpit-session +12 -29
  15. data/lib/foreman_remote_execution/engine.rb +2 -2
  16. data/lib/foreman_remote_execution/version.rb +1 -1
  17. data/locale/action_names.rb +2 -2
  18. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  19. data/locale/de/foreman_remote_execution.po +154 -266
  20. data/locale/en/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  21. data/locale/en/foreman_remote_execution.po +24 -132
  22. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  23. data/locale/en_GB/foreman_remote_execution.po +41 -149
  24. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  25. data/locale/es/foreman_remote_execution.po +210 -320
  26. data/locale/foreman_remote_execution.pot +211 -394
  27. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  28. data/locale/fr/foreman_remote_execution.po +241 -353
  29. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  30. data/locale/ja/foreman_remote_execution.po +261 -368
  31. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  32. data/locale/ko/foreman_remote_execution.po +53 -161
  33. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  34. data/locale/pt_BR/foreman_remote_execution.po +225 -335
  35. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  36. data/locale/ru/foreman_remote_execution.po +53 -161
  37. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  38. data/locale/zh_CN/foreman_remote_execution.po +359 -465
  39. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  40. data/locale/zh_TW/foreman_remote_execution.po +54 -162
  41. data/webpack/JobWizard/JobWizard.js +10 -52
  42. data/webpack/JobWizard/JobWizard.scss +1 -5
  43. data/webpack/JobWizard/JobWizardConstants.js +1 -1
  44. data/webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap +0 -8
  45. data/webpack/JobWizard/__tests__/fixtures.js +0 -5
  46. data/webpack/JobWizard/__tests__/integration.test.js +0 -15
  47. data/webpack/JobWizard/__tests__/validation.test.js +0 -27
  48. data/webpack/JobWizard/autofill.js +2 -6
  49. data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +0 -19
  50. data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap +1 -9
  51. data/webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js +0 -3
  52. data/webpack/JobWizard/steps/HostsAndInputs/HostSearch.js +4 -28
  53. data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +2 -32
  54. data/webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js +10 -16
  55. data/webpack/JobWizard/steps/HostsAndInputs/index.js +3 -55
  56. data/webpack/JobWizard/steps/Schedule/QueryType.js +1 -1
  57. data/webpack/JobWizard/steps/Schedule/RepeatHour.js +1 -0
  58. data/webpack/JobWizard/steps/Schedule/__tests__/Schedule.test.js +5 -25
  59. data/webpack/JobWizard/steps/form/DateTimePicker.js +1 -0
  60. data/webpack/JobWizard/steps/form/Formatter.js +8 -30
  61. data/webpack/JobWizard/steps/form/GroupedSelectField.js +1 -0
  62. data/webpack/JobWizard/steps/form/SelectField.js +1 -0
  63. data/webpack/JobWizard/submit.js +2 -13
  64. data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +4 -4
  65. data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +2 -2
  66. data/webpack/react_app/components/RecentJobsCard/constants.js +2 -2
  67. metadata +5 -5
@@ -39,35 +39,15 @@ api.get.mockImplementation(({ handleSuccess, ...action }) => {
39
39
  handleSuccess({
40
40
  data: { results: [jobTemplateResponse.job_template] },
41
41
  });
42
- } else if (action.key === 'HOST_IDS') {
43
- handleSuccess &&
44
- handleSuccess({
45
- data: { results: [{ name: 'host1' }, { name: 'host3' }] },
46
- });
47
42
  }
48
43
  return { type: 'get', ...action };
49
44
  });
50
45
 
51
46
  const mockStore = configureMockStore([]);
52
- const store = mockStore({
53
- HOSTS_API: {
54
- response: {
55
- subtotal: 3,
56
- },
57
- },
58
- });
47
+ const store = mockStore({});
59
48
  jest.useFakeTimers();
60
49
 
61
50
  describe('Schedule', () => {
62
- beforeEach(() => {
63
- jest.spyOn(selectors, 'selectRouterSearch');
64
- selectors.selectRouterSearch.mockImplementation(() => ({
65
- 'host_ids[]': ['105', '37'],
66
- }));
67
- });
68
- afterEach(() => {
69
- selectors.selectRouterSearch.mockRestore();
70
- });
71
51
  it('sub steps appear', () => {
72
52
  render(
73
53
  <Provider store={store}>
@@ -139,7 +119,7 @@ describe('Schedule', () => {
139
119
  });
140
120
 
141
121
  act(() => {
142
- fireEvent.click(screen.getByText('Category and template'));
122
+ fireEvent.click(screen.getByText('Category and Template'));
143
123
  });
144
124
  act(() => {
145
125
  fireEvent.click(screen.getByRole('button', { name: 'Future execution' }));
@@ -246,7 +226,7 @@ describe('Schedule', () => {
246
226
  });
247
227
 
248
228
  act(() => {
249
- fireEvent.click(screen.getByText('Category and template'));
229
+ fireEvent.click(screen.getByText('Category and Template'));
250
230
  });
251
231
  act(() => {
252
232
  fireEvent.click(
@@ -306,9 +286,9 @@ describe('Schedule', () => {
306
286
  expect(screen.getByText('Review details').disabled).toBeFalsy();
307
287
 
308
288
  await act(async () => {
309
- fireEvent.click(screen.getByText('Category and template'));
289
+ fireEvent.click(screen.getByText('Category and Template'));
310
290
  });
311
- expect(screen.getAllByText('Category and template')).toHaveLength(3);
291
+ expect(screen.getAllByText('Category and Template')).toHaveLength(3);
312
292
 
313
293
  await act(async () => {
314
294
  fireEvent.click(
@@ -119,6 +119,7 @@ export const DateTimePicker = ({
119
119
  is24Hour
120
120
  isDisabled={isDisabled || formattedDate.length === 0}
121
121
  invalidFormatErrorMessage={__('Invalid time format')}
122
+ menuAppendTo={() => document.body}
122
123
  includeSeconds={includeSeconds}
123
124
  />
124
125
  </>
@@ -1,16 +1,12 @@
1
- import React, { useEffect } from 'react';
2
- import { useSelector, useDispatch } from 'react-redux';
1
+ import React from 'react';
3
2
  import { FormGroup, TextArea } from '@patternfly/react-core';
4
3
  import PropTypes from 'prop-types';
5
4
  import SearchBar from 'foremanReact/components/SearchBar';
6
5
  import { getControllerSearchProps } from 'foremanReact/constants';
7
- import { TRIGGERS } from 'foremanReact/components/AutoComplete/AutoCompleteConstants';
8
- import { getResults } from 'foremanReact/components/AutoComplete/AutoCompleteActions';
9
6
  import { helpLabel, ResetDefault } from './FormHelpers';
10
7
  import { SelectField } from './SelectField';
11
8
  import { ResourceSelect } from './ResourceSelect';
12
9
  import { DateTimePicker } from '../form/DateTimePicker';
13
- import { noop } from '../../../helpers';
14
10
 
15
11
  const TemplateSearchField = ({
16
12
  name,
@@ -22,51 +18,33 @@ const TemplateSearchField = ({
22
18
  setValue,
23
19
  values,
24
20
  }) => {
25
- const searchQuery = useSelector(
26
- state => state.autocomplete?.[name]?.searchQuery
27
- );
28
- const dispatch = useDispatch();
29
- useEffect(() => {
30
- setValue({ ...values, [name]: searchQuery });
31
- // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, [searchQuery]);
33
21
  const id = name.replace(/ /g, '-');
34
22
  const props = getControllerSearchProps(controller.replace('/', '_'), name);
35
-
36
- const setSearch = newSearchQuery => {
37
- dispatch(
38
- getResults({
39
- url,
40
- searchQuery: newSearchQuery,
41
- controller,
42
- trigger: TRIGGERS.INPUT_CHANGE,
43
- id: name,
44
- })
45
- );
46
- };
47
23
  return (
48
24
  <FormGroup
49
25
  label={name}
50
26
  labelIcon={helpLabel(labelText, name)}
51
27
  labelInfo={
52
- <ResetDefault defaultValue={defaultValue} setValue={setSearch} />
28
+ <ResetDefault
29
+ defaultValue={defaultValue}
30
+ setValue={search => setValue({ ...values, [name]: search })}
31
+ />
53
32
  }
54
33
  fieldId={id}
55
34
  isRequired={required}
56
35
  className="foreman-search-field"
57
36
  >
58
37
  <SearchBar
59
- initialQuery={values[name]}
60
38
  data={{
61
39
  ...props,
62
40
  autocomplete: {
63
41
  id: name,
64
42
  url,
65
- useKeyShortcuts: true,
43
+ searchQuery: values[name],
66
44
  },
67
45
  }}
68
- onSearch={noop}
69
- onBookmarkClick={search => setSearch(search)}
46
+ onSearch={null}
47
+ onSearchChange={search => setValue({ ...values, [name]: search })}
70
48
  />
71
49
  </FormGroup>
72
50
  );
@@ -68,6 +68,7 @@ export const GroupedSelectField = ({
68
68
  selections={selected}
69
69
  className="without_select2"
70
70
  onClear={onClear}
71
+ menuAppendTo={() => document.body}
71
72
  aria-labelledby={fieldId}
72
73
  toggleAriaLabel={`${label} toggle`}
73
74
  {...props}
@@ -43,6 +43,7 @@ export const SelectField = ({
43
43
  isOpen={isOpen}
44
44
  className="without_select2"
45
45
  maxHeight="45vh"
46
+ menuAppendTo={() => document.body}
46
47
  placeholderText=" " // To prevent showing first option as selected
47
48
  aria-labelledby={fieldId}
48
49
  toggleAriaLabel={`${label} toggle`}
@@ -12,8 +12,6 @@ export const submit = ({
12
12
  location,
13
13
  organization,
14
14
  feature,
15
- provider,
16
- advancedInputs,
17
15
  dispatch,
18
16
  }) => {
19
17
  const {
@@ -39,13 +37,6 @@ export const submit = ({
39
37
  keyPassphrase,
40
38
  timeToPickup,
41
39
  } = advancedValues;
42
- const providerInputs = advancedInputs.filter(v => v.provider_input);
43
- const providerValues = {};
44
- providerInputs.forEach(({ name }) => {
45
- providerValues[name] = advancedTemplateValues[name];
46
- delete advancedTemplateValues[name];
47
- });
48
-
49
40
  const getCronLine = () => {
50
41
  const [hour, minute] = repeatData.at
51
42
  ? repeatData.at.split(':')
@@ -113,16 +104,14 @@ export const submit = ({
113
104
  concurrency_level: concurrencyLevel,
114
105
  },
115
106
  bookmark_id: null,
116
- search_query: buildHostQuery(selectedTargets, hostsSearchQuery),
107
+ search_query:
108
+ buildHostQuery(selectedTargets, hostsSearchQuery) || 'name ~ *',
117
109
  description_format: description,
118
110
  execution_timeout_interval: timeoutToKill,
119
111
  feature,
120
112
  time_to_pickup: timeToPickup,
121
113
  },
122
114
  };
123
- if (Object.keys(providerValues).length) {
124
- api.job_invocation[provider] = providerValues;
125
- }
126
115
 
127
116
  dispatch(
128
117
  post({
@@ -25,7 +25,7 @@ const RecentJobsCard = ({ hostDetails: { name, id } }) => {
25
25
  header={__('Recent jobs')}
26
26
  dropdownItems={[
27
27
  <DropdownItem
28
- href={foremanUrl(`${JOB_BASE_URL}${id}`)}
28
+ href={foremanUrl(`${JOB_BASE_URL}${name}`)}
29
29
  key="link-to-all"
30
30
  ouiaId="link-to-all-dropdown-item"
31
31
  >
@@ -33,7 +33,7 @@ const RecentJobsCard = ({ hostDetails: { name, id } }) => {
33
33
  </DropdownItem>,
34
34
  <DropdownItem
35
35
  href={foremanUrl(
36
- `${JOB_BASE_URL}${id}+and+status+%3D+failed+or+status%3D+succeeded`
36
+ `${JOB_BASE_URL}${name}+and+status+%3D+failed+or+status%3D+succeeded`
37
37
  )}
38
38
  key="link-to-finished"
39
39
  ouiaId="link-to-finished-dropdown-item"
@@ -41,14 +41,14 @@ const RecentJobsCard = ({ hostDetails: { name, id } }) => {
41
41
  {__('View finished jobs')}
42
42
  </DropdownItem>,
43
43
  <DropdownItem
44
- href={foremanUrl(`${JOB_BASE_URL}${id}+and+status+%3D+running`)}
44
+ href={foremanUrl(`${JOB_BASE_URL}${name}+and+status+%3D+running`)}
45
45
  key="link-to-running"
46
46
  ouiaId="link-to-running-dropdown-item"
47
47
  >
48
48
  {__('View running jobs')}
49
49
  </DropdownItem>,
50
50
  <DropdownItem
51
- href={foremanUrl(`${JOB_BASE_URL}${id}+and+status+%3D+queued`)}
51
+ href={foremanUrl(`${JOB_BASE_URL}${name}+and+status+%3D+queued`)}
52
52
  key="link-to-scheduled"
53
53
  ouiaId="link-to-scheduled-dropdown-item"
54
54
  >
@@ -17,10 +17,10 @@ const RecentJobsTable = ({ status, hostId }) => {
17
17
  const jobsUrl =
18
18
  hostId &&
19
19
  foremanUrl(
20
- `${JOB_API_URL}${hostId}&status=${status}&limit=${JOBS_IN_CARD}`
20
+ `${JOB_API_URL}${hostId}+and+status%3D${status}&per_page=${JOBS_IN_CARD}`
21
21
  );
22
22
  const {
23
- response: { job_invocations: jobs },
23
+ response: { results: jobs },
24
24
  status: responseStatus,
25
25
  } = useAPI('get', jobsUrl, RECENT_JOBS_KEY);
26
26
 
@@ -6,8 +6,8 @@ export const SCHEDULED_TAB = 2;
6
6
  export const JOB_SUCCESS_STATUS = 0;
7
7
  export const JOB_ERROR_STATUS = 1;
8
8
 
9
- export const JOB_BASE_URL = '/job_invocations?search=targeted_host_id+%3D+';
9
+ export const JOB_BASE_URL = '/job_invocations?search=host+%3D+';
10
10
  export const JOB_API_URL =
11
- '/job_invocations/preview_job_invocations_per_host?host_id=';
11
+ '/api/job_invocations?order=start_at+DESC&search=targeted_host_id%3D';
12
12
  export const JOBS_IN_CARD = 3;
13
13
  export const RECENT_JOBS_KEY = { key: 'RECENT_JOBS_KEY' };
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_remote_execution
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.1
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-28 00:00:00.000000000 Z
11
+ date: 2022-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -543,7 +543,7 @@ homepage: https://github.com/theforeman/foreman_remote_execution
543
543
  licenses:
544
544
  - GPL-3.0
545
545
  metadata: {}
546
- post_install_message:
546
+ post_install_message:
547
547
  rdoc_options: []
548
548
  require_paths:
549
549
  - lib
@@ -559,7 +559,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
559
559
  version: '0'
560
560
  requirements: []
561
561
  rubygems_version: 3.1.6
562
- signing_key:
562
+ signing_key:
563
563
  specification_version: 4
564
564
  summary: A plugin bringing remote execution to the Foreman, completing the config
565
565
  management functionality with remote management functionality.