Skip to content

Commit 0674fa5

Browse files
Refactor code and remove unnecessaary code
1 parent d4b8e3f commit 0674fa5

File tree

4 files changed

+8
-334
lines changed

4 files changed

+8
-334
lines changed

app/javascript/components/automate-entry-points/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const AutomateEntryPoints = ({
177177

178178
return !isLoading && (
179179
<Modal
180-
modalHeading="Select Entry Point Instance"
180+
modalHeading={__('Select Entry Point Instance')}
181181
open={showModal}
182182
primaryButtonText={__('OK')}
183183
secondaryButtonText={__('Cancel')}

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

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -182,48 +182,6 @@ export const prepareRequestObject = (values, formId) => {
182182
requestObject.config_info.provision.extra_vars = convertArrayToObject(requestObject.config_info.provision.extra_vars);
183183
}
184184

185-
if (requestObject.provisioning_entry_point_type === 'embedded_automate') {
186-
if (requestObject.provisioning_entry_point_automate && requestObject.provisioning_entry_point_automate.element) {
187-
requestObject.provisioning_entry_point = {
188-
id: requestObject.provisioning_entry_point_automate.element.id,
189-
name: requestObject.provisioning_entry_point_automate.element.name,
190-
};
191-
delete requestObject.provisioning_entry_point_automate;
192-
}
193-
} else if (requestObject.provisioning_entry_point_workflow) {
194-
requestObject.provisioning_entry_point = requestObject.provisioning_entry_point_workflow.id;
195-
delete requestObject.provisioning_entry_point_workflow;
196-
}
197-
delete requestObject.provisioning_entry_point_type;
198-
199-
if (requestObject.reconfigure_entry_point_type === 'embedded_automate') {
200-
if (requestObject.reconfigure_entry_point_automate && requestObject.reconfigure_entry_point_automate.element) {
201-
requestObject.reconfigure_entry_point = {
202-
id: requestObject.reconfigure_entry_point_automate.element.id,
203-
name: requestObject.reconfigure_entry_point_automate.element.name,
204-
};
205-
delete requestObject.reconfigure_entry_point_automate;
206-
}
207-
} else if (requestObject.reconfigure_entry_point_workflow) {
208-
requestObject.reconfigure_entry_point = requestObject.reconfigure_entry_point_workflow.id;
209-
delete requestObject.reconfigure_entry_point_workflow;
210-
}
211-
delete requestObject.reconfigure_entry_point_type;
212-
213-
if (requestObject.retirement_entry_point_type === 'embedded_automate') {
214-
if (requestObject.retirement_entry_point_automate && requestObject.retirement_entry_point_automate.element) {
215-
requestObject.retirement_entry_point = {
216-
id: requestObject.reconfigure_entry_point_automate.element.id,
217-
name: requestObject.retirement_entry_point_automate.element.name,
218-
};
219-
delete requestObject.retirement_entry_point_automate;
220-
}
221-
} else if (requestObject.retirement_entry_point_workflow) {
222-
requestObject.retirement_entry_point = requestObject.retirement_entry_point_workflow.id;
223-
delete requestObject.retirement_entry_point_workflow;
224-
}
225-
delete requestObject.retirement_entry_point_type;
226-
227185
// if (requestObject.config_info.retirement.extra_vars) {
228186
// requestObject.config_info.retirement.extra_vars = convertArrayToObject(requestObject.config_info.retirement.extra_vars);
229187
// }

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

Lines changed: 0 additions & 280 deletions
Original file line numberDiff line numberDiff line change
@@ -30,108 +30,6 @@ 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: 'reconfigure_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-
},
13533
{
13634
component: componentTypes.CHECKBOX,
13735
name: 'display',
@@ -300,14 +198,6 @@ const provisionTabSchema = (
300198
label: __('Verbosity'),
301199
options: transformObjectToSelectOptions(verbosityTypes),
302200
},
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-
},
311201
{
312202
component: componentTypes.RADIO,
313203
id: 'config_info.provision.dialog_type',
@@ -347,160 +237,6 @@ const provisionTabSchema = (
347237
return schema;
348238
};
349239

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-
// };
503-
504240
const createSchema = ({
505241
data,
506242
setData,
@@ -514,13 +250,10 @@ const createSchema = ({
514250
currencies,
515251
repositories,
516252
provisionRepositoryId,
517-
// retirementRepositoryId,
518253
cloudTypes,
519254
dialogs,
520255
provisionCloudType,
521-
// retirementCloudType,
522256
provisionEsclationDisplay,
523-
// retirementEsclationDisplay,
524257
} = data;
525258

526259
const {
@@ -558,19 +291,6 @@ const createSchema = ({
558291
dialogs
559292
),
560293
},
561-
// {
562-
// ...retirementTabSchema(
563-
// repositories,
564-
// setData,
565-
// retirementRepositoryId,
566-
// currentRegion,
567-
// retirementEsclationDisplay,
568-
// cloudTypes,
569-
// retirementCloudType,
570-
// logOutputTypes,
571-
// verbosityTypes
572-
// ),
573-
// },
574294
],
575295
},
576296
];

0 commit comments

Comments
 (0)