foreman_remote_execution 6.2.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/job_invocations_controller.rb +1 -0
  3. data/app/helpers/hosts_extensions_helper.rb +62 -0
  4. data/app/lib/actions/remote_execution/run_host_job.rb +4 -0
  5. data/app/lib/actions/remote_execution/run_hosts_job.rb +4 -0
  6. data/app/models/job_invocation_composer.rb +6 -2
  7. data/app/models/job_template.rb +4 -1
  8. data/app/models/ssh_execution_provider.rb +3 -3
  9. data/app/views/api/v2/job_invocations/base.json.rabl +1 -1
  10. data/app/views/job_invocations/_card_target_hosts.html.erb +8 -0
  11. data/app/views/job_invocations/_form.html.erb +2 -0
  12. data/db/migrate/20220331112719_add_ssh_user_to_job_invocation.rb +5 -0
  13. data/lib/foreman_remote_execution/engine.rb +6 -3
  14. data/lib/foreman_remote_execution/version.rb +1 -1
  15. data/locale/action_names.rb +3 -3
  16. data/locale/de/foreman_remote_execution.po +23 -23
  17. data/locale/en/foreman_remote_execution.po +23 -23
  18. data/locale/en_GB/foreman_remote_execution.po +23 -23
  19. data/locale/es/foreman_remote_execution.po +23 -23
  20. data/locale/foreman_remote_execution.pot +64 -66
  21. data/locale/fr/foreman_remote_execution.po +23 -23
  22. data/locale/ja/foreman_remote_execution.po +23 -23
  23. data/locale/ko/foreman_remote_execution.po +23 -23
  24. data/locale/pt_BR/foreman_remote_execution.po +23 -23
  25. data/locale/ru/foreman_remote_execution.po +23 -23
  26. data/locale/zh_CN/foreman_remote_execution.po +23 -23
  27. data/locale/zh_TW/foreman_remote_execution.po +23 -23
  28. data/webpack/JobWizard/JobWizardConstants.js +2 -2
  29. data/webpack/JobWizard/__tests__/fixtures.js +8 -4
  30. data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +2 -2
  31. data/webpack/JobWizard/steps/HostsAndInputs/SelectGQL.js +2 -1
  32. data/webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js +1 -1
  33. data/webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js +1 -1
  34. data/webpack/JobWizard/steps/HostsAndInputs/hostgroups.gql +1 -0
  35. data/webpack/JobWizard/steps/HostsAndInputs/hosts.gql +1 -0
  36. data/webpack/JobWizard/steps/ReviewDetails/index.js +1 -1
  37. data/webpack/JobWizard/steps/Schedule/__tests__/Schedule.test.js +15 -15
  38. data/webpack/JobWizard/steps/form/SearchSelect.js +0 -1
  39. data/webpack/__mocks__/foremanReact/common/globalIdHelpers.js +1 -0
  40. data/webpack/global_index.js +2 -8
  41. data/webpack/react_app/components/HostKebab/KebabItems.js +6 -1
  42. data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +4 -4
  43. data/webpack/react_app/components/TargetingHosts/TargetingHostsConsts.js +1 -0
  44. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +8 -3
  45. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +9 -1
  46. data/webpack/react_app/components/TargetingHosts/__tests__/fixtures.js +1 -4
  47. data/webpack/react_app/components/TargetingHosts/index.js +1 -0
  48. data/webpack/react_app/extend/Fills.js +48 -0
  49. metadata +6 -7
  50. data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +0 -62
  51. data/webpack/react_app/extend/fillKebabItems.js +0 -11
  52. data/webpack/react_app/extend/fillRecentJobsCard.js +0 -11
  53. data/webpack/react_app/extend/fillRexFeaturesDropdown.js +0 -11
  54. data/webpack/react_app/extend/fillregistrationAdvanced.js +0 -11
@@ -1,62 +0,0 @@
1
- module ForemanRemoteExecution
2
- module HostsHelperExtensions
3
- def host_overview_buttons(host)
4
- [
5
- { :button => link_to_if_authorized(_("Jobs"), hash_for_job_invocations_path(search: "host=#{host.name}"), :title => _("Job invocations"), :class => 'btn btn-default'), :priority => 200 },
6
- ]
7
- end
8
-
9
- def multiple_actions
10
- res = super
11
- res += [ [_('Schedule Remote Job'), new_job_invocation_path, false] ] if can_schedule_jobs?
12
- res
13
- end
14
-
15
- def schedule_job_multi_button(*args)
16
- host_features = rex_host_features(*args)
17
-
18
- if host_features.present?
19
- action_buttons(schedule_job_button(*args), *host_features)
20
- else
21
- schedule_job_button(*args)
22
- end
23
- end
24
-
25
- def rex_host_features(host, *_rest)
26
- return [] unless can_execute_on_host?(host)
27
- RemoteExecutionFeature.with_host_action_button.order(:label).map do |feature|
28
- link_to(_('%s') % feature.name, job_invocations_path(:host_ids => [host.id], :feature => feature.label), :method => :post)
29
- end
30
- end
31
-
32
- def schedule_job_button(host, *_rest)
33
- return unless can_execute_on_host?(host)
34
- link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [host.id]), :id => :run_button, :class => 'btn btn-default')
35
- end
36
-
37
- def web_console_button(host, *args)
38
- return if !authorized_for(permission: 'cockpit_hosts', auth_object: host) || !can_execute_on_infrastructure_host?(host)
39
-
40
- url = SSHExecutionProvider.cockpit_url_for_host(host.name)
41
- url ? link_to(_('Web Console'), url, :class => 'btn btn-default', :id => :'web-console-button', :target => '_new') : nil
42
- end
43
-
44
- def host_title_actions(*args)
45
- title_actions(button_group(schedule_job_multi_button(*args)),
46
- button_group(web_console_button(*args)))
47
- super(*args)
48
- end
49
-
50
- def can_schedule_jobs?
51
- authorized_for(controller: :job_invocations, action: :create)
52
- end
53
-
54
- def can_execute_on_host?(host)
55
- can_schedule_jobs? && can_execute_on_infrastructure_host?(host)
56
- end
57
-
58
- def can_execute_on_infrastructure_host?(host)
59
- !host.infrastructure_host? || User.current.can?(:execute_jobs_on_infrastructure_hosts)
60
- end
61
- end
62
- end
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
3
- import KebabItems from '../components/HostKebab/KebabItems';
4
-
5
- export default () =>
6
- addGlobalFill(
7
- 'host-details-kebab',
8
- 'rex-host-details-kebab-job',
9
- <KebabItems key="rex-host-details-kebab-job" />,
10
- 100
11
- );
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
3
- import RecentJobsCard from '../components/RecentJobsCard';
4
-
5
- export default () =>
6
- addGlobalFill(
7
- 'details-cards',
8
- 'rex-host-details-latest-jobs',
9
- <RecentJobsCard key="rex-host-details-latest-jobs" />,
10
- 1000
11
- );
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
3
- import FeaturesDropdown from '../components/FeaturesDropdown';
4
-
5
- export default () =>
6
- addGlobalFill(
7
- '_rex-host-features',
8
- '_rex-host-features',
9
- <FeaturesDropdown key="_rex-host-features" />,
10
- 1000
11
- );
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
3
- import RexInterface from '../components/RegistrationExtension/RexInterface';
4
-
5
- export default () =>
6
- addGlobalFill(
7
- 'registrationAdvanced',
8
- 'foreman-remote-exectuion-rex-interface',
9
- <RexInterface key="registration-rex-interface" />,
10
- 100
11
- );