foreman-tasks 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc +2 -22
- data/.rubocop.yml +12 -12
- data/.rubocop_todo.yml +34 -116
- data/README.md +2 -0
- data/app/controllers/foreman_tasks/api/recurring_logics_controller.rb +20 -1
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +66 -11
- data/app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb +1 -1
- data/app/controllers/foreman_tasks/recurring_logics_controller.rb +19 -0
- data/app/controllers/foreman_tasks/tasks_controller.rb +3 -11
- data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +1 -3
- data/app/lib/actions/helpers/humanizer.rb +1 -3
- data/app/lib/actions/proxy_action.rb +33 -12
- data/app/lib/foreman_tasks/concerns/polling_action_extensions.rb +12 -0
- data/app/models/foreman_tasks/concerns/action_triggering.rb +1 -1
- data/app/models/foreman_tasks/recurring_logic.rb +1 -0
- data/app/models/foreman_tasks/remote_task.rb +1 -0
- data/app/models/foreman_tasks/task.rb +8 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +1 -1
- data/app/models/foreman_tasks/task/search.rb +11 -1
- data/app/models/setting/foreman_tasks.rb +7 -2
- data/app/services/foreman_tasks/troubleshooting_help_generator.rb +0 -4
- data/app/services/ui_notifications/tasks/task_bulk_cancel.rb +36 -0
- data/app/services/ui_notifications/tasks/task_bulk_resume.rb +38 -0
- data/app/services/ui_notifications/tasks/task_bulk_stop.rb +36 -0
- data/app/views/foreman_tasks/api/recurring_logics/base.json.rabl +2 -1
- data/app/views/foreman_tasks/api/tasks/details.json.rabl +1 -1
- data/app/views/foreman_tasks/api/tasks/show.json.rabl +1 -1
- data/app/views/foreman_tasks/recurring_logics/index.html.erb +30 -0
- data/app/views/foreman_tasks/tasks/show.html.erb +3 -0
- data/{.babelrc.js → babel.config.js} +0 -0
- data/config/routes.rb +8 -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/seeds.d/30-notification_blueprints.rb +21 -0
- data/foreman-tasks.gemspec +5 -6
- data/gemfile.d/foreman-tasks.rb +1 -0
- data/lib/foreman_tasks/dynflow/console_authorizer.rb +2 -2
- data/lib/foreman_tasks/engine.rb +17 -14
- data/lib/foreman_tasks/tasks/cleanup.rake +1 -1
- data/lib/foreman_tasks/tasks/export_tasks.rake +2 -2
- data/lib/foreman_tasks/test_extensions.rb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +2 -2
- data/locale/en/foreman_tasks.po +227 -41
- data/locale/foreman_tasks.pot +579 -288
- data/package.json +18 -71
- data/script/rails +2 -2
- data/script/travis_run_js_tests.sh +2 -2
- data/test/controllers/api/tasks_controller_test.rb +9 -0
- data/test/factories/task_factory.rb +34 -2
- data/test/foreman_tasks_test_helper.rb +4 -0
- data/test/lib/concerns/polling_action_extensions_test.rb +34 -0
- data/test/unit/actions/action_with_sub_plans_test.rb +1 -1
- data/test/unit/task_test.rb +160 -74
- data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +60 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js +67 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.test.js +46 -0
- 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/Task.js +132 -150
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +3 -12
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Errors.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Locks.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Raw.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +68 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +1 -2
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +104 -71
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +3 -9
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.stories.js +6 -2
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +0 -15
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +0 -5
- 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.test.js +6 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +3 -7
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +5 -1
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -8
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.stories.js +44 -40
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.stories.js +45 -40
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.stories.js +27 -22
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.stories.js +61 -56
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.stories.js +40 -35
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.stories.js +21 -20
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js +40 -39
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.stories.js +16 -17
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.test.js +1 -2
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.mdx +57 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.stories.js +36 -18
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardConstants.js +5 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardHelper.js +3 -2
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardReducer.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js +1 -1
- 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 +45 -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 +54 -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 +30 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js +43 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +2 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap +11 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap +75 -0
- data/webpack/ForemanTasks/Components/TasksTable/SubTasksPage.js +4 -1
- data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +247 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +50 -22
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +62 -101
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +21 -9
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +4 -3
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +65 -38
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +26 -9
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +27 -16
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +147 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +4 -7
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +46 -74
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js +17 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +10 -2
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +28 -8
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +5 -7
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +336 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +4 -7
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +22 -158
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +64 -42
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +43 -16
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionHeaderCellFormatter.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionHeaderCellFormatter.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/index.js +11 -4
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +49 -21
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +61 -14
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +80 -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/ToastsHelpers/ToastTypesConstants.js +11 -0
- data/webpack/ForemanTasks/Components/common/ToastsHelpers/index.js +15 -0
- data/webpack/ForemanTasks/ForemanTasks.test.js +1 -1
- data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
- data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +1 -1
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +4 -4
- data/webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js +1 -1
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +10 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +18 -0
- data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
- metadata +71 -30
- data/.storybook/addons.js +0 -2
- data/.storybook/config.js +0 -7
- data/.storybook/webpack.config.js +0 -84
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.js +0 -23
- data/webpack/ForemanTasks/Components/TasksTable/Components/ActionConfirmation.js +0 -49
- data/webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js +0 -51
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionConfirmation.test.js +0 -18
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelResumeConfirm.test.js +0 -28
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionConfirmation.test.js.snap +0 -89
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelResumeConfirm.test.js.snap +0 -37
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +0 -27
- 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
- data/webpack/stories/index.js +0 -10
- data/webpack/stories/index.scss +0 -7
- data/webpack/test_setup.js +0 -7
@@ -2,8 +2,8 @@ import React, { Component } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import { Grid, Row, Col, ProgressBar } from 'patternfly-react';
|
4
4
|
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
-
import EllipsisWithTooltip from 'react-ellipsis-with-tooltip';
|
6
5
|
import RelativeDateTime from 'foremanReact/components/common/dates/RelativeDateTime';
|
6
|
+
import ReactHtmlParser from 'react-html-parser';
|
7
7
|
|
8
8
|
class TaskInfo extends Component {
|
9
9
|
isDelayed = () => {
|
@@ -69,9 +69,7 @@ class TaskInfo extends Component {
|
|
69
69
|
[
|
70
70
|
{
|
71
71
|
title: 'Name',
|
72
|
-
value: (
|
73
|
-
<EllipsisWithTooltip>{action || __('N/A')}</EllipsisWithTooltip>
|
74
|
-
),
|
72
|
+
value: action || __('N/A'),
|
75
73
|
},
|
76
74
|
{
|
77
75
|
title: 'Start at',
|
@@ -173,14 +171,7 @@ class TaskInfo extends Component {
|
|
173
171
|
<b>{__('Troubleshooting')}</b>
|
174
172
|
</span>
|
175
173
|
</p>
|
176
|
-
<p>
|
177
|
-
{help.split('\n').map((item, i) => (
|
178
|
-
<React.Fragment key={i}>
|
179
|
-
{item}
|
180
|
-
<br />
|
181
|
-
</React.Fragment>
|
182
|
-
))}
|
183
|
-
</p>
|
174
|
+
<p>{ReactHtmlParser(help)}</p>
|
184
175
|
</Col>
|
185
176
|
</Row>
|
186
177
|
)}
|
@@ -1,6 +1,15 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import React from 'react';
|
2
|
+
import {
|
3
|
+
testComponentSnapshotsWithFixtures,
|
4
|
+
mount,
|
5
|
+
shallow,
|
6
|
+
} from '@theforeman/test';
|
7
|
+
import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
|
3
8
|
import Task from '../Task';
|
9
|
+
import {
|
10
|
+
UNLOCK_MODAL,
|
11
|
+
FORCE_UNLOCK_MODAL,
|
12
|
+
} from '../../../TaskActions/TaskActionsConstants';
|
4
13
|
|
5
14
|
const fixtures = {
|
6
15
|
'render without Props': { id: 'test' },
|
@@ -8,11 +17,67 @@ const fixtures = {
|
|
8
17
|
id: 'test',
|
9
18
|
state: 'paused',
|
10
19
|
hasSubTasks: true,
|
11
|
-
|
20
|
+
dynflowEnableConsole: true,
|
21
|
+
parentTask: 'parent-id',
|
22
|
+
taskReload: true,
|
12
23
|
},
|
13
24
|
};
|
14
25
|
|
15
26
|
describe('Task', () => {
|
16
27
|
describe('rendering', () =>
|
17
28
|
testComponentSnapshotsWithFixtures(Task, fixtures));
|
29
|
+
describe('click test', () => {
|
30
|
+
const setModalOpen = jest.fn();
|
31
|
+
useForemanModal.mockImplementation(id => ({
|
32
|
+
setModalOpen: () => setModalOpen(id),
|
33
|
+
}));
|
34
|
+
const cancelTaskRequest = jest.fn();
|
35
|
+
const resumeTaskRequest = jest.fn();
|
36
|
+
const taskReloadStart = jest.fn();
|
37
|
+
const id = 'some-id';
|
38
|
+
const action = 'some-action';
|
39
|
+
const props = {
|
40
|
+
taskReload: false,
|
41
|
+
taskReloadStart,
|
42
|
+
id,
|
43
|
+
action,
|
44
|
+
cancelTaskRequest,
|
45
|
+
resumeTaskRequest,
|
46
|
+
};
|
47
|
+
afterEach(() => {
|
48
|
+
jest.clearAllMocks();
|
49
|
+
});
|
50
|
+
it('reload', () => {
|
51
|
+
const component = mount(<Task {...props} />);
|
52
|
+
const reloadButton = component.find('.reload-button').at(0);
|
53
|
+
reloadButton.simulate('click');
|
54
|
+
expect(taskReloadStart).toBeCalled();
|
55
|
+
});
|
56
|
+
it('resume', () => {
|
57
|
+
const component = shallow(<Task {...props} />);
|
58
|
+
const resumeButton = component.find('.resume-button').at(0);
|
59
|
+
resumeButton.props().onClick();
|
60
|
+
expect(taskReloadStart).toBeCalled();
|
61
|
+
expect(resumeTaskRequest).toBeCalledWith(id, action);
|
62
|
+
});
|
63
|
+
it('cancel', () => {
|
64
|
+
const component = shallow(<Task {...props} />);
|
65
|
+
const cancelButton = component.find('.cancel-button').at(0);
|
66
|
+
cancelButton.props().onClick();
|
67
|
+
expect(taskReloadStart).toBeCalled();
|
68
|
+
expect(cancelTaskRequest).toBeCalledWith(id, action);
|
69
|
+
});
|
70
|
+
it('unlock', () => {
|
71
|
+
const component = shallow(<Task {...props} />);
|
72
|
+
const unlockButton = component.find('.unlock-button').at(0);
|
73
|
+
unlockButton.props().onClick();
|
74
|
+
expect(setModalOpen).toBeCalledWith({ id: UNLOCK_MODAL });
|
75
|
+
});
|
76
|
+
it('focrce unlock', () => {
|
77
|
+
const component = shallow(<Task {...props} />);
|
78
|
+
const forceUnlockButton = component.find('.force-unlock-button').at(0);
|
79
|
+
forceUnlockButton.props().onClick();
|
80
|
+
expect(setModalOpen).toBeCalledWith({ id: FORCE_UNLOCK_MODAL });
|
81
|
+
});
|
82
|
+
});
|
18
83
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
2
2
|
|
3
3
|
import TaskInfo from '../TaskInfo';
|
4
4
|
|
@@ -41,7 +41,6 @@ const fixtures = {
|
|
41
41
|
help:
|
42
42
|
"A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved.\nThe recommended approach is to investigate the error messages below and in 'errors' tab, address the primary cause of the issue and resume the task.",
|
43
43
|
hasSubTasks: false,
|
44
|
-
allowDangerousActions: false,
|
45
44
|
locks: [
|
46
45
|
{
|
47
46
|
name: 'task_owner',
|
@@ -2,25 +2,14 @@
|
|
2
2
|
|
3
3
|
exports[`Task rendering render with some Props 1`] = `
|
4
4
|
<Fragment>
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
confirmAction="Unlock"
|
9
|
-
confirmType="warning"
|
10
|
-
confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
|
11
|
-
path="/foreman_tasks/tasks/test/unlock"
|
12
|
-
showModal={false}
|
13
|
-
title="Unlock"
|
5
|
+
<UnlockModal
|
6
|
+
id="unlockModal"
|
7
|
+
onClick={[Function]}
|
14
8
|
/>
|
15
|
-
<
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
confirmType="danger"
|
20
|
-
confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
|
21
|
-
path="/foreman_tasks/tasks/test/force_unlock"
|
22
|
-
showModal={false}
|
23
|
-
title="Force Unlock"
|
9
|
+
<ForceUnlockModal
|
10
|
+
id="forceUnlockModal"
|
11
|
+
onClick={[Function]}
|
12
|
+
selectedRowsLen={1}
|
24
13
|
/>
|
25
14
|
<Grid
|
26
15
|
bsClass="container"
|
@@ -44,13 +33,12 @@ exports[`Task rendering render with some Props 1`] = `
|
|
44
33
|
bsStyle="default"
|
45
34
|
className="reload-button"
|
46
35
|
disabled={false}
|
47
|
-
hidden={false}
|
48
36
|
onClick={[Function]}
|
49
37
|
>
|
50
38
|
<span
|
51
|
-
className="glyphicon glyphicon-refresh "
|
39
|
+
className="glyphicon glyphicon-refresh spin"
|
52
40
|
/>
|
53
|
-
|
41
|
+
Stop auto-reloading
|
54
42
|
</Button>
|
55
43
|
<Button
|
56
44
|
active={false}
|
@@ -58,29 +46,55 @@ exports[`Task rendering render with some Props 1`] = `
|
|
58
46
|
bsClass="btn"
|
59
47
|
bsSize="small"
|
60
48
|
bsStyle="default"
|
49
|
+
className="dynflow-button"
|
61
50
|
disabled={false}
|
62
51
|
href="/foreman_tasks/dynflow/"
|
63
52
|
>
|
64
53
|
Dynflow console
|
65
54
|
</Button>
|
66
|
-
<
|
55
|
+
<Button
|
56
|
+
active={false}
|
57
|
+
block={false}
|
58
|
+
bsClass="btn"
|
59
|
+
bsSize="small"
|
60
|
+
bsStyle="default"
|
61
|
+
className="resume-button"
|
67
62
|
disabled={true}
|
68
|
-
id="test"
|
69
|
-
name=""
|
70
63
|
onClick={[Function]}
|
71
|
-
|
72
|
-
|
64
|
+
>
|
65
|
+
Resume
|
66
|
+
</Button>
|
67
|
+
<Button
|
68
|
+
active={false}
|
69
|
+
block={false}
|
70
|
+
bsClass="btn"
|
71
|
+
bsSize="small"
|
72
|
+
bsStyle="default"
|
73
|
+
className="cancel-button"
|
73
74
|
disabled={true}
|
74
|
-
id="test"
|
75
|
-
name=""
|
76
75
|
onClick={[Function]}
|
77
|
-
|
76
|
+
>
|
77
|
+
Cancel
|
78
|
+
</Button>
|
78
79
|
<Button
|
79
80
|
active={false}
|
80
81
|
block={false}
|
81
82
|
bsClass="btn"
|
82
83
|
bsSize="small"
|
83
84
|
bsStyle="default"
|
85
|
+
className="parent-button"
|
86
|
+
disabled={false}
|
87
|
+
href="/foreman_tasks/tasks/parent-id"
|
88
|
+
>
|
89
|
+
Parent task
|
90
|
+
</Button>
|
91
|
+
<Button
|
92
|
+
active={false}
|
93
|
+
block={false}
|
94
|
+
bsClass="btn"
|
95
|
+
bsSize="small"
|
96
|
+
bsStyle="default"
|
97
|
+
className="subtask-button"
|
84
98
|
disabled={false}
|
85
99
|
href="/foreman_tasks/tasks/test/sub_tasks"
|
86
100
|
>
|
@@ -92,8 +106,9 @@ exports[`Task rendering render with some Props 1`] = `
|
|
92
106
|
bsClass="btn"
|
93
107
|
bsSize="small"
|
94
108
|
bsStyle="default"
|
109
|
+
className="unlock-button"
|
95
110
|
disabled={false}
|
96
|
-
onClick={[
|
111
|
+
onClick={[MockFunction]}
|
97
112
|
>
|
98
113
|
Unlock
|
99
114
|
</Button>
|
@@ -103,8 +118,9 @@ exports[`Task rendering render with some Props 1`] = `
|
|
103
118
|
bsClass="btn"
|
104
119
|
bsSize="small"
|
105
120
|
bsStyle="default"
|
121
|
+
className="force-unlock-button"
|
106
122
|
disabled={false}
|
107
|
-
onClick={[
|
123
|
+
onClick={[MockFunction]}
|
108
124
|
>
|
109
125
|
Force Unlock
|
110
126
|
</Button>
|
@@ -112,9 +128,9 @@ exports[`Task rendering render with some Props 1`] = `
|
|
112
128
|
</Row>
|
113
129
|
<TaskInfo
|
114
130
|
action=""
|
115
|
-
allowDangerousActions={true}
|
116
131
|
cancelTaskRequest={[Function]}
|
117
132
|
cancellable={false}
|
133
|
+
dynflowEnableConsole={true}
|
118
134
|
endedAt=""
|
119
135
|
error={Array []}
|
120
136
|
externalId=""
|
@@ -122,24 +138,20 @@ exports[`Task rendering render with some Props 1`] = `
|
|
122
138
|
help=""
|
123
139
|
id="test"
|
124
140
|
output=""
|
125
|
-
parentTask=""
|
141
|
+
parentTask="parent-id"
|
126
142
|
progress={0}
|
127
143
|
refetchTaskDetails={[Function]}
|
128
144
|
result="error"
|
129
145
|
resumable={false}
|
130
146
|
resumeTaskRequest={[Function]}
|
131
|
-
showForceUnlockModal={false}
|
132
|
-
showUnlockModal={false}
|
133
147
|
startAt=""
|
134
148
|
startBefore=""
|
135
149
|
startedAt=""
|
136
150
|
state="paused"
|
137
|
-
taskReload={
|
151
|
+
taskReload={true}
|
138
152
|
taskReloadStart={[Function]}
|
139
153
|
taskReloadStop={[Function]}
|
140
154
|
timeoutId={null}
|
141
|
-
toggleForceUnlockModal={[Function]}
|
142
|
-
toggleUnlockModal={[Function]}
|
143
155
|
username=""
|
144
156
|
usernamePath=""
|
145
157
|
/>
|
@@ -149,25 +161,14 @@ exports[`Task rendering render with some Props 1`] = `
|
|
149
161
|
|
150
162
|
exports[`Task rendering render without Props 1`] = `
|
151
163
|
<Fragment>
|
152
|
-
<
|
153
|
-
|
154
|
-
|
155
|
-
confirmAction="Unlock"
|
156
|
-
confirmType="warning"
|
157
|
-
confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
|
158
|
-
path="/foreman_tasks/tasks/test/unlock"
|
159
|
-
showModal={false}
|
160
|
-
title="Unlock"
|
164
|
+
<UnlockModal
|
165
|
+
id="unlockModal"
|
166
|
+
onClick={[Function]}
|
161
167
|
/>
|
162
|
-
<
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
confirmType="danger"
|
167
|
-
confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
|
168
|
-
path="/foreman_tasks/tasks/test/force_unlock"
|
169
|
-
showModal={false}
|
170
|
-
title="Force Unlock"
|
168
|
+
<ForceUnlockModal
|
169
|
+
id="forceUnlockModal"
|
170
|
+
onClick={[Function]}
|
171
|
+
selectedRowsLen={1}
|
171
172
|
/>
|
172
173
|
<Grid
|
173
174
|
bsClass="container"
|
@@ -191,7 +192,6 @@ exports[`Task rendering render without Props 1`] = `
|
|
191
192
|
bsStyle="default"
|
192
193
|
className="reload-button"
|
193
194
|
disabled={false}
|
194
|
-
hidden={true}
|
195
195
|
onClick={[Function]}
|
196
196
|
>
|
197
197
|
<span
|
@@ -205,30 +205,67 @@ exports[`Task rendering render without Props 1`] = `
|
|
205
205
|
bsClass="btn"
|
206
206
|
bsSize="small"
|
207
207
|
bsStyle="default"
|
208
|
-
|
208
|
+
className="dynflow-button"
|
209
|
+
disabled={true}
|
209
210
|
href="/foreman_tasks/dynflow/"
|
210
211
|
>
|
211
212
|
Dynflow console
|
212
213
|
</Button>
|
213
|
-
<
|
214
|
+
<Button
|
215
|
+
active={false}
|
216
|
+
block={false}
|
217
|
+
bsClass="btn"
|
218
|
+
bsSize="small"
|
219
|
+
bsStyle="default"
|
220
|
+
className="resume-button"
|
214
221
|
disabled={true}
|
215
|
-
id="test"
|
216
|
-
name=""
|
217
222
|
onClick={[Function]}
|
218
|
-
|
219
|
-
|
223
|
+
>
|
224
|
+
Resume
|
225
|
+
</Button>
|
226
|
+
<Button
|
227
|
+
active={false}
|
228
|
+
block={false}
|
229
|
+
bsClass="btn"
|
230
|
+
bsSize="small"
|
231
|
+
bsStyle="default"
|
232
|
+
className="cancel-button"
|
220
233
|
disabled={true}
|
221
|
-
id="test"
|
222
|
-
name=""
|
223
234
|
onClick={[Function]}
|
224
|
-
|
235
|
+
>
|
236
|
+
Cancel
|
237
|
+
</Button>
|
238
|
+
<Button
|
239
|
+
active={false}
|
240
|
+
block={false}
|
241
|
+
bsClass="btn"
|
242
|
+
bsSize="small"
|
243
|
+
bsStyle="default"
|
244
|
+
className="unlock-button"
|
245
|
+
disabled={true}
|
246
|
+
onClick={[MockFunction]}
|
247
|
+
>
|
248
|
+
Unlock
|
249
|
+
</Button>
|
250
|
+
<Button
|
251
|
+
active={false}
|
252
|
+
block={false}
|
253
|
+
bsClass="btn"
|
254
|
+
bsSize="small"
|
255
|
+
bsStyle="default"
|
256
|
+
className="force-unlock-button"
|
257
|
+
disabled={false}
|
258
|
+
onClick={[MockFunction]}
|
259
|
+
>
|
260
|
+
Force Unlock
|
261
|
+
</Button>
|
225
262
|
</Col>
|
226
263
|
</Row>
|
227
264
|
<TaskInfo
|
228
265
|
action=""
|
229
|
-
allowDangerousActions={false}
|
230
266
|
cancelTaskRequest={[Function]}
|
231
267
|
cancellable={false}
|
268
|
+
dynflowEnableConsole={false}
|
232
269
|
endedAt=""
|
233
270
|
error={Array []}
|
234
271
|
externalId=""
|
@@ -242,8 +279,6 @@ exports[`Task rendering render without Props 1`] = `
|
|
242
279
|
result="error"
|
243
280
|
resumable={false}
|
244
281
|
resumeTaskRequest={[Function]}
|
245
|
-
showForceUnlockModal={false}
|
246
|
-
showUnlockModal={false}
|
247
282
|
startAt=""
|
248
283
|
startBefore=""
|
249
284
|
startedAt=""
|
@@ -252,8 +287,6 @@ exports[`Task rendering render without Props 1`] = `
|
|
252
287
|
taskReloadStart={[Function]}
|
253
288
|
taskReloadStop={[Function]}
|
254
289
|
timeoutId={null}
|
255
|
-
toggleForceUnlockModal={[Function]}
|
256
|
-
toggleUnlockModal={[Function]}
|
257
290
|
username=""
|
258
291
|
usernamePath=""
|
259
292
|
/>
|