foreman-tasks 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +24 -0
  3. data/.eslintrc +27 -0
  4. data/.gitignore +3 -0
  5. data/.prettierrc +4 -0
  6. data/.rubocop.yml +1 -1
  7. data/.storybook/addons.js +2 -0
  8. data/.storybook/config.js +7 -0
  9. data/.storybook/webpack.config.js +66 -0
  10. data/.stylelintrc +5 -0
  11. data/.travis.yml +5 -0
  12. data/.yo-rc.json +5 -0
  13. data/README.md +1 -0
  14. data/app/controllers/foreman_tasks/api/tasks_controller.rb +28 -10
  15. data/app/controllers/foreman_tasks/react_controller.rb +17 -0
  16. data/app/lib/actions/middleware/proxy_batch_triggering.rb +36 -0
  17. data/app/lib/actions/middleware/watch_delegated_proxy_sub_tasks.rb +12 -7
  18. data/app/lib/actions/proxy_action.rb +52 -16
  19. data/app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb +12 -0
  20. data/app/models/foreman_tasks/remote_task.rb +74 -0
  21. data/app/models/foreman_tasks/task/dynflow_task.rb +14 -7
  22. data/app/models/setting/foreman_tasks.rb +3 -1
  23. data/app/views/foreman_tasks/layouts/react.html.erb +12 -0
  24. data/app/views/foreman_tasks/tasks/show.html.erb +1 -1
  25. data/config/routes.rb +3 -0
  26. data/db/migrate/20181019135324_add_remote_task_operation.rb +5 -0
  27. data/foreman-tasks.gemspec +1 -1
  28. data/lib/foreman_tasks/engine.rb +1 -0
  29. data/lib/foreman_tasks/version.rb +1 -1
  30. data/lib/foreman_tasks.rb +5 -1
  31. data/package.json +117 -0
  32. data/script/travis_run_js_tests.sh +7 -0
  33. data/test/controllers/api/tasks_controller_test.rb +3 -0
  34. data/test/core/unit/dispatcher_test.rb +43 -0
  35. data/test/core/unit/runner_test.rb +129 -0
  36. data/test/core/unit/task_launcher_test.rb +56 -0
  37. data/test/foreman_tasks_core_test_helper.rb +4 -0
  38. data/test/support/dummy_proxy_action.rb +17 -1
  39. data/test/unit/actions/proxy_action_test.rb +20 -2
  40. data/test/unit/actions/recurring_action_test.rb +1 -1
  41. data/test/unit/remote_task_test.rb +41 -0
  42. data/test/unit/task_test.rb +3 -1
  43. data/webpack/ForemanTasks/ForemanTasks.js +27 -0
  44. data/webpack/ForemanTasks/ForemanTasks.test.js +10 -0
  45. data/webpack/ForemanTasks/Routes/ForemanTasksRouter.js +14 -0
  46. data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +22 -0
  47. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.js +17 -0
  48. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +16 -0
  49. data/webpack/ForemanTasks/Routes/IndexTasks/IndexTasks.js +10 -0
  50. data/webpack/ForemanTasks/Routes/IndexTasks/__tests__/IndexTasks.test.js +10 -0
  51. data/webpack/ForemanTasks/Routes/IndexTasks/__tests__/__snapshots__/IndexTasks.test.js.snap +12 -0
  52. data/webpack/ForemanTasks/Routes/IndexTasks/index.js +1 -0
  53. data/webpack/ForemanTasks/Routes/IndexTasks/indexTasks.scss +0 -0
  54. data/webpack/ForemanTasks/Routes/ShowTask/ShowTask.js +10 -0
  55. data/webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js +10 -0
  56. data/webpack/ForemanTasks/Routes/ShowTask/__tests__/__snapshots__/ShowTask.test.js.snap +12 -0
  57. data/webpack/ForemanTasks/Routes/ShowTask/index.js +1 -0
  58. data/webpack/ForemanTasks/Routes/ShowTask/showTask.scss +0 -0
  59. data/webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRouter.test.js.snap +16 -0
  60. data/webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRoutes.test.js.snap +21 -0
  61. data/webpack/ForemanTasks/__snapshots__/ForemanTasks.test.js.snap +60 -0
  62. data/webpack/ForemanTasks/components/Hello/Hello.stories.js +5 -0
  63. data/webpack/ForemanTasks/components/Hello/__tests__/Hello.test.js +11 -0
  64. data/webpack/ForemanTasks/components/Hello/__tests__/__snapshots__/Hello.test.js.snap +7 -0
  65. data/webpack/ForemanTasks/components/Hello/index.js +5 -0
  66. data/webpack/ForemanTasks/index.js +1 -0
  67. data/webpack/index.js +11 -0
  68. data/webpack/stories/index.js +12 -0
  69. data/webpack/test_setup.js +6 -0
  70. metadata +56 -4
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import IndexTasks from './IndexTasks';
3
+ import ShowTask from './ShowTask';
4
+
5
+ const ForemanTasksRoutes = {
6
+ indexTasks: {
7
+ path: '/foreman_tasks/ex_tasks',
8
+ exact: true,
9
+ render: props => <IndexTasks {...props} />,
10
+ },
11
+ showTask: {
12
+ path: '/foreman_tasks/ex_tasks/:id',
13
+ render: props => <ShowTask {...props} />,
14
+ },
15
+ };
16
+
17
+ export default ForemanTasksRoutes;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { shallow } from 'enzyme';
3
+ import toJson from 'enzyme-to-json';
4
+
5
+ import ForemanTasksRoutes from './ForemanTasksRoutes';
6
+
7
+ describe('ForemanTasksRoutes', () => {
8
+ it('should create routes', () => {
9
+ Object.entries(ForemanTasksRoutes).forEach(([key, Route]) => {
10
+ const component = shallow(<Route.render some="props" />);
11
+ Route.renderResult = toJson(component);
12
+ });
13
+
14
+ expect(ForemanTasksRoutes).toMatchSnapshot();
15
+ });
16
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ const IndexTasks = () => (
4
+ <div>
5
+ <h1>Hello Foreman Tasks</h1>
6
+ <h2>index-tasks-page</h2>
7
+ </div>
8
+ );
9
+
10
+ export default IndexTasks;
@@ -0,0 +1,10 @@
1
+ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import IndexTasks from '../IndexTasks';
4
+
5
+ const fixtures = {
6
+ 'render without Props': {},
7
+ };
8
+
9
+ describe('IndexTasks', () =>
10
+ testComponentSnapshotsWithFixtures(IndexTasks, fixtures));
@@ -0,0 +1,12 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`IndexTasks render without Props 1`] = `
4
+ <div>
5
+ <h1>
6
+ Hello Foreman Tasks
7
+ </h1>
8
+ <h2>
9
+ index-tasks-page
10
+ </h2>
11
+ </div>
12
+ `;
@@ -0,0 +1 @@
1
+ export { default } from './IndexTasks';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ const ShowTask = () => (
4
+ <div>
5
+ <h1>Hello Foreman Tasks</h1>
6
+ <h2>show-task-page</h2>
7
+ </div>
8
+ );
9
+
10
+ export default ShowTask;
@@ -0,0 +1,10 @@
1
+ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import ShowTask from '../ShowTask';
4
+
5
+ const fixtures = {
6
+ 'render without Props': {},
7
+ };
8
+
9
+ describe('ShowTask', () =>
10
+ testComponentSnapshotsWithFixtures(ShowTask, fixtures));
@@ -0,0 +1,12 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ShowTask render without Props 1`] = `
4
+ <div>
5
+ <h1>
6
+ Hello Foreman Tasks
7
+ </h1>
8
+ <h2>
9
+ show-task-page
10
+ </h2>
11
+ </div>
12
+ `;
@@ -0,0 +1 @@
1
+ export { default } from './ShowTask';
@@ -0,0 +1,16 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ForemanTasksRouter render without Props 1`] = `
4
+ <Switch>
5
+ <Route
6
+ key="someRoute"
7
+ path="/some-route"
8
+ render={[Function]}
9
+ />
10
+ <Route
11
+ key="someOtherRoute"
12
+ path="/some-other-route"
13
+ render={[Function]}
14
+ />
15
+ </Switch>
16
+ `;
@@ -0,0 +1,21 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ForemanTasksRoutes should create routes 1`] = `
4
+ Object {
5
+ "indexTasks": Object {
6
+ "exact": true,
7
+ "path": "/foreman_tasks/ex_tasks",
8
+ "render": [Function],
9
+ "renderResult": <IndexTasks
10
+ some="props"
11
+ />,
12
+ },
13
+ "showTask": Object {
14
+ "path": "/foreman_tasks/ex_tasks/:id",
15
+ "render": [Function],
16
+ "renderResult": <ShowTask
17
+ some="props"
18
+ />,
19
+ },
20
+ }
21
+ `;
@@ -0,0 +1,60 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ForemanTasks render without Props 1`] = `
4
+ <BrowserRouter>
5
+ <div>
6
+ <div
7
+ style={
8
+ Object {
9
+ "paddingBottom": "10px",
10
+ "paddingTop": "10px",
11
+ }
12
+ }
13
+ >
14
+ <ButtonGroup
15
+ block={false}
16
+ bsClass="btn-group"
17
+ bsSize="large"
18
+ justified={false}
19
+ vertical={false}
20
+ >
21
+ <LinkContainer
22
+ activeClassName="active"
23
+ exact={false}
24
+ replace={false}
25
+ strict={false}
26
+ to="/foreman_tasks/ex_tasks"
27
+ >
28
+ <Button
29
+ active={false}
30
+ block={false}
31
+ bsClass="btn"
32
+ bsStyle="link"
33
+ disabled={false}
34
+ >
35
+ index-tasks-page
36
+ </Button>
37
+ </LinkContainer>
38
+ <LinkContainer
39
+ activeClassName="active"
40
+ exact={false}
41
+ replace={false}
42
+ strict={false}
43
+ to="/foreman_tasks/ex_tasks/some-id"
44
+ >
45
+ <Button
46
+ active={false}
47
+ block={false}
48
+ bsClass="btn"
49
+ bsStyle="link"
50
+ disabled={false}
51
+ >
52
+ show-task-page
53
+ </Button>
54
+ </LinkContainer>
55
+ </ButtonGroup>
56
+ </div>
57
+ <ForemanTasksRouter />
58
+ </div>
59
+ </BrowserRouter>
60
+ `;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import Hello from './index';
4
+
5
+ storiesOf('Hello React', module).add('Hello', () => <Hello />);
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { shallow } from 'enzyme';
3
+ import toJson from 'enzyme-to-json';
4
+ import Hello from '../index';
5
+
6
+ describe('Hello component', () => {
7
+ it('rendering', () => {
8
+ const wrapper = shallow(<Hello />);
9
+ expect(toJson(wrapper)).toMatchSnapshot();
10
+ });
11
+ });
@@ -0,0 +1,7 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Hello component rendering 1`] = `
4
+ <h1>
5
+ Hello React
6
+ </h1>
7
+ `;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+
3
+ const Hello = () => <h1>Hello React</h1>;
4
+
5
+ export default Hello;
@@ -0,0 +1 @@
1
+ export { default } from './ForemanTasks';
data/webpack/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /* eslint import/no-unresolved: [2, { ignore: [foremanReact/*] }] */
2
+ /* eslint-disable import/no-extraneous-dependencies */
3
+ /* eslint-disable import/extensions */
4
+ /* eslint-disable import/no-unresolved */
5
+ import componentRegistry from 'foremanReact/components/componentRegistry';
6
+ import ForemanTasks from './ForemanTasks';
7
+
8
+ componentRegistry.register({
9
+ name: 'ForemanTasks',
10
+ type: ForemanTasks,
11
+ });
@@ -0,0 +1,12 @@
1
+ import { configure } from '@storybook/react';
2
+
3
+ require('patternfly/dist/css/patternfly.min.css');
4
+ require('patternfly/dist/css/patternfly-additions.min.css');
5
+
6
+ const req = require.context('../', true, /.stories.js$/);
7
+
8
+ function loadStories() {
9
+ req.keys().forEach(filename => req(filename));
10
+ }
11
+
12
+ configure(loadStories, module);
@@ -0,0 +1,6 @@
1
+ import 'babel-polyfill';
2
+
3
+ import { configure } from 'enzyme';
4
+ import Adapter from 'enzyme-adapter-react-16';
5
+
6
+ configure({ adapter: new Adapter() });
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: 0.15.0
4
+ version: 0.15.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: 2019-02-08 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks-core
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.1
33
+ version: 1.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.1
40
+ version: 1.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sinatra
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -107,10 +107,19 @@ extra_rdoc_files:
107
107
  - README.md
108
108
  - LICENSE
109
109
  files:
110
+ - ".babelrc"
111
+ - ".eslintrc"
110
112
  - ".gitignore"
113
+ - ".prettierrc"
111
114
  - ".rubocop.yml"
112
115
  - ".rubocop_todo.yml"
116
+ - ".storybook/addons.js"
117
+ - ".storybook/config.js"
118
+ - ".storybook/webpack.config.js"
119
+ - ".stylelintrc"
120
+ - ".travis.yml"
113
121
  - ".tx/config"
122
+ - ".yo-rc.json"
114
123
  - Gemfile
115
124
  - LICENSE
116
125
  - README.md
@@ -123,6 +132,7 @@ files:
123
132
  - app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb
124
133
  - app/controllers/foreman_tasks/concerns/parameters/recurring_logic.rb
125
134
  - app/controllers/foreman_tasks/concerns/parameters/triggering.rb
135
+ - app/controllers/foreman_tasks/react_controller.rb
126
136
  - app/controllers/foreman_tasks/recurring_logics_controller.rb
127
137
  - app/controllers/foreman_tasks/tasks_controller.rb
128
138
  - app/helpers/foreman_tasks/foreman_tasks_helper.rb
@@ -144,6 +154,7 @@ files:
144
154
  - app/lib/actions/middleware/keep_current_taxonomies.rb
145
155
  - app/lib/actions/middleware/keep_current_timezone.rb
146
156
  - app/lib/actions/middleware/keep_current_user.rb
157
+ - app/lib/actions/middleware/proxy_batch_triggering.rb
147
158
  - app/lib/actions/middleware/rails_executor_wrap.rb
148
159
  - app/lib/actions/middleware/recurring_logic.rb
149
160
  - app/lib/actions/middleware/watch_delegated_proxy_sub_tasks.rb
@@ -176,6 +187,7 @@ files:
176
187
  - app/views/foreman_tasks/api/recurring_logics/show.json.rabl
177
188
  - app/views/foreman_tasks/api/recurring_logics/update.json.rabl
178
189
  - app/views/foreman_tasks/api/tasks/show.json.rabl
190
+ - app/views/foreman_tasks/layouts/react.html.erb
179
191
  - app/views/foreman_tasks/recurring_logics/_tab_related.html.erb
180
192
  - app/views/foreman_tasks/recurring_logics/index.html.erb
181
193
  - app/views/foreman_tasks/recurring_logics/show.html.erb
@@ -212,6 +224,7 @@ files:
212
224
  - db/migrate/20171026082635_add_task_action.foreman_tasks.rb
213
225
  - db/migrate/20180207150921_add_remote_tasks.foreman_tasks.rb
214
226
  - db/migrate/20180216092715_use_uuid.rb
227
+ - db/migrate/20181019135324_add_remote_task_operation.rb
215
228
  - db/seeds.d/20-foreman_tasks_permissions.rb
216
229
  - db/seeds.d/60-dynflow_proxy_feature.rb
217
230
  - db/seeds.d/61-foreman_tasks_bookmarks.rb
@@ -243,14 +256,20 @@ files:
243
256
  - locale/en/LC_MESSAGES/foreman_tasks.mo
244
257
  - locale/en/foreman_tasks.po
245
258
  - locale/foreman_tasks.pot
259
+ - package.json
246
260
  - script/rails
261
+ - script/travis_run_js_tests.sh
247
262
  - test/controllers/api/recurring_logics_controller_test.rb
248
263
  - test/controllers/api/tasks_controller_test.rb
249
264
  - test/controllers/recurring_logics_controller_test.rb
250
265
  - test/controllers/tasks_controller_test.rb
266
+ - test/core/unit/dispatcher_test.rb
267
+ - test/core/unit/runner_test.rb
268
+ - test/core/unit/task_launcher_test.rb
251
269
  - test/factories/recurring_logic_factory.rb
252
270
  - test/factories/task_factory.rb
253
271
  - test/factories/triggering_factory.rb
272
+ - test/foreman_tasks_core_test_helper.rb
254
273
  - test/foreman_tasks_test_helper.rb
255
274
  - test/helpers/foreman_tasks/tasks_helper_test.rb
256
275
  - test/lib/actions/middleware/keep_current_request_id_test.rb
@@ -274,9 +293,37 @@ files:
274
293
  - test/unit/otp_manager_test.rb
275
294
  - test/unit/proxy_selector_test.rb
276
295
  - test/unit/recurring_logic_test.rb
296
+ - test/unit/remote_task_test.rb
277
297
  - test/unit/task_groups_test.rb
278
298
  - test/unit/task_test.rb
279
299
  - test/unit/triggering_test.rb
300
+ - webpack/ForemanTasks/ForemanTasks.js
301
+ - webpack/ForemanTasks/ForemanTasks.test.js
302
+ - webpack/ForemanTasks/Routes/ForemanTasksRouter.js
303
+ - webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js
304
+ - webpack/ForemanTasks/Routes/ForemanTasksRoutes.js
305
+ - webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js
306
+ - webpack/ForemanTasks/Routes/IndexTasks/IndexTasks.js
307
+ - webpack/ForemanTasks/Routes/IndexTasks/__tests__/IndexTasks.test.js
308
+ - webpack/ForemanTasks/Routes/IndexTasks/__tests__/__snapshots__/IndexTasks.test.js.snap
309
+ - webpack/ForemanTasks/Routes/IndexTasks/index.js
310
+ - webpack/ForemanTasks/Routes/IndexTasks/indexTasks.scss
311
+ - webpack/ForemanTasks/Routes/ShowTask/ShowTask.js
312
+ - webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js
313
+ - webpack/ForemanTasks/Routes/ShowTask/__tests__/__snapshots__/ShowTask.test.js.snap
314
+ - webpack/ForemanTasks/Routes/ShowTask/index.js
315
+ - webpack/ForemanTasks/Routes/ShowTask/showTask.scss
316
+ - webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRouter.test.js.snap
317
+ - webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRoutes.test.js.snap
318
+ - webpack/ForemanTasks/__snapshots__/ForemanTasks.test.js.snap
319
+ - webpack/ForemanTasks/components/Hello/Hello.stories.js
320
+ - webpack/ForemanTasks/components/Hello/__tests__/Hello.test.js
321
+ - webpack/ForemanTasks/components/Hello/__tests__/__snapshots__/Hello.test.js.snap
322
+ - webpack/ForemanTasks/components/Hello/index.js
323
+ - webpack/ForemanTasks/index.js
324
+ - webpack/index.js
325
+ - webpack/stories/index.js
326
+ - webpack/test_setup.js
280
327
  homepage: https://github.com/theforeman/foreman-tasks
281
328
  licenses: []
282
329
  metadata: {}
@@ -305,9 +352,13 @@ test_files:
305
352
  - test/controllers/api/tasks_controller_test.rb
306
353
  - test/controllers/recurring_logics_controller_test.rb
307
354
  - test/controllers/tasks_controller_test.rb
355
+ - test/core/unit/dispatcher_test.rb
356
+ - test/core/unit/runner_test.rb
357
+ - test/core/unit/task_launcher_test.rb
308
358
  - test/factories/recurring_logic_factory.rb
309
359
  - test/factories/task_factory.rb
310
360
  - test/factories/triggering_factory.rb
361
+ - test/foreman_tasks_core_test_helper.rb
311
362
  - test/foreman_tasks_test_helper.rb
312
363
  - test/helpers/foreman_tasks/tasks_helper_test.rb
313
364
  - test/lib/actions/middleware/keep_current_request_id_test.rb
@@ -331,6 +382,7 @@ test_files:
331
382
  - test/unit/otp_manager_test.rb
332
383
  - test/unit/proxy_selector_test.rb
333
384
  - test/unit/recurring_logic_test.rb
385
+ - test/unit/remote_task_test.rb
334
386
  - test/unit/task_groups_test.rb
335
387
  - test/unit/task_test.rb
336
388
  - test/unit/triggering_test.rb