foreman-tasks 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +4 -1
  3. data/.eslintrc +4 -13
  4. data/app/assets/stylesheets/foreman_tasks/application.css.scss +0 -37
  5. data/app/controllers/foreman_tasks/api/tasks_controller.rb +9 -5
  6. data/app/controllers/foreman_tasks/tasks_controller.rb +23 -19
  7. data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +28 -29
  8. data/app/lib/actions/bulk_action.rb +1 -1
  9. data/app/models/foreman_tasks/task.rb +1 -1
  10. data/app/models/foreman_tasks/task/dynflow_task.rb +30 -0
  11. data/app/services/foreman_tasks/troubleshooting_help_generator.rb +4 -0
  12. data/app/views/foreman_tasks/api/tasks/details.json.rabl +18 -0
  13. data/app/views/foreman_tasks/layouts/react.html.erb +1 -1
  14. data/app/views/foreman_tasks/tasks/index.html.erb +3 -0
  15. data/app/views/foreman_tasks/tasks/show.html.erb +10 -134
  16. data/config/routes.rb +3 -0
  17. data/lib/foreman_tasks/engine.rb +1 -1
  18. data/lib/foreman_tasks/tasks/export_tasks.rake +1 -2
  19. data/lib/foreman_tasks/version.rb +1 -1
  20. data/package.json +6 -20
  21. data/test/controllers/tasks_controller_test.rb +11 -0
  22. data/test/helpers/foreman_tasks/foreman_tasks_helper_test.rb +39 -0
  23. data/test/unit/actions/bulk_action_test.rb +2 -0
  24. data/test/unit/task_test.rb +4 -0
  25. data/webpack/ForemanTasks/Components/TaskDetails/Components/Errors.js +60 -0
  26. data/webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js +46 -0
  27. data/webpack/ForemanTasks/Components/TaskDetails/Components/Raw.js +73 -0
  28. data/webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js +55 -0
  29. data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +202 -0
  30. data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskHelper.js +38 -0
  31. data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +238 -0
  32. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Errors.test.js +36 -0
  33. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Locks.test.js +28 -0
  34. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Raw.test.js +27 -0
  35. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +29 -0
  36. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +18 -0
  37. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskHelper.test.js +77 -0
  38. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +60 -0
  39. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Errors.test.js.snap +77 -0
  40. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Locks.test.js.snap +108 -0
  41. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Raw.test.js.snap +174 -0
  42. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/RunningSteps.test.js.snap +62 -0
  43. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +282 -0
  44. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskHelper.test.js.snap +37 -0
  45. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +568 -0
  46. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +87 -0
  47. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.scss +63 -0
  48. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.stories.js +5 -0
  49. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +109 -0
  50. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +18 -0
  51. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +44 -0
  52. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +83 -0
  53. data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +1 -0
  54. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +12 -0
  55. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +20 -0
  56. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +33 -0
  57. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +97 -0
  58. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +43 -0
  59. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsReducer.test.js.snap +26 -0
  60. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/integration.test.js.snap +122 -0
  61. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +63 -0
  62. data/webpack/ForemanTasks/Components/TaskDetails/index.js +77 -0
  63. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.js +6 -1
  64. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/__snapshots__/PausedTasksCard.test.js.snap +2 -0
  65. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.js +6 -1
  66. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/__snapshots__/RunningTasksCard.test.js.snap +2 -0
  67. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js +3 -6
  68. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.scss +0 -3
  69. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/__snapshots__/ScheduledTasksCard.test.js.snap +3 -0
  70. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.js +2 -0
  71. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.scss +0 -4
  72. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCardHelper.js +3 -3
  73. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCard.test.js.snap +495 -54
  74. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.js +1 -0
  75. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.scss +6 -0
  76. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.scss +0 -3
  77. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.scss +1 -1
  78. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.scss +2 -2
  79. data/webpack/ForemanTasks/Components/common/ClickConfirmation/index.js +83 -0
  80. data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
  81. data/webpack/__mocks__/foremanReact/common/I18n.js +2 -0
  82. data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +2 -0
  83. data/webpack/index.js +5 -0
  84. metadata +46 -9
  85. data/app/views/foreman_tasks/tasks/_details.html.erb +0 -195
  86. data/app/views/foreman_tasks/tasks/_errors.html.erb +0 -42
  87. data/app/views/foreman_tasks/tasks/_locks.html.erb +0 -19
  88. data/app/views/foreman_tasks/tasks/_raw.html.erb +0 -28
  89. data/app/views/foreman_tasks/tasks/_running_steps.html.erb +0 -40
@@ -0,0 +1,60 @@
1
+ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import TaskInfo from '../TaskInfo';
4
+
5
+ const fixtures = {
6
+ 'render without Props': { id: 'test' },
7
+ 'render with Props': {
8
+ id: 'test',
9
+ startAt: '2019-06-17 16:04:09 +0300',
10
+ label: 'Actions::Katello::EventQueue::Monitor',
11
+ pending: true,
12
+ action: 'Monitor Event Queue',
13
+ username: 'admin',
14
+ startedAt: '2019-06-17 16:04:09 +0300',
15
+ endedAt: null,
16
+ state: 'paused',
17
+ result: 'error',
18
+ progress: 0.5,
19
+ input: {
20
+ locale: 'en',
21
+ current_request_id: null,
22
+ current_timezone: 'Asia/Jerusalem',
23
+ current_user_id: 4,
24
+ current_organization_id: null,
25
+ current_location_id: null,
26
+ },
27
+ output: {},
28
+ humanized: {
29
+ action: 'Monitor Event Queue',
30
+ input: '',
31
+ output: '',
32
+ errors: [
33
+ 'Action Actions::Katello::EventQueue::Monitor is already active',
34
+ ],
35
+ },
36
+ cli_example: null,
37
+ executionPlan: {
38
+ state: 'paused',
39
+ cancellable: false,
40
+ },
41
+ help:
42
+ "A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved.\nThe recommended approach is to investigate the error messages below and in 'errors' tab, address the primary cause of the issue and resume the task.",
43
+ hasSubTasks: false,
44
+ allowDangerousActions: false,
45
+ locks: [
46
+ {
47
+ name: 'task_owner',
48
+ exclusive: false,
49
+ resource_type: 'User',
50
+ resource_id: 4,
51
+ },
52
+ ],
53
+ username_path: '<a href="/users/4-admin/edit">admin</a>',
54
+ },
55
+ };
56
+
57
+ describe('TaskInfo', () => {
58
+ describe('rendering', () =>
59
+ testComponentSnapshotsWithFixtures(TaskInfo, fixtures));
60
+ });
@@ -0,0 +1,77 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Errors rendering render with Props 1`] = `
4
+ <div>
5
+ <Alert
6
+ className=""
7
+ key="0"
8
+ onDismiss={null}
9
+ type="error"
10
+ >
11
+ <span>
12
+ Action
13
+ :
14
+ </span>
15
+ <span>
16
+ <pre>
17
+ Actions::Katello::EventQueue::Monitor
18
+ </pre>
19
+ </span>
20
+ <span>
21
+ Input
22
+ :
23
+ </span>
24
+ <span>
25
+ <pre>
26
+ {"locale"=&gt;"en",
27
+ "current_request_id"=&gt;nil,
28
+ "current_user_id"=&gt;4,
29
+ "current_organization_id"=&gt;nil,
30
+ "current_location_id"=&gt;nil}
31
+
32
+ </pre>
33
+ </span>
34
+ <span>
35
+ Output
36
+ :
37
+ </span>
38
+ <span>
39
+ <pre>
40
+ {}
41
+
42
+ </pre>
43
+ </span>
44
+ <span>
45
+ Exception
46
+ :
47
+ </span>
48
+ <span>
49
+ <pre>
50
+ RuntimeError
51
+ :
52
+ Action Actions::Katello::EventQueue::Monitor is already active
53
+ </pre>
54
+ </span>
55
+ <span>
56
+ Backtrace
57
+ :
58
+ </span>
59
+ <span>
60
+ <pre>
61
+ /home/vagrant/.gem/ruby/gems/dynflow-1.2.3/lib/dynflow/action/singleton.rb:15:in \`rescue in singleton_lock!'
62
+ /home/vagrant/.gem/ruby/gems/dynflow-1.2.3/lib/dynflow/action/singleton.rb:12:in \`singleton_lock!'
63
+ </pre>
64
+ </span>
65
+ </Alert>
66
+ </div>
67
+ `;
68
+
69
+ exports[`Errors rendering render without Props 1`] = `
70
+ <Alert
71
+ className=""
72
+ onDismiss={null}
73
+ type="success"
74
+ >
75
+ No errors
76
+ </Alert>
77
+ `;
@@ -0,0 +1,108 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Locks rendering render with Props 1`] = `
4
+ <div>
5
+ <Alert
6
+ className=""
7
+ onDismiss={null}
8
+ type="info"
9
+ >
10
+ You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource
11
+ </Alert>
12
+ <CardGrid
13
+ className=""
14
+ matchHeight={false}
15
+ >
16
+ <Row
17
+ bsClass="row"
18
+ componentClass="div"
19
+ >
20
+ <Col
21
+ bsClass="col"
22
+ componentClass="div"
23
+ key="0"
24
+ md={4}
25
+ sm={4}
26
+ xs={6}
27
+ >
28
+ <Card
29
+ accented={true}
30
+ aggregated={false}
31
+ aggregatedMini={false}
32
+ cardRef={null}
33
+ className="card-pf-aggregate-status"
34
+ matchHeight={false}
35
+ >
36
+ <CardTitle
37
+ className=""
38
+ >
39
+ <span
40
+ className="fa fa-unlock-alt"
41
+ />
42
+ task_owner
43
+ </CardTitle>
44
+ <CardBody
45
+ className=""
46
+ >
47
+ User id:4
48
+ <br />
49
+ </CardBody>
50
+ </Card>
51
+ </Col>
52
+ <Col
53
+ bsClass="col"
54
+ componentClass="div"
55
+ key="1"
56
+ md={4}
57
+ sm={4}
58
+ xs={6}
59
+ >
60
+ <Card
61
+ accented={true}
62
+ aggregated={false}
63
+ aggregatedMini={false}
64
+ cardRef={null}
65
+ className="card-pf-aggregate-status"
66
+ matchHeight={false}
67
+ >
68
+ <CardTitle
69
+ className=""
70
+ >
71
+ <span
72
+ className="fa fa-unlock-alt"
73
+ />
74
+ task_owner2
75
+ </CardTitle>
76
+ <CardBody
77
+ className=""
78
+ >
79
+ User id:2
80
+ <br />
81
+ </CardBody>
82
+ </Card>
83
+ </Col>
84
+ </Row>
85
+ </CardGrid>
86
+ </div>
87
+ `;
88
+
89
+ exports[`Locks rendering render without Props 1`] = `
90
+ <div>
91
+ <Alert
92
+ className=""
93
+ onDismiss={null}
94
+ type="info"
95
+ >
96
+ You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource
97
+ </Alert>
98
+ <CardGrid
99
+ className=""
100
+ matchHeight={false}
101
+ >
102
+ <Row
103
+ bsClass="row"
104
+ componentClass="div"
105
+ />
106
+ </CardGrid>
107
+ </div>
108
+ `;
@@ -0,0 +1,174 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Raw rendering render with Props 1`] = `
4
+ <div>
5
+ <div>
6
+ <span
7
+ className="param-name list-group-item-heading"
8
+ >
9
+ Id
10
+ :
11
+ </span>
12
+ <span
13
+ className="param-value"
14
+ >
15
+ 6b0d6db2-e9ab-40da-94e5-b6842ac50bd0
16
+ </span>
17
+ </div>
18
+ <div>
19
+ <span
20
+ className="param-name list-group-item-heading"
21
+ >
22
+ Label
23
+ :
24
+ </span>
25
+ <span
26
+ className="param-value"
27
+ >
28
+ Actions::Katello::EventQueue::Monitor
29
+ </span>
30
+ </div>
31
+ <div>
32
+ <span
33
+ className="param-name list-group-item-heading"
34
+ >
35
+ Duration
36
+ :
37
+ </span>
38
+ <span
39
+ className="param-value"
40
+ title="60 seconds"
41
+ >
42
+ 1 minute
43
+ </span>
44
+ </div>
45
+ <div>
46
+ <span
47
+ className="param-name list-group-item-heading"
48
+ >
49
+ Raw input
50
+ :
51
+ </span>
52
+ <span
53
+ className="param-value"
54
+ >
55
+ <pre>
56
+ {
57
+ "locale": "en",
58
+ "current_request_id": 1,
59
+ "current_user_id": 4,
60
+ "current_organization_id": 2,
61
+ "current_location_id": 3
62
+ }
63
+ </pre>
64
+ </span>
65
+ </div>
66
+ <div>
67
+ <span
68
+ className="param-name list-group-item-heading"
69
+ >
70
+ Raw output
71
+ :
72
+ </span>
73
+ <span
74
+ className="param-value"
75
+ >
76
+ <pre>
77
+ {}
78
+ </pre>
79
+ </span>
80
+ </div>
81
+ <div>
82
+ <span
83
+ className="param-name list-group-item-heading"
84
+ >
85
+ External Id
86
+ :
87
+ </span>
88
+ <span
89
+ className="param-value"
90
+ >
91
+ test
92
+ </span>
93
+ </div>
94
+ </div>
95
+ `;
96
+
97
+ exports[`Raw rendering render without Props 1`] = `
98
+ <div>
99
+ <div>
100
+ <span
101
+ className="param-name list-group-item-heading"
102
+ >
103
+ Id
104
+ :
105
+ </span>
106
+ <span
107
+ className="param-value"
108
+ />
109
+ </div>
110
+ <div>
111
+ <span
112
+ className="param-name list-group-item-heading"
113
+ >
114
+ Label
115
+ :
116
+ </span>
117
+ <span
118
+ className="param-value"
119
+ />
120
+ </div>
121
+ <div>
122
+ <span
123
+ className="param-name list-group-item-heading"
124
+ >
125
+ Duration
126
+ :
127
+ </span>
128
+ <span
129
+ className="param-value"
130
+ />
131
+ </div>
132
+ <div>
133
+ <span
134
+ className="param-name list-group-item-heading"
135
+ >
136
+ Raw input
137
+ :
138
+ </span>
139
+ <span
140
+ className="param-value"
141
+ >
142
+ <pre>
143
+ []
144
+ </pre>
145
+ </span>
146
+ </div>
147
+ <div>
148
+ <span
149
+ className="param-name list-group-item-heading"
150
+ >
151
+ Raw output
152
+ :
153
+ </span>
154
+ <span
155
+ className="param-value"
156
+ >
157
+ <pre>
158
+ {}
159
+ </pre>
160
+ </span>
161
+ </div>
162
+ <div>
163
+ <span
164
+ className="param-name list-group-item-heading"
165
+ >
166
+ External Id
167
+ :
168
+ </span>
169
+ <span
170
+ className="param-value"
171
+ />
172
+ </div>
173
+ </div>
174
+ `;
@@ -0,0 +1,62 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`RunningSteps rendering render with Props 1`] = `
4
+ <div>
5
+ <Alert
6
+ className=""
7
+ key="0"
8
+ onDismiss={null}
9
+ type="warning"
10
+ >
11
+ <p>
12
+ <span>
13
+ Action
14
+ :
15
+ </span>
16
+ <span />
17
+ </p>
18
+ <pre>
19
+ test
20
+ </pre>
21
+ <p>
22
+ <span>
23
+ State
24
+ :
25
+ </span>
26
+ <span>
27
+ paused
28
+ </span>
29
+ </p>
30
+ <span>
31
+ Input
32
+ :
33
+ </span>
34
+ <span>
35
+ <pre>
36
+ {"locale"=&gt;"en",
37
+ "current_request_id"=&gt;nil,
38
+ "current_user_id"=&gt;4,
39
+ "current_organization_id"=&gt;nil,
40
+ "current_location_id"=&gt;nil}
41
+
42
+ </pre>
43
+ </span>
44
+ <span>
45
+ Output
46
+ :
47
+ </span>
48
+ <span>
49
+ <pre>
50
+ {}
51
+
52
+ </pre>
53
+ </span>
54
+ </Alert>
55
+ </div>
56
+ `;
57
+
58
+ exports[`RunningSteps rendering render without Props 1`] = `
59
+ <span>
60
+ No running steps
61
+ </span>
62
+ `;