foreman-tasks 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc +2 -22
  3. data/app/controllers/foreman_tasks/api/tasks_controller.rb +1 -1
  4. data/{.babelrc.js → babel.config.js} +0 -0
  5. data/lib/foreman_tasks/engine.rb +1 -1
  6. data/lib/foreman_tasks/version.rb +1 -1
  7. data/package.json +17 -69
  8. data/test/controllers/api/tasks_controller_test.rb +9 -0
  9. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Errors.test.js +1 -1
  10. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Locks.test.js +1 -1
  11. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Raw.test.js +1 -1
  12. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
  13. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +1 -1
  14. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +1 -1
  15. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.stories.js +6 -2
  16. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +1 -1
  17. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +1 -1
  18. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +1 -1
  19. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +1 -1
  20. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.stories.js +44 -40
  21. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.test.js +1 -1
  22. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.stories.js +45 -40
  23. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.test.js +1 -1
  24. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.stories.js +27 -22
  25. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.test.js +1 -1
  26. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.stories.js +61 -56
  27. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +1 -1
  28. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.stories.js +40 -35
  29. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.test.js +1 -1
  30. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.stories.js +21 -20
  31. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js +1 -1
  32. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js +40 -39
  33. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.test.js +1 -1
  34. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.stories.js +16 -17
  35. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.test.js +1 -2
  36. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.mdx +57 -0
  37. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.test.js +1 -1
  38. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.stories.js +36 -18
  39. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.test.js +1 -1
  40. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboard.test.js +1 -1
  41. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +1 -1
  42. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardReducer.test.js +1 -1
  43. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js +1 -1
  44. data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +53 -0
  45. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +56 -0
  46. data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +52 -0
  47. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -1
  48. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +26 -0
  49. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +24 -0
  50. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +26 -0
  51. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js +1 -1
  52. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js +1 -1
  53. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +65 -0
  54. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +30 -0
  55. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +63 -0
  56. data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +22 -12
  57. data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +15 -18
  58. data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +6 -2
  59. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +54 -18
  60. data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +5 -7
  61. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +18 -16
  62. data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +1 -1
  63. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +1 -1
  64. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +7 -3
  65. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +1 -1
  66. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +1 -1
  67. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +1 -1
  68. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +6 -7
  69. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +9 -3
  70. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +9 -3
  71. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +116 -18
  72. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +9 -16
  73. data/webpack/ForemanTasks/Components/TasksTable/index.js +3 -2
  74. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +4 -4
  75. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +1 -1
  76. data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +1 -2
  77. data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +2 -2
  78. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +3 -3
  79. data/webpack/ForemanTasks/ForemanTasks.test.js +1 -1
  80. data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +1 -1
  81. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -3
  82. data/webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js +1 -1
  83. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
  84. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +10 -0
  85. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +4 -0
  86. metadata +16 -16
  87. data/.storybook/addons.js +0 -2
  88. data/.storybook/config.js +0 -7
  89. data/.storybook/webpack.config.js +0 -84
  90. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.js +0 -23
  91. data/webpack/ForemanTasks/Components/TasksTable/Components/ActionConfirmation.js +0 -49
  92. data/webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js +0 -51
  93. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionConfirmation.test.js +0 -18
  94. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelResumeConfirm.test.js +0 -28
  95. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionConfirmation.test.js.snap +0 -89
  96. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelResumeConfirm.test.js.snap +0 -37
  97. data/webpack/stories/index.js +0 -10
  98. data/webpack/stories/index.scss +0 -7
  99. data/webpack/test_setup.js +0 -7
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import RunningTasksCard from './RunningTasksCard';
4
4
 
@@ -1,28 +1,33 @@
1
1
  import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withKnobs, number, select } from '@storybook/addon-knobs';
4
- import { action } from '@storybook/addon-actions';
2
+ import { number, select, action } from '@theforeman/stories';
3
+
5
4
  import { withCardsDecorator } from '../../../../../../../stories/decorators';
6
5
 
7
6
  import { TASKS_DASHBOARD_AVAILABLE_QUERY_STATES } from '../../../../TasksDashboardConstants';
8
7
  import ScheduledTasksCard from './ScheduledTasksCard';
9
8
 
10
- storiesOf('TasksDashboard/TasksCardsGrid', module)
11
- .addDecorator(withKnobs)
12
- .addDecorator(withCardsDecorator)
13
- .add('ScheduledTasksCard', () => {
14
- const selectState = select(
15
- 'query.state',
16
- { ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES, NONE: 'none' },
17
- 'none'
18
- );
19
- return (
20
- <ScheduledTasksCard
21
- data={number('data', 1)}
22
- query={{
23
- state: selectState,
24
- }}
25
- updateQuery={action('updateQuery')}
26
- />
27
- );
28
- });
9
+ export default {
10
+ title: 'TasksDashboard/TasksCardsGrid/Cards/ScheduledTasksCard',
11
+ component: ScheduledTasksCard,
12
+ decorators: [withCardsDecorator],
13
+ parameters: {
14
+ centered: { disable: true },
15
+ },
16
+ };
17
+
18
+ export const Basic = () => {
19
+ const selectState = select(
20
+ 'query.state',
21
+ { ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES, NONE: 'none' },
22
+ 'none'
23
+ );
24
+ return (
25
+ <ScheduledTasksCard
26
+ data={number('data', 1)}
27
+ query={{
28
+ state: selectState,
29
+ }}
30
+ updateQuery={action('updateQuery')}
31
+ />
32
+ );
33
+ };
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import { TASKS_DASHBOARD_AVAILABLE_QUERY_STATES } from '../../../../TasksDashboardConstants';
4
4
  import ScheduledTasksCard from './ScheduledTasksCard';
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withKnobs, number, select } from '@storybook/addon-knobs';
4
- import { action } from '@storybook/addon-actions';
2
+ import { number, select, action } from '@theforeman/stories';
3
+
5
4
  import { withCardsDecorator } from '../../../../../../../stories/decorators';
6
5
 
7
6
  import {
@@ -12,56 +11,62 @@ import {
12
11
  } from '../../../../TasksDashboardConstants';
13
12
  import StoppedTasksCard from './StoppedTasksCard';
14
13
 
15
- storiesOf('TasksDashboard/TasksCardsGrid', module)
16
- .addDecorator(withKnobs)
17
- .addDecorator(withCardsDecorator)
18
- .add('StoppedTasksCard', () => {
19
- const selectTime = select(
20
- 'time',
21
- TASKS_DASHBOARD_AVAILABLE_TIMES,
22
- StoppedTasksCard.defaultProps.time
23
- );
24
- const selectState = select(
25
- 'query.state',
26
- { ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES, NONE: null },
27
- TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.STOPPED
28
- );
29
- const selectResult = select(
30
- 'query.result',
31
- { ...TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS, NONE: null },
32
- null
33
- );
34
- const selectMode = select(
35
- 'query.mode',
36
- { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: null },
37
- null
38
- );
39
- return (
40
- <div>
41
- <StoppedTasksCard
42
- data={{
43
- error: {
44
- total: number('errorTotal', 8),
45
- last: number('errorLast', 1),
46
- },
47
- warning: {
48
- total: number('warningTotal', 20),
49
- last: number('warningLast', 2),
50
- },
51
- success: {
52
- total: number('successTotal', 25),
53
- last: number('successLast', 3),
54
- },
55
- }}
56
- time={selectTime}
57
- query={{
58
- state: selectState,
59
- result: selectResult,
60
- mode: selectMode,
61
- time: selectTime,
62
- }}
63
- updateQuery={action('updateQuery')}
64
- />
65
- </div>
66
- );
67
- });
14
+ export default {
15
+ title: 'TasksDashboard/TasksCardsGrid/Cards/StoppedTasksCard',
16
+ component: StoppedTasksCard,
17
+ decorators: [withCardsDecorator],
18
+ parameters: {
19
+ centered: { disable: true },
20
+ },
21
+ };
22
+
23
+ export const Basic = () => {
24
+ const selectTime = select(
25
+ 'time',
26
+ TASKS_DASHBOARD_AVAILABLE_TIMES,
27
+ StoppedTasksCard.defaultProps.time
28
+ );
29
+ const selectState = select(
30
+ 'query.state',
31
+ { ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES, NONE: null },
32
+ TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.STOPPED
33
+ );
34
+ const selectResult = select(
35
+ 'query.result',
36
+ { ...TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS, NONE: null },
37
+ null
38
+ );
39
+ const selectMode = select(
40
+ 'query.mode',
41
+ { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: null },
42
+ null
43
+ );
44
+ return (
45
+ <div>
46
+ <StoppedTasksCard
47
+ data={{
48
+ error: {
49
+ total: number('errorTotal', 8),
50
+ last: number('errorLast', 1),
51
+ },
52
+ warning: {
53
+ total: number('warningTotal', 20),
54
+ last: number('warningLast', 2),
55
+ },
56
+ success: {
57
+ total: number('successTotal', 25),
58
+ last: number('successLast', 3),
59
+ },
60
+ }}
61
+ time={selectTime}
62
+ query={{
63
+ state: selectState,
64
+ result: selectResult,
65
+ mode: selectMode,
66
+ time: selectTime,
67
+ }}
68
+ updateQuery={action('updateQuery')}
69
+ />
70
+ </div>
71
+ );
72
+ };
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
  import {
3
3
  TASKS_DASHBOARD_AVAILABLE_TIMES,
4
4
  TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withKnobs, number, text, select } from '@storybook/addon-knobs';
4
- import { action } from '@storybook/addon-actions';
2
+ import { number, text, select, action } from '@theforeman/stories';
3
+
5
4
  import { withCardsDecorator } from '../../../../../../../stories/decorators';
6
5
 
7
6
  import {
@@ -10,37 +9,43 @@ import {
10
9
  } from '../../../../TasksDashboardConstants';
11
10
  import TasksDonutCard from './TasksDonutCard';
12
11
 
13
- storiesOf('TasksDashboard/TasksCardsGrid', module)
14
- .addDecorator(withKnobs)
15
- .addDecorator(withCardsDecorator)
16
- .add('TasksDonutCard', () => {
17
- const selectTime = select(
18
- 'time',
19
- TASKS_DASHBOARD_AVAILABLE_TIMES,
20
- TasksDonutCard.defaultProps.time
21
- );
12
+ export default {
13
+ title: 'TasksDashboard/TasksCardsGrid/Cards/TasksDonutCard',
14
+ component: TasksDonutCard,
15
+ decorators: [withCardsDecorator],
16
+ parameters: {
17
+ centered: { disable: true },
18
+ },
19
+ };
20
+
21
+ export const Basic = () => {
22
+ const selectTime = select(
23
+ 'time',
24
+ TASKS_DASHBOARD_AVAILABLE_TIMES,
25
+ TasksDonutCard.defaultProps.time
26
+ );
22
27
 
23
- const selectMode = select(
24
- 'mode',
25
- { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: 'none' },
26
- 'none'
27
- );
28
+ const selectMode = select(
29
+ 'mode',
30
+ { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: 'none' },
31
+ 'none'
32
+ );
28
33
 
29
- return (
30
- <TasksDonutCard
31
- title={text('title', 'Some Title')}
32
- data={{
33
- last: number('data.last', 3),
34
- older: number('data.older', 5),
35
- }}
36
- time={selectTime}
37
- query={{
38
- state: text('query.state', 'some-state'),
39
- mode: selectMode,
40
- time: selectTime,
41
- }}
42
- wantedQueryState={text('wantedQueryState', 'wanted-state')}
43
- updateQuery={action('updateQuery')}
44
- />
45
- );
46
- });
34
+ return (
35
+ <TasksDonutCard
36
+ title={text('title', 'Some Title')}
37
+ data={{
38
+ last: number('data.last', 3),
39
+ older: number('data.older', 5),
40
+ }}
41
+ time={selectTime}
42
+ query={{
43
+ state: text('query.state', 'some-state'),
44
+ mode: selectMode,
45
+ time: selectTime,
46
+ }}
47
+ wantedQueryState={text('wantedQueryState', 'wanted-state')}
48
+ updateQuery={action('updateQuery')}
49
+ />
50
+ );
51
+ };
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import {
4
4
  TASKS_DASHBOARD_AVAILABLE_TIMES,
@@ -1,25 +1,26 @@
1
1
  import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withKnobs, number, text, select } from '@storybook/addon-knobs';
4
- import { action } from '@storybook/addon-actions';
2
+ import { number, text, select, action } from '@theforeman/stories';
5
3
 
6
4
  import { TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS_ARRAY } from './TasksDonutChartConstants';
7
5
  import TasksDonutChart from './TasksDonutChart';
8
6
 
9
- storiesOf('TasksDashboard/TasksCardsGrid', module)
10
- .addDecorator(withKnobs)
11
- .add('TasksDonutChart', () => (
12
- <TasksDonutChart
13
- last={number('last', 3)}
14
- older={number('older', 5)}
15
- time={text('time', '24h')}
16
- focusedOn={select(
17
- 'focusedOn',
18
- TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS_ARRAY,
19
- TasksDonutChart.defaultProps.focusedOn
20
- )}
21
- onTotalClick={action('onTotalClick')}
22
- onLastClick={action('onLastClick')}
23
- onOlderClick={action('onOlderClick')}
24
- />
25
- ));
7
+ export default {
8
+ title: 'TasksDashboard/TasksCardsGrid/Charts/TasksDonutChart',
9
+ component: TasksDonutChart,
10
+ };
11
+
12
+ export const Basic = () => (
13
+ <TasksDonutChart
14
+ last={number('last', 3)}
15
+ older={number('older', 5)}
16
+ time={text('time', '24h')}
17
+ focusedOn={select(
18
+ 'focusedOn',
19
+ TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS_ARRAY,
20
+ TasksDonutChart.defaultProps.focusedOn
21
+ )}
22
+ onTotalClick={action('onTotalClick')}
23
+ onLastClick={action('onLastClick')}
24
+ onOlderClick={action('onOlderClick')}
25
+ />
26
+ );
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import { TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS_ARRAY } from './TasksDonutChartConstants';
4
4
  import TasksDonutChart from './TasksDonutChart';
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withKnobs, object, select } from '@storybook/addon-knobs';
4
- import { action } from '@storybook/addon-actions';
2
+ import { object, select, action } from '@theforeman/stories';
5
3
 
6
4
  import {
7
5
  TASKS_DASHBOARD_AVAILABLE_TIMES,
@@ -12,43 +10,46 @@ import {
12
10
  import { MOCKED_DATA } from './TasksCardsGrid.fixtures';
13
11
  import TasksCardsGrid from './TasksCardsGrid';
14
12
 
13
+ export default {
14
+ title: 'TasksDashboard/TasksCardsGrid/TasksCardsGrid',
15
+ component: TasksCardsGrid,
16
+ };
17
+
15
18
  const createSelect = (name, options) =>
16
19
  select(name, { ...options, NONE: 'none' }, 'none');
17
20
 
18
- storiesOf('TasksDashboard/TasksCardsGrid', module)
19
- .addDecorator(withKnobs)
20
- .add('TasksCardsGrid', () => {
21
- const selectTime = select(
22
- 'time',
23
- TASKS_DASHBOARD_AVAILABLE_TIMES,
24
- TasksCardsGrid.defaultProps.time
25
- );
26
- const selectState = createSelect(
27
- 'query.state',
28
- TASKS_DASHBOARD_AVAILABLE_QUERY_STATES
29
- );
30
- const selectResult = createSelect(
31
- 'query.result',
32
- TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS
33
- );
34
- const selectMode = createSelect(
35
- 'query.mode',
36
- TASKS_DASHBOARD_AVAILABLE_QUERY_MODES
37
- );
21
+ export const Basic = () => {
22
+ const selectTime = select(
23
+ 'time',
24
+ TASKS_DASHBOARD_AVAILABLE_TIMES,
25
+ TasksCardsGrid.defaultProps.time
26
+ );
27
+ const selectState = createSelect(
28
+ 'query.state',
29
+ TASKS_DASHBOARD_AVAILABLE_QUERY_STATES
30
+ );
31
+ const selectResult = createSelect(
32
+ 'query.result',
33
+ TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS
34
+ );
35
+ const selectMode = createSelect(
36
+ 'query.mode',
37
+ TASKS_DASHBOARD_AVAILABLE_QUERY_MODES
38
+ );
38
39
 
39
- return (
40
- <div>
41
- <TasksCardsGrid
42
- time={selectTime}
43
- query={{
44
- state: selectState,
45
- result: selectResult,
46
- mode: selectMode,
47
- time: selectTime,
48
- }}
49
- data={object('data', MOCKED_DATA)}
50
- updateQuery={action('updateQuery')}
51
- />
52
- </div>
53
- );
54
- });
40
+ return (
41
+ <div>
42
+ <TasksCardsGrid
43
+ time={selectTime}
44
+ query={{
45
+ state: selectState,
46
+ result: selectResult,
47
+ mode: selectMode,
48
+ time: selectTime,
49
+ }}
50
+ data={object('data', MOCKED_DATA)}
51
+ updateQuery={action('updateQuery')}
52
+ />
53
+ </div>
54
+ );
55
+ };
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import {
4
4
  TASKS_DASHBOARD_AVAILABLE_TIMES,