Skip to content

Commit 92c8d3f

Browse files
Enhance the workflow entry point modal
1 parent ab2ae8c commit 92c8d3f

File tree

3 files changed

+288
-4
lines changed

3 files changed

+288
-4
lines changed

app/javascript/components/terraform-template-catalog-form/terraform-template-catalog-form.schema.js

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,108 @@ const basicInformationTabSchema = (availableCatalogs, tenantTree, roleAllows, zo
3030
id: 'description',
3131
label: __('Description'),
3232
},
33+
{
34+
component: componentTypes.SELECT,
35+
id: 'provisioning_entry_point_type',
36+
name: 'provisioning_entry_point_type',
37+
label: __('Provisioning Entry Point'),
38+
initialValue: 'embedded_automate',
39+
options: [{ value: 'embedded_automate', label: __('Embedded Automate') }, { value: 'embedded_workflow', label: __('Embedded Workflow') }],
40+
},
41+
{
42+
component: 'embedded-automate-entry-point',
43+
id: 'provisioning_entry_point_automate',
44+
name: 'provisioning_entry_point_automate',
45+
label: 'Provisioning Entry Point',
46+
field: 'fqname',
47+
selected: '',
48+
type: 'provision',
49+
condition: {
50+
when: 'provisioning_entry_point_type',
51+
is: 'embedded_automate',
52+
},
53+
},
54+
{
55+
component: 'embedded-workflow-entry-point',
56+
id: 'provisioning_entry_point_workflow',
57+
name: 'provisioning_entry_point_workflow',
58+
label: 'Provisioning Entry Point',
59+
field: 'fqname',
60+
selected: '',
61+
type: 'provision',
62+
condition: {
63+
when: 'provisioning_entry_point_type',
64+
is: 'embedded_workflow',
65+
},
66+
},
67+
{
68+
component: componentTypes.SELECT,
69+
id: 'reconfigure_entry_point_type',
70+
name: 'reconfigure_entry_point_type',
71+
label: __('Reconfigure Entry Point'),
72+
initialValue: 'embedded_automate',
73+
options: [{ value: 'embedded_automate', label: __('Embedded Automate') }, { value: 'embedded_workflow', label: __('Embedded Workflow') }],
74+
},
75+
{
76+
component: 'embedded-automate-entry-point',
77+
id: 'reconfigure_entry_point_automate',
78+
name: 'recounfigure_entry_point_automate',
79+
label: 'Reconfigure Entry Point',
80+
field: 'fqname',
81+
selected: '',
82+
type: 'provision',
83+
condition: {
84+
when: 'reconfigure_entry_point_type',
85+
is: 'embedded_automate',
86+
},
87+
},
88+
{
89+
component: 'embedded-workflow-entry-point',
90+
id: 'reconfigure_entry_point_workflow',
91+
name: 'reconfigure_entry_point_workflow',
92+
label: 'Reconfigure Entry Point',
93+
field: 'fqname',
94+
selected: '',
95+
type: 'provision',
96+
condition: {
97+
when: 'reconfigure_entry_point_type',
98+
is: 'embedded_workflow',
99+
},
100+
},
101+
{
102+
component: componentTypes.SELECT,
103+
id: 'retirement_entry_point_type',
104+
name: 'retirement_entry_point_type',
105+
label: __('Retirement Entry Point'),
106+
initialValue: 'embedded_automate',
107+
options: [{ value: 'embedded_automate', label: __('Embedded Automate') }, { value: 'embedded_workflow', label: __('Embedded Workflow') }],
108+
},
109+
{
110+
component: 'embedded-automate-entry-point',
111+
id: 'retirement_entry_point_automate',
112+
name: 'retirement_entry_point_automate',
113+
label: 'Retirement Entry Point',
114+
field: 'fqname',
115+
selected: '',
116+
type: 'provision',
117+
condition: {
118+
when: 'retirement_entry_point_type',
119+
is: 'embedded_automate',
120+
},
121+
},
122+
{
123+
component: 'embedded-workflow-entry-point',
124+
id: 'retirement_entry_point_workflow',
125+
name: 'retirement_entry_point_workflow',
126+
label: 'Retirement Entry Point',
127+
field: 'fqname',
128+
selected: '',
129+
type: 'provision',
130+
condition: {
131+
when: 'retirement_entry_point_type',
132+
is: 'embedded_workflow',
133+
},
134+
},
33135
{
34136
component: componentTypes.CHECKBOX,
35137
name: 'display',
@@ -198,6 +300,14 @@ const provisionTabSchema = (
198300
label: __('Verbosity'),
199301
options: transformObjectToSelectOptions(verbosityTypes),
200302
},
303+
{
304+
component: 'key-value-list',
305+
id: 'config_info.provision.extra_vars',
306+
name: 'config_info.provision.extra_vars',
307+
label: __('Variables & Default Values'),
308+
keyLabel: __('Variable'),
309+
valueLabel: __('Default value'),
310+
},
201311
{
202312
component: componentTypes.RADIO,
203313
id: 'config_info.provision.dialog_type',
@@ -237,6 +347,159 @@ const provisionTabSchema = (
237347
return schema;
238348
};
239349

350+
// const retirementTabSchema = (
351+
// repositories,
352+
// setData,
353+
// retirementRepositoryId,
354+
// currentRegion,
355+
// retirementEsclationDisplay,
356+
// cloudTypes,
357+
// retirementCloudType,
358+
// logOutputTypes,
359+
// verbosityTypes
360+
// ) => {
361+
// const schema = {
362+
// component: componentTypes.TAB_ITEM,
363+
// id: 'retirement-tab',
364+
// name: 'retirement-tab',
365+
// label: __('Retirement'),
366+
// fields: [
367+
// {
368+
// component: 'copy-from-provisioning',
369+
// id: 'config_info.retirement.copyFromProvisioning',
370+
// name: 'config_info.retirement.copyFromProvisioning',
371+
// label: __('Copy from Provisioning'),
372+
// copyFrom: ['repository_id', 'configuration_script_payload_id', 'credential_id', 'cloud_type'],
373+
// copyTo: ['repository_id', 'configuration_script_payload_id', 'credential_id', 'cloud_type'],
374+
// },
375+
// {
376+
// component: componentTypes.SELECT,
377+
// id: 'config_info.retirement.repository_id',
378+
// name: 'config_info.retirement.repository_id',
379+
// label: __('Repository'),
380+
// options: transformGeneralOptions(repositories),
381+
// includeEmpty: true,
382+
// onChange: (repositoryId) => setData((state) => ({ ...state, retirementRepositoryId: repositoryId })),
383+
// },
384+
// {
385+
// component: componentTypes.SELECT,
386+
// id: 'config_info.retirement.configuration_script_payload_id',
387+
// name: 'config_info.retirement.configuration_script_payload_id',
388+
// label: __('Template'),
389+
// loadOptions: () => (retirementRepositoryId ? loadRepositoryOptions(retirementRepositoryId, currentRegion) : Promise.resolve([])),
390+
// condition: {
391+
// when: 'config_info.retirement.repository_id',
392+
// isNotEmpty: true,
393+
// },
394+
// key: `${retirementRepositoryId}-retirement-payload_id`,
395+
// validateOnMount: true,
396+
// validate: [{ type: 'customValidatorForRetirementFields' }],
397+
// includeEmpty: true,
398+
// },
399+
// {
400+
// component: 'conditional-checkbox',
401+
// id: 'config_info.retirement.become_method',
402+
// name: 'config_info.retirement.become_method',
403+
// label: __('Escalate Privilege'),
404+
// display: retirementEsclationDisplay,
405+
// },
406+
// {
407+
// component: componentTypes.SELECT,
408+
// id: 'config_info.retirement.cloud_type',
409+
// name: 'config_info.retirement.cloud_type',
410+
// label: __('Cloud Type'),
411+
// options: transformcloudTypesOptions(cloudTypes),
412+
// onChange: (cloudType) => setData((state) => ({ ...state, retirementCloudType: cloudType })),
413+
// includeEmpty: true,
414+
// condition: {
415+
// when: 'config_info.retirement.repository_id',
416+
// isNotEmpty: true,
417+
// },
418+
// },
419+
// {
420+
// component: componentTypes.SELECT,
421+
// id: 'config_info.retirement.credential_id',
422+
// name: 'config_info.retirement.credential_id',
423+
// label: __('Credential'),
424+
// options: transformcloudTypesOptions(cloudTypes),
425+
// loadOptions: () => (retirementCloudType ? loadCloudCredentialOptions(retirementCloudType) : Promise.resolve([])),
426+
// key: `${retirementCloudType}-retirement-cloud-credentail-id`,
427+
// includeEmpty: true,
428+
// condition: {
429+
// and: [
430+
// {
431+
// when: 'config_info.retirement.cloud_type',
432+
// isNotEmpty: true,
433+
// },
434+
// {
435+
// when: 'config_info.retirement.repository_id',
436+
// isNotEmpty: true,
437+
// },
438+
// ],
439+
// },
440+
// },
441+
// {
442+
// component: componentTypes.TEXT_FIELD,
443+
// id: 'config_info.retirement.execution_ttl',
444+
// name: 'config_info.retirement.execution_ttl',
445+
// label: __('Max TTL (mins)'),
446+
// dataType: 'number',
447+
// },
448+
// {
449+
// component: componentTypes.SELECT,
450+
// id: 'config_info.retirement.log_output',
451+
// name: 'config_info.retirement.log_output',
452+
// label: __('Logging Output'),
453+
// options: transformObjectToSelectOptions(logOutputTypes),
454+
// },
455+
// {
456+
// component: componentTypes.SELECT,
457+
// id: 'config_info.retirement.verbosity',
458+
// name: 'config_info.retirement.verbosity',
459+
// label: __('Verbosity'),
460+
// options: transformObjectToSelectOptions(verbosityTypes),
461+
// },
462+
// {
463+
// component: componentTypes.SELECT,
464+
// id: 'config_info.retirement.remove_resources',
465+
// name: 'config_info.retirement.remove_resources',
466+
// label: __('Remove resources?'),
467+
// options: [
468+
// { label: 'No', value: 'no_with_playbook' },
469+
// { label: 'Before Template runs', value: 'pre_with_playbook' },
470+
// { label: 'After Template runs', value: "post_with_playbook'" },
471+
// ],
472+
// condition: {
473+
// when: 'config_info.retirement.repository_id',
474+
// isNotEmpty: true,
475+
// },
476+
// },
477+
// {
478+
// component: componentTypes.SELECT,
479+
// id: 'config_info.retirement.remove_resources_with_no_repistory_id',
480+
// name: 'config_info.retirement.remove_resources_with_no_repistory_id',
481+
// label: __('Remove resources?'),
482+
// options: [
483+
// { label: 'No', value: 'no_without_playbook' },
484+
// { label: 'Yes', value: 'yes_without_playbook' },
485+
// ],
486+
// condition: {
487+
// when: 'config_info.retirement.repository_id',
488+
// isEmpty: true,
489+
// },
490+
// },
491+
// {
492+
// component: 'key-value-list',
493+
// id: 'config_info.retirement.extra_vars',
494+
// name: 'config_info.retirement.extra_vars',
495+
// label: __('Variables & Default Values'),
496+
// keyLabel: __('Variable'),
497+
// valueLabel: __('Default value'),
498+
// },
499+
// ],
500+
// };
501+
// return schema;
502+
// };
240503

241504
const createSchema = ({
242505
data,
@@ -251,10 +514,13 @@ const createSchema = ({
251514
currencies,
252515
repositories,
253516
provisionRepositoryId,
517+
// retirementRepositoryId,
254518
cloudTypes,
255519
dialogs,
256520
provisionCloudType,
521+
// retirementCloudType,
257522
provisionEsclationDisplay,
523+
// retirementEsclationDisplay,
258524
} = data;
259525

260526
const {
@@ -292,6 +558,19 @@ const createSchema = ({
292558
dialogs
293559
),
294560
},
561+
// {
562+
// ...retirementTabSchema(
563+
// repositories,
564+
// setData,
565+
// retirementRepositoryId,
566+
// currentRegion,
567+
// retirementEsclationDisplay,
568+
// cloudTypes,
569+
// retirementCloudType,
570+
// logOutputTypes,
571+
// verbosityTypes
572+
// ),
573+
// },
295574
],
296575
},
297576
];

app/javascript/components/workflows/helper.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@ import { rowData } from '../miq-data-table/helper';
22

33
/** Function to return the header information for the service catalog item's entry points. */
44
const entryPointsHeaderInfo = () => [
5-
{ header: __('Name'), key: 'name' },
5+
{ header: __('Repository'), key: 'configuration_script_source.name' },
6+
{ header: __('Workflow name'), key: 'name' },
67
];
78

89
/** Function to return the cell data for a row item. */
9-
const celInfo = (workflow) => [
10+
const cellInfo = (workflow) => [
11+
{ text: workflow.configuration_script_source ? workflow.configuration_script_source.name : '' },
1012
{ text: workflow.name },
1113
];
1214

1315
/** Function to return the row information for the list */
1416
const rowInfo = (headers, response) => {
1517
const headerKeys = headers.map((item) => item.key);
1618
const rows = response.resources.filter((item) => item.payload).map((workflow) => ({
17-
id: workflow.id.toString(), cells: celInfo(workflow), clickable: true,
19+
id: workflow.id.toString(), cells: cellInfo(workflow), clickable: true,
1820
}));
1921
const miqRows = rowData(headerKeys, rows, false);
2022
return miqRows.rowItems;

app/javascript/components/workflows/workflow-entry-points.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ const WorkflowEntryPoints = ({
2121
useEffect(() => {
2222
http.post(`/catalog/ae_tree_select_toggle?typ=${type}`, {}, { headers: {}, skipJsonParsing: true })
2323
.then((_data) => {
24-
API.get('/api/configuration_script_payloads?expand=resources')
24+
const url = '/api/configuration_script_payloads/?expand=resources&attributes=configuration_script_source.name&'
25+
+ 'collection_class=ManageIQ::Providers::Workflows::AutomationManager::Workflow';
26+
API.get(url)
2527
.then((response) => {
2628
setData({
2729
...data,
@@ -81,6 +83,7 @@ const WorkflowEntryPoints = ({
8183
open
8284
modalHeading={sprintf(__('Select Embedded Workflow - %s Entry Point'), workflowTypes[type])}
8385
primaryButtonText={__('Apply')}
86+
primaryButtonDisabled={!data.selectedItemId}
8487
secondaryButtonText={__('Cancel')}
8588
onRequestSubmit={onApply}
8689
onRequestClose={onCloseModal}

0 commit comments

Comments
 (0)