foreman_remote_execution 4.5.1 → 4.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/ui_job_wizard_controller.rb +7 -0
  3. data/app/helpers/remote_execution_helper.rb +5 -1
  4. data/app/views/templates/ssh/module_action.erb +1 -0
  5. data/app/views/templates/ssh/puppet_run_once.erb +1 -0
  6. data/lib/foreman_remote_execution/version.rb +1 -1
  7. data/webpack/JobWizard/JobWizard.js +28 -8
  8. data/webpack/JobWizard/JobWizard.scss +39 -0
  9. data/webpack/JobWizard/JobWizardConstants.js +10 -0
  10. data/webpack/JobWizard/JobWizardSelectors.js +9 -0
  11. data/webpack/JobWizard/__tests__/fixtures.js +104 -2
  12. data/webpack/JobWizard/__tests__/integration.test.js +13 -85
  13. data/webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js +21 -4
  14. data/webpack/JobWizard/steps/AdvancedFields/DescriptionField.js +67 -0
  15. data/webpack/JobWizard/steps/AdvancedFields/Fields.js +73 -59
  16. data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +135 -16
  17. data/webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js +23 -0
  18. data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js +122 -51
  19. data/webpack/JobWizard/steps/Schedule/QueryType.js +48 -0
  20. data/webpack/JobWizard/steps/Schedule/RepeatOn.js +61 -0
  21. data/webpack/JobWizard/steps/Schedule/ScheduleType.js +25 -0
  22. data/webpack/JobWizard/steps/Schedule/StartEndDates.js +51 -0
  23. data/webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js +22 -0
  24. data/webpack/JobWizard/steps/Schedule/index.js +41 -0
  25. data/webpack/JobWizard/steps/form/FormHelpers.js +1 -0
  26. data/webpack/JobWizard/steps/form/Formatter.js +149 -0
  27. data/webpack/JobWizard/steps/form/NumberInput.js +33 -0
  28. data/webpack/JobWizard/steps/form/SelectField.js +14 -2
  29. data/webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example +76 -0
  30. data/webpack/__mocks__/foremanReact/components/SearchBar.js +18 -1
  31. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -0
  32. metadata +13 -10
  33. data/webpack/JobWizard/__tests__/JobWizard.test.js +0 -13
  34. data/webpack/JobWizard/__tests__/__snapshots__/JobWizard.test.js.snap +0 -32
  35. data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap +0 -249
  36. data/webpack/JobWizard/steps/CategoryAndTemplate/__snapshots__/CategoryAndTemplate.test.js.snap +0 -113
  37. data/webpack/JobWizard/steps/form/__tests__/GroupedSelectField.test.js +0 -38
  38. data/webpack/JobWizard/steps/form/__tests__/SelectField.test.js +0 -23
  39. data/webpack/JobWizard/steps/form/__tests__/__snapshots__/GroupedSelectField.test.js.snap +0 -37
  40. data/webpack/JobWizard/steps/form/__tests__/__snapshots__/SelectField.test.js.snap +0 -23
@@ -1,249 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AdvancedFields rendring 1`] = `
4
- <Provider
5
- store={
6
- Object {
7
- "clearActions": [Function],
8
- "dispatch": [Function],
9
- "getActions": [Function],
10
- "getState": [Function],
11
- "replaceReducer": [Function],
12
- "subscribe": [Function],
13
- }
14
- }
15
- >
16
- <AdvancedFields
17
- advancedValues={Object {}}
18
- setAdvancedValues={[MockFunction]}
19
- >
20
- <Title
21
- className="advanced-fields-title"
22
- headingLevel="h2"
23
- >
24
- <h2
25
- className="pf-c-title pf-m-xl advanced-fields-title"
26
- >
27
- Advanced Fields
28
- </h2>
29
- </Title>
30
- <Form>
31
- <form
32
- className="pf-c-form"
33
- noValidate={true}
34
- >
35
- <EffectiveUserField
36
- setValue={[Function]}
37
- value=""
38
- >
39
- <mockConstructor
40
- fieldId="effective-user"
41
- label="Effective user"
42
- labelIcon={
43
- <Popover
44
- aria-label="help-text"
45
- bodyContent="A user to be used for executing the script. If it differs from the SSH user, su or sudo is used to switch the accounts."
46
- id="effective-user-help"
47
- >
48
- <button
49
- aria-label="open-help-tooltip-button"
50
- className="pf-c-form__group-label-help"
51
- onClick={[Function]}
52
- >
53
- <HelpIcon
54
- color="currentColor"
55
- noVerticalAlign={true}
56
- size="sm"
57
- />
58
- </button>
59
- </Popover>
60
- }
61
- >
62
- <div />
63
- </mockConstructor>
64
- </EffectiveUserField>
65
- <TimeoutToKillField
66
- setValue={[Function]}
67
- value=""
68
- >
69
- <mockConstructor
70
- fieldId="timeout-to-kill"
71
- label="Timeout to kill"
72
- labelIcon={
73
- <Popover
74
- aria-label="help-text"
75
- bodyContent="Time in seconds from the start on the remote host after which the job should be killed."
76
- id="timeout-to-kill-help"
77
- >
78
- <button
79
- aria-label="open-help-tooltip-button"
80
- className="pf-c-form__group-label-help"
81
- onClick={[Function]}
82
- >
83
- <HelpIcon
84
- color="currentColor"
85
- noVerticalAlign={true}
86
- size="sm"
87
- />
88
- </button>
89
- </Popover>
90
- }
91
- >
92
- <div />
93
- </mockConstructor>
94
- </TimeoutToKillField>
95
- <PasswordField
96
- setValue={[Function]}
97
- value=""
98
- >
99
- <mockConstructor
100
- fieldId="password"
101
- label="Password"
102
- labelIcon={
103
- <Popover
104
- aria-label="help-text"
105
- bodyContent="Password is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
106
- id="password-help"
107
- >
108
- <button
109
- aria-label="open-help-tooltip-button"
110
- className="pf-c-form__group-label-help"
111
- onClick={[Function]}
112
- >
113
- <HelpIcon
114
- color="currentColor"
115
- noVerticalAlign={true}
116
- size="sm"
117
- />
118
- </button>
119
- </Popover>
120
- }
121
- >
122
- <div />
123
- </mockConstructor>
124
- </PasswordField>
125
- <KeyPassphraseField
126
- setValue={[Function]}
127
- value=""
128
- >
129
- <mockConstructor
130
- fieldId="key-passphrase"
131
- label="Private key passphrase"
132
- labelIcon={
133
- <Popover
134
- aria-label="help-text"
135
- bodyContent="Key passphrase is only applicable for SSH provider. Other providers ignore this field. Passphrase is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
136
- id="key-passphrase-help"
137
- >
138
- <button
139
- aria-label="open-help-tooltip-button"
140
- className="pf-c-form__group-label-help"
141
- onClick={[Function]}
142
- >
143
- <HelpIcon
144
- color="currentColor"
145
- noVerticalAlign={true}
146
- size="sm"
147
- />
148
- </button>
149
- </Popover>
150
- }
151
- >
152
- <div />
153
- </mockConstructor>
154
- </KeyPassphraseField>
155
- <EffectiveUserPasswordField
156
- setValue={[Function]}
157
- value=""
158
- >
159
- <mockConstructor
160
- fieldId="effective-user-password"
161
- label="Effective user password"
162
- labelIcon={
163
- <Popover
164
- aria-label="help-text"
165
- bodyContent="Effective user password is only applicable for SSH provider. Other providers ignore this field. Password is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
166
- id="effective-user-password-help"
167
- >
168
- <button
169
- aria-label="open-help-tooltip-button"
170
- className="pf-c-form__group-label-help"
171
- onClick={[Function]}
172
- >
173
- <HelpIcon
174
- color="currentColor"
175
- noVerticalAlign={true}
176
- size="sm"
177
- />
178
- </button>
179
- </Popover>
180
- }
181
- >
182
- <div />
183
- </mockConstructor>
184
- </EffectiveUserPasswordField>
185
- <ConcurrencyLevelField
186
- setValue={[Function]}
187
- value=""
188
- >
189
- <mockConstructor
190
- fieldId="concurrency-level"
191
- label="Concurrency level"
192
- labelIcon={
193
- <Popover
194
- aria-label="help-text"
195
- bodyContent="Run at most N tasks at a time. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1."
196
- id="concurrency-level-help"
197
- >
198
- <button
199
- aria-label="open-help-tooltip-button"
200
- className="pf-c-form__group-label-help"
201
- onClick={[Function]}
202
- >
203
- <HelpIcon
204
- color="currentColor"
205
- noVerticalAlign={true}
206
- size="sm"
207
- />
208
- </button>
209
- </Popover>
210
- }
211
- >
212
- <div />
213
- </mockConstructor>
214
- </ConcurrencyLevelField>
215
- <TimeSpanLevelField
216
- setValue={[Function]}
217
- value=""
218
- >
219
- <mockConstructor
220
- fieldId="time-span"
221
- label="Time span"
222
- labelIcon={
223
- <Popover
224
- aria-label="help-text"
225
- bodyContent="Distribute execution over N seconds. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1."
226
- id="time-span-help"
227
- >
228
- <button
229
- aria-label="open-help-tooltip-button"
230
- className="pf-c-form__group-label-help"
231
- onClick={[Function]}
232
- >
233
- <HelpIcon
234
- color="currentColor"
235
- noVerticalAlign={true}
236
- size="sm"
237
- />
238
- </button>
239
- </Popover>
240
- }
241
- >
242
- <div />
243
- </mockConstructor>
244
- </TimeSpanLevelField>
245
- </form>
246
- </Form>
247
- </AdvancedFields>
248
- </Provider>
249
- `;
@@ -1,113 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`CategoryAndTemplate rendering render with error 1`] = `
4
- <Fragment>
5
- <Title
6
- headingLevel="h2"
7
- >
8
- Category and Template
9
- </Title>
10
- <Text
11
- component="p"
12
- >
13
- All fields are required.
14
- </Text>
15
- <Form>
16
- <SelectField
17
- fieldId="job_category"
18
- isDisabled={false}
19
- label="Job category"
20
- options={Array []}
21
- placeholderText=""
22
- setValue={[Function]}
23
- value={null}
24
- />
25
- <GroupedSelectField
26
- fieldId="job_template"
27
- groups={Array []}
28
- isDisabled={true}
29
- label="Job template"
30
- placeholderText="Error"
31
- selected={null}
32
- setSelected={[MockFunction]}
33
- />
34
- <Alert
35
- title="Errors:"
36
- variant="danger"
37
- >
38
- <span>
39
- Templates list failed with:
40
-
41
- I have an error
42
- </span>
43
- </Alert>
44
- </Form>
45
- </Fragment>
46
- `;
47
-
48
- exports[`CategoryAndTemplate rendering renders with props 1`] = `
49
- <Fragment>
50
- <Title
51
- headingLevel="h2"
52
- >
53
- Category and Template
54
- </Title>
55
- <Text
56
- component="p"
57
- >
58
- All fields are required.
59
- </Text>
60
- <Form>
61
- <SelectField
62
- fieldId="job_category"
63
- isDisabled={false}
64
- label="Job category"
65
- options={
66
- Array [
67
- "Commands",
68
- "Ansible Playbook",
69
- "Ansible Galaxy",
70
- "Ansible Roles Installation",
71
- ]
72
- }
73
- placeholderText=""
74
- setValue={[Function]}
75
- value="I am a category"
76
- />
77
- <GroupedSelectField
78
- fieldId="job_template"
79
- groups={
80
- Array [
81
- Object {
82
- "groupLabel": "SSH",
83
- "options": Array [
84
- Object {
85
- "label": "ab Run Command - SSH Default clone",
86
- "value": 190,
87
- },
88
- ],
89
- },
90
- Object {
91
- "groupLabel": "Ansible",
92
- "options": Array [
93
- Object {
94
- "label": "Ansible Roles - Ansible Default",
95
- "value": 168,
96
- },
97
- Object {
98
- "label": "Ansible Roles - Install from git",
99
- "value": 170,
100
- },
101
- ],
102
- },
103
- ]
104
- }
105
- isDisabled={false}
106
- label="Job template"
107
- placeholderText=""
108
- selected="ab Run Command - SSH Default clone"
109
- setSelected={[MockFunction]}
110
- />
111
- </Form>
112
- </Fragment>
113
- `;
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import * as patternfly from '@patternfly/react-core';
3
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
4
- import { GroupedSelectField } from '../GroupedSelectField';
5
-
6
- jest.spyOn(patternfly, 'Select');
7
- jest.spyOn(patternfly, 'SelectOption');
8
- patternfly.Select.mockImplementation(props => <div>{props}</div>);
9
- patternfly.SelectOption.mockImplementation(props => <div>{props}</div>);
10
-
11
- const fixtures = {
12
- 'renders with props': {
13
- label: 'grouped select',
14
- fieldId: 'field-id',
15
- groups: [
16
- {
17
- groupLabel: 'Ansible',
18
- options: [
19
- {
20
- label: 'Ansible Roles - Ansible Default',
21
- value: 168,
22
- },
23
- {
24
- label: 'Ansible Roles - Install from git',
25
- value: 170,
26
- },
27
- ],
28
- },
29
- ],
30
- selected: 170,
31
- setSelected: jest.fn(),
32
- },
33
- };
34
-
35
- describe('GroupedSelectField', () => {
36
- describe('rendering', () =>
37
- testComponentSnapshotsWithFixtures(GroupedSelectField, fixtures));
38
- });
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import * as patternfly from '@patternfly/react-core';
3
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
4
- import { SelectField } from '../SelectField';
5
-
6
- jest.spyOn(patternfly, 'Select');
7
- jest.spyOn(patternfly, 'SelectOption');
8
- patternfly.Select.mockImplementation(props => <div>{props}</div>);
9
- patternfly.SelectOption.mockImplementation(props => <div>{props}</div>);
10
- const fixtures = {
11
- 'renders with props': {
12
- label: 'grouped select',
13
- fieldId: 'field-id',
14
- options: ['Commands'],
15
- value: 'Commands',
16
- setValue: jest.fn(),
17
- },
18
- };
19
-
20
- describe('SelectField', () => {
21
- describe('rendering', () =>
22
- testComponentSnapshotsWithFixtures(SelectField, fixtures));
23
- });
@@ -1,37 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`GroupedSelectField rendering renders with props 1`] = `
4
- <FormGroup
5
- fieldId="field-id"
6
- label="grouped select"
7
- >
8
- <mockConstructor
9
- className="without_select2"
10
- isGrouped={true}
11
- isOpen={false}
12
- menuAppendTo={[Function]}
13
- onClear={[Function]}
14
- onFilter={[Function]}
15
- onSelect={[Function]}
16
- onToggle={[Function]}
17
- selections={170}
18
- variant="typeahead"
19
- >
20
- <SelectGroup
21
- key="0"
22
- label="Ansible"
23
- >
24
- <mockConstructor
25
- key="0"
26
- onClick={[Function]}
27
- value="Ansible Roles - Ansible Default"
28
- />
29
- <mockConstructor
30
- key="1"
31
- onClick={[Function]}
32
- value="Ansible Roles - Install from git"
33
- />
34
- </SelectGroup>
35
- </mockConstructor>
36
- </FormGroup>
37
- `;