foreman-tasks 7.2.0 → 7.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5d611523d1262879b33177bf9c1f4c394142fee8433c2fda798cb4063b60f99
4
- data.tar.gz: 1e7974c6fde725d0fe46dcffd6793c7f4b078c3c6e2e3429dce42180e61e4044
3
+ metadata.gz: 84fbe8d91ad4109b2f32bed34ca474da3274062d1413572f22da460ba84fae2e
4
+ data.tar.gz: 6176aacd201d2652ffdec31de70a37f34f3cdee4213fcabbea5206692fa3737c
5
5
  SHA512:
6
- metadata.gz: 6f358b767cf2c8f2f6d31a43aa6c1fca27a6db053311d4540cea15d11c7c76758db192d5b39ecef17fcfc9d89e9e99a233c6b3d14fadd41efcca709aea37704b
7
- data.tar.gz: 9c08bf19e2f8bdc05add76a9b8e9b783407b03ba99f0c47325454468a4654e44296f8dafd87e40a5d58ed771edb58900c0ac41738202efce5043193b5580a50c
6
+ metadata.gz: 2fe679d1b7eef698c3ec42e4d31590cc674e556a91cdd490c4da01aa7ba61988c9a1c1f730972a9d55829b09550fe4235e7192157b976aa71398558a632bae70
7
+ data.tar.gz: 581e0a7c39164915da8f19505745f6b7c98cbe4dbdbc088073e6fc7d6224b4fb209443ac48a566e008c59ee0e7b53a351b70808efa72d2ffa6fa7c0cd79f0521
@@ -52,8 +52,8 @@ module ForemanTasks
52
52
  default = '-'
53
53
  return default if recurring_logic.done? || recurring_logic.disabled?
54
54
 
55
- last_task = recurring_logic.tasks.order(:start_at).last
56
- last_task ? last_task.start_at : default
55
+ upcoming_task = recurring_logic.next_task
56
+ upcoming_task ? upcoming_task.start_at : default
57
57
  end
58
58
 
59
59
  def time_f(f, attr, field_options = {}, time_options = {}, html_options = {})
@@ -51,7 +51,7 @@ module Actions
51
51
 
52
52
  def notify(event, tasks)
53
53
  tasks.each do |task|
54
- action.plan_event(event, execution_plan_id: task.execution_plan_id, step_id: task.step_id)
54
+ action.plan_event(event, execution_plan_id: task.execution_plan_id, step_id: task.step_id, optional: true)
55
55
  end
56
56
  end
57
57
 
@@ -29,6 +29,14 @@ module ForemanTasks
29
29
  %w[active disabled finished cancelled failed]
30
30
  end
31
31
 
32
+ def last_task
33
+ tasks.order(:started_at).where.not(started_at: nil).last
34
+ end
35
+
36
+ def next_task
37
+ tasks.order(:start_at).where(started_at: nil).last
38
+ end
39
+
32
40
  def enabled=(value)
33
41
  task = tasks.find_by(:state => :scheduled)
34
42
  if task
@@ -1,4 +1,9 @@
1
1
  object @recurring_logic
2
2
 
3
3
  attributes :id, :cron_line, :end_time, :iteration, :task_group_id, :state,
4
- :max_iteration
4
+ :max_iteration, :purpose
5
+
6
+ node(:task_count) { |rl| rl.tasks.count }
7
+ node(:action) { |rl| rl.tasks.first.try(:action) }
8
+ node(:last_occurence) { |rl| rl.last_task&.started_at }
9
+ node(:next_occurence) { |rl| rl.next_task&.start_at }
@@ -56,7 +56,7 @@
56
56
  <td><%= recurring_logic.cron_line %></td>
57
57
  <td><%= link_to(recurring_logic.tasks.count, foreman_tasks_tasks_url(:search => "task_group.id = #{recurring_logic.task_group.id}")) %></td>
58
58
  <td><%= format_task_input(recurring_logic.tasks.first) %></td>
59
- <td><%= recurring_logic.tasks.order(:started_at).where('started_at IS NOT NULL').last.try(:started_at) || "-" %></td>
59
+ <td><%= recurring_logic.last_task.try(:started_at) || "-" %></td>
60
60
  <td><%= recurring_logic_next_occurrence recurring_logic %></td>
61
61
  <td><%= recurring_logic.iteration %></td>
62
62
  <td><%= format_recurring_logic_limit recurring_logic.max_iteration %></td>
data/config/routes.rb CHANGED
@@ -72,7 +72,6 @@ Foreman::Application.routes.draw do
72
72
  require 'sidekiq/web'
73
73
  redis_url = ENV['DYNFLOW_REDIS_URL'] || SETTINGS.dig(:dynflow, :redis_url)
74
74
  Sidekiq.redis = { url: redis_url }
75
- Sidekiq::Web.set :sessions, false
76
75
  mount Sidekiq::Web => '/sidekiq', :constraints => ForemanTasks::Dynflow::SidekiqConsoleConstraint.new
77
76
  end
78
77
  end
@@ -1,5 +1,5 @@
1
1
  class TasksSettingsToDslCategory < ActiveRecord::Migration[6.0]
2
2
  def up
3
- Setting.where(category: 'Setting::ForemanTasks').update_all(category: 'Setting')
3
+ Setting.where(category: 'Setting::ForemanTasks').update_all(category: 'Setting') if column_exists?(:settings, :category)
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '7.2.0'.freeze
2
+ VERSION = '7.2.1'.freeze
3
3
  end
@@ -48,7 +48,7 @@ export const TaskButtons = ({
48
48
  <span
49
49
  className={`glyphicon glyphicon-refresh ${taskReload ? 'spin' : ''}`}
50
50
  />
51
- {__(`${taskReload ? 'Stop' : 'Start'} auto-reloading`)}
51
+ {taskReload ? __('Stop auto-reloading') : __('Start auto-reloading')}
52
52
  </Button>
53
53
  <Button
54
54
  className="dynflow-button"
@@ -19,7 +19,7 @@ exports[`Task rendering render with minimal Props 1`] = `
19
19
  <span
20
20
  className="glyphicon glyphicon-refresh "
21
21
  />
22
- Start auto-reloading
22
+ Start auto-reloading
23
23
  </Button>
24
24
  <Button
25
25
  active={false}
@@ -118,7 +118,7 @@ exports[`Task rendering render with some Props 1`] = `
118
118
  <span
119
119
  className="glyphicon glyphicon-refresh spin"
120
120
  />
121
- Stop auto-reloading
121
+ Stop auto-reloading
122
122
  </Button>
123
123
  <Button
124
124
  active={false}
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Tab, Tabs } from 'patternfly-react';
4
- import { translate as __ } from 'foremanReact/common/I18n';
4
+ import { translate as __, sprintf } from 'foremanReact/common/I18n';
5
5
  import { STATUS } from 'foremanReact/constants';
6
6
  import MessageBox from 'foremanReact/components/common/MessageBox';
7
7
  import Task from './Components/Task';
@@ -49,7 +49,7 @@ const TaskDetails = ({
49
49
  <MessageBox
50
50
  key="task-details-error"
51
51
  icontype="error-circle-o"
52
- msg={__(`Could not receive data: ${APIerror && APIerror.message}`)}
52
+ msg={sprintf(__('Could not receive data: %s'), APIerror?.message)}
53
53
  />
54
54
  );
55
55
  }
@@ -1,3 +1,4 @@
1
+ import { FormattedMessage } from 'react-intl';
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { Alert, Button } from 'patternfly-react';
@@ -17,14 +18,19 @@ export const SelectAllAlert = ({
17
18
  Math.min(itemCount, perPage)
18
19
  )}
19
20
  <Button bsStyle="link" onClick={selectAllRows}>
20
- {__('Select All')}
21
- <b> {itemCount} </b> {__('tasks.')}
21
+ <FormattedMessage
22
+ id="select-all-tasks"
23
+ values={{
24
+ count: <b>{itemCount}</b>,
25
+ }}
26
+ defaultMessage={__('Select all {count} tasks')}
27
+ />
22
28
  </Button>
23
29
  </React.Fragment>
24
30
  );
25
31
  const undoSelectText = (
26
32
  <React.Fragment>
27
- {sprintf(__(`All %s tasks are selected. `), itemCount)}
33
+ {sprintf(__('All %s tasks are selected.'), itemCount)}
28
34
  <Button bsStyle="link" onClick={unselectAllRows}>
29
35
  {__('Undo selection')}
30
36
  </Button>
@@ -6,7 +6,7 @@ exports[`SelectAllAlert renders SelectAllAlert with all rows selected 1`] = `
6
6
  onDismiss={null}
7
7
  type="info"
8
8
  >
9
- All 7 tasks are selected.
9
+ All 7 tasks are selected.
10
10
  <Button
11
11
  active={false}
12
12
  block={false}
@@ -35,14 +35,17 @@ exports[`SelectAllAlert renders SelectAllAlert with perPage > itemCout 1`] = `
35
35
  disabled={false}
36
36
  onClick={[MockFunction]}
37
37
  >
38
- Select All
39
- <b>
40
-
41
- 7
42
-
43
- </b>
44
-
45
- tasks.
38
+ <FormattedMessage
39
+ defaultMessage="Select all {count} tasks"
40
+ id="select-all-tasks"
41
+ values={
42
+ Object {
43
+ "count": <b>
44
+ 7
45
+ </b>,
46
+ }
47
+ }
48
+ />
46
49
  </Button>
47
50
  </Alert>
48
51
  `;
@@ -62,14 +65,17 @@ exports[`SelectAllAlert renders SelectAllAlert without all rows selected 1`] = `
62
65
  disabled={false}
63
66
  onClick={[MockFunction]}
64
67
  >
65
- Select All
66
- <b>
67
-
68
- 7
69
-
70
- </b>
71
-
72
- tasks.
68
+ <FormattedMessage
69
+ defaultMessage="Select all {count} tasks"
70
+ id="select-all-tasks"
71
+ values={
72
+ Object {
73
+ "count": <b>
74
+ 7
75
+ </b>,
76
+ }
77
+ }
78
+ />
73
79
  </Button>
74
80
  </Alert>
75
81
  `;
@@ -53,7 +53,7 @@ const handleErrorResume = (error, dispatch) => {
53
53
  dispatch({ type: TASKS_RESUME_FAILURE, error });
54
54
  dispatch(
55
55
  addToast(
56
- errorToastData(`${__(`Cannot resume tasks at the moment`)} ${error}`)
56
+ errorToastData(`${__('Cannot resume tasks at the moment')} ${error}`)
57
57
  )
58
58
  );
59
59
  };
@@ -112,7 +112,7 @@ const handleErrorCancel = (error, dispatch) => {
112
112
  dispatch({ type: TASKS_CANCEL_FAILURE, error });
113
113
  dispatch(
114
114
  addToast(
115
- errorToastData(`${__(`Cannot cancel tasks at the moment`)} ${error}`)
115
+ errorToastData(`${__('Cannot cancel tasks at the moment')} ${error}`)
116
116
  )
117
117
  );
118
118
  };
@@ -175,7 +175,7 @@ const handleErrorForceCancel = (error, dispatch) => {
175
175
  dispatch(
176
176
  addToast(
177
177
  errorToastData(
178
- `${__(`Cannot force cancel tasks at the moment`)} ${error}`
178
+ `${__('Cannot force cancel tasks at the moment')} ${error}`
179
179
  )
180
180
  )
181
181
  );
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { Table } from 'foremanReact/components/common/table';
4
4
  import { STATUS } from 'foremanReact/constants';
5
5
  import MessageBox from 'foremanReact/components/common/MessageBox';
6
- import { translate as __ } from 'foremanReact/common/I18n';
6
+ import { translate as __, sprintf } from 'foremanReact/common/I18n';
7
7
  import Pagination from 'foremanReact/components/Pagination';
8
8
  import { getURIQuery } from 'foremanReact/common/helpers';
9
9
  import createTasksTableSchema from './TasksTableSchema';
@@ -68,7 +68,7 @@ const TasksTable = ({
68
68
  <MessageBox
69
69
  key="tasks-table-error"
70
70
  icontype="error-circle-o"
71
- msg={__(`Could not receive data: ${error && error.message}`)}
71
+ msg={sprintf(__('Could not receive data: %s'), error?.message)}
72
72
  />
73
73
  );
74
74
  }
@@ -4,7 +4,7 @@ exports[`TasksTable rendering render with error Props 1`] = `
4
4
  <MessageBox
5
5
  icontype="error-circle-o"
6
6
  key="tasks-table-error"
7
- msg="Could not receive data: null"
7
+ msg="Could not receive data: "
8
8
  />
9
9
  `;
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 7.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-20 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow