foreman-tasks 3.0.6 → 4.0.0

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/lib/actions/entry_action.rb +8 -4
  3. data/app/lib/actions/helpers/lock.rb +11 -5
  4. data/app/lib/actions/middleware/keep_current_request_id.rb +4 -1
  5. data/app/lib/actions/middleware/keep_current_user.rb +11 -1
  6. data/app/lib/actions/observable_action.rb +80 -0
  7. data/app/models/foreman_tasks/concerns/action_subject.rb +0 -6
  8. data/app/models/foreman_tasks/link.rb +60 -0
  9. data/app/models/foreman_tasks/lock.rb +30 -128
  10. data/app/models/foreman_tasks/task.rb +20 -7
  11. data/app/models/foreman_tasks/task/dynflow_task.rb +3 -8
  12. data/app/models/foreman_tasks/task/search.rb +6 -6
  13. data/app/views/foreman_tasks/api/locks/show.json.rabl +4 -0
  14. data/app/views/foreman_tasks/api/tasks/details.json.rabl +5 -3
  15. data/app/views/foreman_tasks/tasks/_lock_card.html.erb +10 -0
  16. data/db/migrate/20181206123910_create_foreman_tasks_links.foreman_tasks.rb +26 -0
  17. data/db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb +14 -0
  18. data/db/migrate/20181206131436_drop_old_locks.foreman_tasks.rb +20 -0
  19. data/db/migrate/20181206131627_make_locks_exclusive.foreman_tasks.rb +25 -0
  20. data/lib/foreman_tasks/cleaner.rb +10 -0
  21. data/lib/foreman_tasks/engine.rb +5 -2
  22. data/lib/foreman_tasks/tasks/export_tasks.rake +2 -2
  23. data/lib/foreman_tasks/version.rb +1 -1
  24. data/package.json +6 -6
  25. data/test/controllers/tasks_controller_test.rb +1 -1
  26. data/test/unit/actions/action_with_sub_plans_test.rb +5 -2
  27. data/test/unit/cleaner_test.rb +4 -4
  28. data/test/unit/locking_test.rb +85 -0
  29. data/webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js +2 -2
  30. data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +3 -2
  31. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Locks.test.js.snap +4 -4
  32. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +2 -0
  33. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +4 -1
  34. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.scss +5 -1
  35. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +3 -0
  36. data/webpack/ForemanTasks/Components/TaskDetails/index.js +2 -0
  37. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.scss +4 -3
  38. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +2 -2
  39. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionNameCellFormatter.test.js.snap +2 -3
  40. data/webpack/ForemanTasks/Components/TasksTable/formatters/actionNameCellFormatter.js +2 -3
  41. metadata +12 -4
  42. data/test/unit/lock_test.rb +0 -22
@@ -21,10 +21,10 @@ const Locks = ({ locks }) => (
21
21
  lock.exclusive ? 'fa-lock' : 'fa-unlock-alt'
22
22
  }`}
23
23
  />
24
- {lock.name}
24
+ {lock.resource_type}
25
25
  </Card.Title>
26
26
  <Card.Body>
27
- {`${lock.resource_type} id:${lock.resource_id}`}
27
+ {`id:${lock.resource_id}`}
28
28
  <br />
29
29
  </Card.Body>
30
30
  </Card>
@@ -69,6 +69,7 @@ class TaskInfo extends Component {
69
69
  {
70
70
  title: 'Name',
71
71
  value: action || __('N/A'),
72
+ className: 'details-name',
72
73
  },
73
74
  {
74
75
  title: 'Start at',
@@ -129,7 +130,7 @@ class TaskInfo extends Component {
129
130
  {__(items[0].title)}:
130
131
  </span>
131
132
  </Col>
132
- <Col md={5} sm={6}>
133
+ <Col md={5} sm={6} className={items[0].className}>
133
134
  <span>{items[0].value}</span>
134
135
  </Col>
135
136
  <Col md={2} sm={6}>
@@ -137,7 +138,7 @@ class TaskInfo extends Component {
137
138
  {__(items[1].title)}:
138
139
  </span>
139
140
  </Col>
140
- <Col md={3} sm={6}>
141
+ <Col md={3} sm={6} className={items[1].className}>
141
142
  {items[1].value}
142
143
  </Col>
143
144
  </Row>
@@ -39,12 +39,12 @@ exports[`Locks rendering render with Props 1`] = `
39
39
  <span
40
40
  className="fa fa-unlock-alt"
41
41
  />
42
- task_owner
42
+ User
43
43
  </CardTitle>
44
44
  <CardBody
45
45
  className=""
46
46
  >
47
- User id:4
47
+ id:4
48
48
  <br />
49
49
  </CardBody>
50
50
  </Card>
@@ -71,12 +71,12 @@ exports[`Locks rendering render with Props 1`] = `
71
71
  <span
72
72
  className="fa fa-unlock-alt"
73
73
  />
74
- task_owner2
74
+ User
75
75
  </CardTitle>
76
76
  <CardBody
77
77
  className=""
78
78
  >
79
- User id:2
79
+ id:2
80
80
  <br />
81
81
  </CardBody>
82
82
  </Card>
@@ -27,6 +27,7 @@ exports[`TaskInfo rendering render with Props 1`] = `
27
27
  </Col>
28
28
  <Col
29
29
  bsClass="col"
30
+ className="details-name"
30
31
  componentClass="div"
31
32
  md={5}
32
33
  sm={6}
@@ -330,6 +331,7 @@ exports[`TaskInfo rendering render without Props 1`] = `
330
331
  </Col>
331
332
  <Col
332
333
  bsClass="col"
334
+ className="details-name"
333
335
  componentClass="div"
334
336
  md={5}
335
337
  sm={6}
@@ -19,6 +19,7 @@ const TaskDetails = ({
19
19
  failedSteps,
20
20
  runningSteps,
21
21
  locks,
22
+ links,
22
23
  cancelStep,
23
24
  taskReloadStart,
24
25
  taskReloadStop,
@@ -87,7 +88,7 @@ const TaskDetails = ({
87
88
  <Errors executionPlan={executionPlan} failedSteps={failedSteps} />
88
89
  </Tab>
89
90
  <Tab eventKey={4} disabled={isLoading} title={__('Locks')}>
90
- <Locks locks={locks} />
91
+ <Locks locks={locks.concat(links)} />
91
92
  </Tab>
92
93
  <Tab eventKey={5} disabled={isLoading} title={__('Raw')}>
93
94
  <Raw
@@ -114,6 +115,7 @@ TaskDetails.propTypes = {
114
115
  APIerror: PropTypes.object,
115
116
  taskReloadStop: PropTypes.func.isRequired,
116
117
  taskReloadStart: PropTypes.func.isRequired,
118
+ links: PropTypes.array,
117
119
  ...Task.propTypes,
118
120
  ...Errors.propTypes,
119
121
  ...Locks.propTypes,
@@ -124,6 +126,7 @@ TaskDetails.defaultProps = {
124
126
  runningSteps: [],
125
127
  APIerror: null,
126
128
  status: STATUS.PENDING,
129
+ links: [],
127
130
  ...Task.defaultProps,
128
131
  ...RunningSteps.defaultProps,
129
132
  ...Errors.defaultProps,
@@ -51,7 +51,7 @@
51
51
  }
52
52
 
53
53
  pre {
54
- white-space: pre;
54
+ white-space: pre-wrap;
55
55
  word-break: normal;
56
56
  }
57
57
 
@@ -59,4 +59,8 @@
59
59
  display: inline-block;
60
60
  width: 10em;
61
61
  }
62
+
63
+ .details-name {
64
+ overflow-wrap: anywhere;
65
+ }
62
66
  }
@@ -70,6 +70,9 @@ export const selectHasSubTasks = state =>
70
70
  export const selectLocks = state =>
71
71
  selectTaskDetailsResponse(state).locks || [];
72
72
 
73
+ export const selectLinks = state =>
74
+ selectTaskDetailsResponse(state).links || [];
75
+
73
76
  export const selectUsernamePath = state =>
74
77
  selectTaskDetailsResponse(state)?.username_path;
75
78
 
@@ -9,6 +9,7 @@ import {
9
9
  selectStartBefore,
10
10
  selectStartedAt,
11
11
  selectLocks,
12
+ selectLinks,
12
13
  selectInput,
13
14
  selectOutput,
14
15
  selectResumable,
@@ -56,6 +57,7 @@ const mapStateToProps = state => ({
56
57
  help: selectHelp(state),
57
58
  hasSubTasks: selectHasSubTasks(state),
58
59
  locks: selectLocks(state),
60
+ links: selectLinks(state),
59
61
  usernamePath: selectUsernamePath(state),
60
62
  action: selectAction(state),
61
63
  state: selectState(state),
@@ -1,8 +1,9 @@
1
- .tasks-pagination {
2
- margin-top: -6px;
3
- }
4
1
  .tasks-table {
5
2
  margin-bottom: 70px;
3
+
4
+ .action-name-tasks-table {
5
+ overflow-wrap: anywhere;
6
+ }
6
7
  }
7
8
 
8
9
  .tasks-table-wrapper {
@@ -17,7 +17,7 @@ exports[`TasksTablePage rendering render with Breadcrubs and edit permissions 1`
17
17
  />
18
18
  <PageLayout
19
19
  beforeToolbarComponent={
20
- <UNDEFINED
20
+ <Memo(Connect(TasksDashboard))
21
21
  history={
22
22
  Object {
23
23
  "location": Object {
@@ -169,7 +169,7 @@ exports[`TasksTablePage rendering render with minimal props 1`] = `
169
169
  />
170
170
  <PageLayout
171
171
  beforeToolbarComponent={
172
- <UNDEFINED
172
+ <Memo(Connect(TasksDashboard))
173
173
  history={
174
174
  Object {
175
175
  "location": Object {
@@ -2,10 +2,9 @@
2
2
 
3
3
  exports[`actionNameCellFormatter render 1`] = `
4
4
  <a
5
+ className="action-name-tasks-table"
5
6
  href="/some-url/some-id"
6
7
  >
7
- <EllipisWithTooltip>
8
- action-name
9
- </EllipisWithTooltip>
8
+ action-name
10
9
  </a>
11
10
  `;
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import { cellFormatter } from 'foremanReact/components/common/table';
3
- import EllipsisWithTooltip from 'react-ellipsis-with-tooltip';
4
3
 
5
4
  export const actionNameCellFormatter = url => (value, { rowData: { id } }) =>
6
5
  cellFormatter(
7
- <a href={`/${url}/${id}`}>
8
- <EllipsisWithTooltip>{value}</EllipsisWithTooltip>
6
+ <a href={`/${url}/${id}`} className="action-name-tasks-table">
7
+ {value}
9
8
  </a>
10
9
  );
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: 3.0.6
4
+ version: 4.0.0
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: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow
@@ -170,6 +170,7 @@ files:
170
170
  - app/lib/actions/middleware/rails_executor_wrap.rb
171
171
  - app/lib/actions/middleware/recurring_logic.rb
172
172
  - app/lib/actions/middleware/watch_delegated_proxy_sub_tasks.rb
173
+ - app/lib/actions/observable_action.rb
173
174
  - app/lib/actions/proxy_action.rb
174
175
  - app/lib/actions/recurring_action.rb
175
176
  - app/lib/actions/serializers/active_record_serializer.rb
@@ -179,6 +180,7 @@ files:
179
180
  - app/models/foreman_tasks/concerns/action_triggering.rb
180
181
  - app/models/foreman_tasks/concerns/host_action_subject.rb
181
182
  - app/models/foreman_tasks/concerns/user_extensions.rb
183
+ - app/models/foreman_tasks/link.rb
182
184
  - app/models/foreman_tasks/lock.rb
183
185
  - app/models/foreman_tasks/recurring_logic.rb
184
186
  - app/models/foreman_tasks/recurring_logic_cancelled_exception.rb
@@ -204,6 +206,7 @@ files:
204
206
  - app/services/ui_notifications/tasks/task_paused_admin.rb
205
207
  - app/services/ui_notifications/tasks/task_paused_owner.rb
206
208
  - app/views/common/_trigger_form.html.erb
209
+ - app/views/foreman_tasks/api/locks/show.json.rabl
207
210
  - app/views/foreman_tasks/api/recurring_logics/base.json.rabl
208
211
  - app/views/foreman_tasks/api/recurring_logics/index.json.rabl
209
212
  - app/views/foreman_tasks/api/recurring_logics/main.json.rabl
@@ -220,6 +223,7 @@ files:
220
223
  - app/views/foreman_tasks/task_groups/_detail.html.erb
221
224
  - app/views/foreman_tasks/task_groups/_tab_related.html.erb
222
225
  - app/views/foreman_tasks/task_groups/recurring_logic_task_groups/_recurring_logic_task_group.html.erb
226
+ - app/views/foreman_tasks/tasks/_lock_card.html.erb
223
227
  - app/views/foreman_tasks/tasks/dashboard/_latest_tasks_in_error_warning.html.erb
224
228
  - app/views/foreman_tasks/tasks/dashboard/_tasks_status.html.erb
225
229
  - app/views/foreman_tasks/tasks/show.html.erb
@@ -246,6 +250,10 @@ files:
246
250
  - db/migrate/20180216092715_use_uuid.rb
247
251
  - db/migrate/20180927120509_add_user_id.foreman_tasks.rb
248
252
  - db/migrate/20181019135324_add_remote_task_operation.rb
253
+ - db/migrate/20181206123910_create_foreman_tasks_links.foreman_tasks.rb
254
+ - db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
255
+ - db/migrate/20181206131436_drop_old_locks.foreman_tasks.rb
256
+ - db/migrate/20181206131627_make_locks_exclusive.foreman_tasks.rb
249
257
  - db/migrate/20190318153925_add_task_state_updated_at.foreman_tasks.rb
250
258
  - db/migrate/20200517215015_rename_bookmarks_controller.rb
251
259
  - db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb
@@ -327,7 +335,7 @@ files:
327
335
  - test/unit/config/environment.rb
328
336
  - test/unit/dashboard_table_filter_test.rb
329
337
  - test/unit/dynflow_console_authorizer_test.rb
330
- - test/unit/lock_test.rb
338
+ - test/unit/locking_test.rb
331
339
  - test/unit/otp_manager_test.rb
332
340
  - test/unit/proxy_selector_test.rb
333
341
  - test/unit/recurring_logic_test.rb
@@ -642,7 +650,7 @@ test_files:
642
650
  - test/unit/config/environment.rb
643
651
  - test/unit/dashboard_table_filter_test.rb
644
652
  - test/unit/dynflow_console_authorizer_test.rb
645
- - test/unit/lock_test.rb
653
+ - test/unit/locking_test.rb
646
654
  - test/unit/otp_manager_test.rb
647
655
  - test/unit/proxy_selector_test.rb
648
656
  - test/unit/recurring_logic_test.rb
@@ -1,22 +0,0 @@
1
- require 'ostruct'
2
- require 'foreman_tasks_test_helper'
3
-
4
- module ForemanTasks
5
- class LockTest < ::ActiveSupport::TestCase
6
- describe ::ForemanTasks::Lock::LockConflict do
7
- class FakeLockConflict < ForemanTasks::Lock::LockConflict
8
- def _(val)
9
- val.freeze
10
- end
11
- end
12
-
13
- it 'does not modify frozen strings' do
14
- required_lock = OpenStruct.new(:name => 'my_lock')
15
- # Before #21770 the next line would raise
16
- # RuntimeError: can't modify frozen String
17
- conflict = FakeLockConflict.new(required_lock, [])
18
- assert conflict._('this should be frozen').frozen?
19
- end
20
- end
21
- end
22
- end