foreman_remote_execution 4.4.0 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/job_invocations_controller.rb +13 -24
- data/app/controllers/job_templates_controller.rb +4 -4
- data/app/controllers/ui_job_wizard_controller.rb +12 -0
- data/app/helpers/job_invocations_helper.rb +2 -2
- data/app/helpers/remote_execution_helper.rb +8 -8
- data/app/lib/actions/remote_execution/run_host_job.rb +31 -5
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +5 -5
- data/app/models/host_status/execution_status.rb +5 -5
- data/app/models/job_invocation.rb +23 -7
- data/app/models/job_invocation_composer.rb +59 -17
- data/app/models/ssh_execution_provider.rb +4 -4
- data/app/overrides/execution_interface.rb +8 -8
- data/app/overrides/subnet_proxies.rb +6 -6
- data/config/routes.rb +1 -0
- data/db/migrate/20180110104432_rename_template_invocation_permission.rb +1 -1
- data/db/migrate/20190111153330_remove_remote_execution_without_proxy_setting.rb +4 -4
- data/extra/cockpit/foreman-cockpit-session +6 -6
- data/lib/foreman_remote_execution/engine.rb +11 -6
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/package.json +2 -1
- data/test/functional/api/v2/job_invocations_controller_test.rb +14 -1
- data/test/unit/job_invocation_composer_test.rb +45 -1
- data/webpack/JobWizard/JobWizard.js +59 -18
- data/webpack/JobWizard/JobWizard.scss +3 -1
- data/webpack/JobWizard/JobWizardConstants.js +1 -0
- data/webpack/JobWizard/JobWizardSelectors.js +18 -1
- data/webpack/JobWizard/__tests__/JobWizard.test.js +4 -11
- data/webpack/JobWizard/__tests__/__snapshots__/JobWizard.test.js.snap +0 -51
- data/webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap +43 -0
- data/webpack/JobWizard/__tests__/fixtures.js +26 -0
- data/webpack/JobWizard/__tests__/integration.test.js +156 -0
- data/webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js +93 -0
- data/webpack/JobWizard/steps/AdvancedFields/Fields.js +181 -0
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +25 -0
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap +249 -0
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +34 -2
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js +10 -3
- data/webpack/JobWizard/steps/CategoryAndTemplate/__snapshots__/CategoryAndTemplate.test.js.snap +50 -1
- data/webpack/JobWizard/steps/CategoryAndTemplate/index.js +9 -1
- data/webpack/JobWizard/steps/form/FormHelpers.js +19 -0
- data/webpack/JobWizard/steps/form/GroupedSelectField.js +3 -0
- data/webpack/JobWizard/steps/form/SelectField.js +10 -1
- data/webpack/JobWizard/steps/form/__tests__/__snapshots__/GroupedSelectField.test.js.snap +1 -0
- data/webpack/JobWizard/steps/form/__tests__/__snapshots__/SelectField.test.js.snap +1 -0
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +21 -2
- data/webpack/global_index.js +5 -3
- data/webpack/index.js +3 -0
- data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +1 -5
- data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHostsSelectors.test.js +8 -3
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsSelectors.test.js.snap +7 -2
- data/webpack/react_app/extend/{fills.js → fillRecentJobsCard.js} +7 -6
- data/webpack/react_app/extend/fillregistrationAdvanced.js +11 -0
- data/webpack/react_app/extend/reducers.js +2 -1
- metadata +12 -4
- data/webpack/fills_index.js +0 -11
@@ -8,6 +8,9 @@ import {
|
|
8
8
|
selectJobTemplates,
|
9
9
|
selectJobCategoriesStatus,
|
10
10
|
filterJobTemplates,
|
11
|
+
selectCategoryError,
|
12
|
+
selectAllTemplatesError,
|
13
|
+
selectTemplateError,
|
11
14
|
} from '../../JobWizardSelectors';
|
12
15
|
import { CategoryAndTemplate } from './CategoryAndTemplate';
|
13
16
|
|
@@ -41,7 +44,6 @@ const ConnectedCategoryAndTemplate = ({
|
|
41
44
|
}, [jobCategoriesStatus, dispatch, setCategory]);
|
42
45
|
|
43
46
|
const jobCategories = useSelector(selectJobCategories);
|
44
|
-
|
45
47
|
useEffect(() => {
|
46
48
|
if (category) {
|
47
49
|
const templatesUrlObject = new URI(templatesUrl);
|
@@ -63,6 +65,11 @@ const ConnectedCategoryAndTemplate = ({
|
|
63
65
|
|
64
66
|
const jobTemplates = useSelector(selectJobTemplates);
|
65
67
|
|
68
|
+
const errors = {
|
69
|
+
categoryError: useSelector(selectCategoryError),
|
70
|
+
allTemplatesError: useSelector(selectAllTemplatesError),
|
71
|
+
templateError: useSelector(selectTemplateError),
|
72
|
+
};
|
66
73
|
return (
|
67
74
|
<CategoryAndTemplate
|
68
75
|
jobTemplates={jobTemplates}
|
@@ -71,6 +78,7 @@ const ConnectedCategoryAndTemplate = ({
|
|
71
78
|
selectedTemplateID={jobTemplate}
|
72
79
|
setCategory={setCategory}
|
73
80
|
selectedCategory={category}
|
81
|
+
errors={errors}
|
74
82
|
/>
|
75
83
|
);
|
76
84
|
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Popover } from '@patternfly/react-core';
|
3
|
+
import { HelpIcon } from '@patternfly/react-icons';
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
|
6
|
+
export const helpLabel = (text, id) => {
|
7
|
+
if (!text) return null;
|
8
|
+
return (
|
9
|
+
<Popover id={`${id}-help`} bodyContent={text} aria-label="help-text">
|
10
|
+
<button
|
11
|
+
aria-label={__('open-help-tooltip-button')}
|
12
|
+
onClick={e => e.preventDefault()}
|
13
|
+
className="pf-c-form__group-label-help"
|
14
|
+
>
|
15
|
+
<HelpIcon noVerticalAlign />
|
16
|
+
</button>
|
17
|
+
</Popover>
|
18
|
+
);
|
19
|
+
};
|
@@ -14,6 +14,7 @@ export const GroupedSelectField = ({
|
|
14
14
|
groups,
|
15
15
|
selected,
|
16
16
|
setSelected,
|
17
|
+
...props
|
17
18
|
}) => {
|
18
19
|
const [isOpen, setIsOpen] = useState(false);
|
19
20
|
const onSelect = selection => {
|
@@ -67,6 +68,8 @@ export const GroupedSelectField = ({
|
|
67
68
|
selections={selected}
|
68
69
|
className="without_select2"
|
69
70
|
onClear={onClear}
|
71
|
+
menuAppendTo={() => document.body}
|
72
|
+
{...props}
|
70
73
|
>
|
71
74
|
{options}
|
72
75
|
</Select>
|
@@ -2,7 +2,14 @@ import React, { useState } from 'react';
|
|
2
2
|
import { FormGroup, Select, SelectOption } from '@patternfly/react-core';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
|
5
|
-
export const SelectField = ({
|
5
|
+
export const SelectField = ({
|
6
|
+
label,
|
7
|
+
fieldId,
|
8
|
+
options,
|
9
|
+
value,
|
10
|
+
setValue,
|
11
|
+
...props
|
12
|
+
}) => {
|
6
13
|
const onSelect = (event, selection) => {
|
7
14
|
setValue(selection);
|
8
15
|
setIsOpen(false);
|
@@ -17,6 +24,8 @@ export const SelectField = ({ label, fieldId, options, value, setValue }) => {
|
|
17
24
|
isOpen={isOpen}
|
18
25
|
className="without_select2"
|
19
26
|
maxHeight="45vh"
|
27
|
+
menuAppendTo={() => document.body}
|
28
|
+
{...props}
|
20
29
|
>
|
21
30
|
{options.map((option, index) => (
|
22
31
|
<SelectOption key={index} value={option} />
|
@@ -1,2 +1,21 @@
|
|
1
|
-
export const
|
2
|
-
export const
|
1
|
+
export const selectAPI = state => state;
|
2
|
+
export const selectAPIByKey = (state, key) => selectAPI(state)[key] || {};
|
3
|
+
|
4
|
+
export const selectAPIStatus = (state, key) =>
|
5
|
+
selectAPIByKey(state, key).status;
|
6
|
+
|
7
|
+
export const selectAPIPayload = (state, key) =>
|
8
|
+
selectAPIByKey(state, key).payload || {};
|
9
|
+
|
10
|
+
export const selectAPIResponse = (state, key) =>
|
11
|
+
selectAPIByKey(state, key).response || {};
|
12
|
+
|
13
|
+
export const selectAPIError = (state, key) =>
|
14
|
+
selectAPIStatus(state, key) === 'ERROR'
|
15
|
+
? selectAPIResponse(state, key)
|
16
|
+
: null;
|
17
|
+
|
18
|
+
export const selectAPIErrorMessage = (state, key) => {
|
19
|
+
const error = selectAPIError(state, key);
|
20
|
+
return error && error.message;
|
21
|
+
};
|
data/webpack/global_index.js
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
import { registerRoutes } from 'foremanReact/routes/RoutingService';
|
2
2
|
import routes from './Routes/routes';
|
3
|
+
import fillregistrationAdvanced from './react_app/extend/fillregistrationAdvanced';
|
4
|
+
import fillRecentJobsCard from './react_app/extend/fillRecentJobsCard';
|
3
5
|
import registerReducers from './react_app/extend/reducers';
|
4
|
-
import registerFills from './react_app/extend/fills';
|
5
6
|
|
6
|
-
registerRoutes('foreman_remote_execution', routes);
|
7
7
|
registerReducers();
|
8
|
-
|
8
|
+
registerRoutes('foreman_remote_execution', routes);
|
9
|
+
fillRecentJobsCard();
|
10
|
+
fillregistrationAdvanced();
|
data/webpack/index.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
import componentRegistry from 'foremanReact/components/componentRegistry';
|
2
2
|
import JobInvocationContainer from './react_app/components/jobInvocations';
|
3
3
|
import TargetingHosts from './react_app/components/TargetingHosts';
|
4
|
+
import registerReducers from './react_app/extend/reducers';
|
5
|
+
|
6
|
+
registerReducers();
|
4
7
|
|
5
8
|
const components = [
|
6
9
|
{ name: 'JobInvocationContainer', type: JobInvocationContainer },
|
@@ -6,15 +6,11 @@ import Skeleton from 'react-loading-skeleton';
|
|
6
6
|
import ElipsisWithTooltip from 'react-ellipsis-with-tooltip';
|
7
7
|
|
8
8
|
import { Grid, GridItem } from '@patternfly/react-core';
|
9
|
-
import {
|
10
|
-
OkIcon,
|
11
|
-
ErrorCircleOIcon,
|
12
|
-
} from '@patternfly/react-icons/dist/js/icons';
|
13
9
|
import {
|
14
10
|
PropertiesSidePanel,
|
15
11
|
PropertyItem,
|
16
12
|
} from '@patternfly/react-catalog-view-extension';
|
17
|
-
import { ArrowIcon } from '@patternfly/react-icons';
|
13
|
+
import { ArrowIcon, ErrorCircleOIcon, OkIcon } from '@patternfly/react-icons';
|
18
14
|
|
19
15
|
import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
|
20
16
|
import CardItem from 'foremanReact/components/HostDetails/Templates/CardItem/CardTemplate';
|
@@ -9,9 +9,14 @@ import {
|
|
9
9
|
} from '../TargetingHostsSelectors';
|
10
10
|
|
11
11
|
const state = {
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
TARGETING_HOSTS: {
|
13
|
+
status: 'RESOLVED',
|
14
|
+
response: {
|
15
|
+
hosts: [1, 2],
|
16
|
+
total_hosts: 2,
|
17
|
+
autoRefresh: 'true',
|
18
|
+
},
|
19
|
+
},
|
15
20
|
};
|
16
21
|
|
17
22
|
const fixtures = {
|
@@ -4,8 +4,13 @@ exports[`TargetingHostsSelectors should return apiStatus 1`] = `"RESOLVED"`;
|
|
4
4
|
|
5
5
|
exports[`TargetingHostsSelectors should return autoRefresh 1`] = `"true"`;
|
6
6
|
|
7
|
-
exports[`TargetingHostsSelectors should return hosts 1`] = `
|
7
|
+
exports[`TargetingHostsSelectors should return hosts 1`] = `
|
8
|
+
Array [
|
9
|
+
1,
|
10
|
+
2,
|
11
|
+
]
|
12
|
+
`;
|
8
13
|
|
9
14
|
exports[`TargetingHostsSelectors should return intervalExists 1`] = `false`;
|
10
15
|
|
11
|
-
exports[`TargetingHostsSelectors should return totalHosts 1`] = `
|
16
|
+
exports[`TargetingHostsSelectors should return totalHosts 1`] = `2`;
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
2
2
|
import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
|
3
3
|
import RecentJobsCard from '../components/RecentJobsCard';
|
4
4
|
|
5
|
-
export default
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
export default () =>
|
6
|
+
addGlobalFill(
|
7
|
+
'details-cards',
|
8
|
+
'rex-host-details-latest-jobs',
|
9
|
+
<RecentJobsCard />,
|
10
|
+
1000
|
11
|
+
);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
|
3
|
+
import RexInterface from '../components/RegistrationExtension/RexInterface';
|
4
|
+
|
5
|
+
export default () =>
|
6
|
+
addGlobalFill(
|
7
|
+
'registrationAdvanced',
|
8
|
+
'foreman-remote-exectuion-rex-interface',
|
9
|
+
<RexInterface key="registration-rex-interface" />,
|
10
|
+
100
|
11
|
+
);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { registerReducer } from 'foremanReact/common/MountingService';
|
2
2
|
import rootReducer from '../redux/reducers';
|
3
3
|
|
4
|
-
export default
|
4
|
+
export default () =>
|
5
|
+
registerReducer('foremanRemoteExecutionReducers', rootReducer);
|
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.
|
4
|
+
version: 4.5.0
|
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: 2021-05-
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -406,11 +406,19 @@ files:
|
|
406
406
|
- webpack/JobWizard/JobWizardSelectors.js
|
407
407
|
- webpack/JobWizard/__tests__/JobWizard.test.js
|
408
408
|
- webpack/JobWizard/__tests__/__snapshots__/JobWizard.test.js.snap
|
409
|
+
- webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap
|
410
|
+
- webpack/JobWizard/__tests__/fixtures.js
|
411
|
+
- webpack/JobWizard/__tests__/integration.test.js
|
409
412
|
- webpack/JobWizard/index.js
|
413
|
+
- webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js
|
414
|
+
- webpack/JobWizard/steps/AdvancedFields/Fields.js
|
415
|
+
- webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js
|
416
|
+
- webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap
|
410
417
|
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js
|
411
418
|
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js
|
412
419
|
- webpack/JobWizard/steps/CategoryAndTemplate/__snapshots__/CategoryAndTemplate.test.js.snap
|
413
420
|
- webpack/JobWizard/steps/CategoryAndTemplate/index.js
|
421
|
+
- webpack/JobWizard/steps/form/FormHelpers.js
|
414
422
|
- webpack/JobWizard/steps/form/GroupedSelectField.js
|
415
423
|
- webpack/JobWizard/steps/form/SelectField.js
|
416
424
|
- webpack/JobWizard/steps/form/__tests__/GroupedSelectField.test.js
|
@@ -429,7 +437,6 @@ files:
|
|
429
437
|
- webpack/__mocks__/foremanReact/redux/API/index.js
|
430
438
|
- webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware/IntervalSelectors.js
|
431
439
|
- webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
|
432
|
-
- webpack/fills_index.js
|
433
440
|
- webpack/global_index.js
|
434
441
|
- webpack/index.js
|
435
442
|
- webpack/react_app/components/RecentJobsCard/RecentJobsCard.js
|
@@ -462,7 +469,8 @@ files:
|
|
462
469
|
- webpack/react_app/components/jobInvocations/AggregateStatus/index.js
|
463
470
|
- webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js
|
464
471
|
- webpack/react_app/components/jobInvocations/index.js
|
465
|
-
- webpack/react_app/extend/
|
472
|
+
- webpack/react_app/extend/fillRecentJobsCard.js
|
473
|
+
- webpack/react_app/extend/fillregistrationAdvanced.js
|
466
474
|
- webpack/react_app/extend/reducers.js
|
467
475
|
- webpack/react_app/redux/actions/jobInvocations/index.js
|
468
476
|
- webpack/react_app/redux/consts.js
|
data/webpack/fills_index.js
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
|
3
|
-
|
4
|
-
import RexInterface from './react_app/components/RegistrationExtension/RexInterface';
|
5
|
-
|
6
|
-
addGlobalFill(
|
7
|
-
'registrationAdvanced',
|
8
|
-
'foreman-remote-exectuion-rex-interface',
|
9
|
-
<RexInterface key="registration-rex-interface" />,
|
10
|
-
100
|
11
|
-
);
|