foreman-tasks 0.17.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/foreman_tasks/tasks.css.scss +3 -3
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +50 -30
- data/app/controllers/foreman_tasks/tasks_controller.rb +8 -17
- data/app/models/foreman_tasks/task.rb +6 -4
- data/app/models/foreman_tasks/task/search.rb +0 -25
- data/app/models/setting/foreman_tasks.rb +19 -23
- data/app/views/foreman_tasks/api/tasks/show.json.rabl +1 -0
- data/app/views/foreman_tasks/layouts/react.html.erb +4 -1
- data/config/routes.rb +17 -3
- data/db/migrate/20180927120509_add_user_id.foreman_tasks.rb +4 -2
- data/lib/foreman_tasks/dynflow.rb +1 -1
- data/lib/foreman_tasks/dynflow/console_authorizer.rb +13 -2
- data/lib/foreman_tasks/engine.rb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/package.json +1 -0
- data/test/controllers/tasks_controller_test.rb +35 -4
- data/test/unit/dynflow_console_authorizer_test.rb +1 -1
- data/test/unit/otp_manager_test.rb +24 -17
- data/test/unit/task_test.rb +48 -2
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +29 -16
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskHelper.js +3 -17
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +18 -5
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskHelper.test.js +1 -56
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +24 -44
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +22 -10
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +6 -0
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +2 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.js +6 -3
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardActions.js +2 -3
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardHelper.js +10 -41
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardReducer.js +0 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardReducer.test.js.snap +1 -6
- data/webpack/ForemanTasks/Components/TasksTable/SubTasksPage.js +30 -0
- data/webpack/ForemanTasks/Components/TasksTable/TaskTableFormmatters.js +53 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksIndexPage.js +10 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +119 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +67 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +5 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +64 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +63 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.scss +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +35 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +67 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +39 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +20 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +12 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +42 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +9 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +48 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js +28 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +26 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +37 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +49 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +42 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTable.test.js.snap +72 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +115 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +194 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +32 -0
- data/webpack/ForemanTasks/Components/TasksTable/index.js +32 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +39 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +45 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +23 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +27 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.js +23 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +27 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +28 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap +15 -0
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap +15 -0
- data/webpack/ForemanTasks/ForemanTasks.js +1 -17
- data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
- data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +5 -1
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.js +9 -3
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +1 -1
- data/webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js +5 -1
- data/webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRoutes.test.js.snap +18 -2
- data/webpack/ForemanTasks/__snapshots__/ForemanTasks.test.js.snap +1 -54
- data/webpack/__mocks__/foremanReact/common/helpers.js +1 -0
- data/webpack/__mocks__/foremanReact/common/urlHelpers.js +1 -0
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +2 -0
- data/webpack/__mocks__/foremanReact/components/common/MessageBox.js +4 -0
- data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +5 -0
- data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +3 -0
- data/webpack/__mocks__/foremanReact/components/common/table.js +4 -0
- data/webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js +7 -0
- data/webpack/__mocks__/foremanReact/constants.js +24 -0
- data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +8 -0
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +10 -0
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton.js +5 -0
- data/webpack/index.js +5 -0
- metadata +49 -9
- data/app/views/foreman_tasks/tasks/index.html.erb +0 -46
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskHelper.test.js.snap +0 -37
- data/webpack/ForemanTasks/Routes/IndexTasks/IndexTasks.js +0 -10
- data/webpack/ForemanTasks/Routes/IndexTasks/__tests__/IndexTasks.test.js +0 -10
- data/webpack/ForemanTasks/Routes/IndexTasks/__tests__/__snapshots__/IndexTasks.test.js.snap +0 -12
- data/webpack/ForemanTasks/Routes/IndexTasks/index.js +0 -1
- data/webpack/ForemanTasks/Routes/IndexTasks/indexTasks.scss +0 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`TasksTablePaginationReducer reducer should handle TASKS_TABLE_SET_PAGINATION 1`] = `
|
4
|
+
Object {
|
5
|
+
"tasksTableQuery": Object {},
|
6
|
+
}
|
7
|
+
`;
|
8
|
+
|
9
|
+
exports[`TasksTablePaginationReducer reducer should handle TASKS_TABLE_SET_SORT 1`] = `
|
10
|
+
Object {
|
11
|
+
"tasksTableQuery": Object {},
|
12
|
+
}
|
13
|
+
`;
|
14
|
+
|
15
|
+
exports[`TasksTablePaginationReducer reducer should handle TASKS_TABLE_SUCCESS 1`] = `
|
16
|
+
Object {
|
17
|
+
"tasksTableQuery": Object {
|
18
|
+
"actionName": undefined,
|
19
|
+
"itemCount": 120,
|
20
|
+
"pagination": Object {
|
21
|
+
"page": 3,
|
22
|
+
"perPage": 12,
|
23
|
+
},
|
24
|
+
},
|
25
|
+
}
|
26
|
+
`;
|
27
|
+
|
28
|
+
exports[`TasksTablePaginationReducer reducer should return the initial state 1`] = `
|
29
|
+
Object {
|
30
|
+
"tasksTableQuery": Object {},
|
31
|
+
}
|
32
|
+
`;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { connect } from 'react-redux';
|
2
|
+
import { bindActionCreators } from 'redux';
|
3
|
+
import TasksTablePage from './TasksTablePage';
|
4
|
+
import reducer from './TasksTableReducer';
|
5
|
+
import * as actions from './TasksTableActions';
|
6
|
+
import {
|
7
|
+
selectStatus,
|
8
|
+
selectError,
|
9
|
+
selectResults,
|
10
|
+
selectPagitation,
|
11
|
+
selectItemCount,
|
12
|
+
selectSort,
|
13
|
+
selectActionName,
|
14
|
+
} from './TasksTableSelectors';
|
15
|
+
|
16
|
+
const mapStateToProps = state => ({
|
17
|
+
status: selectStatus(state),
|
18
|
+
error: selectError(state),
|
19
|
+
sort: selectSort(state),
|
20
|
+
results: selectResults(state),
|
21
|
+
pagination: selectPagitation(state),
|
22
|
+
itemCount: selectItemCount(state),
|
23
|
+
actionName: selectActionName(state),
|
24
|
+
});
|
25
|
+
const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
|
26
|
+
|
27
|
+
export const reducers = { tasksTable: reducer };
|
28
|
+
|
29
|
+
export default connect(
|
30
|
+
mapStateToProps,
|
31
|
+
mapDispatchToProps
|
32
|
+
)(TasksTablePage);
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { CancelButton } from './CancelButton';
|
4
|
+
import { ResumeButton } from './ResumeButton';
|
5
|
+
|
6
|
+
export const ActionButton = ({ id, name, availableActions, taskActions }) => {
|
7
|
+
const isResume = availableActions.resumable;
|
8
|
+
if (isResume) {
|
9
|
+
return (
|
10
|
+
<ResumeButton
|
11
|
+
id={id}
|
12
|
+
name={name}
|
13
|
+
onClick={taskActions.resume}
|
14
|
+
disabled={false}
|
15
|
+
/>
|
16
|
+
);
|
17
|
+
}
|
18
|
+
return (
|
19
|
+
<CancelButton
|
20
|
+
id={id}
|
21
|
+
name={name}
|
22
|
+
disabled={!availableActions.cancellable}
|
23
|
+
onClick={taskActions.cancel}
|
24
|
+
/>
|
25
|
+
);
|
26
|
+
};
|
27
|
+
|
28
|
+
ActionButton.propTypes = {
|
29
|
+
id: PropTypes.string.isRequired,
|
30
|
+
name: PropTypes.string.isRequired,
|
31
|
+
availableActions: PropTypes.shape({
|
32
|
+
cancellable: PropTypes.bool,
|
33
|
+
resumable: PropTypes.bool,
|
34
|
+
}).isRequired,
|
35
|
+
taskActions: PropTypes.shape({
|
36
|
+
cancel: PropTypes.func,
|
37
|
+
resume: PropTypes.func,
|
38
|
+
}).isRequired,
|
39
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import { ActionButton } from './ActionButton';
|
4
|
+
|
5
|
+
const fixtures = {
|
6
|
+
'render with cancellable true props': {
|
7
|
+
availableActions: {
|
8
|
+
cancellable: true,
|
9
|
+
resumable: false,
|
10
|
+
},
|
11
|
+
taskActions: {
|
12
|
+
cancel: jest.fn(),
|
13
|
+
resume: jest.fn(),
|
14
|
+
},
|
15
|
+
id: 'id',
|
16
|
+
name: 'some-name',
|
17
|
+
},
|
18
|
+
'render with resumable true props': {
|
19
|
+
availableActions: {
|
20
|
+
cancellable: false,
|
21
|
+
resumable: true,
|
22
|
+
},
|
23
|
+
taskActions: {
|
24
|
+
cancel: jest.fn(),
|
25
|
+
resume: jest.fn(),
|
26
|
+
},
|
27
|
+
id: 'id',
|
28
|
+
name: 'some-name',
|
29
|
+
},
|
30
|
+
'render with cancellable false props': {
|
31
|
+
availableActions: {
|
32
|
+
cancellable: false,
|
33
|
+
resumable: false,
|
34
|
+
},
|
35
|
+
taskActions: {
|
36
|
+
cancel: jest.fn(),
|
37
|
+
resume: jest.fn(),
|
38
|
+
},
|
39
|
+
id: 'id',
|
40
|
+
name: 'some-name',
|
41
|
+
},
|
42
|
+
};
|
43
|
+
|
44
|
+
describe('ActionButton', () =>
|
45
|
+
testComponentSnapshotsWithFixtures(ActionButton, fixtures));
|
@@ -0,0 +1,23 @@
|
|
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
|
+
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
3
|
+
import { shallow } from 'enzyme';
|
4
|
+
import { CancelButton } from './CancelButton';
|
5
|
+
|
6
|
+
const fixtures = {
|
7
|
+
'render with minimal props': {
|
8
|
+
id: 'some-id',
|
9
|
+
name: 'some-name',
|
10
|
+
},
|
11
|
+
};
|
12
|
+
|
13
|
+
describe('CancelButton', () => {
|
14
|
+
describe('rendering', () =>
|
15
|
+
testComponentSnapshotsWithFixtures(CancelButton, 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
|
+
<CancelButton id={id} name={name} onClick={onClick} />
|
22
|
+
);
|
23
|
+
component.find('Button').simulate('click');
|
24
|
+
|
25
|
+
expect(onClick).toHaveBeenCalledWith(id, name);
|
26
|
+
});
|
27
|
+
});
|
@@ -0,0 +1,23 @@
|
|
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
|
+
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
3
|
+
import { shallow } from 'enzyme';
|
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
|
+
});
|
data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`ActionButton render with cancellable false props 1`] = `
|
4
|
+
<CancelButton
|
5
|
+
disabled={true}
|
6
|
+
id="id"
|
7
|
+
name="some-name"
|
8
|
+
onClick={[MockFunction]}
|
9
|
+
/>
|
10
|
+
`;
|
11
|
+
|
12
|
+
exports[`ActionButton render with cancellable true props 1`] = `
|
13
|
+
<CancelButton
|
14
|
+
disabled={false}
|
15
|
+
id="id"
|
16
|
+
name="some-name"
|
17
|
+
onClick={[MockFunction]}
|
18
|
+
/>
|
19
|
+
`;
|
20
|
+
|
21
|
+
exports[`ActionButton render with resumable true props 1`] = `
|
22
|
+
<ResumeButton
|
23
|
+
disabled={false}
|
24
|
+
id="id"
|
25
|
+
name="some-name"
|
26
|
+
onClick={[MockFunction]}
|
27
|
+
/>
|
28
|
+
`;
|
data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap
ADDED
@@ -0,0 +1,15 @@
|
|
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
|
+
`;
|
data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap
ADDED
@@ -0,0 +1,15 @@
|
|
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
|
+
`;
|
@@ -1,26 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { BrowserRouter } from 'react-router-dom';
|
3
|
-
import { LinkContainer } from 'react-router-bootstrap';
|
4
|
-
import { ButtonGroup, Button } from 'patternfly-react';
|
5
|
-
|
6
|
-
import routes from './Routes/ForemanTasksRoutes';
|
7
3
|
import ForemanTasksRouter from './Routes/ForemanTasksRouter';
|
8
4
|
|
9
5
|
const ForemanTasks = () => (
|
10
6
|
<BrowserRouter>
|
11
|
-
<
|
12
|
-
<div style={{ paddingTop: '10px', paddingBottom: '10px' }}>
|
13
|
-
<ButtonGroup bsSize="large">
|
14
|
-
<LinkContainer to={routes.indexTasks.path}>
|
15
|
-
<Button bsStyle="link">index-tasks-page</Button>
|
16
|
-
</LinkContainer>
|
17
|
-
<LinkContainer to={routes.showTask.path.replace(':id', 'some-id')}>
|
18
|
-
<Button bsStyle="link">show-task-page</Button>
|
19
|
-
</LinkContainer>
|
20
|
-
</ButtonGroup>
|
21
|
-
</div>
|
22
|
-
<ForemanTasksRouter />
|
23
|
-
</div>
|
7
|
+
<ForemanTasksRouter />
|
24
8
|
</BrowserRouter>
|
25
9
|
);
|
26
10
|
|
@@ -1,11 +1,13 @@
|
|
1
1
|
import { combineReducers } from 'redux';
|
2
2
|
import { reducers as tasksDashboardReducers } from './Components/TasksDashboard';
|
3
3
|
import { reducers as taskDetailsReducers } from './Components/TaskDetails';
|
4
|
+
import { reducers as tasksTableReducers } from './Components/TasksTable';
|
4
5
|
|
5
6
|
const reducers = {
|
6
7
|
foremanTasks: combineReducers({
|
7
8
|
...tasksDashboardReducers,
|
8
9
|
...taskDetailsReducers,
|
10
|
+
...tasksTableReducers,
|
9
11
|
}),
|
10
12
|
};
|
11
13
|
|
@@ -1,12 +1,18 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import
|
2
|
+
import { TasksIndexPage } from '../Components/TasksTable/TasksIndexPage';
|
3
|
+
import { SubTasksPage } from '../Components/TasksTable/SubTasksPage';
|
3
4
|
import ShowTask from './ShowTask';
|
4
5
|
|
5
6
|
const ForemanTasksRoutes = {
|
6
7
|
indexTasks: {
|
7
|
-
path: '/foreman_tasks/
|
8
|
+
path: '/foreman_tasks/tasks',
|
8
9
|
exact: true,
|
9
|
-
render: props => <
|
10
|
+
render: props => <TasksIndexPage {...props} />,
|
11
|
+
},
|
12
|
+
subTasks: {
|
13
|
+
path: '/foreman_tasks/tasks/:id/sub_tasks',
|
14
|
+
exact: true,
|
15
|
+
render: props => <SubTasksPage {...props} />,
|
10
16
|
},
|
11
17
|
showTask: {
|
12
18
|
path: '/foreman_tasks/ex_tasks/:id',
|
@@ -7,7 +7,7 @@ import ForemanTasksRoutes from './ForemanTasksRoutes';
|
|
7
7
|
describe('ForemanTasksRoutes', () => {
|
8
8
|
it('should create routes', () => {
|
9
9
|
Object.entries(ForemanTasksRoutes).forEach(([key, Route]) => {
|
10
|
-
const component = shallow(<Route.render some="props" />);
|
10
|
+
const component = shallow(<Route.render history={{}} some="props" />);
|
11
11
|
Route.renderResult = toJson(component);
|
12
12
|
});
|
13
13
|
|
@@ -3,7 +3,11 @@ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
|
3
3
|
import ShowTask from '../ShowTask';
|
4
4
|
|
5
5
|
const fixtures = {
|
6
|
-
'render without Props': {
|
6
|
+
'render without Props': {
|
7
|
+
history: {
|
8
|
+
push: jest.fn(),
|
9
|
+
},
|
10
|
+
},
|
7
11
|
};
|
8
12
|
|
9
13
|
describe('ShowTask', () =>
|
@@ -4,9 +4,10 @@ exports[`ForemanTasksRoutes should create routes 1`] = `
|
|
4
4
|
Object {
|
5
5
|
"indexTasks": Object {
|
6
6
|
"exact": true,
|
7
|
-
"path": "/foreman_tasks/
|
7
|
+
"path": "/foreman_tasks/tasks",
|
8
8
|
"render": [Function],
|
9
|
-
"renderResult": <
|
9
|
+
"renderResult": <TasksIndexPage
|
10
|
+
history={Object {}}
|
10
11
|
some="props"
|
11
12
|
/>,
|
12
13
|
},
|
@@ -14,6 +15,21 @@ Object {
|
|
14
15
|
"path": "/foreman_tasks/ex_tasks/:id",
|
15
16
|
"render": [Function],
|
16
17
|
"renderResult": <ShowTask
|
18
|
+
history={Object {}}
|
19
|
+
some="props"
|
20
|
+
/>,
|
21
|
+
},
|
22
|
+
"subTasks": Object {
|
23
|
+
"exact": true,
|
24
|
+
"path": "/foreman_tasks/tasks/:id/sub_tasks",
|
25
|
+
"render": [Function],
|
26
|
+
"renderResult": <SubTasksPage
|
27
|
+
history={Object {}}
|
28
|
+
match={
|
29
|
+
Object {
|
30
|
+
"params": Object {},
|
31
|
+
}
|
32
|
+
}
|
17
33
|
some="props"
|
18
34
|
/>,
|
19
35
|
},
|