foreman-tasks 1.1.2 → 2.0.2
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 +4 -4
- data/.travis.yml +2 -0
- data/README.md +2 -0
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +33 -1
- data/app/controllers/foreman_tasks/tasks_controller.rb +9 -14
- data/app/lib/actions/proxy_action.rb +1 -1
- data/app/models/foreman_tasks/task.rb +4 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +3 -1
- data/app/models/setting/foreman_tasks.rb +1 -1
- data/app/services/ui_notifications/tasks/task_bulk_stop.rb +36 -0
- data/app/views/foreman_tasks/api/tasks/details.json.rabl +0 -1
- data/app/views/foreman_tasks/api/tasks/show.json.rabl +2 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20200517215015_rename_bookmarks_controller.rb +35 -0
- data/db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb +5 -0
- data/db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb +3 -3
- data/db/seeds.d/30-notification_blueprints.rb +7 -0
- data/lib/foreman_tasks/engine.rb +2 -7
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +1 -1
- data/locale/en/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/en/foreman_tasks.po +270 -54
- data/locale/foreman_tasks.pot +630 -292
- data/locale/fr/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/fr/foreman_tasks.po +817 -0
- data/locale/ja/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/ja/foreman_tasks.po +817 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/zh_CN/foreman_tasks.po +816 -0
- data/package.json +1 -0
- data/script/npm_link_foreman_js.sh +26 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +60 -0
- data/webpack/ForemanTasks/Components/{TasksTable/TasksTableActionHelpers.js → TaskActions/TaskActionHelpers.js} +21 -6
- data/webpack/ForemanTasks/Components/{TasksTable/__tests__/TasksTableActionHelpers.test.js → TaskActions/TaskActionHelpers.test.js} +2 -2
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionsConstants.js +16 -0
- data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.js +60 -0
- data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.test.js +14 -0
- data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/TaskAction.test.js.snap +233 -0
- data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/UnlockModals.test.js.snap +25 -0
- data/webpack/ForemanTasks/Components/TaskActions/index.js +115 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js +17 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +149 -167
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +8 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +68 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +0 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/RunningSteps.test.js.snap +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +124 -76
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +35 -5
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.scss +3 -14
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +40 -16
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +3 -4
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -6
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +4 -10
- data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +6 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.fixtures.js +8 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +7 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +18 -2
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +30 -13
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +91 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +13 -4
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -8
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardActions.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/Components/ActionSelectButton.js +14 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModal.js +83 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalActions.js +106 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalReducer.js +38 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js +46 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModal.test.js +36 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalActions.test.js +205 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalReducer.test.js +27 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js +55 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModal.test.js.snap +41 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalReducer.test.js.snap +19 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap +32 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap +11 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +135 -35
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +13 -9
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +26 -66
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +10 -12
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +30 -96
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +8 -4
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +50 -2
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +3 -12
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +22 -26
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +2 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +3 -14
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +155 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +3 -14
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +17 -124
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +63 -133
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionCellFormatter.test.js.snap +1 -0
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/selectionCellFormatter.test.js.snap +2 -0
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/actionCellFormatter.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionCellFormatter.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/actionCellFormatter.js +10 -7
- data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionCellFormatter.js +7 -0
- data/webpack/ForemanTasks/Components/TasksTable/index.js +2 -2
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +55 -19
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +75 -19
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +88 -21
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.scss +9 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.test.js +44 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/__snapshots__/ClickConfirmation.test.js.snap +52 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/index.js +59 -66
- data/webpack/ForemanTasks/Components/common/{ToastTypesConstants.js → ToastsHelpers/ToastTypesConstants.js} +0 -0
- data/webpack/ForemanTasks/Components/common/ToastsHelpers/index.js +15 -0
- data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -1
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +2 -2
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +17 -3
- data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
- data/webpack/__mocks__/foremanReact/{API.js → redux/API.js} +1 -1
- metadata +41 -21
- data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +0 -53
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +0 -56
- data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +0 -52
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +0 -26
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +0 -24
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +0 -26
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +0 -65
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +0 -30
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +0 -63
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +0 -26
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +0 -27
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap +0 -15
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap +0 -15
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { testComponentSnapshotsWithFixtures, mount } from '@theforeman/test';
|
|
3
|
+
import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
|
|
4
|
+
import { ClickConfirmation } from './';
|
|
5
|
+
|
|
6
|
+
const fixtures = {
|
|
7
|
+
render: {
|
|
8
|
+
title: 'some-title',
|
|
9
|
+
confirmType: 'danger',
|
|
10
|
+
body: 'some-body',
|
|
11
|
+
confirmationMessage: 'some-message',
|
|
12
|
+
id: 'some-id',
|
|
13
|
+
confirmAction: 'some-confirm',
|
|
14
|
+
onClick: jest.fn(),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('ClickConfirmation', () => {
|
|
19
|
+
testComponentSnapshotsWithFixtures(ClickConfirmation, fixtures);
|
|
20
|
+
it('enable button on checkbox click', () => {
|
|
21
|
+
const component = mount(<ClickConfirmation {...fixtures.render} />);
|
|
22
|
+
const getButton = () => component.find('.confirm-button').at(0);
|
|
23
|
+
expect(getButton().props().disabled).toBeTruthy();
|
|
24
|
+
const checkbox = component.find('input').at(0);
|
|
25
|
+
checkbox.simulate('change', { target: { checked: true } });
|
|
26
|
+
expect(getButton().props().disabled).toBeFalsy();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('click test', () => {
|
|
30
|
+
const setModalClosed = jest.fn();
|
|
31
|
+
useForemanModal.mockImplementation(id => ({
|
|
32
|
+
setModalClosed: () => setModalClosed(id),
|
|
33
|
+
}));
|
|
34
|
+
const onClick = jest.fn();
|
|
35
|
+
const props = { ...fixtures.render, onClick };
|
|
36
|
+
const component = mount(<ClickConfirmation {...props} />);
|
|
37
|
+
const getButton = () => component.find('.confirm-button').at(0);
|
|
38
|
+
const checkbox = component.find('input').at(0);
|
|
39
|
+
checkbox.simulate('change', { target: { checked: true } });
|
|
40
|
+
getButton().simulate('click');
|
|
41
|
+
expect(onClick).toBeCalled();
|
|
42
|
+
expect(setModalClosed).toBeCalledWith({ id: fixtures.render.id });
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ClickConfirmation render 1`] = `
|
|
4
|
+
<ForemanModal
|
|
5
|
+
id="some-id"
|
|
6
|
+
>
|
|
7
|
+
<Component>
|
|
8
|
+
<span
|
|
9
|
+
className="glyphicon glyphicon-exclamation-sign"
|
|
10
|
+
/>
|
|
11
|
+
some-title
|
|
12
|
+
</Component>
|
|
13
|
+
<span>
|
|
14
|
+
some-body
|
|
15
|
+
</span>
|
|
16
|
+
<div
|
|
17
|
+
className="confirmation-check"
|
|
18
|
+
>
|
|
19
|
+
<input
|
|
20
|
+
checked={false}
|
|
21
|
+
onChange={[Function]}
|
|
22
|
+
type="checkbox"
|
|
23
|
+
/>
|
|
24
|
+
<span>
|
|
25
|
+
some-message
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
<Component>
|
|
29
|
+
<Button
|
|
30
|
+
active={false}
|
|
31
|
+
block={false}
|
|
32
|
+
bsClass="btn"
|
|
33
|
+
bsStyle="danger"
|
|
34
|
+
className="confirm-button"
|
|
35
|
+
disabled={true}
|
|
36
|
+
onClick={[Function]}
|
|
37
|
+
>
|
|
38
|
+
some-confirm
|
|
39
|
+
</Button>
|
|
40
|
+
<Button
|
|
41
|
+
active={false}
|
|
42
|
+
block={false}
|
|
43
|
+
bsClass="btn"
|
|
44
|
+
bsStyle="default"
|
|
45
|
+
disabled={false}
|
|
46
|
+
onClick={[MockFunction]}
|
|
47
|
+
>
|
|
48
|
+
Cancel
|
|
49
|
+
</Button>
|
|
50
|
+
</Component>
|
|
51
|
+
</ForemanModal>
|
|
52
|
+
`;
|
|
@@ -1,82 +1,75 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { Button } from 'patternfly-react';
|
|
4
|
+
import ForemanModal from 'foremanReact/components/ForemanModal';
|
|
4
5
|
import { translate as __ } from 'foremanReact/common/I18n';
|
|
6
|
+
import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
|
|
7
|
+
import './ClickConfirmation.scss';
|
|
5
8
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
>
|
|
59
|
-
{confirmAction}
|
|
60
|
-
</Button>
|
|
61
|
-
</Modal.Footer>
|
|
62
|
-
</Modal>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
9
|
+
export const ClickConfirmation = ({
|
|
10
|
+
title,
|
|
11
|
+
confirmType,
|
|
12
|
+
body,
|
|
13
|
+
confirmationMessage,
|
|
14
|
+
id,
|
|
15
|
+
confirmAction,
|
|
16
|
+
onClick,
|
|
17
|
+
}) => {
|
|
18
|
+
const [isConfirmed, setConfirm] = useState(false);
|
|
19
|
+
const { setModalClosed, modalOpen } = useForemanModal({
|
|
20
|
+
id,
|
|
21
|
+
});
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setConfirm(false);
|
|
24
|
+
}, [modalOpen]);
|
|
25
|
+
const icon = confirmType === 'warning' ? confirmType : 'exclamation';
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<ForemanModal id={id}>
|
|
29
|
+
<ForemanModal.Header>
|
|
30
|
+
<span className={`glyphicon glyphicon-${icon}-sign`} />
|
|
31
|
+
{` ${title}`}
|
|
32
|
+
</ForemanModal.Header>
|
|
33
|
+
<span>{body}</span>
|
|
34
|
+
<div className="confirmation-check">
|
|
35
|
+
<input
|
|
36
|
+
onChange={e => {
|
|
37
|
+
setConfirm(e.target.checked);
|
|
38
|
+
}}
|
|
39
|
+
checked={isConfirmed}
|
|
40
|
+
type="checkbox"
|
|
41
|
+
/>
|
|
42
|
+
<span>{` ${confirmationMessage}`}</span>
|
|
43
|
+
</div>
|
|
44
|
+
<ForemanModal.Footer>
|
|
45
|
+
<Button
|
|
46
|
+
className="confirm-button"
|
|
47
|
+
onClick={() => {
|
|
48
|
+
onClick();
|
|
49
|
+
setModalClosed();
|
|
50
|
+
}}
|
|
51
|
+
bsStyle={confirmType}
|
|
52
|
+
disabled={!isConfirmed}
|
|
53
|
+
>
|
|
54
|
+
{confirmAction}
|
|
55
|
+
</Button>
|
|
56
|
+
<Button onClick={setModalClosed}>{__('Cancel')}</Button>
|
|
57
|
+
</ForemanModal.Footer>
|
|
58
|
+
</ForemanModal>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
66
61
|
|
|
67
62
|
ClickConfirmation.propTypes = {
|
|
68
|
-
showModal: PropTypes.bool,
|
|
69
63
|
title: PropTypes.string.isRequired,
|
|
70
64
|
body: PropTypes.string.isRequired,
|
|
71
65
|
confirmationMessage: PropTypes.string.isRequired,
|
|
72
66
|
confirmAction: PropTypes.string.isRequired,
|
|
73
|
-
|
|
67
|
+
onClick: PropTypes.func.isRequired,
|
|
74
68
|
confirmType: PropTypes.oneOf(['warning', 'danger']),
|
|
75
|
-
|
|
69
|
+
id: PropTypes.string.isRequired,
|
|
76
70
|
};
|
|
77
71
|
|
|
78
72
|
ClickConfirmation.defaultProps = {
|
|
79
|
-
showModal: false,
|
|
80
73
|
confirmType: 'warning',
|
|
81
74
|
};
|
|
82
75
|
|
|
File without changes
|
|
@@ -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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
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:
|
|
4
|
+
version: 2.0.2
|
|
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-
|
|
11
|
+
date: 2020-07-09 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,6 +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
|
|
249
|
+
- db/migrate/20200517215015_rename_bookmarks_controller.rb
|
|
250
|
+
- db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb
|
|
248
251
|
- db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb
|
|
249
252
|
- db/seeds.d/20-foreman_tasks_permissions.rb
|
|
250
253
|
- db/seeds.d/30-notification_blueprints.rb
|
|
@@ -280,7 +283,14 @@ files:
|
|
|
280
283
|
- locale/en/LC_MESSAGES/foreman_tasks.mo
|
|
281
284
|
- locale/en/foreman_tasks.po
|
|
282
285
|
- locale/foreman_tasks.pot
|
|
286
|
+
- locale/fr/LC_MESSAGES/foreman_tasks.mo
|
|
287
|
+
- locale/fr/foreman_tasks.po
|
|
288
|
+
- locale/ja/LC_MESSAGES/foreman_tasks.mo
|
|
289
|
+
- locale/ja/foreman_tasks.po
|
|
290
|
+
- locale/zh_CN/LC_MESSAGES/foreman_tasks.mo
|
|
291
|
+
- locale/zh_CN/foreman_tasks.po
|
|
283
292
|
- package.json
|
|
293
|
+
- script/npm_link_foreman_js.sh
|
|
284
294
|
- script/rails
|
|
285
295
|
- script/travis_run_js_tests.sh
|
|
286
296
|
- test/controllers/api/recurring_logics_controller_test.rb
|
|
@@ -329,6 +339,15 @@ files:
|
|
|
329
339
|
- test/unit/troubleshooting_help_generator_test.rb
|
|
330
340
|
- test/unit/ui_notifications_test.rb
|
|
331
341
|
- webpack/ForemanTasks/Components/Chart/Chart.js
|
|
342
|
+
- webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js
|
|
343
|
+
- webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js
|
|
344
|
+
- webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.test.js
|
|
345
|
+
- webpack/ForemanTasks/Components/TaskActions/TaskActionsConstants.js
|
|
346
|
+
- webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
|
|
347
|
+
- webpack/ForemanTasks/Components/TaskActions/UnlockModals.test.js
|
|
348
|
+
- webpack/ForemanTasks/Components/TaskActions/__snapshots__/TaskAction.test.js.snap
|
|
349
|
+
- webpack/ForemanTasks/Components/TaskActions/__snapshots__/UnlockModals.test.js.snap
|
|
350
|
+
- webpack/ForemanTasks/Components/TaskActions/index.js
|
|
332
351
|
- webpack/ForemanTasks/Components/TaskDetails/Components/Errors.js
|
|
333
352
|
- webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js
|
|
334
353
|
- webpack/ForemanTasks/Components/TaskDetails/Components/Raw.js
|
|
@@ -357,6 +376,7 @@ files:
|
|
|
357
376
|
- webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js
|
|
358
377
|
- webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js
|
|
359
378
|
- webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js
|
|
379
|
+
- webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.fixtures.js
|
|
360
380
|
- webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js
|
|
361
381
|
- webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js
|
|
362
382
|
- webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js
|
|
@@ -438,23 +458,26 @@ files:
|
|
|
438
458
|
- webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardSelectors.test.js.snap
|
|
439
459
|
- webpack/ForemanTasks/Components/TasksDashboard/index.js
|
|
440
460
|
- webpack/ForemanTasks/Components/TasksTable/Components/ActionSelectButton.js
|
|
441
|
-
- webpack/ForemanTasks/Components/TasksTable/Components/
|
|
442
|
-
- webpack/ForemanTasks/Components/TasksTable/Components/
|
|
443
|
-
- webpack/ForemanTasks/Components/TasksTable/Components/
|
|
461
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModal.js
|
|
462
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalActions.js
|
|
463
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalReducer.js
|
|
464
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js
|
|
465
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModal.test.js
|
|
466
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalActions.test.js
|
|
467
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalReducer.test.js
|
|
468
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js
|
|
469
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModal.test.js.snap
|
|
470
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalReducer.test.js.snap
|
|
471
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap
|
|
472
|
+
- webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js
|
|
444
473
|
- webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
|
|
445
474
|
- webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionCell.js
|
|
446
475
|
- webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionHeaderCell.js
|
|
447
476
|
- 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
477
|
- webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js
|
|
452
478
|
- webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js
|
|
453
479
|
- webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js
|
|
454
480
|
- 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
481
|
- webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap
|
|
459
482
|
- webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionCell.test.js.snap
|
|
460
483
|
- webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionHeaderCell.test.js.snap
|
|
@@ -462,7 +485,6 @@ files:
|
|
|
462
485
|
- webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js
|
|
463
486
|
- webpack/ForemanTasks/Components/TasksTable/TasksIndexPage.js
|
|
464
487
|
- webpack/ForemanTasks/Components/TasksTable/TasksTable.js
|
|
465
|
-
- webpack/ForemanTasks/Components/TasksTable/TasksTableActionHelpers.js
|
|
466
488
|
- webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js
|
|
467
489
|
- webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js
|
|
468
490
|
- webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js
|
|
@@ -476,7 +498,6 @@ files:
|
|
|
476
498
|
- webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js
|
|
477
499
|
- webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js
|
|
478
500
|
- webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js
|
|
479
|
-
- webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActionHelpers.test.js
|
|
480
501
|
- webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js
|
|
481
502
|
- webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js
|
|
482
503
|
- webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js
|
|
@@ -510,15 +531,13 @@ files:
|
|
|
510
531
|
- webpack/ForemanTasks/Components/TasksTable/index.js
|
|
511
532
|
- webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js
|
|
512
533
|
- 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
534
|
- webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap
|
|
518
|
-
- webpack/ForemanTasks/Components/common/
|
|
519
|
-
- webpack/ForemanTasks/Components/common/
|
|
535
|
+
- webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.scss
|
|
536
|
+
- webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.test.js
|
|
537
|
+
- webpack/ForemanTasks/Components/common/ClickConfirmation/__snapshots__/ClickConfirmation.test.js.snap
|
|
520
538
|
- webpack/ForemanTasks/Components/common/ClickConfirmation/index.js
|
|
521
|
-
- webpack/ForemanTasks/Components/common/ToastTypesConstants.js
|
|
539
|
+
- webpack/ForemanTasks/Components/common/ToastsHelpers/ToastTypesConstants.js
|
|
540
|
+
- webpack/ForemanTasks/Components/common/ToastsHelpers/index.js
|
|
522
541
|
- webpack/ForemanTasks/ForemanTasks.js
|
|
523
542
|
- webpack/ForemanTasks/ForemanTasks.test.js
|
|
524
543
|
- webpack/ForemanTasks/ForemanTasksReducers.js
|
|
@@ -536,7 +555,6 @@ files:
|
|
|
536
555
|
- webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRoutes.test.js.snap
|
|
537
556
|
- webpack/ForemanTasks/__snapshots__/ForemanTasks.test.js.snap
|
|
538
557
|
- webpack/ForemanTasks/index.js
|
|
539
|
-
- webpack/__mocks__/foremanReact/API.js
|
|
540
558
|
- webpack/__mocks__/foremanReact/common/I18n.js
|
|
541
559
|
- webpack/__mocks__/foremanReact/common/helpers.js
|
|
542
560
|
- webpack/__mocks__/foremanReact/common/urlHelpers.js
|
|
@@ -545,12 +563,14 @@ files:
|
|
|
545
563
|
- webpack/__mocks__/foremanReact/components/ForemanModal/index.js
|
|
546
564
|
- webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js
|
|
547
565
|
- webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
|
|
566
|
+
- webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js
|
|
548
567
|
- webpack/__mocks__/foremanReact/components/common/MessageBox.js
|
|
549
568
|
- webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js
|
|
550
569
|
- webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js
|
|
551
570
|
- webpack/__mocks__/foremanReact/components/common/table.js
|
|
552
571
|
- webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js
|
|
553
572
|
- webpack/__mocks__/foremanReact/constants.js
|
|
573
|
+
- webpack/__mocks__/foremanReact/redux/API.js
|
|
554
574
|
- webpack/__mocks__/foremanReact/redux/actions/toasts.js
|
|
555
575
|
- webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
|
|
556
576
|
- webpack/__mocks__/foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton.js
|