Skip to content

Commit f69d2fd

Browse files
committed
Merge pull request #9449 from putmanoj/issue#96-hide-extra-vars-for-terraform
Remove redundant catalog variables (extra_vars) for terraform-template
2 parents efe5f45 + e918202 commit f69d2fd

File tree

3 files changed

+6
-180
lines changed

3 files changed

+6
-180
lines changed

app/helpers/catalog_helper.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ def catalog_tab_conditions(record)
268268
:resource => record.composite?,
269269
:request => !record.prov_type || (record.prov_type && need_prov_dialogs?(record.prov_type)),
270270
:provision => record.prov_type == catalog_provision_types[:playbook] || record.prov_type == catalog_provision_types[:terraform_template],
271-
:retirement => record.prov_type == catalog_provision_types[:terraform_template] ? nil : record.config_info.fetch_path(:retirement)
271+
:retirement => record.prov_type == catalog_provision_types[:terraform_template] ? nil : record.config_info.fetch_path(:retirement),
272+
:variables => record.prov_type != catalog_provision_types[:terraform_template]
272273
}
273274
end
274275

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

Lines changed: 0 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,6 @@ const provisionTabSchema = (
198198
label: __('Verbosity'),
199199
options: transformObjectToSelectOptions(verbosityTypes),
200200
},
201-
{
202-
component: 'key-value-list',
203-
id: 'config_info.provision.extra_vars',
204-
name: 'config_info.provision.extra_vars',
205-
label: __('Variables & Default Values'),
206-
keyLabel: __('Variable'),
207-
valueLabel: __('Default value'),
208-
},
209201
{
210202
component: componentTypes.RADIO,
211203
id: 'config_info.provision.dialog_type',
@@ -245,159 +237,6 @@ const provisionTabSchema = (
245237
return schema;
246238
};
247239

248-
// const retirementTabSchema = (
249-
// repositories,
250-
// setData,
251-
// retirementRepositoryId,
252-
// currentRegion,
253-
// retirementEsclationDisplay,
254-
// cloudTypes,
255-
// retirementCloudType,
256-
// logOutputTypes,
257-
// verbosityTypes
258-
// ) => {
259-
// const schema = {
260-
// component: componentTypes.TAB_ITEM,
261-
// id: 'retirement-tab',
262-
// name: 'retirement-tab',
263-
// label: __('Retirement'),
264-
// fields: [
265-
// {
266-
// component: 'copy-from-provisioning',
267-
// id: 'config_info.retirement.copyFromProvisioning',
268-
// name: 'config_info.retirement.copyFromProvisioning',
269-
// label: __('Copy from Provisioning'),
270-
// copyFrom: ['repository_id', 'configuration_script_payload_id', 'credential_id', 'cloud_type'],
271-
// copyTo: ['repository_id', 'configuration_script_payload_id', 'credential_id', 'cloud_type'],
272-
// },
273-
// {
274-
// component: componentTypes.SELECT,
275-
// id: 'config_info.retirement.repository_id',
276-
// name: 'config_info.retirement.repository_id',
277-
// label: __('Repository'),
278-
// options: transformGeneralOptions(repositories),
279-
// includeEmpty: true,
280-
// onChange: (repositoryId) => setData((state) => ({ ...state, retirementRepositoryId: repositoryId })),
281-
// },
282-
// {
283-
// component: componentTypes.SELECT,
284-
// id: 'config_info.retirement.configuration_script_payload_id',
285-
// name: 'config_info.retirement.configuration_script_payload_id',
286-
// label: __('Template'),
287-
// loadOptions: () => (retirementRepositoryId ? loadRepositoryOptions(retirementRepositoryId, currentRegion) : Promise.resolve([])),
288-
// condition: {
289-
// when: 'config_info.retirement.repository_id',
290-
// isNotEmpty: true,
291-
// },
292-
// key: `${retirementRepositoryId}-retirement-payload_id`,
293-
// validateOnMount: true,
294-
// validate: [{ type: 'customValidatorForRetirementFields' }],
295-
// includeEmpty: true,
296-
// },
297-
// {
298-
// component: 'conditional-checkbox',
299-
// id: 'config_info.retirement.become_method',
300-
// name: 'config_info.retirement.become_method',
301-
// label: __('Escalate Privilege'),
302-
// display: retirementEsclationDisplay,
303-
// },
304-
// {
305-
// component: componentTypes.SELECT,
306-
// id: 'config_info.retirement.cloud_type',
307-
// name: 'config_info.retirement.cloud_type',
308-
// label: __('Cloud Type'),
309-
// options: transformcloudTypesOptions(cloudTypes),
310-
// onChange: (cloudType) => setData((state) => ({ ...state, retirementCloudType: cloudType })),
311-
// includeEmpty: true,
312-
// condition: {
313-
// when: 'config_info.retirement.repository_id',
314-
// isNotEmpty: true,
315-
// },
316-
// },
317-
// {
318-
// component: componentTypes.SELECT,
319-
// id: 'config_info.retirement.credential_id',
320-
// name: 'config_info.retirement.credential_id',
321-
// label: __('Credential'),
322-
// options: transformcloudTypesOptions(cloudTypes),
323-
// loadOptions: () => (retirementCloudType ? loadCloudCredentialOptions(retirementCloudType) : Promise.resolve([])),
324-
// key: `${retirementCloudType}-retirement-cloud-credentail-id`,
325-
// includeEmpty: true,
326-
// condition: {
327-
// and: [
328-
// {
329-
// when: 'config_info.retirement.cloud_type',
330-
// isNotEmpty: true,
331-
// },
332-
// {
333-
// when: 'config_info.retirement.repository_id',
334-
// isNotEmpty: true,
335-
// },
336-
// ],
337-
// },
338-
// },
339-
// {
340-
// component: componentTypes.TEXT_FIELD,
341-
// id: 'config_info.retirement.execution_ttl',
342-
// name: 'config_info.retirement.execution_ttl',
343-
// label: __('Max TTL (mins)'),
344-
// dataType: 'number',
345-
// },
346-
// {
347-
// component: componentTypes.SELECT,
348-
// id: 'config_info.retirement.log_output',
349-
// name: 'config_info.retirement.log_output',
350-
// label: __('Logging Output'),
351-
// options: transformObjectToSelectOptions(logOutputTypes),
352-
// },
353-
// {
354-
// component: componentTypes.SELECT,
355-
// id: 'config_info.retirement.verbosity',
356-
// name: 'config_info.retirement.verbosity',
357-
// label: __('Verbosity'),
358-
// options: transformObjectToSelectOptions(verbosityTypes),
359-
// },
360-
// {
361-
// component: componentTypes.SELECT,
362-
// id: 'config_info.retirement.remove_resources',
363-
// name: 'config_info.retirement.remove_resources',
364-
// label: __('Remove resources?'),
365-
// options: [
366-
// { label: 'No', value: 'no_with_playbook' },
367-
// { label: 'Before Template runs', value: 'pre_with_playbook' },
368-
// { label: 'After Template runs', value: "post_with_playbook'" },
369-
// ],
370-
// condition: {
371-
// when: 'config_info.retirement.repository_id',
372-
// isNotEmpty: true,
373-
// },
374-
// },
375-
// {
376-
// component: componentTypes.SELECT,
377-
// id: 'config_info.retirement.remove_resources_with_no_repistory_id',
378-
// name: 'config_info.retirement.remove_resources_with_no_repistory_id',
379-
// label: __('Remove resources?'),
380-
// options: [
381-
// { label: 'No', value: 'no_without_playbook' },
382-
// { label: 'Yes', value: 'yes_without_playbook' },
383-
// ],
384-
// condition: {
385-
// when: 'config_info.retirement.repository_id',
386-
// isEmpty: true,
387-
// },
388-
// },
389-
// {
390-
// component: 'key-value-list',
391-
// id: 'config_info.retirement.extra_vars',
392-
// name: 'config_info.retirement.extra_vars',
393-
// label: __('Variables & Default Values'),
394-
// keyLabel: __('Variable'),
395-
// valueLabel: __('Default value'),
396-
// },
397-
// ],
398-
// };
399-
// return schema;
400-
// };
401240

402241
const createSchema = ({
403242
data,
@@ -412,13 +251,10 @@ const createSchema = ({
412251
currencies,
413252
repositories,
414253
provisionRepositoryId,
415-
// retirementRepositoryId,
416254
cloudTypes,
417255
dialogs,
418256
provisionCloudType,
419-
// retirementCloudType,
420257
provisionEsclationDisplay,
421-
// retirementEsclationDisplay,
422258
} = data;
423259

424260
const {
@@ -456,19 +292,6 @@ const createSchema = ({
456292
dialogs
457293
),
458294
},
459-
// {
460-
// ...retirementTabSchema(
461-
// repositories,
462-
// setData,
463-
// retirementRepositoryId,
464-
// currentRegion,
465-
// retirementEsclationDisplay,
466-
// cloudTypes,
467-
// retirementCloudType,
468-
// logOutputTypes,
469-
// verbosityTypes
470-
// ),
471-
// },
472295
],
473296
},
474297
];

app/views/catalog/_sandt_tree_show.html.haml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
- if condition[:provision]
2727
= catalog_tab_content(:provision) do
2828
= catalog_generic_template_info(:provision, record, provisioning)
29-
= catalog_variables_default_data(:provision, record)
29+
- if condition[:variables]
30+
= catalog_variables_default_data(:provision, record)
3031
= catalog_dialog(provisioning)
3132

3233
- if condition[:retirement]
3334
= catalog_tab_content(:retirement) do
3435
= catalog_generic_template_info(:retirement, record, retirement)
35-
= catalog_variables_default_data(:retirement, record)
36+
- if condition[:variables]
37+
= catalog_variables_default_data(:retirement, record)

0 commit comments

Comments
 (0)