foreman-tasks 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/js_tests.yml +5 -1
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +1 -2
- data/app/models/setting/foreman_tasks.rb +8 -8
- data/app/services/foreman_tasks/dashboard_table_filter.rb +5 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/test/controllers/api/tasks_controller_test.rb +10 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.scss +4 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js +53 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.test.js +14 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.js +27 -19
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.scss +14 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +1 -34
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/{StoppedTasksCardHelper.js → StoppedTasksCardTable.js} +28 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCardTable.test.js +54 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/OtherInfo.test.js.snap +48 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCard.test.js.snap +60 -1367
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCardTable.test.js.snap +960 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/__snapshots__/TasksCardsGrid.test.js.snap +14 -11
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardConstants.js +2 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardSelectors.js +17 -11
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js +26 -14
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboard.test.js.snap +14 -11
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardSelectors.test.js.snap +38 -22
- metadata +8 -3
@@ -57,17 +57,20 @@ exports[`TasksCardsGrid render with minimal props 1`] = `
|
|
57
57
|
className=""
|
58
58
|
data={
|
59
59
|
Object {
|
60
|
-
"
|
61
|
-
|
62
|
-
"
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
"
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
"
|
60
|
+
"other": 0,
|
61
|
+
"results": Object {
|
62
|
+
"error": Object {
|
63
|
+
"last": 0,
|
64
|
+
"total": 0,
|
65
|
+
},
|
66
|
+
"success": Object {
|
67
|
+
"last": 0,
|
68
|
+
"total": 0,
|
69
|
+
},
|
70
|
+
"warning": Object {
|
71
|
+
"last": 0,
|
72
|
+
"total": 0,
|
73
|
+
},
|
71
74
|
},
|
72
75
|
}
|
73
76
|
}
|
@@ -11,6 +11,7 @@ export const TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS = {
|
|
11
11
|
ERROR: 'error',
|
12
12
|
WARNING: 'warning',
|
13
13
|
SUCCESS: 'success',
|
14
|
+
OTHER: 'other',
|
14
15
|
};
|
15
16
|
|
16
17
|
export const TASKS_DASHBOARD_AVAILABLE_QUERY_MODES = {
|
@@ -44,6 +45,7 @@ export const TASKS_DASHBOARD_QUERY_VALUES_TEXT = {
|
|
44
45
|
[TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS.ERROR]: __('error'),
|
45
46
|
[TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS.WARNING]: __('warning'),
|
46
47
|
[TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS.SUCCESS]: __('success'),
|
48
|
+
[TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS.OTHER]: __('other'),
|
47
49
|
[TASKS_DASHBOARD_AVAILABLE_QUERY_MODES.LAST]: __('last'),
|
48
50
|
[TASKS_DASHBOARD_AVAILABLE_QUERY_MODES.OLDER]: __('older'),
|
49
51
|
[TASKS_DASHBOARD_AVAILABLE_TIMES.H24]: __('24h'),
|
@@ -12,6 +12,9 @@ export const selectTime = state =>
|
|
12
12
|
|
13
13
|
export const selectQuery = state => selectTasksDashboard(state).query || {};
|
14
14
|
|
15
|
+
export const calcStoppedOther = data =>
|
16
|
+
(data?.cancelled?.total || 0) + (data?.pending?.total || 0);
|
17
|
+
|
15
18
|
export const selectTasksSummary = state => {
|
16
19
|
const { running, paused, stopped, scheduled } =
|
17
20
|
selectTasksDashboard(state).tasksSummary || TASKS_SUMMARY_ZERO;
|
@@ -26,18 +29,21 @@ export const selectTasksSummary = state => {
|
|
26
29
|
older: paused.total - paused.recent,
|
27
30
|
},
|
28
31
|
stopped: {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
results: {
|
33
|
+
error: {
|
34
|
+
total: stopped.by_result.error.total,
|
35
|
+
last: stopped.by_result.error.recent,
|
36
|
+
},
|
37
|
+
warning: {
|
38
|
+
total: stopped.by_result.warning.total,
|
39
|
+
last: stopped.by_result.warning.recent,
|
40
|
+
},
|
41
|
+
success: {
|
42
|
+
total: stopped.by_result.success.total,
|
43
|
+
last: stopped.by_result.success.recent,
|
44
|
+
},
|
40
45
|
},
|
46
|
+
other: calcStoppedOther(stopped.by_result),
|
41
47
|
},
|
42
48
|
scheduled: scheduled.total,
|
43
49
|
};
|
data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js
CHANGED
@@ -4,8 +4,32 @@ import {
|
|
4
4
|
selectTime,
|
5
5
|
selectQuery,
|
6
6
|
selectTasksSummary,
|
7
|
+
calcStoppedOther,
|
7
8
|
} from '../TasksDashboardSelectors';
|
8
9
|
|
10
|
+
const stoppedResult = {
|
11
|
+
error: {
|
12
|
+
total: 9,
|
13
|
+
recent: 1,
|
14
|
+
},
|
15
|
+
warning: {
|
16
|
+
total: 8,
|
17
|
+
recent: 2,
|
18
|
+
},
|
19
|
+
success: {
|
20
|
+
total: 7,
|
21
|
+
recent: 3,
|
22
|
+
},
|
23
|
+
cancelled: {
|
24
|
+
total: 5,
|
25
|
+
recent: 3,
|
26
|
+
},
|
27
|
+
pending: {
|
28
|
+
total: 11,
|
29
|
+
recent: 4,
|
30
|
+
},
|
31
|
+
};
|
32
|
+
|
9
33
|
const state = {
|
10
34
|
foremanTasks: {
|
11
35
|
tasksDashboard: {
|
@@ -21,20 +45,7 @@ const state = {
|
|
21
45
|
total: 9,
|
22
46
|
},
|
23
47
|
stopped: {
|
24
|
-
by_result:
|
25
|
-
error: {
|
26
|
-
total: 9,
|
27
|
-
recent: 1,
|
28
|
-
},
|
29
|
-
warning: {
|
30
|
-
total: 8,
|
31
|
-
recent: 2,
|
32
|
-
},
|
33
|
-
success: {
|
34
|
-
total: 7,
|
35
|
-
recent: 3,
|
36
|
-
},
|
37
|
-
},
|
48
|
+
by_result: stoppedResult,
|
38
49
|
},
|
39
50
|
scheduled: {
|
40
51
|
total: 6,
|
@@ -55,6 +66,7 @@ const fixtures = {
|
|
55
66
|
'should select tasks-summary': () => selectTasksSummary(state),
|
56
67
|
'should select tasks-summary when state is empty': () =>
|
57
68
|
selectTasksSummary({}),
|
69
|
+
'should calcStoppedOther': () => calcStoppedOther(stoppedResult),
|
58
70
|
};
|
59
71
|
|
60
72
|
describe('TasksDashboard - Selectors', () =>
|
@@ -24,17 +24,20 @@ exports[`TasksDashboard rendering render without Props 1`] = `
|
|
24
24
|
},
|
25
25
|
"scheduled": 0,
|
26
26
|
"stopped": Object {
|
27
|
-
"
|
28
|
-
|
29
|
-
"
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"
|
27
|
+
"other": 0,
|
28
|
+
"results": Object {
|
29
|
+
"error": Object {
|
30
|
+
"last": 0,
|
31
|
+
"total": 0,
|
32
|
+
},
|
33
|
+
"success": Object {
|
34
|
+
"last": 0,
|
35
|
+
"total": 0,
|
36
|
+
},
|
37
|
+
"warning": Object {
|
38
|
+
"last": 0,
|
39
|
+
"total": 0,
|
40
|
+
},
|
38
41
|
},
|
39
42
|
},
|
40
43
|
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
+
exports[`TasksDashboard - Selectors should calcStoppedOther 1`] = `16`;
|
4
|
+
|
3
5
|
exports[`TasksDashboard - Selectors should select query 1`] = `"some-query"`;
|
4
6
|
|
5
7
|
exports[`TasksDashboard - Selectors should select query when state is empty 1`] = `Object {}`;
|
@@ -21,10 +23,18 @@ Object {
|
|
21
23
|
},
|
22
24
|
"stopped": Object {
|
23
25
|
"by_result": Object {
|
26
|
+
"cancelled": Object {
|
27
|
+
"recent": 3,
|
28
|
+
"total": 5,
|
29
|
+
},
|
24
30
|
"error": Object {
|
25
31
|
"recent": 1,
|
26
32
|
"total": 9,
|
27
33
|
},
|
34
|
+
"pending": Object {
|
35
|
+
"recent": 4,
|
36
|
+
"total": 11,
|
37
|
+
},
|
28
38
|
"success": Object {
|
29
39
|
"recent": 3,
|
30
40
|
"total": 7,
|
@@ -54,17 +64,20 @@ Object {
|
|
54
64
|
},
|
55
65
|
"scheduled": 6,
|
56
66
|
"stopped": Object {
|
57
|
-
"
|
58
|
-
|
59
|
-
"
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
"
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
"
|
67
|
+
"other": 16,
|
68
|
+
"results": Object {
|
69
|
+
"error": Object {
|
70
|
+
"last": 1,
|
71
|
+
"total": 9,
|
72
|
+
},
|
73
|
+
"success": Object {
|
74
|
+
"last": 3,
|
75
|
+
"total": 7,
|
76
|
+
},
|
77
|
+
"warning": Object {
|
78
|
+
"last": 2,
|
79
|
+
"total": 8,
|
80
|
+
},
|
68
81
|
},
|
69
82
|
},
|
70
83
|
}
|
@@ -82,17 +95,20 @@ Object {
|
|
82
95
|
},
|
83
96
|
"scheduled": 0,
|
84
97
|
"stopped": Object {
|
85
|
-
"
|
86
|
-
|
87
|
-
"
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
"
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
"
|
98
|
+
"other": 0,
|
99
|
+
"results": Object {
|
100
|
+
"error": Object {
|
101
|
+
"last": 0,
|
102
|
+
"total": 0,
|
103
|
+
},
|
104
|
+
"success": Object {
|
105
|
+
"last": 0,
|
106
|
+
"total": 0,
|
107
|
+
},
|
108
|
+
"warning": Object {
|
109
|
+
"last": 0,
|
110
|
+
"total": 0,
|
111
|
+
},
|
96
112
|
},
|
97
113
|
},
|
98
114
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynflow
|
@@ -399,12 +399,17 @@ files:
|
|
399
399
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.stories.js
|
400
400
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.test.js
|
401
401
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/__snapshots__/ScheduledTasksCard.test.js.snap
|
402
|
+
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
|
403
|
+
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.test.js
|
402
404
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.js
|
403
405
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.scss
|
404
406
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.stories.js
|
405
407
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js
|
406
|
-
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/
|
408
|
+
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCardTable.js
|
409
|
+
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCardTable.test.js
|
410
|
+
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/OtherInfo.test.js.snap
|
407
411
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCard.test.js.snap
|
412
|
+
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCardTable.test.js.snap
|
408
413
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.js
|
409
414
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.scss
|
410
415
|
- webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.stories.js
|