foreman_remote_execution 4.2.0 → 4.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/js_ci.yml +29 -0
  3. data/.github/workflows/{ci.yml → ruby_ci.yml} +22 -50
  4. data/.prettierrc +4 -0
  5. data/.rubocop.yml +13 -49
  6. data/.rubocop_todo.yml +326 -102
  7. data/Gemfile +1 -4
  8. data/app/controllers/api/v2/job_invocations_controller.rb +1 -1
  9. data/app/controllers/ui_job_wizard_controller.rb +18 -0
  10. data/app/lib/actions/remote_execution/run_host_job.rb +38 -1
  11. data/app/lib/foreman_remote_execution/renderer/scope/input.rb +1 -0
  12. data/app/models/foreign_input_set.rb +1 -1
  13. data/app/models/host_status/execution_status.rb +7 -0
  14. data/app/models/job_invocation.rb +1 -1
  15. data/app/models/job_invocation_composer.rb +1 -1
  16. data/app/views/template_invocations/show.html.erb +30 -23
  17. data/config/routes.rb +4 -0
  18. data/foreman_remote_execution.gemspec +1 -2
  19. data/lib/foreman_remote_execution/engine.rb +12 -1
  20. data/lib/foreman_remote_execution/version.rb +1 -1
  21. data/lib/tasks/foreman_remote_execution_tasks.rake +1 -18
  22. data/test/functional/api/v2/job_invocations_controller_test.rb +24 -4
  23. data/test/functional/api/v2/registration_controller_test.rb +4 -13
  24. data/test/functional/ui_job_wizard_controller_test.rb +16 -0
  25. data/webpack/JobWizard/JobWizard.js +32 -0
  26. data/webpack/JobWizard/index.js +32 -0
  27. data/webpack/Routes/routes.js +12 -0
  28. data/webpack/__mocks__/foremanReact/history.js +1 -0
  29. data/webpack/global_index.js +4 -0
  30. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +1 -1
  31. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.scss +0 -3
  32. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -1
  33. metadata +15 -19
@@ -0,0 +1,16 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class UiJobWizardControllerTest < ActionController::TestCase
4
+ def setup
5
+ FactoryBot.create(:job_template, :job_category => 'cat1')
6
+ FactoryBot.create(:job_template, :job_category => 'cat2')
7
+ FactoryBot.create(:job_template, :job_category => 'cat2')
8
+ end
9
+
10
+ test 'should respond with categories' do
11
+ get :categories, :params => {}, :session => set_session_user
12
+ assert_response :success
13
+ res = JSON.parse @response.body
14
+ assert_equal ['cat1','cat2'], res['job_categories']
15
+ end
16
+ end
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Wizard } from '@patternfly/react-core';
3
+ import { translate as __ } from 'foremanReact/common/I18n';
4
+ import history from 'foremanReact/history';
5
+
6
+ export const JobWizard = () => {
7
+ const steps = [
8
+ {
9
+ name: __('Category and template'),
10
+ component: <p>Category and template</p>,
11
+ },
12
+ { name: __('Target hosts'), component: <p>TargetHosts </p> },
13
+ { name: __('Advanced fields'), component: <p> AdvancedFields </p> },
14
+ { name: __('Schedule'), component: <p>Schedule</p> },
15
+ {
16
+ name: __('Review details'),
17
+ component: <p>ReviewDetails</p>,
18
+ nextButtonText: 'Run',
19
+ },
20
+ ];
21
+ const title = __('Run Job');
22
+ return (
23
+ <Wizard
24
+ onClose={() => history.goBack()}
25
+ navAriaLabel={`${title} steps`}
26
+ steps={steps}
27
+ height="70vh"
28
+ />
29
+ );
30
+ };
31
+
32
+ export default JobWizard;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Title, Divider } from '@patternfly/react-core';
3
+ import { translate as __ } from 'foremanReact/common/I18n';
4
+ import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
5
+ import { JobWizard } from './JobWizard';
6
+
7
+ const JobWizardPage = () => {
8
+ const title = __('Run job');
9
+ const breadcrumbOptions = {
10
+ breadcrumbItems: [
11
+ { caption: __('Jobs'), url: `/jobs` },
12
+ { caption: title },
13
+ ],
14
+ };
15
+ return (
16
+ <PageLayout
17
+ header={title}
18
+ breadcrumbOptions={breadcrumbOptions}
19
+ searchable={false}
20
+ >
21
+ <React.Fragment>
22
+ <Title headingLevel="h2" size="2xl">
23
+ {title}
24
+ </Title>
25
+ <Divider component="div" />
26
+ <JobWizard />
27
+ </React.Fragment>
28
+ </PageLayout>
29
+ );
30
+ };
31
+
32
+ export default JobWizardPage;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import JobWizardPage from '../JobWizard';
3
+
4
+ const ForemanREXRoutes = [
5
+ {
6
+ path: '/experimental/job_wizard',
7
+ exact: true,
8
+ render: props => <JobWizardPage {...props} />,
9
+ },
10
+ ];
11
+
12
+ export default ForemanREXRoutes;
@@ -0,0 +1 @@
1
+ export default { goBack: () => null };
@@ -0,0 +1,4 @@
1
+ import { registerRoutes } from 'foremanReact/routes/RoutingService';
2
+ import routes from './Routes/routes';
3
+
4
+ registerRoutes('foreman_remote_execution', routes);
@@ -39,7 +39,7 @@ const TargetingHostsPage = ({
39
39
  <br />
40
40
  <TargetingHosts apiStatus={apiStatus} items={items} />
41
41
  <Pagination
42
- viewType="list"
42
+ viewType="table"
43
43
  itemCount={totalHosts}
44
44
  pagination={pagination}
45
45
  onChange={args => handlePagination(args)}
@@ -1,6 +1,3 @@
1
- .targeting-hosts-pagination {
2
- margin-top: -7px;
3
- }
4
1
  #targeting_hosts {
5
2
  min-height: 350px;
6
3
  }
@@ -62,7 +62,7 @@ exports[`TargetingHostsPage renders 1`] = `
62
62
  "perPage": 20,
63
63
  }
64
64
  }
65
- viewType="list"
65
+ viewType="table"
66
66
  />
67
67
  </div>
68
68
  `;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_remote_execution
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-09 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 0.15.1
67
+ version: 4.0.0
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 0.15.1
74
+ version: 4.0.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: factory_bot_rails
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -86,20 +86,6 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 4.8.0
89
- - !ruby/object:Gem::Dependency
90
- name: rubocop
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: 0.80.0
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: 0.80.0
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: rdoc
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -127,8 +113,10 @@ files:
127
113
  - ".babelrc.js"
128
114
  - ".eslintignore"
129
115
  - ".eslintrc"
130
- - ".github/workflows/ci.yml"
116
+ - ".github/workflows/js_ci.yml"
117
+ - ".github/workflows/ruby_ci.yml"
131
118
  - ".gitignore"
119
+ - ".prettierrc"
132
120
  - ".rubocop.yml"
133
121
  - ".rubocop_todo.yml"
134
122
  - ".tx/config"
@@ -160,6 +148,7 @@ files:
160
148
  - app/controllers/job_templates_controller.rb
161
149
  - app/controllers/remote_execution_features_controller.rb
162
150
  - app/controllers/template_invocations_controller.rb
151
+ - app/controllers/ui_job_wizard_controller.rb
163
152
  - app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
164
153
  - app/helpers/concerns/foreman_remote_execution/job_templates_extensions.rb
165
154
  - app/helpers/job_invocation_output_helper.rb
@@ -385,6 +374,7 @@ files:
385
374
  - test/functional/cockpit_controller_test.rb
386
375
  - test/functional/job_invocations_controller_test.rb
387
376
  - test/functional/job_templates_controller_test.rb
377
+ - test/functional/ui_job_wizard_controller_test.rb
388
378
  - test/helpers/remote_execution_helper_test.rb
389
379
  - test/models/orchestration/ssh_test.rb
390
380
  - test/support/remote_execution_helper.rb
@@ -405,13 +395,18 @@ files:
405
395
  - test/unit/renderer_scope_input.rb
406
396
  - test/unit/targeting_test.rb
407
397
  - test/unit/template_invocation_input_value_test.rb
398
+ - webpack/JobWizard/JobWizard.js
399
+ - webpack/JobWizard/index.js
400
+ - webpack/Routes/routes.js
408
401
  - webpack/__mocks__/foremanReact/common/I18n.js
409
402
  - webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
410
403
  - webpack/__mocks__/foremanReact/components/SearchBar.js
411
404
  - webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js
412
405
  - webpack/__mocks__/foremanReact/constants.js
406
+ - webpack/__mocks__/foremanReact/history.js
413
407
  - webpack/__mocks__/foremanReact/redux/API/APISelectors.js
414
408
  - webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware/IntervalSelectors.js
409
+ - webpack/global_index.js
415
410
  - webpack/index.js
416
411
  - webpack/react_app/components/TargetingHosts/TargetingHosts.js
417
412
  - webpack/react_app/components/TargetingHosts/TargetingHostsConsts.js
@@ -480,6 +475,7 @@ test_files:
480
475
  - test/functional/cockpit_controller_test.rb
481
476
  - test/functional/job_invocations_controller_test.rb
482
477
  - test/functional/job_templates_controller_test.rb
478
+ - test/functional/ui_job_wizard_controller_test.rb
483
479
  - test/helpers/remote_execution_helper_test.rb
484
480
  - test/models/orchestration/ssh_test.rb
485
481
  - test/support/remote_execution_helper.rb