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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb59b3cde7c9b2cf5ffb6164584597ee6cf50ff827567ab3ac650446f9bc6b24
4
- data.tar.gz: 0c98300b211d4949b800fd2c2ee5b64f33a3dbb12bfe8bbb0284a6922eb2c422
3
+ metadata.gz: 523767f29aa2c7e5485b4f18978a03120eb2369e510f5340ecb940d03372229e
4
+ data.tar.gz: 8db1c0c802560d5d8f910f0b8ae30be95640a4ad99c19145529aab2c6ab67ba8
5
5
  SHA512:
6
- metadata.gz: ddb084939964bfdada51a988c183e9c3cd2187c87b39c20e22eae9c4b254c8e5a45bf0d96462db545119fd9e5c1b1c910c96a306e01c74bfcdd3214275ea5959
7
- data.tar.gz: 46470595733a1b94473b63f73d7e3d554176e15e8c005e9173aea05b28a10334fba5cad1f22e3f6038f3fd8ff3b87c563bea85b3e74b29ec02514e9af7c10fb7
6
+ metadata.gz: 284dc372bba144d11030df2ca96bfc01a716726e74e2d9797f88508984fe053d49d917f34b717b6e1806f2719df28e050750d274fe114ca0d6189b32ac5819bc
7
+ data.tar.gz: 4f7cdfc025e74b30177d8a437b5e01a7eb9be1159ef68eb8ab4243301850547fc9d72bbabbb629223dbcab0e77a3416ccd5a4586bf39f6f2240a09cb26b63a11
data/.eslintrc CHANGED
@@ -1,24 +1,4 @@
1
1
  {
2
- "plugins": ["patternfly-react"],
3
- "extends": [
4
- "plugin:patternfly-react/recommended",
5
- "./node_modules/@theforeman/vendor-dev/eslint.extends.js"
6
- ],
7
- "rules": {
8
- "prettier/prettier": ["error", {
9
- "singleQuote": true,
10
- "trailingComma": "es5"
11
- }],
12
- "import/no-unresolved": ["error", {
13
- "ignore": ['foremanReact/.*']
14
- }],
15
- "import/extensions": ["error", {
16
- "ignore": ['foremanReact/.*']
17
- }]
18
- },
19
- "settings": {
20
- "import/resolver": {
21
- "babel-module": {}
22
- }
23
- }
2
+ "plugins": ["@theforeman/foreman"],
3
+ "extends": ["plugin:@theforeman/foreman/core", "plugin:@theforeman/foreman/plugins"]
24
4
  }
@@ -240,7 +240,7 @@ module ForemanTasks
240
240
  sort_by = ordering_params[:sort_by] || 'started_at'
241
241
  sort_by = 'foreman_tasks_tasks.' + sort_by if sort_by == 'started_at'
242
242
  sort_order = ordering_params[:sort_order] || 'DESC'
243
- scope = scope.select("*, coalesce(ended_at, current_timestamp) - coalesce(coalesce(started_at, ended_at), current_timestamp) as duration")
243
+ scope = scope.select("foreman_tasks_tasks.*, coalesce(ended_at, current_timestamp) - coalesce(coalesce(started_at, ended_at), current_timestamp) as duration")
244
244
  scope.order("#{sort_by} #{sort_order}")
245
245
  end
246
246
 
File without changes
@@ -34,7 +34,7 @@ module ForemanTasks
34
34
 
35
35
  initializer 'foreman_tasks.register_plugin', :before => :finisher_hook do |_app|
36
36
  Foreman::Plugin.register :"foreman-tasks" do
37
- requires_foreman '>= 1.25.0'
37
+ requires_foreman '>= 2.0.0'
38
38
  divider :top_menu, :parent => :monitor_menu, :last => true, :caption => N_('Foreman Tasks')
39
39
  menu :top_menu, :tasks,
40
40
  :url_hash => { :controller => 'foreman_tasks/tasks', :action => :index },
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
data/package.json CHANGED
@@ -4,14 +4,14 @@
4
4
  "description": "Foreman Tasks =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "lint": "./node_modules/.bin/eslint -c .eslintrc webpack/",
8
- "test": "node node_modules/.bin/jest --no-cache",
9
- "test:watch": "node node_modules/.bin/jest --watchAll",
10
- "test:current": "node node_modules/.bin/jest --watch",
11
- "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
12
- "storybook": "start-storybook -p 6006",
13
- "storybook:build": "node --max_old_space_size=2048 ./node_modules/.bin/build-storybook --config-dir .storybook --output-dir .storybook-dist",
14
- "storybook:deploy": "surge --project .storybook-dist",
7
+ "lint": "tfm-lint --plugin -d /webpack",
8
+ "test": "tfm-test --plugin",
9
+ "test:watch": "tfm-test --plugin --watchAll",
10
+ "test:current": "tfm-test --plugin --watch",
11
+ "publish-coverage": "tfm-publish-coverage",
12
+ "stories": "tfm-stories --plugin",
13
+ "stories:build": "tfm-build-stories --plugin",
14
+ "stories:deploy": "surge --project .storybook-dist",
15
15
  "create-react-component": "yo react-domain"
16
16
  },
17
17
  "repository": {
@@ -21,81 +21,29 @@
21
21
  "bugs": {
22
22
  "url": "http://projects.theforeman.org/projects/foreman-tasks/issues"
23
23
  },
24
+ "peerDependencies": {
25
+ "@theforeman/vendor": ">= 4.0.2"
26
+ },
24
27
  "dependencies": {
25
- "@theforeman/vendor": "^3.3.2",
26
28
  "c3": "^0.4.11",
27
29
  "humanize-duration": "^3.20.1",
28
30
  "react-intl": "^2.8.0"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@babel/core": "^7.7.0",
32
- "@storybook/addon-actions": "^5.0.1",
33
- "@storybook/addon-knobs": "^5.0.1",
34
- "@storybook/react": "^5.0.1",
35
- "@theforeman/env": "^3.3.2",
36
- "@theforeman/builder": "^3.3.2",
37
- "@theforeman/vendor-dev": "^3.3.2",
34
+ "@theforeman/builder": "^4.0.2",
35
+ "@theforeman/eslint-plugin-foreman": "4.0.5",
36
+ "@theforeman/stories": "^4.0.2",
37
+ "@theforeman/test": "^4.0.2",
38
+ "@theforeman/vendor-dev": "^4.0.2",
38
39
  "babel-eslint": "^10.0.3",
39
- "babel-jest": "^24.9.0",
40
- "babel-loader": "^8.0.0",
41
- "coveralls": "^3.0.0",
42
- "enzyme": "^3.4.0",
43
- "enzyme-adapter-react-16": "^1.4.0",
44
- "enzyme-to-json": "^3.2.1",
45
- "eslint": "^4.10.0",
46
- "eslint-import-resolver-babel-module": "^5.1.0",
47
- "eslint-plugin-patternfly-react": "0.2.0",
40
+ "eslint": "^6.7.2",
48
41
  "identity-obj-proxy": "^3.0.0",
49
42
  "jed": "^1.1.1",
50
- "jest-cli": "^24.9.0",
51
- "jest-prop-type-error": "^1.1.0",
52
- "node-sass": "^4.5.0",
53
- "patternfly": "^3.58.0",
54
43
  "prettier": "^1.13.5",
55
- "raf": "^3.4.0",
56
- "react-redux-test-utils": "^0.1.1",
57
44
  "react-remarkable": "^1.1.3",
58
- "sass-loader": "^6.0.7",
59
45
  "stylelint": "^9.3.0",
60
46
  "stylelint-config-standard": "^18.0.0",
61
47
  "surge": "^0.20.3"
62
- },
63
- "jest": {
64
- "verbose": true,
65
- "testMatch": [
66
- "**/*.test.js"
67
- ],
68
- "testURL": "http://localhost/",
69
- "collectCoverage": true,
70
- "collectCoverageFrom": [
71
- "webpack/**/*.js",
72
- "!webpack/index.js",
73
- "!webpack/test_setup.js",
74
- "!webpack/**/bundle*",
75
- "!webpack/stories/**",
76
- "!webpack/**/*stories.js"
77
- ],
78
- "coverageReporters": [
79
- "lcov"
80
- ],
81
- "moduleNameMapper": {
82
- "^.+\\.(png|gif|css|scss)$": "identity-obj-proxy"
83
- },
84
- "globals": {
85
- "__testing__": true
86
- },
87
- "transform": {
88
- "^.+\\.js$": "babel-jest"
89
- },
90
- "moduleDirectories": [
91
- "node_modules/@theforeman/vendor-core/node_modules",
92
- "node_modules",
93
- "webpack"
94
- ],
95
- "setupFiles": [
96
- "raf/polyfill",
97
- "jest-prop-type-error",
98
- "./webpack/test_setup.js"
99
- ]
100
48
  }
101
49
  }
@@ -27,6 +27,15 @@ module ForemanTasks
27
27
  _(data['results'].count).must_equal 5
28
28
  end
29
29
 
30
+ it 'renders task ids when searching by resource id' do
31
+ task = FactoryBot.create(:dynflow_task, :product_create_task)
32
+ ForemanTasks::Lock.create!(name: "create", resource_type: "Katello::Product", resource_id: 1, task_id: task.id)
33
+ get :index, params: { :search => "label = Actions::Katello::Product::Create and resource_id = 1" }
34
+ assert_response :success
35
+ data = JSON.parse(response.body)
36
+ _(data['results'].first["id"]).must_equal task.id
37
+ end
38
+
30
39
  it 'supports ordering by duration' do
31
40
  get :index, params: { :sort_by => 'duration' }
32
41
  assert_response :success
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import Errors from '../Errors';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import Locks from '../Locks';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import Raw from '../Raw';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import RunningSteps from '../RunningSteps';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import Task from '../Task';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import TaskInfo from '../TaskInfo';
4
4
 
@@ -1,5 +1,9 @@
1
1
  import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
2
  import TaskDetails from './TaskDetails';
4
3
 
5
- storiesOf('TaskDetails', module).add('TaskDetails', () => <TaskDetails />);
4
+ export default {
5
+ title: 'TaskDetails',
6
+ component: TaskDetails,
7
+ };
8
+
9
+ export const Basic = () => <TaskDetails />;
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import TaskDetails from '../TaskDetails';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
1
+ import { testActionSnapshotWithFixtures } from '@theforeman/test';
2
2
  import API from 'foremanReact/API';
3
3
  import {
4
4
  taskReloadStop,
@@ -1,4 +1,4 @@
1
- import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
1
+ import { testReducerSnapshotWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import {
4
4
  FOREMAN_TASK_DETAILS_FETCH_TASK_SUCCESS,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import API from 'foremanReact/API';
4
- import { IntegrationTestHelper } from 'react-redux-test-utils';
4
+ import { IntegrationTestHelper } from '@theforeman/test';
5
5
 
6
6
  import TaskDetails, { reducers } from '../index';
7
7
  import { selectForemanTasks } from '../../../ForemanTasksSelectors';
@@ -1,7 +1,5 @@
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 { action, number, select } from '@theforeman/stories';
5
3
  import { withCardsDecorator } from '../../../../../../../stories/decorators';
6
4
 
7
5
  import {
@@ -11,41 +9,47 @@ import {
11
9
  } from '../../../../TasksDashboardConstants';
12
10
  import PausedTasksCard from './PausedTasksCard';
13
11
 
14
- storiesOf('TasksDashboard/TasksCardsGrid', module)
15
- .addDecorator(withKnobs)
16
- .addDecorator(withCardsDecorator)
17
- .add('PausedTasksCard', () => {
18
- const selectTime = select(
19
- 'time',
20
- TASKS_DASHBOARD_AVAILABLE_TIMES,
21
- PausedTasksCard.defaultProps.time
22
- );
12
+ export default {
13
+ title: 'TasksDashboard/TasksCardsGrid/Cards/PausedTasksCard',
14
+ component: PausedTasksCard,
15
+ decorators: [withCardsDecorator],
16
+ parameters: {
17
+ centered: { disable: true },
18
+ },
19
+ };
23
20
 
24
- const selectMode = select(
25
- 'mode',
26
- { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: 'none', TOTAL: null },
27
- 'none'
28
- );
29
- return (
30
- <PausedTasksCard
31
- data={{
32
- last: number('data.last', 3),
33
- older: number('data.older', 5),
34
- }}
35
- time={selectTime}
36
- query={{
37
- state: select(
38
- 'query.state',
39
- {
40
- ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
41
- NONE: null,
42
- },
43
- TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.PAUSED
44
- ),
45
- mode: selectMode,
46
- time: selectTime,
47
- }}
48
- updateQuery={action('updateQuery')}
49
- />
50
- );
51
- });
21
+ export const Basic = () => {
22
+ const selectTime = select(
23
+ 'time',
24
+ TASKS_DASHBOARD_AVAILABLE_TIMES,
25
+ PausedTasksCard.defaultProps.time
26
+ );
27
+
28
+ const selectMode = select(
29
+ 'mode',
30
+ { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: 'none', TOTAL: null },
31
+ 'none'
32
+ );
33
+ return (
34
+ <PausedTasksCard
35
+ data={{
36
+ last: number('data.last', 3),
37
+ older: number('data.older', 5),
38
+ }}
39
+ time={selectTime}
40
+ query={{
41
+ state: select(
42
+ 'query.state',
43
+ {
44
+ ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
45
+ NONE: null,
46
+ },
47
+ TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.PAUSED
48
+ ),
49
+ mode: selectMode,
50
+ time: selectTime,
51
+ }}
52
+ updateQuery={action('updateQuery')}
53
+ />
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 PausedTasksCard from './PausedTasksCard';
4
4
 
@@ -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 {
@@ -11,41 +10,47 @@ import {
11
10
  } from '../../../../TasksDashboardConstants';
12
11
  import RunningTasksCard from './RunningTasksCard';
13
12
 
14
- storiesOf('TasksDashboard/TasksCardsGrid', module)
15
- .addDecorator(withKnobs)
16
- .addDecorator(withCardsDecorator)
17
- .add('RunningTasksCard', () => {
18
- const selectTime = select(
19
- 'time',
20
- TASKS_DASHBOARD_AVAILABLE_TIMES,
21
- RunningTasksCard.defaultProps.time
22
- );
13
+ export default {
14
+ title: 'TasksDashboard/TasksCardsGrid/Cards/RunningTasksCard',
15
+ component: RunningTasksCard,
16
+ decorators: [withCardsDecorator],
17
+ parameters: {
18
+ centered: { disable: true },
19
+ },
20
+ };
21
+
22
+ export const Basic = () => {
23
+ const selectTime = select(
24
+ 'time',
25
+ TASKS_DASHBOARD_AVAILABLE_TIMES,
26
+ RunningTasksCard.defaultProps.time
27
+ );
23
28
 
24
- const selectMode = select(
25
- 'mode',
26
- { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: 'none', TOTAL: null },
27
- 'none'
28
- );
29
- return (
30
- <RunningTasksCard
31
- data={{
32
- last: number('data.last', 3),
33
- older: number('data.older', 5),
34
- }}
35
- time={selectTime}
36
- query={{
37
- state: select(
38
- 'query.state',
39
- {
40
- ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
41
- NONE: null,
42
- },
43
- TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.RUNNING
44
- ),
45
- mode: selectMode,
46
- time: selectTime,
47
- }}
48
- updateQuery={action('updateQuery')}
49
- />
50
- );
51
- });
29
+ const selectMode = select(
30
+ 'mode',
31
+ { ...TASKS_DASHBOARD_AVAILABLE_QUERY_MODES, NONE: 'none', TOTAL: null },
32
+ 'none'
33
+ );
34
+ return (
35
+ <RunningTasksCard
36
+ data={{
37
+ last: number('data.last', 3),
38
+ older: number('data.older', 5),
39
+ }}
40
+ time={selectTime}
41
+ query={{
42
+ state: select(
43
+ 'query.state',
44
+ {
45
+ ...TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
46
+ NONE: null,
47
+ },
48
+ TASKS_DASHBOARD_AVAILABLE_QUERY_STATES.RUNNING
49
+ ),
50
+ mode: selectMode,
51
+ time: selectTime,
52
+ }}
53
+ updateQuery={action('updateQuery')}
54
+ />
55
+ );
56
+ };