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.
- checksums.yaml +4 -4
- data/.eslintrc +2 -22
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +1 -1
- data/{.babelrc.js → babel.config.js} +0 -0
- data/lib/foreman_tasks/engine.rb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/package.json +17 -69
- data/test/controllers/api/tasks_controller_test.rb +9 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Errors.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Locks.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Raw.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.stories.js +6 -2
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.stories.js +44 -40
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.stories.js +45 -40
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.stories.js +27 -22
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.stories.js +61 -56
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.stories.js +40 -35
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.stories.js +21 -20
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js +40 -39
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.stories.js +16 -17
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.test.js +1 -2
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.mdx +57 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.stories.js +36 -18
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardReducer.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +53 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +56 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +52 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +26 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +24 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +26 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +65 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +30 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +63 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +22 -12
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +15 -18
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +6 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +54 -18
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +5 -7
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +18 -16
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +7 -3
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +6 -7
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +9 -3
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +9 -3
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +116 -18
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +9 -16
- data/webpack/ForemanTasks/Components/TasksTable/index.js +3 -2
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +4 -4
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +1 -1
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +1 -2
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +2 -2
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +3 -3
- data/webpack/ForemanTasks/ForemanTasks.test.js +1 -1
- data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +1 -1
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -3
- data/webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js +1 -1
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +10 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +4 -0
- metadata +16 -16
- data/.storybook/addons.js +0 -2
- data/.storybook/config.js +0 -7
- data/.storybook/webpack.config.js +0 -84
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.js +0 -23
- data/webpack/ForemanTasks/Components/TasksTable/Components/ActionConfirmation.js +0 -49
- data/webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js +0 -51
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionConfirmation.test.js +0 -18
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelResumeConfirm.test.js +0 -28
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionConfirmation.test.js.snap +0 -89
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelResumeConfirm.test.js.snap +0 -37
- data/webpack/stories/index.js +0 -10
- data/webpack/stories/index.scss +0 -7
- data/webpack/test_setup.js +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 523767f29aa2c7e5485b4f18978a03120eb2369e510f5340ecb940d03372229e
|
4
|
+
data.tar.gz: 8db1c0c802560d5d8f910f0b8ae30be95640a4ad99c19145529aab2c6ab67ba8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 284dc372bba144d11030df2ca96bfc01a716726e74e2d9797f88508984fe053d49d917f34b717b6e1806f2719df28e050750d274fe114ca0d6189b32ac5819bc
|
7
|
+
data.tar.gz: 4f7cdfc025e74b30177d8a437b5e01a7eb9be1159ef68eb8ab4243301850547fc9d72bbabbb629223dbcab0e77a3416ccd5a4586bf39f6f2240a09cb26b63a11
|
data/.eslintrc
CHANGED
@@ -1,24 +1,4 @@
|
|
1
1
|
{
|
2
|
-
"plugins": ["
|
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("
|
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
|
data/lib/foreman_tasks/engine.rb
CHANGED
@@ -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 '>=
|
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 },
|
data/package.json
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
"description": "Foreman Tasks =============",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
7
|
-
"lint": "
|
8
|
-
"test": "
|
9
|
-
"test:watch": "
|
10
|
-
"test:current": "
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
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
|
-
"@
|
33
|
-
"@
|
34
|
-
"@
|
35
|
-
"@theforeman/
|
36
|
-
"@theforeman/
|
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
|
-
"
|
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,5 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { storiesOf } from '@storybook/react';
|
3
2
|
import TaskDetails from './TaskDetails';
|
4
3
|
|
5
|
-
|
4
|
+
export default {
|
5
|
+
title: 'TaskDetails',
|
6
|
+
component: TaskDetails,
|
7
|
+
};
|
8
|
+
|
9
|
+
export const Basic = () => <TaskDetails />;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
|
3
3
|
import API from 'foremanReact/API';
|
4
|
-
import { IntegrationTestHelper } from '
|
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 {
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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,7 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
+
};
|