foreman-tasks 0.15.1 → 0.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +9 -1
  3. data/.eslintrc +6 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +6 -0
  6. data/.storybook/webpack.config.js +51 -54
  7. data/app/controllers/foreman_tasks/api/tasks_controller.rb +0 -2
  8. data/app/controllers/foreman_tasks/tasks_controller.rb +6 -1
  9. data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +8 -0
  10. data/app/lib/actions/base.rb +7 -0
  11. data/app/lib/actions/helpers/lifecycle_logging.rb +21 -0
  12. data/app/lib/actions/proxy_action.rb +4 -2
  13. data/app/models/foreman_tasks/task.rb +23 -0
  14. data/app/models/foreman_tasks/task/summarizer.rb +96 -6
  15. data/app/models/foreman_tasks/triggering.rb +2 -2
  16. data/app/models/setting/foreman_tasks.rb +8 -1
  17. data/app/services/foreman_tasks/dashboard_table_filter.rb +47 -0
  18. data/app/services/foreman_tasks/troubleshooting_help_generator.rb +92 -0
  19. data/app/services/ui_notifications/tasks.rb +20 -0
  20. data/app/services/ui_notifications/tasks/task_paused_admin.rb +43 -0
  21. data/app/services/ui_notifications/tasks/task_paused_owner.rb +30 -0
  22. data/app/views/foreman_tasks/tasks/_details.html.erb +5 -3
  23. data/app/views/foreman_tasks/tasks/index.html.erb +13 -0
  24. data/config/routes.rb +1 -0
  25. data/db/migrate/20190318153925_add_task_state_updated_at.foreman_tasks.rb +5 -0
  26. data/db/migrate/20190404132157_add_implicit_varchar_uuid_cast.rb +25 -0
  27. data/db/seeds.d/30-notification_blueprints.rb +33 -0
  28. data/foreman-tasks.gemspec +1 -1
  29. data/lib/foreman_tasks/cleaner.rb +5 -4
  30. data/lib/foreman_tasks/engine.rb +1 -1
  31. data/lib/foreman_tasks/test_helpers.rb +10 -0
  32. data/lib/foreman_tasks/version.rb +1 -1
  33. data/package.json +14 -11
  34. data/test/controllers/tasks_controller_test.rb +10 -0
  35. data/test/foreman_tasks_test_helper.rb +4 -0
  36. data/test/support/dummy_dynflow_action.rb +29 -0
  37. data/test/support/history_tasks_builder.rb +42 -0
  38. data/test/unit/actions/action_with_sub_plans_test.rb +4 -1
  39. data/test/unit/actions/bulk_action_test.rb +2 -0
  40. data/test/unit/cleaner_test.rb +15 -0
  41. data/test/unit/dashboard_table_filter_test.rb +65 -0
  42. data/test/unit/summarizer_test.rb +39 -0
  43. data/test/unit/task_test.rb +14 -0
  44. data/test/unit/troubleshooting_help_generator_test.rb +71 -0
  45. data/test/unit/ui_notifications_test.rb +86 -0
  46. data/webpack/ForemanTasks/Components/Chart/Chart.js +128 -0
  47. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.js +20 -0
  48. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.stories.js +51 -0
  49. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.test.js +11 -0
  50. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/__snapshots__/PausedTasksCard.test.js.snap +36 -0
  51. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.js +20 -0
  52. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.stories.js +51 -0
  53. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.test.js +11 -0
  54. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/__snapshots__/RunningTasksCard.test.js.snap +36 -0
  55. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js +64 -0
  56. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.scss +25 -0
  57. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.stories.js +28 -0
  58. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.test.js +18 -0
  59. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/__snapshots__/ScheduledTasksCard.test.js.snap +94 -0
  60. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.js +89 -0
  61. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.scss +46 -0
  62. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.stories.js +72 -0
  63. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +48 -0
  64. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCardHelper.js +63 -0
  65. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCard.test.js.snap +973 -0
  66. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.js +96 -0
  67. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.scss +17 -0
  68. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.stories.js +46 -0
  69. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.test.js +43 -0
  70. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/__snapshots__/TasksDonutCard.test.js.snap +183 -0
  71. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.js +166 -0
  72. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.scss +24 -0
  73. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.stories.js +25 -0
  74. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js +40 -0
  75. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChartConstants.js +13 -0
  76. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChartHelper.js +94 -0
  77. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChartHelper.test.js +152 -0
  78. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/__snapshots__/TasksDonutChart.test.js.snap +302 -0
  79. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/__snapshots__/TasksDonutChartHelper.test.js.snap +21 -0
  80. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.fixtures.js +25 -0
  81. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.js +72 -0
  82. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js +52 -0
  83. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.test.js +21 -0
  84. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/__snapshots__/TasksCardsGrid.test.js.snap +223 -0
  85. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.js +57 -0
  86. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.scss +26 -0
  87. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.stories.js +22 -0
  88. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.test.js +57 -0
  89. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/__snapshots__/TasksLabelsRow.test.js.snap +47 -0
  90. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.js +51 -0
  91. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.js +23 -0
  92. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.test.js +19 -0
  93. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/__snapshots__/TimeDropDown.test.js.snap +85 -0
  94. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.js +33 -0
  95. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.scss +11 -0
  96. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.stories.js +22 -0
  97. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.test.js +15 -0
  98. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/__snapshots__/TasksTimeRow.test.js.snap +41 -0
  99. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.js +77 -0
  100. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.scss +6 -0
  101. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardActions.js +62 -0
  102. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardConstants.js +94 -0
  103. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardHelper.js +78 -0
  104. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardPropTypes.js +13 -0
  105. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardReducer.js +50 -0
  106. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardSelectors.js +44 -0
  107. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboard.test.js +13 -0
  108. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +37 -0
  109. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardHelper.test.js +36 -0
  110. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardReducer.test.js +58 -0
  111. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test..js +59 -0
  112. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboard.test.js.snap +51 -0
  113. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardActions.test.js.snap +61 -0
  114. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardReducer.test.js.snap +280 -0
  115. data/webpack/ForemanTasks/Components/TasksDashboard/index.js +25 -0
  116. data/webpack/ForemanTasks/ForemanTasksReducers.js +10 -0
  117. data/webpack/ForemanTasks/ForemanTasksSelectors.js +1 -0
  118. data/webpack/__mocks__/foremanReact/API.js +7 -0
  119. data/webpack/__mocks__/foremanReact/common/I18n.js +5 -0
  120. data/webpack/__mocks__/foremanReact/common/helpers.js +3 -0
  121. data/webpack/index.js +13 -1
  122. data/webpack/stories/decorators/index.js +1 -0
  123. data/webpack/stories/decorators/withCardsDecorator.js +14 -0
  124. data/webpack/stories/index.js +1 -3
  125. data/webpack/stories/index.scss +6 -0
  126. metadata +101 -8
  127. data/webpack/ForemanTasks/components/Hello/Hello.stories.js +0 -5
  128. data/webpack/ForemanTasks/components/Hello/__tests__/Hello.test.js +0 -11
  129. data/webpack/ForemanTasks/components/Hello/__tests__/__snapshots__/Hello.test.js.snap +0 -7
  130. data/webpack/ForemanTasks/components/Hello/index.js +0 -5
@@ -0,0 +1,37 @@
1
+ import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import API from 'foremanReact/API';
3
+ import { timeToHoursNumber } from '../TasksDashboardHelper';
4
+ import {
5
+ initializeDashboard,
6
+ updateTime,
7
+ updateQuery,
8
+ fetchTasksSummary,
9
+ } from '../TasksDashboardActions';
10
+
11
+ jest.mock('foremanReact/API');
12
+ jest.mock('../TasksDashboardHelper');
13
+
14
+ const correctTime = 'H24';
15
+ const wrongTime = 'H25';
16
+
17
+ timeToHoursNumber.mockImplementation(arg => arg);
18
+ API.get.mockImplementation(async path => {
19
+ if (path === `/foreman_tasks/tasks/summary/${correctTime}`) {
20
+ return { data: 'some-data' };
21
+ }
22
+
23
+ throw new Error('wrong time');
24
+ });
25
+
26
+ const fixtures = {
27
+ 'should initialize-dashboard': () =>
28
+ initializeDashboard({ time: 'some-time', query: 'some-query' }),
29
+ 'should update-time': () => updateTime('some-time'),
30
+ 'should update-query': () => updateQuery('some-query'),
31
+ 'should fetch-tasks-summary and success': () =>
32
+ fetchTasksSummary(correctTime),
33
+ 'should fetch-tasks-summary and fail': () => fetchTasksSummary(wrongTime),
34
+ };
35
+
36
+ describe('TasksDashboard - Actions', () =>
37
+ testActionSnapshotWithFixtures(fixtures));
@@ -0,0 +1,36 @@
1
+ import {
2
+ getQueryKeyText,
3
+ getQueryValueText,
4
+ timeToHoursNumber,
5
+ } from '../TasksDashboardHelper';
6
+ import {
7
+ TASKS_DASHBOARD_AVAILABLE_TIMES,
8
+ TASKS_DASHBOARD_QUERY_KEYS_TEXT,
9
+ TASKS_DASHBOARD_QUERY_VALUES_TEXT,
10
+ } from '../TasksDashboardConstants';
11
+
12
+ const { H12, H24, WEEK } = TASKS_DASHBOARD_AVAILABLE_TIMES;
13
+
14
+ describe('TasksDashboard - helpers', () => {
15
+ it('should getQueryKeyText', () => {
16
+ Object.entries(TASKS_DASHBOARD_QUERY_KEYS_TEXT).forEach(([key, value]) => {
17
+ expect(getQueryKeyText(key)).toBe(value);
18
+ });
19
+ });
20
+
21
+ it('should getQueryValueText', () => {
22
+ Object.entries(TASKS_DASHBOARD_QUERY_VALUES_TEXT).forEach(
23
+ ([key, value]) => {
24
+ expect(getQueryValueText(key)).toBe(value);
25
+ }
26
+ );
27
+ });
28
+
29
+ it('should timeToHoursNumber', () => {
30
+ expect(timeToHoursNumber(H12)).toBe(12);
31
+ expect(timeToHoursNumber(H24)).toBe(24);
32
+ expect(timeToHoursNumber(WEEK)).toBe(7 * 24);
33
+
34
+ expect(timeToHoursNumber('other')).toBe(24);
35
+ });
36
+ });
@@ -0,0 +1,58 @@
1
+ import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import {
4
+ FOREMAN_TASKS_DASHBOARD_INIT,
5
+ FOREMAN_TASKS_DASHBOARD_UPDATE_TIME,
6
+ FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY,
7
+ FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST,
8
+ FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_SUCCESS,
9
+ FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE,
10
+ } from '../TasksDashboardConstants';
11
+ import reducer from '../TasksDashboardReducer';
12
+
13
+ const fixtures = {
14
+ 'should return the initial state': {},
15
+ 'should handle FOREMAN_TASKS_DASHBOARD_INIT': {
16
+ action: {
17
+ type: FOREMAN_TASKS_DASHBOARD_INIT,
18
+ },
19
+ },
20
+ 'should handle FOREMAN_TASKS_DASHBOARD_INIT with data': {
21
+ action: {
22
+ type: FOREMAN_TASKS_DASHBOARD_INIT,
23
+ payload: { time: 'some-time', query: 'some-query' },
24
+ },
25
+ },
26
+ 'should handle FOREMAN_TASKS_DASHBOARD_UPDATE_TIME': {
27
+ action: {
28
+ type: FOREMAN_TASKS_DASHBOARD_UPDATE_TIME,
29
+ payload: 'some-time',
30
+ },
31
+ },
32
+ 'should handle FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY': {
33
+ action: {
34
+ type: FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY,
35
+ payload: 'some-query',
36
+ },
37
+ },
38
+ 'should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST': {
39
+ action: {
40
+ type: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST,
41
+ },
42
+ },
43
+ 'should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_SUCCESS': {
44
+ action: {
45
+ type: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_SUCCESS,
46
+ payload: 'some-payload',
47
+ },
48
+ },
49
+ 'should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE': {
50
+ action: {
51
+ type: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE,
52
+ payload: new Error('some error'),
53
+ },
54
+ },
55
+ };
56
+
57
+ describe('BreadcrumbBar reducer', () =>
58
+ testReducerSnapshotWithFixtures(reducer, fixtures));
@@ -0,0 +1,59 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import {
3
+ selectTasksDashboard,
4
+ selectTime,
5
+ selectQuery,
6
+ selectTasksSummary,
7
+ } from '../TasksDashboardSelectors';
8
+
9
+ const state = {
10
+ tasksDashboard: {
11
+ time: 'some-time',
12
+ query: 'some-query',
13
+ tasksSummary: {
14
+ running: {
15
+ recent: 3,
16
+ total: 8,
17
+ },
18
+ paused: {
19
+ recent: 2,
20
+ total: 9,
21
+ },
22
+ stopped: {
23
+ by_result: {
24
+ error: {
25
+ total: 9,
26
+ recent: 1,
27
+ },
28
+ warning: {
29
+ total: 8,
30
+ recent: 2,
31
+ },
32
+ success: {
33
+ total: 7,
34
+ recent: 3,
35
+ },
36
+ },
37
+ },
38
+ scheduled: {
39
+ total: 6,
40
+ },
41
+ },
42
+ },
43
+ };
44
+
45
+ const fixtures = {
46
+ 'should select tasks-dashboard': () => selectTasksDashboard(state),
47
+ 'should select tasks-dashboard when state is empty': () =>
48
+ selectTasksDashboard({}),
49
+ 'should select time': () => selectTime(state),
50
+ 'should select time when state is empty': () => selectTime({}),
51
+ 'should select query': () => selectQuery(state),
52
+ 'should select query when state is empty': () => selectQuery({}),
53
+ 'should select tasks-summary': () => selectTasksSummary(state),
54
+ 'should select tasks-summary when state is empty': () =>
55
+ selectTasksSummary({}),
56
+ };
57
+
58
+ describe('TasksDashboard - Selectors', () =>
59
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,51 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`TasksDashboard rendering render without Props 1`] = `
4
+ <Grid
5
+ bsClass="container"
6
+ className="tasks-dashboard-grid"
7
+ componentClass="div"
8
+ fluid={true}
9
+ >
10
+ <TasksTimeRow
11
+ time="H24"
12
+ updateTime={[Function]}
13
+ />
14
+ <TasksCardsGrid
15
+ data={
16
+ Object {
17
+ "paused": Object {
18
+ "last": 0,
19
+ "older": 0,
20
+ },
21
+ "running": Object {
22
+ "last": 0,
23
+ "older": 0,
24
+ },
25
+ "scheduled": 0,
26
+ "stopped": Object {
27
+ "error": Object {
28
+ "last": 0,
29
+ "total": 0,
30
+ },
31
+ "success": Object {
32
+ "last": 0,
33
+ "total": 0,
34
+ },
35
+ "warning": Object {
36
+ "last": 0,
37
+ "total": 0,
38
+ },
39
+ },
40
+ }
41
+ }
42
+ query={Object {}}
43
+ time="H24"
44
+ updateQuery={[Function]}
45
+ />
46
+ <TasksLabelsRow
47
+ query={Object {}}
48
+ updateQuery={[Function]}
49
+ />
50
+ </Grid>
51
+ `;
@@ -0,0 +1,61 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`TasksDashboard - Actions should fetch-tasks-summary and fail 1`] = `
4
+ Array [
5
+ Array [
6
+ Object {
7
+ "type": "FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST",
8
+ },
9
+ ],
10
+ Array [
11
+ Object {
12
+ "payload": [Error: wrong time],
13
+ "type": "FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE",
14
+ },
15
+ ],
16
+ ]
17
+ `;
18
+
19
+ exports[`TasksDashboard - Actions should fetch-tasks-summary and success 1`] = `
20
+ Array [
21
+ Array [
22
+ Object {
23
+ "type": "FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST",
24
+ },
25
+ ],
26
+ Array [
27
+ Object {
28
+ "payload": "some-data",
29
+ "type": "FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_SUCCESS",
30
+ },
31
+ ],
32
+ ]
33
+ `;
34
+
35
+ exports[`TasksDashboard - Actions should initialize-dashboard 1`] = `
36
+ Object {
37
+ "payload": Object {
38
+ "query": "some-query",
39
+ "time": "some-time",
40
+ },
41
+ "type": "FOREMAN_TASKS_DASHBOARD_INIT",
42
+ }
43
+ `;
44
+
45
+ exports[`TasksDashboard - Actions should update-query 1`] = `
46
+ Array [
47
+ Array [
48
+ Object {
49
+ "payload": "some-query",
50
+ "type": "FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY",
51
+ },
52
+ ],
53
+ ]
54
+ `;
55
+
56
+ exports[`TasksDashboard - Actions should update-time 1`] = `
57
+ Object {
58
+ "payload": "some-time",
59
+ "type": "FOREMAN_TASKS_DASHBOARD_UPDATE_TIME",
60
+ }
61
+ `;
@@ -0,0 +1,280 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BreadcrumbBar reducer should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_FAILURE 1`] = `
4
+ Object {
5
+ "error": [Error: some error],
6
+ "isLoading": false,
7
+ "isLoadingTasksSummary": false,
8
+ "query": Object {},
9
+ "tasksSummary": Object {
10
+ "paused": Object {
11
+ "recent": 0,
12
+ "total": 0,
13
+ },
14
+ "running": Object {
15
+ "recent": 0,
16
+ "total": 0,
17
+ },
18
+ "scheduled": Object {
19
+ "total": 0,
20
+ },
21
+ "stopped": Object {
22
+ "by_result": Object {
23
+ "error": Object {
24
+ "recent": 0,
25
+ "total": 0,
26
+ },
27
+ "success": Object {
28
+ "recent": 0,
29
+ "total": 0,
30
+ },
31
+ "warning": Object {
32
+ "recent": 0,
33
+ "total": 0,
34
+ },
35
+ },
36
+ },
37
+ },
38
+ "time": "H24",
39
+ }
40
+ `;
41
+
42
+ exports[`BreadcrumbBar reducer should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_REQUEST 1`] = `
43
+ Object {
44
+ "error": null,
45
+ "isLoading": true,
46
+ "isLoadingTasksSummary": false,
47
+ "query": Object {},
48
+ "tasksSummary": Object {
49
+ "paused": Object {
50
+ "recent": 0,
51
+ "total": 0,
52
+ },
53
+ "running": Object {
54
+ "recent": 0,
55
+ "total": 0,
56
+ },
57
+ "scheduled": Object {
58
+ "total": 0,
59
+ },
60
+ "stopped": Object {
61
+ "by_result": Object {
62
+ "error": Object {
63
+ "recent": 0,
64
+ "total": 0,
65
+ },
66
+ "success": Object {
67
+ "recent": 0,
68
+ "total": 0,
69
+ },
70
+ "warning": Object {
71
+ "recent": 0,
72
+ "total": 0,
73
+ },
74
+ },
75
+ },
76
+ },
77
+ "time": "H24",
78
+ }
79
+ `;
80
+
81
+ exports[`BreadcrumbBar reducer should handle FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY_SUCCESS 1`] = `
82
+ Object {
83
+ "error": null,
84
+ "isLoading": false,
85
+ "isLoadingTasksSummary": false,
86
+ "query": Object {},
87
+ "tasksSummary": "some-payload",
88
+ "time": "H24",
89
+ }
90
+ `;
91
+
92
+ exports[`BreadcrumbBar reducer should handle FOREMAN_TASKS_DASHBOARD_INIT 1`] = `
93
+ Object {
94
+ "error": null,
95
+ "isLoadingTasksSummary": false,
96
+ "query": Object {},
97
+ "tasksSummary": Object {
98
+ "paused": Object {
99
+ "recent": 0,
100
+ "total": 0,
101
+ },
102
+ "running": Object {
103
+ "recent": 0,
104
+ "total": 0,
105
+ },
106
+ "scheduled": Object {
107
+ "total": 0,
108
+ },
109
+ "stopped": Object {
110
+ "by_result": Object {
111
+ "error": Object {
112
+ "recent": 0,
113
+ "total": 0,
114
+ },
115
+ "success": Object {
116
+ "recent": 0,
117
+ "total": 0,
118
+ },
119
+ "warning": Object {
120
+ "recent": 0,
121
+ "total": 0,
122
+ },
123
+ },
124
+ },
125
+ },
126
+ "time": "H24",
127
+ }
128
+ `;
129
+
130
+ exports[`BreadcrumbBar reducer should handle FOREMAN_TASKS_DASHBOARD_INIT with data 1`] = `
131
+ Object {
132
+ "error": null,
133
+ "isLoadingTasksSummary": false,
134
+ "query": "some-query",
135
+ "tasksSummary": Object {
136
+ "paused": Object {
137
+ "recent": 0,
138
+ "total": 0,
139
+ },
140
+ "running": Object {
141
+ "recent": 0,
142
+ "total": 0,
143
+ },
144
+ "scheduled": Object {
145
+ "total": 0,
146
+ },
147
+ "stopped": Object {
148
+ "by_result": Object {
149
+ "error": Object {
150
+ "recent": 0,
151
+ "total": 0,
152
+ },
153
+ "success": Object {
154
+ "recent": 0,
155
+ "total": 0,
156
+ },
157
+ "warning": Object {
158
+ "recent": 0,
159
+ "total": 0,
160
+ },
161
+ },
162
+ },
163
+ },
164
+ "time": "some-time",
165
+ }
166
+ `;
167
+
168
+ exports[`BreadcrumbBar reducer should handle FOREMAN_TASKS_DASHBOARD_UPDATE_QUERY 1`] = `
169
+ Object {
170
+ "error": null,
171
+ "isLoadingTasksSummary": false,
172
+ "query": "some-query",
173
+ "tasksSummary": Object {
174
+ "paused": Object {
175
+ "recent": 0,
176
+ "total": 0,
177
+ },
178
+ "running": Object {
179
+ "recent": 0,
180
+ "total": 0,
181
+ },
182
+ "scheduled": Object {
183
+ "total": 0,
184
+ },
185
+ "stopped": Object {
186
+ "by_result": Object {
187
+ "error": Object {
188
+ "recent": 0,
189
+ "total": 0,
190
+ },
191
+ "success": Object {
192
+ "recent": 0,
193
+ "total": 0,
194
+ },
195
+ "warning": Object {
196
+ "recent": 0,
197
+ "total": 0,
198
+ },
199
+ },
200
+ },
201
+ },
202
+ "time": "H24",
203
+ }
204
+ `;
205
+
206
+ exports[`BreadcrumbBar reducer should handle FOREMAN_TASKS_DASHBOARD_UPDATE_TIME 1`] = `
207
+ Object {
208
+ "error": null,
209
+ "isLoadingTasksSummary": false,
210
+ "query": Object {},
211
+ "tasksSummary": Object {
212
+ "paused": Object {
213
+ "recent": 0,
214
+ "total": 0,
215
+ },
216
+ "running": Object {
217
+ "recent": 0,
218
+ "total": 0,
219
+ },
220
+ "scheduled": Object {
221
+ "total": 0,
222
+ },
223
+ "stopped": Object {
224
+ "by_result": Object {
225
+ "error": Object {
226
+ "recent": 0,
227
+ "total": 0,
228
+ },
229
+ "success": Object {
230
+ "recent": 0,
231
+ "total": 0,
232
+ },
233
+ "warning": Object {
234
+ "recent": 0,
235
+ "total": 0,
236
+ },
237
+ },
238
+ },
239
+ },
240
+ "time": "some-time",
241
+ }
242
+ `;
243
+
244
+ exports[`BreadcrumbBar reducer should return the initial state 1`] = `
245
+ Object {
246
+ "error": null,
247
+ "isLoadingTasksSummary": false,
248
+ "query": Object {},
249
+ "tasksSummary": Object {
250
+ "paused": Object {
251
+ "recent": 0,
252
+ "total": 0,
253
+ },
254
+ "running": Object {
255
+ "recent": 0,
256
+ "total": 0,
257
+ },
258
+ "scheduled": Object {
259
+ "total": 0,
260
+ },
261
+ "stopped": Object {
262
+ "by_result": Object {
263
+ "error": Object {
264
+ "recent": 0,
265
+ "total": 0,
266
+ },
267
+ "success": Object {
268
+ "recent": 0,
269
+ "total": 0,
270
+ },
271
+ "warning": Object {
272
+ "recent": 0,
273
+ "total": 0,
274
+ },
275
+ },
276
+ },
277
+ },
278
+ "time": "H24",
279
+ }
280
+ `;