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
@@ -1,26 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
-
3
- import { ResumeConfirm } from '../ResumeConfirm';
4
- import {
5
- RESUME_CONFIRM_MODAL_ID,
6
- RESUME_SELECTED_CONFIRM_MODAL_ID,
7
- } from '../../TasksTableConstants';
8
-
9
- const baseProps = {
10
- closeModal: () => null,
11
- selectedRowsLen: 3,
12
- action: () => null,
13
- };
14
- const fixtures = {
15
- 'renders RESUME modal': {
16
- ...baseProps,
17
- id: RESUME_CONFIRM_MODAL_ID,
18
- },
19
- 'renders RESUME_SELECTED modal': {
20
- ...baseProps,
21
- id: RESUME_SELECTED_CONFIRM_MODAL_ID,
22
- },
23
- };
24
-
25
- describe('ResumeConfirm', () =>
26
- testComponentSnapshotsWithFixtures(ResumeConfirm, fixtures));
@@ -1,65 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`CancelConfirm renders CANCEL modal 1`] = `
4
- <ForemanModal
5
- id="cancelConfirmModal"
6
- title="Cancel Selected Tasks"
7
- >
8
- <Component />
9
- This will cancel 1 task(s), putting them in the stopped state. Are you sure?
10
- <Component>
11
- <Button
12
- active={false}
13
- block={false}
14
- bsClass="btn"
15
- bsStyle="default"
16
- disabled={false}
17
- onClick={[Function]}
18
- >
19
- No
20
- </Button>
21
- <Button
22
- active={false}
23
- block={false}
24
- bsClass="btn"
25
- bsStyle="primary"
26
- disabled={false}
27
- onClick={[Function]}
28
- >
29
- Yes
30
- </Button>
31
- </Component>
32
- </ForemanModal>
33
- `;
34
-
35
- exports[`CancelConfirm renders CANCEL_SELECTED modal 1`] = `
36
- <ForemanModal
37
- id="cancelSelectedConfirmModal"
38
- title="Cancel Selected Tasks"
39
- >
40
- <Component />
41
- This will cancel 1 task(s), putting them in the stopped state. Are you sure?
42
- <Component>
43
- <Button
44
- active={false}
45
- block={false}
46
- bsClass="btn"
47
- bsStyle="default"
48
- disabled={false}
49
- onClick={[Function]}
50
- >
51
- No
52
- </Button>
53
- <Button
54
- active={false}
55
- block={false}
56
- bsClass="btn"
57
- bsStyle="primary"
58
- disabled={false}
59
- onClick={[Function]}
60
- >
61
- Yes
62
- </Button>
63
- </Component>
64
- </ForemanModal>
65
- `;
@@ -1,30 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ConfirmationModals renders ConfirmationModals 1`] = `
4
- <Fragment>
5
- <CancelConfirm
6
- action={[MockFunction]}
7
- closeModal={[MockFunction]}
8
- id="cancelConfirmModal"
9
- selectedRowsLen={1}
10
- />
11
- <ResumeConfirm
12
- action={[MockFunction]}
13
- closeModal={[MockFunction]}
14
- id="resumeConfirmModal"
15
- selectedRowsLen={1}
16
- />
17
- <CancelConfirm
18
- action={[MockFunction]}
19
- closeModal={[MockFunction]}
20
- id="cancelSelectedConfirmModal"
21
- selectedRowsLen={7}
22
- />
23
- <ResumeConfirm
24
- action={[MockFunction]}
25
- closeModal={[MockFunction]}
26
- id="resumeSelectedConfirmModal"
27
- selectedRowsLen={7}
28
- />
29
- </Fragment>
30
- `;
@@ -1,63 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ResumeConfirm renders RESUME modal 1`] = `
4
- <ForemanModal
5
- id="resumeConfirmModal"
6
- title="Resume Selected Tasks"
7
- >
8
- This will resume 3 task(s), putting them in the running state. Are you sure?
9
- <Component>
10
- <Button
11
- active={false}
12
- block={false}
13
- bsClass="btn"
14
- bsStyle="default"
15
- disabled={false}
16
- onClick={[Function]}
17
- >
18
- No
19
- </Button>
20
- <Button
21
- active={false}
22
- block={false}
23
- bsClass="btn"
24
- bsStyle="primary"
25
- disabled={false}
26
- onClick={[Function]}
27
- >
28
- Yes
29
- </Button>
30
- </Component>
31
- </ForemanModal>
32
- `;
33
-
34
- exports[`ResumeConfirm renders RESUME_SELECTED modal 1`] = `
35
- <ForemanModal
36
- id="resumeSelectedConfirmModal"
37
- title="Resume Selected Tasks"
38
- >
39
- This will resume 3 task(s), putting them in the running state. Are you sure?
40
- <Component>
41
- <Button
42
- active={false}
43
- block={false}
44
- bsClass="btn"
45
- bsStyle="default"
46
- disabled={false}
47
- onClick={[Function]}
48
- >
49
- No
50
- </Button>
51
- <Button
52
- active={false}
53
- block={false}
54
- bsClass="btn"
55
- bsStyle="primary"
56
- disabled={false}
57
- onClick={[Function]}
58
- >
59
- Yes
60
- </Button>
61
- </Component>
62
- </ForemanModal>
63
- `;
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { Button } from 'patternfly-react';
3
- import PropTypes from 'prop-types';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
- import { noop } from 'foremanReact/common/helpers';
6
-
7
- export const CancelButton = ({ id, name, disabled, onClick }) => (
8
- <Button bsSize="small" onClick={() => onClick(id, name)} disabled={disabled}>
9
- {__('Cancel')}
10
- </Button>
11
- );
12
-
13
- CancelButton.propTypes = {
14
- id: PropTypes.string.isRequired,
15
- name: PropTypes.string.isRequired,
16
- disabled: PropTypes.bool,
17
- onClick: PropTypes.func,
18
- };
19
-
20
- CancelButton.defaultProps = {
21
- disabled: false,
22
- onClick: noop,
23
- };
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { testComponentSnapshotsWithFixtures, shallow } from '@theforeman/test';
3
- import { CancelButton } from './CancelButton';
4
-
5
- const fixtures = {
6
- 'render with minimal props': {
7
- id: 'some-id',
8
- name: 'some-name',
9
- },
10
- };
11
-
12
- describe('CancelButton', () => {
13
- describe('rendering', () =>
14
- testComponentSnapshotsWithFixtures(CancelButton, fixtures));
15
- describe('should use id and name on click', () => {
16
- const onClick = jest.fn();
17
- const id = 'some-id';
18
- const name = 'some-name';
19
- const component = shallow(
20
- <CancelButton id={id} name={name} onClick={onClick} />
21
- );
22
- component.find('Button').simulate('click');
23
-
24
- expect(onClick).toHaveBeenCalledWith(id, name);
25
- });
26
- });
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { Button } from 'patternfly-react';
3
- import PropTypes from 'prop-types';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
- import { noop } from 'foremanReact/common/helpers';
6
-
7
- export const ResumeButton = ({ id, name, disabled, onClick }) => (
8
- <Button bsSize="small" onClick={() => onClick(id, name)} disabled={disabled}>
9
- {__('Resume')}
10
- </Button>
11
- );
12
-
13
- ResumeButton.propTypes = {
14
- id: PropTypes.string.isRequired,
15
- name: PropTypes.string.isRequired,
16
- onClick: PropTypes.func,
17
- disabled: PropTypes.bool,
18
- };
19
-
20
- ResumeButton.defaultProps = {
21
- disabled: false,
22
- onClick: noop,
23
- };
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { testComponentSnapshotsWithFixtures, shallow } from '@theforeman/test';
3
-
4
- import { ResumeButton } from './ResumeButton';
5
-
6
- const fixtures = {
7
- 'render with minimal props': {
8
- id: 'some-id',
9
- name: 'some-name',
10
- },
11
- };
12
-
13
- describe('ResumeButton', () => {
14
- describe('rendering', () =>
15
- testComponentSnapshotsWithFixtures(ResumeButton, fixtures));
16
- describe('should use id and name on click', () => {
17
- const onClick = jest.fn();
18
- const id = 'some-id';
19
- const name = 'some-name';
20
- const component = shallow(
21
- <ResumeButton id={id} name={name} onClick={onClick} />
22
- );
23
- component.find('Button').simulate('click');
24
-
25
- expect(onClick).toHaveBeenCalledWith(id, name);
26
- });
27
- });
@@ -1,15 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`CancelButton rendering render with minimal props 1`] = `
4
- <Button
5
- active={false}
6
- block={false}
7
- bsClass="btn"
8
- bsSize="small"
9
- bsStyle="default"
10
- disabled={false}
11
- onClick={[Function]}
12
- >
13
- Cancel
14
- </Button>
15
- `;
@@ -1,15 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ResumeButton rendering render with minimal props 1`] = `
4
- <Button
5
- active={false}
6
- block={false}
7
- bsClass="btn"
8
- bsSize="small"
9
- bsStyle="default"
10
- disabled={false}
11
- onClick={[Function]}
12
- >
13
- Resume
14
- </Button>
15
- `;