foreman-tasks 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_tasks/api/tasks_controller.rb +29 -1
  3. data/app/controllers/foreman_tasks/tasks_controller.rb +3 -11
  4. data/app/models/foreman_tasks/task.rb +4 -0
  5. data/app/models/setting/foreman_tasks.rb +1 -1
  6. data/app/services/ui_notifications/tasks/task_bulk_stop.rb +36 -0
  7. data/app/views/foreman_tasks/api/tasks/details.json.rabl +0 -1
  8. data/config/routes.rb +1 -0
  9. data/db/migrate/20200517215015_rename_bookmarks_controller.rb +35 -0
  10. data/db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb +5 -0
  11. data/db/seeds.d/30-notification_blueprints.rb +7 -0
  12. data/lib/foreman_tasks/engine.rb +1 -1
  13. data/lib/foreman_tasks/tasks/cleanup.rake +2 -2
  14. data/lib/foreman_tasks/tasks/export_tasks.rake +1 -1
  15. data/lib/foreman_tasks/version.rb +1 -1
  16. data/locale/action_names.rb +1 -1
  17. data/locale/en/foreman_tasks.po +227 -41
  18. data/locale/foreman_tasks.pot +579 -288
  19. data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +60 -0
  20. data/webpack/ForemanTasks/Components/{TasksTable/TasksTableActionHelpers.js → TaskActions/TaskActionHelpers.js} +21 -6
  21. data/webpack/ForemanTasks/Components/{TasksTable/__tests__/TasksTableActionHelpers.test.js → TaskActions/TaskActionHelpers.test.js} +2 -2
  22. data/webpack/ForemanTasks/Components/TaskActions/TaskActionsConstants.js +16 -0
  23. data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.js +60 -0
  24. data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.test.js +14 -0
  25. data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/TaskAction.test.js.snap +233 -0
  26. data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/UnlockModals.test.js.snap +25 -0
  27. data/webpack/ForemanTasks/Components/TaskActions/index.js +115 -0
  28. data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +130 -152
  29. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +67 -3
  30. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +0 -1
  31. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +101 -70
  32. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +0 -15
  33. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +0 -5
  34. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -6
  35. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +0 -9
  36. data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +6 -1
  37. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +5 -0
  38. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +2 -7
  39. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +4 -0
  40. data/webpack/ForemanTasks/Components/TaskDetails/index.js +4 -8
  41. data/webpack/ForemanTasks/Components/TasksTable/Components/ActionSelectButton.js +14 -1
  42. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModal.js +83 -0
  43. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalActions.js +106 -0
  44. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalReducer.js +38 -0
  45. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js +45 -0
  46. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModal.test.js +36 -0
  47. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalActions.test.js +205 -0
  48. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalReducer.test.js +27 -0
  49. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js +54 -0
  50. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModal.test.js.snap +41 -0
  51. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalReducer.test.js.snap +19 -0
  52. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap +30 -0
  53. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +29 -0
  54. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -0
  55. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap +11 -0
  56. data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +113 -30
  57. data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +13 -9
  58. data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +23 -63
  59. data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +10 -12
  60. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +24 -94
  61. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
  62. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +7 -4
  63. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +35 -0
  64. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +2 -12
  65. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +22 -26
  66. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +2 -14
  67. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +107 -0
  68. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +2 -14
  69. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +17 -124
  70. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +24 -128
  71. data/webpack/ForemanTasks/Components/TasksTable/index.js +2 -2
  72. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +47 -19
  73. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +61 -14
  74. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +80 -21
  75. data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.scss +9 -0
  76. data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.test.js +44 -0
  77. data/webpack/ForemanTasks/Components/common/ClickConfirmation/__snapshots__/ClickConfirmation.test.js.snap +52 -0
  78. data/webpack/ForemanTasks/Components/common/ClickConfirmation/index.js +59 -66
  79. data/webpack/ForemanTasks/Components/common/{ToastTypesConstants.js → ToastsHelpers/ToastTypesConstants.js} +0 -0
  80. data/webpack/ForemanTasks/Components/common/ToastsHelpers/index.js +15 -0
  81. data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
  82. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -1
  83. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +2 -2
  84. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +17 -3
  85. data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
  86. metadata +32 -22
  87. data/db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb +0 -9
  88. data/lib/foreman_tasks/tasks/dynflow.rake +0 -6
  89. data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +0 -53
  90. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +0 -56
  91. data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +0 -52
  92. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +0 -26
  93. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +0 -24
  94. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +0 -26
  95. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +0 -65
  96. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +0 -30
  97. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +0 -63
  98. data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +0 -23
  99. data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +0 -26
  100. data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.js +0 -23
  101. data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +0 -27
  102. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap +0 -15
  103. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap +0 -15
@@ -0,0 +1,15 @@
1
+ import { TOAST_TYPES } from './ToastTypesConstants';
2
+
3
+ export const successToastData = message => ({
4
+ type: TOAST_TYPES.SUCCESS,
5
+ message,
6
+ });
7
+ export const errorToastData = message => ({ type: TOAST_TYPES.ERROR, message });
8
+ export const warningToastData = message => ({
9
+ type: TOAST_TYPES.WARNING,
10
+ message,
11
+ });
12
+ export const infoToastData = message => ({
13
+ type: TOAST_TYPES.INFO,
14
+ message,
15
+ });
@@ -2,12 +2,14 @@ import { combineReducers } from 'redux';
2
2
  import { reducers as tasksDashboardReducers } from './Components/TasksDashboard';
3
3
  import { reducers as taskDetailsReducers } from './Components/TaskDetails';
4
4
  import { reducers as tasksTableReducers } from './Components/TasksTable';
5
+ import { reducers as confirmModalReducers } from './Components/TasksTable/Components/ConfirmModal';
5
6
 
6
7
  const reducers = {
7
8
  foremanTasks: combineReducers({
8
9
  ...tasksDashboardReducers,
9
10
  ...taskDetailsReducers,
10
11
  ...tasksTableReducers,
12
+ ...confirmModalReducers,
11
13
  }),
12
14
  };
13
15
 
@@ -6,7 +6,8 @@ import ForemanTasksRoutes from './ForemanTasksRoutes';
6
6
  describe('ForemanTasksRoutes', () => {
7
7
  it('should create routes', () => {
8
8
  Object.entries(ForemanTasksRoutes).forEach(([key, Route]) => {
9
- const component = shallow(<Route.render history={{}} some="props" />);
9
+ const RouteRender = Route.render;
10
+ const component = shallow(<RouteRender history={{}} some="props" />);
10
11
  Route.renderResult = component;
11
12
  });
12
13
 
@@ -2,9 +2,9 @@ const modalOpen = true;
2
2
  const setModalOpen = jest.fn();
3
3
  const setModalClosed = jest.fn();
4
4
 
5
- export const useForemanModal = () => ({
5
+ export const useForemanModal = jest.fn(() => ({
6
6
  modalOpen,
7
7
  setModalOpen,
8
8
  setModalClosed,
9
- });
9
+ }));
10
10
  export default useForemanModal;
@@ -1,4 +1,18 @@
1
- const ForemanModal = () => jest.fn();
2
- ForemanModal.Header = () => jest.fn();
3
- ForemanModal.Footer = () => jest.fn();
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const ForemanModal = ({ children }) => <div className="modal">{children}</div>;
5
+ ForemanModal.Header = ({ children }) => (
6
+ <div className="modal-header">{children}</div>
7
+ );
8
+ ForemanModal.Footer = ({ children }) => (
9
+ <div className="modal-footer">{children}</div>
10
+ );
11
+
12
+ ForemanModal.propTypes = {
13
+ children: PropTypes.node.isRequired,
14
+ };
15
+ ForemanModal.Header.propTypes = ForemanModal.propTypes;
16
+ ForemanModal.Footer.propTypes = ForemanModal.propTypes;
17
+
4
18
  export default ForemanModal;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+
3
+ export const ActionButtons = props => <button>{JSON.stringify(props)}</button>;
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: 1.1.3
4
+ version: 1.2.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: 2020-07-03 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow
@@ -200,6 +200,7 @@ files:
200
200
  - app/services/ui_notifications/tasks.rb
201
201
  - app/services/ui_notifications/tasks/task_bulk_cancel.rb
202
202
  - app/services/ui_notifications/tasks/task_bulk_resume.rb
203
+ - app/services/ui_notifications/tasks/task_bulk_stop.rb
203
204
  - app/services/ui_notifications/tasks/task_paused_admin.rb
204
205
  - app/services/ui_notifications/tasks/task_paused_owner.rb
205
206
  - app/views/common/_trigger_form.html.erb
@@ -245,7 +246,8 @@ files:
245
246
  - db/migrate/20180927120509_add_user_id.foreman_tasks.rb
246
247
  - db/migrate/20181019135324_add_remote_task_operation.rb
247
248
  - db/migrate/20190318153925_add_task_state_updated_at.foreman_tasks.rb
248
- - db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb
249
+ - db/migrate/20200517215015_rename_bookmarks_controller.rb
250
+ - db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb
249
251
  - db/seeds.d/20-foreman_tasks_permissions.rb
250
252
  - db/seeds.d/30-notification_blueprints.rb
251
253
  - db/seeds.d/60-dynflow_proxy_feature.rb
@@ -267,7 +269,6 @@ files:
267
269
  - lib/foreman_tasks/engine.rb
268
270
  - lib/foreman_tasks/task_error.rb
269
271
  - lib/foreman_tasks/tasks/cleanup.rake
270
- - lib/foreman_tasks/tasks/dynflow.rake
271
272
  - lib/foreman_tasks/tasks/export_tasks.rake
272
273
  - lib/foreman_tasks/tasks/generate_task_actions.rake
273
274
  - lib/foreman_tasks/test_extensions.rb
@@ -329,6 +330,15 @@ files:
329
330
  - test/unit/troubleshooting_help_generator_test.rb
330
331
  - test/unit/ui_notifications_test.rb
331
332
  - webpack/ForemanTasks/Components/Chart/Chart.js
333
+ - webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js
334
+ - webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js
335
+ - webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.test.js
336
+ - webpack/ForemanTasks/Components/TaskActions/TaskActionsConstants.js
337
+ - webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
338
+ - webpack/ForemanTasks/Components/TaskActions/UnlockModals.test.js
339
+ - webpack/ForemanTasks/Components/TaskActions/__snapshots__/TaskAction.test.js.snap
340
+ - webpack/ForemanTasks/Components/TaskActions/__snapshots__/UnlockModals.test.js.snap
341
+ - webpack/ForemanTasks/Components/TaskActions/index.js
332
342
  - webpack/ForemanTasks/Components/TaskDetails/Components/Errors.js
333
343
  - webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
334
344
  - webpack/ForemanTasks/Components/TaskDetails/Components/Raw.js
@@ -438,23 +448,26 @@ files:
438
448
  - webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardSelectors.test.js.snap
439
449
  - webpack/ForemanTasks/Components/TasksDashboard/index.js
440
450
  - webpack/ForemanTasks/Components/TasksTable/Components/ActionSelectButton.js
441
- - webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js
442
- - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js
443
- - webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js
451
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModal.js
452
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalActions.js
453
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalReducer.js
454
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js
455
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModal.test.js
456
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalActions.test.js
457
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalReducer.test.js
458
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js
459
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModal.test.js.snap
460
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalReducer.test.js.snap
461
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap
462
+ - webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js
444
463
  - webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
445
464
  - webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionCell.js
446
465
  - webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionHeaderCell.js
447
466
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js
448
- - webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js
449
- - webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js
450
- - webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js
451
467
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js
452
468
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js
453
469
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js
454
470
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap
455
- - webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap
456
- - webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap
457
- - webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap
458
471
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap
459
472
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionCell.test.js.snap
460
473
  - webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionHeaderCell.test.js.snap
@@ -462,7 +475,6 @@ files:
462
475
  - webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js
463
476
  - webpack/ForemanTasks/Components/TasksTable/TasksIndexPage.js
464
477
  - webpack/ForemanTasks/Components/TasksTable/TasksTable.js
465
- - webpack/ForemanTasks/Components/TasksTable/TasksTableActionHelpers.js
466
478
  - webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js
467
479
  - webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js
468
480
  - webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js
@@ -476,7 +488,6 @@ files:
476
488
  - webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js
477
489
  - webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js
478
490
  - webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js
479
- - webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActionHelpers.test.js
480
491
  - webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js
481
492
  - webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js
482
493
  - webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js
@@ -510,15 +521,13 @@ files:
510
521
  - webpack/ForemanTasks/Components/TasksTable/index.js
511
522
  - webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js
512
523
  - webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js
513
- - webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js
514
- - webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js
515
- - webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.js
516
- - webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js
517
524
  - webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap
518
- - webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap
519
- - webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap
525
+ - webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.scss
526
+ - webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.test.js
527
+ - webpack/ForemanTasks/Components/common/ClickConfirmation/__snapshots__/ClickConfirmation.test.js.snap
520
528
  - webpack/ForemanTasks/Components/common/ClickConfirmation/index.js
521
- - webpack/ForemanTasks/Components/common/ToastTypesConstants.js
529
+ - webpack/ForemanTasks/Components/common/ToastsHelpers/ToastTypesConstants.js
530
+ - webpack/ForemanTasks/Components/common/ToastsHelpers/index.js
522
531
  - webpack/ForemanTasks/ForemanTasks.js
523
532
  - webpack/ForemanTasks/ForemanTasks.test.js
524
533
  - webpack/ForemanTasks/ForemanTasksReducers.js
@@ -545,6 +554,7 @@ files:
545
554
  - webpack/__mocks__/foremanReact/components/ForemanModal/index.js
546
555
  - webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js
547
556
  - webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
557
+ - webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js
548
558
  - webpack/__mocks__/foremanReact/components/common/MessageBox.js
549
559
  - webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js
550
560
  - webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js
@@ -1,9 +0,0 @@
1
- class AddTaskLockIndexOnResourceTypeAndTaskId < ActiveRecord::Migration[5.2]
2
- def change
3
- add_index :foreman_tasks_locks, [:task_id, :resource_type, :resource_id], name: 'index_tasks_locks_on_task_id_resource_type_and_resource_id'
4
- # These indexes are not needed as they can be gained from partial index lookups
5
- [:task_id, :name, :resource_type].each do |index|
6
- remove_index :foreman_tasks_locks, index if index_exists?(:foreman_tasks_locks, index)
7
- end
8
- end
9
- end
@@ -1,6 +0,0 @@
1
- namespace :dynflow do
2
- task :client do
3
- ::ForemanTasks.dynflow.config.remote = true
4
- ::ForemanTasks.dynflow.initialize!
5
- end
6
- end
@@ -1,53 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { sprintf, translate as __ } from 'foremanReact/common/I18n';
4
- import { Button } from 'patternfly-react';
5
- import ForemanModal from 'foremanReact/components/ForemanModal';
6
- import {
7
- CANCEL_CONFIRM_MODAL_ID,
8
- RESUME_CONFIRM_MODAL_ID,
9
- CANCEL_SELECTED_CONFIRM_MODAL_ID,
10
- RESUME_SELECTED_CONFIRM_MODAL_ID,
11
- } from '../TasksTableConstants';
12
-
13
- export const CancelConfirm = ({ closeModal, action, selectedRowsLen, id }) => (
14
- <ForemanModal title={__('Cancel Selected Tasks')} id={id}>
15
- <ForemanModal.Header />
16
- {sprintf(
17
- __(
18
- `This will cancel %s task(s), putting them in the stopped state. Are you sure?`
19
- ),
20
- selectedRowsLen
21
- )}
22
- <ForemanModal.Footer>
23
- <Button onClick={closeModal}>{__('No')}</Button>
24
- <Button
25
- bsStyle="primary"
26
- onClick={() => {
27
- action();
28
- closeModal();
29
- }}
30
- >
31
- {__('Yes')}
32
- </Button>
33
- </ForemanModal.Footer>
34
- </ForemanModal>
35
- );
36
-
37
- CancelConfirm.propTypes = {
38
- closeModal: PropTypes.func.isRequired,
39
- selectedRowsLen: PropTypes.number.isRequired,
40
- action: PropTypes.func,
41
- id: PropTypes.oneOf([
42
- CANCEL_CONFIRM_MODAL_ID,
43
- RESUME_CONFIRM_MODAL_ID,
44
- CANCEL_SELECTED_CONFIRM_MODAL_ID,
45
- RESUME_SELECTED_CONFIRM_MODAL_ID,
46
- ]).isRequired,
47
- };
48
-
49
- CancelConfirm.defaultProps = {
50
- action: () => null,
51
- };
52
-
53
- export default CancelConfirm;
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {
4
- CANCEL_CONFIRM_MODAL_ID,
5
- RESUME_CONFIRM_MODAL_ID,
6
- CANCEL_SELECTED_CONFIRM_MODAL_ID,
7
- RESUME_SELECTED_CONFIRM_MODAL_ID,
8
- } from '../TasksTableConstants';
9
- import { CancelConfirm } from './CancelConfirm';
10
- import { ResumeConfirm } from './ResumeConfirm';
11
-
12
- export const ConfirmationModals = ({
13
- modalProps,
14
- tasksActions,
15
- selectedRowsLen,
16
- }) => (
17
- <React.Fragment>
18
- <CancelConfirm
19
- closeModal={modalProps.cancelModal.setModalClosed}
20
- action={tasksActions.cancelTask}
21
- selectedRowsLen={1}
22
- id={CANCEL_CONFIRM_MODAL_ID}
23
- />
24
- <ResumeConfirm
25
- closeModal={modalProps.resumeModal.setModalClosed}
26
- action={tasksActions.resumeTask}
27
- selectedRowsLen={1}
28
- id={RESUME_CONFIRM_MODAL_ID}
29
- />
30
- <CancelConfirm
31
- closeModal={modalProps.cancelSelectedModal.setModalClosed}
32
- action={tasksActions.cancelSelectedTasks}
33
- selectedRowsLen={selectedRowsLen}
34
- id={CANCEL_SELECTED_CONFIRM_MODAL_ID}
35
- />
36
- <ResumeConfirm
37
- closeModal={modalProps.resumeSelectedModal.setModalClosed}
38
- action={tasksActions.resumeSelectedTasks}
39
- selectedRowsLen={selectedRowsLen}
40
- id={RESUME_SELECTED_CONFIRM_MODAL_ID}
41
- />
42
- </React.Fragment>
43
- );
44
-
45
- ConfirmationModals.propTypes = {
46
- modalProps: PropTypes.object.isRequired,
47
- selectedRowsLen: PropTypes.number.isRequired,
48
- tasksActions: PropTypes.shape({
49
- cancelTask: PropTypes.func,
50
- resumeTask: PropTypes.func,
51
- cancelSelectedTasks: PropTypes.func,
52
- resumeSelectedTasks: PropTypes.func,
53
- }).isRequired,
54
- };
55
-
56
- export default ConfirmationModals;
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { sprintf, translate as __ } from 'foremanReact/common/I18n';
4
- import { Button } from 'patternfly-react';
5
- import ForemanModal from 'foremanReact/components/ForemanModal';
6
- import {
7
- CANCEL_CONFIRM_MODAL_ID,
8
- RESUME_CONFIRM_MODAL_ID,
9
- CANCEL_SELECTED_CONFIRM_MODAL_ID,
10
- RESUME_SELECTED_CONFIRM_MODAL_ID,
11
- } from '../TasksTableConstants';
12
-
13
- export const ResumeConfirm = ({ closeModal, action, selectedRowsLen, id }) => (
14
- <ForemanModal title={__('Resume Selected Tasks')} id={id}>
15
- {sprintf(
16
- __(
17
- `This will resume %s task(s), putting them in the running state. Are you sure?`
18
- ),
19
- selectedRowsLen
20
- )}
21
- <ForemanModal.Footer>
22
- <Button onClick={closeModal}>{__('No')}</Button>
23
- <Button
24
- bsStyle="primary"
25
- onClick={() => {
26
- action();
27
- closeModal();
28
- }}
29
- >
30
- {__('Yes')}
31
- </Button>
32
- </ForemanModal.Footer>
33
- </ForemanModal>
34
- );
35
-
36
- ResumeConfirm.propTypes = {
37
- closeModal: PropTypes.func.isRequired,
38
- selectedRowsLen: PropTypes.number.isRequired,
39
- action: PropTypes.func,
40
- id: PropTypes.oneOf([
41
- CANCEL_CONFIRM_MODAL_ID,
42
- RESUME_CONFIRM_MODAL_ID,
43
- CANCEL_SELECTED_CONFIRM_MODAL_ID,
44
- RESUME_SELECTED_CONFIRM_MODAL_ID,
45
- ]).isRequired,
46
- };
47
-
48
- ResumeConfirm.defaultProps = {
49
- action: () => null,
50
- };
51
-
52
- export default ResumeConfirm;
@@ -1,26 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
-
3
- import { CancelConfirm } from '../CancelConfirm';
4
- import {
5
- CANCEL_CONFIRM_MODAL_ID,
6
- CANCEL_SELECTED_CONFIRM_MODAL_ID,
7
- } from '../../TasksTableConstants';
8
-
9
- const baseProps = {
10
- closeModal: () => null,
11
- selectedRowsLen: 1,
12
- action: () => null,
13
- };
14
- const fixtures = {
15
- 'renders CANCEL modal': {
16
- ...baseProps,
17
- id: CANCEL_CONFIRM_MODAL_ID,
18
- },
19
- 'renders CANCEL_SELECTED modal': {
20
- ...baseProps,
21
- id: CANCEL_SELECTED_CONFIRM_MODAL_ID,
22
- },
23
- };
24
-
25
- describe('CancelConfirm', () =>
26
- testComponentSnapshotsWithFixtures(CancelConfirm, fixtures));
@@ -1,24 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
-
3
- import { ConfirmationModals } from '../ConfirmationModals';
4
-
5
- const fixtures = {
6
- 'renders ConfirmationModals': {
7
- modalProps: {
8
- cancelSelectedModal: { setModalClosed: jest.fn() },
9
- resumeSelectedModal: { setModalClosed: jest.fn() },
10
- cancelModal: { setModalClosed: jest.fn() },
11
- resumeModal: { setModalClosed: jest.fn() },
12
- },
13
- selectedRowsLen: 7,
14
- tasksActions: {
15
- cancelTask: jest.fn(),
16
- resumeTask: jest.fn(),
17
- cancelSelectedTasks: jest.fn(),
18
- resumeSelectedTasks: jest.fn(),
19
- },
20
- },
21
- };
22
-
23
- describe('ConfirmationModals', () =>
24
- testComponentSnapshotsWithFixtures(ConfirmationModals, fixtures));