foreman-tasks 11.0.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f24b857f3261425696740e1723b1e7b3aa3f0c1f69a33a7c466fb08f66b8c5a
4
- data.tar.gz: 0b696984a0b211d2408208e5402147b2a2c4a5de94af8bd51177457ecbb14eb5
3
+ metadata.gz: 79bd6594ab916273ed9721d27414688ac717fd041ba33fdc67a1531e0ff0e30c
4
+ data.tar.gz: 91de29666d6b045b9179f662bda4f645e4532683ec1ff5e397b6f90948e6f32a
5
5
  SHA512:
6
- metadata.gz: ae7c4ada68e2cefaa9d90229a3bd05bc43e12511028085f626af8d4de0c9ed4da006831eaebda82d8833ef37c31744d17639826accc2bb8b199e62b2b15be346
7
- data.tar.gz: '078add200bd24fb484e0c2f5435dbad614c7fc535b09e03ed903ace00a297380fc332b62f48244a4c1a88730fe0c1dae65ee44662f020e6867169750d1339d49'
6
+ metadata.gz: 81a6e7b9989f9becb04bf6486ded109c937e9395325ac060d9ce9b027343f44b2be70d44a1b997cb19c15520dabf7bdd654ddf7b017482b09e812fa980a7f103
7
+ data.tar.gz: ed7f40efaae46bbaec076deb15d0c7ff076fe661f5ad28bff67694070954eeac0229d3304a81375982cf96e9f11b60f7fb94402285310598837e52b0ffcec499
@@ -1,33 +1,14 @@
1
1
  name: JavaScript Testing
2
+
2
3
  on:
4
+ push:
5
+ branches:
6
+ - master
3
7
  pull_request:
4
- paths:
5
- - 'webpack/**'
6
- - 'package.json'
7
- - '.github/workflows/js_tests.yml'
8
8
 
9
9
  jobs:
10
10
  test_js:
11
- runs-on: ubuntu-latest
12
- strategy:
13
- fail-fast: false
14
- matrix:
15
- node-version:
16
- - 12
17
- - 14
18
- steps:
19
- - uses: actions/checkout@v2
20
- - name: Setup Node
21
- uses: actions/setup-node@v1
22
- with:
23
- node-version: ${{ matrix.node-version }}
24
- - name: Npm install
25
- run: npm install
26
- - name: Run plugin linter
27
- run: npm run lint
28
- - name: Run plugin tests
29
- run: npm run test
30
- - name: Publish Coveralls
31
- uses: coverallsapp/github-action@master
32
- with:
33
- github-token: ${{ secrets.GITHUB_TOKEN }}
11
+ name: JavaScript
12
+ uses: theforeman/actions/.github/workflows/foreman_plugin_js.yml@v0
13
+ with:
14
+ plugin: foreman-tasks
@@ -38,6 +38,7 @@ module ForemanTasks
38
38
  :if => proc { |t| t.recurring? && t.input_type == :monthly } }
39
39
  validate :can_start_recurring, :if => :recurring?
40
40
  validate :can_start_future, :if => :future?
41
+ validate :start_at_is_not_past
41
42
 
42
43
  def self.new_from_params(params = {})
43
44
  new(params.except(:mode, :start_at, :start_before)).tap do |triggering|
@@ -121,5 +122,9 @@ module ForemanTasks
121
122
  parse_start_at!
122
123
  errors.add(:start_before_raw, _('The task could not be started')) if !start_before.nil? && start_before < start_at
123
124
  end
125
+
126
+ def start_at_is_not_past
127
+ errors.add(:start_at, _('is in the past')) if !start_at.nil? && start_at < Time.zone.now
128
+ end
124
129
  end
125
130
  end
@@ -16,121 +16,122 @@ module ForemanTasks
16
16
  SETTINGS[:foreman_tasks] = { :assets => { :precompile => assets_to_precompile } }
17
17
  end
18
18
 
19
- initializer 'foreman_tasks.register_plugin', :before => :finisher_hook do |app|
20
- app.reloader.to_prepare do
21
- Foreman::Plugin.register :"foreman-tasks" do
22
- requires_foreman '>= 3.15'
23
- divider :top_menu, :parent => :monitor_menu, :last => true, :caption => N_('Foreman Tasks')
24
- menu :top_menu, :tasks,
25
- :url_hash => { :controller => 'foreman_tasks/tasks', :action => :index },
26
- :caption => N_('Tasks'),
27
- :parent => :monitor_menu,
28
- :last => true
29
-
30
- menu :top_menu, :recurring_logics,
31
- :url_hash => { :controller => 'foreman_tasks/recurring_logics', :action => :index },
32
- :caption => N_('Recurring Logics'),
33
- :parent => :monitor_menu,
34
- :last => true
35
-
36
- security_block :foreman_tasks do |_map|
37
- permission :view_foreman_tasks, { :'foreman_tasks/tasks' => [:auto_complete_search, :sub_tasks, :index, :summary, :summary_sub_tasks, :show],
38
- :'foreman_tasks/react' => [:index],
39
- :'foreman_tasks/api/tasks' => [:bulk_search, :show, :index, :summary, :summary_sub_tasks, :details, :sub_tasks] }, :resource_type => 'ForemanTasks::Task'
40
- permission :edit_foreman_tasks, { :'foreman_tasks/tasks' => [:resume, :unlock, :force_unlock, :cancel_step, :cancel, :abort],
41
- :'foreman_tasks/api/tasks' => [:bulk_resume, :bulk_cancel, :bulk_stop] }, :resource_type => 'ForemanTasks::Task'
42
-
43
- permission :create_recurring_logics, {}, :resource_type => 'ForemanTasks::RecurringLogic'
44
-
45
- permission :view_recurring_logics, { :'foreman_tasks/recurring_logics' => [:auto_complete_search, :index, :show],
46
- :'foreman_tasks/api/recurring_logics' => [:index, :show] }, :resource_type => 'ForemanTasks::RecurringLogic'
47
-
48
- permission :edit_recurring_logics, { :'foreman_tasks/recurring_logics' => [:cancel, :enable, :disable, :clear_cancelled],
49
- :'foreman_tasks/api/recurring_logics' => [:cancel, :update, :bulk_destroy] }, :resource_type => 'ForemanTasks::RecurringLogic'
50
- end
19
+ initializer 'foreman_tasks.register_plugin', :before => :finisher_hook do
20
+ Foreman::Plugin.register :"foreman-tasks" do
21
+ requires_foreman '>= 3.15'
22
+ divider :top_menu, :parent => :monitor_menu, :last => true, :caption => N_('Foreman Tasks')
23
+ menu :top_menu, :tasks,
24
+ :url_hash => { :controller => 'foreman_tasks/tasks', :action => :index },
25
+ :caption => N_('Tasks'),
26
+ :parent => :monitor_menu,
27
+ :last => true
28
+
29
+ menu :top_menu, :recurring_logics,
30
+ :url_hash => { :controller => 'foreman_tasks/recurring_logics', :action => :index },
31
+ :caption => N_('Recurring Logics'),
32
+ :parent => :monitor_menu,
33
+ :last => true
34
+
35
+ security_block :foreman_tasks do |_map|
36
+ permission :view_foreman_tasks, { :'foreman_tasks/tasks' => [:auto_complete_search, :sub_tasks, :index, :summary, :summary_sub_tasks, :show],
37
+ :'foreman_tasks/react' => [:index],
38
+ :'foreman_tasks/api/tasks' => [:bulk_search, :show, :index, :summary, :summary_sub_tasks, :details, :sub_tasks] }, :resource_type => 'ForemanTasks::Task'
39
+ permission :edit_foreman_tasks, { :'foreman_tasks/tasks' => [:resume, :unlock, :force_unlock, :cancel_step, :cancel, :abort],
40
+ :'foreman_tasks/api/tasks' => [:bulk_resume, :bulk_cancel, :bulk_stop] }, :resource_type => 'ForemanTasks::Task'
41
+
42
+ permission :create_recurring_logics, {}, :resource_type => 'ForemanTasks::RecurringLogic'
43
+
44
+ permission :view_recurring_logics, { :'foreman_tasks/recurring_logics' => [:auto_complete_search, :index, :show],
45
+ :'foreman_tasks/api/recurring_logics' => [:index, :show] }, :resource_type => 'ForemanTasks::RecurringLogic'
46
+
47
+ permission :edit_recurring_logics, { :'foreman_tasks/recurring_logics' => [:cancel, :enable, :disable, :clear_cancelled],
48
+ :'foreman_tasks/api/recurring_logics' => [:cancel, :update, :bulk_destroy] }, :resource_type => 'ForemanTasks::RecurringLogic'
49
+ end
51
50
 
52
- add_all_permissions_to_default_roles
53
-
54
- settings do
55
- category(:tasks, N_('Tasks')) do
56
- setting('foreman_tasks_sync_task_timeout',
57
- type: :integer,
58
- description: N_('Number of seconds to wait for synchronous task to finish.'),
59
- default: 120,
60
- full_name: N_('Sync task timeout'))
61
- setting('dynflow_enable_console',
62
- type: :boolean,
63
- description: N_('Enable the dynflow console (/foreman_tasks/dynflow) for debugging'),
64
- default: true,
65
- full_name: N_('Enable dynflow console'))
66
- setting('dynflow_console_require_auth',
67
- type: :boolean,
68
- description: N_('Require user to be authenticated as user with admin rights when accessing dynflow console'),
69
- default: true,
70
- full_name: N_('Require auth for dynflow console'))
71
- setting('foreman_tasks_proxy_action_retry_count',
72
- type: :integer,
73
- description: N_('Number of attempts to start a task on the smart proxy before failing'),
74
- default: 4,
75
- full_name: N_('Proxy action retry count'))
76
- setting('foreman_tasks_proxy_action_retry_interval',
77
- type: :integer,
78
- description: N_('Time in seconds between retries'),
79
- default: 15,
80
- full_name: N_('Proxy action retry interval'))
81
- setting('foreman_tasks_proxy_batch_trigger',
82
- type: :boolean,
83
- description: N_('Allow triggering tasks on the smart proxy in batches'),
84
- default: true,
85
- full_name: N_('Allow proxy batch tasks'))
86
- setting('foreman_tasks_proxy_batch_size',
87
- type: :integer,
88
- description: N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'),
89
- default: 100,
90
- full_name: N_('Proxy tasks batch size'))
91
- setting('foreman_tasks_troubleshooting_url',
92
- type: :string,
93
- description: N_('Url pointing to the task troubleshooting documentation. '\
94
- 'It should contain %{label} placeholder, that will be replaced with normalized task label '\
95
- '(restricted to only alphanumeric characters)). %{version} placeholder is also available.'),
96
- default: nil,
97
- full_name: N_('Tasks troubleshooting URL'))
98
- setting('foreman_tasks_polling_multiplier',
99
- type: :integer,
100
- description: N_('Polling multiplier which is used to multiply the default polling intervals. '\
101
- 'This can be used to prevent polling too frequently for long running tasks.'),
102
- default: 1,
103
- full_name: N_("Polling intervals multiplier"),
104
- validate: { numericality: { greater_than: 0 } })
105
- end
51
+ add_all_permissions_to_default_roles
52
+
53
+ settings do
54
+ category(:tasks, N_('Tasks')) do
55
+ setting('foreman_tasks_sync_task_timeout',
56
+ type: :integer,
57
+ description: N_('Number of seconds to wait for synchronous task to finish.'),
58
+ default: 120,
59
+ full_name: N_('Sync task timeout'))
60
+ setting('dynflow_enable_console',
61
+ type: :boolean,
62
+ description: N_('Enable the dynflow console (/foreman_tasks/dynflow) for debugging'),
63
+ default: true,
64
+ full_name: N_('Enable dynflow console'))
65
+ setting('dynflow_console_require_auth',
66
+ type: :boolean,
67
+ description: N_('Require user to be authenticated as user with admin rights when accessing dynflow console'),
68
+ default: true,
69
+ full_name: N_('Require auth for dynflow console'))
70
+ setting('foreman_tasks_proxy_action_retry_count',
71
+ type: :integer,
72
+ description: N_('Number of attempts to start a task on the smart proxy before failing'),
73
+ default: 4,
74
+ full_name: N_('Proxy action retry count'))
75
+ setting('foreman_tasks_proxy_action_retry_interval',
76
+ type: :integer,
77
+ description: N_('Time in seconds between retries'),
78
+ default: 15,
79
+ full_name: N_('Proxy action retry interval'))
80
+ setting('foreman_tasks_proxy_batch_trigger',
81
+ type: :boolean,
82
+ description: N_('Allow triggering tasks on the smart proxy in batches'),
83
+ default: true,
84
+ full_name: N_('Allow proxy batch tasks'))
85
+ setting('foreman_tasks_proxy_batch_size',
86
+ type: :integer,
87
+ description: N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'),
88
+ default: 100,
89
+ full_name: N_('Proxy tasks batch size'))
90
+ setting('foreman_tasks_troubleshooting_url',
91
+ type: :string,
92
+ description: N_('Url pointing to the task troubleshooting documentation. '\
93
+ 'It should contain %{label} placeholder, that will be replaced with normalized task label '\
94
+ '(restricted to only alphanumeric characters)). %{version} placeholder is also available.'),
95
+ default: nil,
96
+ full_name: N_('Tasks troubleshooting URL'))
97
+ setting('foreman_tasks_polling_multiplier',
98
+ type: :integer,
99
+ description: N_('Polling multiplier which is used to multiply the default polling intervals. '\
100
+ 'This can be used to prevent polling too frequently for long running tasks.'),
101
+ default: 1,
102
+ full_name: N_("Polling intervals multiplier"),
103
+ validate: { numericality: { greater_than: 0 } })
106
104
  end
105
+ end
107
106
 
108
- register_graphql_query_field :task, '::Types::Task', :record_field
109
- register_graphql_query_field :tasks, '::Types::Task', :collection_field
110
- register_graphql_query_field :recurring_logic, '::Types::RecurringLogic', :record_field
111
- register_graphql_query_field :recurring_logics, '::Types::RecurringLogic', :collection_field
112
-
113
- register_graphql_mutation_field :cancel_recurring_logic, '::Mutations::RecurringLogics::Cancel'
107
+ register_graphql_query_field :task, '::Types::Task', :record_field
108
+ register_graphql_query_field :tasks, '::Types::Task', :collection_field
109
+ register_graphql_query_field :recurring_logic, '::Types::RecurringLogic', :record_field
110
+ register_graphql_query_field :recurring_logics, '::Types::RecurringLogic', :collection_field
114
111
 
115
- logger :dynflow, :enabled => true
116
- logger :action, :enabled => true
112
+ register_graphql_mutation_field :cancel_recurring_logic, '::Mutations::RecurringLogics::Cancel'
117
113
 
118
- role 'Tasks Manager', [:view_foreman_tasks, :edit_foreman_tasks],
119
- 'Role granting permissions to inspect, cancel, resume and unlock tasks'
120
- role 'Tasks Reader', [:view_foreman_tasks],
121
- 'Role granting permissions to inspect tasks'
114
+ logger :dynflow, :enabled => true
115
+ logger :action, :enabled => true
122
116
 
123
- widget 'foreman_tasks/tasks/dashboard/tasks_status', :sizex => 6, :sizey => 1, :name => N_('Task Status')
124
- widget 'foreman_tasks/tasks/dashboard/latest_tasks_in_error_warning', :sizex => 6, :sizey => 1, :name => N_('Latest Warning/Error Tasks')
117
+ role 'Tasks Manager', [:view_foreman_tasks, :edit_foreman_tasks],
118
+ 'Role granting permissions to inspect, cancel, resume and unlock tasks'
119
+ role 'Tasks Reader', [:view_foreman_tasks],
120
+ 'Role granting permissions to inspect tasks'
125
121
 
126
- register_gettext domain: "foreman_tasks"
122
+ widget 'foreman_tasks/tasks/dashboard/tasks_status', :sizex => 6, :sizey => 1, :name => N_('Task Status')
123
+ widget 'foreman_tasks/tasks/dashboard/latest_tasks_in_error_warning', :sizex => 6, :sizey => 1, :name => N_('Latest Warning/Error Tasks')
127
124
 
128
- ForemanTasks.dynflow.eager_load_actions!
129
- extend_observable_events(::Dynflow::Action.descendants.select { |klass| klass <= ::Actions::ObservableAction }.map(&:namespaced_event_names))
130
- end
125
+ register_gettext domain: "foreman_tasks"
131
126
  end
132
127
  end
133
128
 
129
+ config.after_initialize do
130
+ ForemanTasks.dynflow.eager_load_actions!
131
+ plugin = ::Foreman::Plugin.find("foreman-tasks")
132
+ plugin.extend_observable_events(::Dynflow::Action.descendants.select { |klass| klass <= ::Actions::ObservableAction }.map(&:namespaced_event_names))
133
+ end
134
+
134
135
  initializer 'foreman_tasks.apipie' do
135
136
  # this condition is here for compatibility reason to work with Foreman 1.4.x
136
137
  if Apipie.configuration.api_controllers_matcher.is_a?(Array) &&
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '11.0.0'.freeze
2
+ VERSION = '11.0.1'.freeze
3
3
  end
@@ -3,7 +3,7 @@ FactoryBot.define do
3
3
  mode { :immediate }
4
4
 
5
5
  trait :future do
6
- time = Time.zone.now
6
+ time = Time.zone.now + 1.year
7
7
  mode { :future }
8
8
  start_at { time }
9
9
  start_at_raw { time.strftime(ForemanTasks::Triggering::TIME_FORMAT) }
@@ -13,6 +13,13 @@ class TriggeringTest < ActiveSupport::TestCase
13
13
  assert_not_predicate(triggering, :valid?)
14
14
  end
15
15
 
16
+ it 'is invalid when future execution is in the past' do
17
+ triggering = FactoryBot.build(:triggering, :future)
18
+ assert_predicate(triggering, :valid?)
19
+ triggering.start_at = Time.zone.now - 1.day
20
+ assert_not_predicate(triggering, :valid?)
21
+ end
22
+
16
23
  it 'is invalid when recurring logic is invalid' do
17
24
  triggering = FactoryBot.build(:triggering, :recurring)
18
25
  assert_predicate(triggering, :valid?)
@@ -30,6 +30,7 @@ export const OtherInfo = ({ updateQuery, otherCount, query }) => {
30
30
  </span>
31
31
  </Tooltip>
32
32
  <Button
33
+ ouiaId="stopped-other-tasks-button"
33
34
  variant="link"
34
35
  onClick={() =>
35
36
  updateQuery({
@@ -21,6 +21,7 @@ exports[`OtherInfo render 1`] = `
21
21
  </Tooltip>
22
22
  <Button
23
23
  onClick={[Function]}
24
+ ouiaId="stopped-other-tasks-button"
24
25
  variant="link"
25
26
  >
26
27
  7
@@ -1,4 +1,4 @@
1
- @import '~@theforeman/vendor/scss/variables';
1
+ @import 'foremanReact/common/variables';
2
2
 
3
3
  .tasks-labels-row {
4
4
  margin: 0;
@@ -1,5 +1,5 @@
1
- @import '~@theforeman/vendor/scss/variables';
2
- @import '~@theforeman/vendor/scss/mixins';
1
+ @import 'foremanReact/common/variables';
2
+ @import 'foremanReact/common/scss/mixins';
3
3
 
4
4
  @mixin create-tasks-dashboard-column($columns: 12, $screen-min: 0, $gutter: $grid-gutter-width) {
5
5
  @media (min-width: $screen-min) {
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0
4
+ version: 11.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: dynflow
@@ -117,8 +117,8 @@ email:
117
117
  executables: []
118
118
  extensions: []
119
119
  extra_rdoc_files:
120
- - README.md
121
120
  - LICENSE
121
+ - README.md
122
122
  files:
123
123
  - ".eslintrc"
124
124
  - ".github/workflows/js_tests.yml"
@@ -640,7 +640,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
640
640
  - !ruby/object:Gem::Version
641
641
  version: '0'
642
642
  requirements: []
643
- rubygems_version: 3.6.2
643
+ rubygems_version: 3.6.7
644
644
  specification_version: 4
645
645
  summary: Foreman plugin for showing tasks information for resources and users
646
646
  test_files: