Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ const AutomateEntryPoints = ({

return !isLoading && (
<Modal
modalHeading="Select Entry Point Instance"
open={showModal}
primaryButtonText={__('OK')}
secondaryButtonText={__('Cancel')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,48 @@ export const prepareRequestObject = (values, formId) => {
requestObject.config_info.provision.extra_vars = convertArrayToObject(requestObject.config_info.provision.extra_vars);
}

if (requestObject.provisioning_entry_point_type === 'embedded_automate') {
if (requestObject.provisioning_entry_point_automate && requestObject.provisioning_entry_point_automate.element) {
requestObject.provisioning_entry_point = {
id: requestObject.provisioning_entry_point_automate.element.id,
name: requestObject.provisioning_entry_point_automate.element.name,
};
delete requestObject.provisioning_entry_point_automate;
}
} else if (requestObject.provisioning_entry_point_workflow) {
requestObject.provisioning_entry_point = requestObject.provisioning_entry_point_workflow.id;
delete requestObject.provisioning_entry_point_workflow;
}
delete requestObject.provisioning_entry_point_type;

if (requestObject.reconfigure_entry_point_type === 'embedded_automate') {
if (requestObject.reconfigure_entry_point_automate && requestObject.reconfigure_entry_point_automate.element) {
requestObject.reconfigure_entry_point = {
id: requestObject.reconfigure_entry_point_automate.element.id,
name: requestObject.reconfigure_entry_point_automate.element.name,
};
delete requestObject.reconfigure_entry_point_automate;
}
} else if (requestObject.reconfigure_entry_point_workflow) {
requestObject.reconfigure_entry_point = requestObject.reconfigure_entry_point_workflow.id;
delete requestObject.reconfigure_entry_point_workflow;
}
delete requestObject.reconfigure_entry_point_type;

if (requestObject.retirement_entry_point_type === 'embedded_automate') {
if (requestObject.retirement_entry_point_automate && requestObject.retirement_entry_point_automate.element) {
requestObject.retirement_entry_point = {
id: requestObject.reconfigure_entry_point_automate.element.id,
name: requestObject.retirement_entry_point_automate.element.name,
};
delete requestObject.retirement_entry_point_automate;
}
} else if (requestObject.retirement_entry_point_workflow) {
requestObject.retirement_entry_point = requestObject.retirement_entry_point_workflow.id;
delete requestObject.retirement_entry_point_workflow;
}
delete requestObject.retirement_entry_point_type;

// if (requestObject.config_info.retirement.extra_vars) {
// requestObject.config_info.retirement.extra_vars = convertArrayToObject(requestObject.config_info.retirement.extra_vars);
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,108 @@ const basicInformationTabSchema = (availableCatalogs, tenantTree, roleAllows, zo
id: 'description',
label: __('Description'),
},
{
component: componentTypes.SELECT,
id: 'provisioning_entry_point_type',
name: 'provisioning_entry_point_type',
label: __('Provisioning Entry Point'),
initialValue: 'embedded_automate',
options: [{ value: 'embedded_automate', label: __('Embedded Automate') }, { value: 'embedded_workflow', label: __('Embedded Workflow') }],
},
{
component: 'embedded-automate-entry-point',
id: 'provisioning_entry_point_automate',
name: 'provisioning_entry_point_automate',
label: 'Provisioning Entry Point',
field: 'fqname',
selected: '',
type: 'provision',
condition: {
when: 'provisioning_entry_point_type',
is: 'embedded_automate',
},
},
{
component: 'embedded-workflow-entry-point',
id: 'provisioning_entry_point_workflow',
name: 'provisioning_entry_point_workflow',
label: 'Provisioning Entry Point',
field: 'fqname',
selected: '',
type: 'provision',
condition: {
when: 'provisioning_entry_point_type',
is: 'embedded_workflow',
},
},
{
component: componentTypes.SELECT,
id: 'reconfigure_entry_point_type',
name: 'reconfigure_entry_point_type',
label: __('Reconfigure Entry Point'),
initialValue: 'embedded_automate',
options: [{ value: 'embedded_automate', label: __('Embedded Automate') }, { value: 'embedded_workflow', label: __('Embedded Workflow') }],
},
{
component: 'embedded-automate-entry-point',
id: 'reconfigure_entry_point_automate',
name: 'reconfigure_entry_point_automate',
label: 'Reconfigure Entry Point',
field: 'fqname',
selected: '',
type: 'provision',
condition: {
when: 'reconfigure_entry_point_type',
is: 'embedded_automate',
},
},
{
component: 'embedded-workflow-entry-point',
id: 'reconfigure_entry_point_workflow',
name: 'reconfigure_entry_point_workflow',
label: 'Reconfigure Entry Point',
field: 'fqname',
selected: '',
type: 'provision',
condition: {
when: 'reconfigure_entry_point_type',
is: 'embedded_workflow',
},
},
{
component: componentTypes.SELECT,
id: 'retirement_entry_point_type',
name: 'retirement_entry_point_type',
label: __('Retirement Entry Point'),
initialValue: 'embedded_automate',
options: [{ value: 'embedded_automate', label: __('Embedded Automate') }, { value: 'embedded_workflow', label: __('Embedded Workflow') }],
},
{
component: 'embedded-automate-entry-point',
id: 'retirement_entry_point_automate',
name: 'retirement_entry_point_automate',
label: 'Retirement Entry Point',
field: 'fqname',
selected: '',
type: 'provision',
condition: {
when: 'retirement_entry_point_type',
is: 'embedded_automate',
},
},
{
component: 'embedded-workflow-entry-point',
id: 'retirement_entry_point_workflow',
name: 'retirement_entry_point_workflow',
label: 'Retirement Entry Point',
field: 'fqname',
selected: '',
type: 'provision',
condition: {
when: 'retirement_entry_point_type',
is: 'embedded_workflow',
},
},
{
component: componentTypes.CHECKBOX,
name: 'display',
Expand Down Expand Up @@ -198,6 +300,14 @@ const provisionTabSchema = (
label: __('Verbosity'),
options: transformObjectToSelectOptions(verbosityTypes),
},
{
component: 'key-value-list',
id: 'config_info.provision.extra_vars',
name: 'config_info.provision.extra_vars',
label: __('Variables & Default Values'),
keyLabel: __('Variable'),
valueLabel: __('Default value'),
},
{
component: componentTypes.RADIO,
id: 'config_info.provision.dialog_type',
Expand Down Expand Up @@ -237,6 +347,159 @@ const provisionTabSchema = (
return schema;
};

// const retirementTabSchema = (
// repositories,
// setData,
// retirementRepositoryId,
// currentRegion,
// retirementEsclationDisplay,
// cloudTypes,
// retirementCloudType,
// logOutputTypes,
// verbosityTypes
// ) => {
// const schema = {
// component: componentTypes.TAB_ITEM,
// id: 'retirement-tab',
// name: 'retirement-tab',
// label: __('Retirement'),
// fields: [
// {
// component: 'copy-from-provisioning',
// id: 'config_info.retirement.copyFromProvisioning',
// name: 'config_info.retirement.copyFromProvisioning',
// label: __('Copy from Provisioning'),
// copyFrom: ['repository_id', 'configuration_script_payload_id', 'credential_id', 'cloud_type'],
// copyTo: ['repository_id', 'configuration_script_payload_id', 'credential_id', 'cloud_type'],
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.repository_id',
// name: 'config_info.retirement.repository_id',
// label: __('Repository'),
// options: transformGeneralOptions(repositories),
// includeEmpty: true,
// onChange: (repositoryId) => setData((state) => ({ ...state, retirementRepositoryId: repositoryId })),
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.configuration_script_payload_id',
// name: 'config_info.retirement.configuration_script_payload_id',
// label: __('Template'),
// loadOptions: () => (retirementRepositoryId ? loadRepositoryOptions(retirementRepositoryId, currentRegion) : Promise.resolve([])),
// condition: {
// when: 'config_info.retirement.repository_id',
// isNotEmpty: true,
// },
// key: `${retirementRepositoryId}-retirement-payload_id`,
// validateOnMount: true,
// validate: [{ type: 'customValidatorForRetirementFields' }],
// includeEmpty: true,
// },
// {
// component: 'conditional-checkbox',
// id: 'config_info.retirement.become_method',
// name: 'config_info.retirement.become_method',
// label: __('Escalate Privilege'),
// display: retirementEsclationDisplay,
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.cloud_type',
// name: 'config_info.retirement.cloud_type',
// label: __('Cloud Type'),
// options: transformcloudTypesOptions(cloudTypes),
// onChange: (cloudType) => setData((state) => ({ ...state, retirementCloudType: cloudType })),
// includeEmpty: true,
// condition: {
// when: 'config_info.retirement.repository_id',
// isNotEmpty: true,
// },
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.credential_id',
// name: 'config_info.retirement.credential_id',
// label: __('Credential'),
// options: transformcloudTypesOptions(cloudTypes),
// loadOptions: () => (retirementCloudType ? loadCloudCredentialOptions(retirementCloudType) : Promise.resolve([])),
// key: `${retirementCloudType}-retirement-cloud-credentail-id`,
// includeEmpty: true,
// condition: {
// and: [
// {
// when: 'config_info.retirement.cloud_type',
// isNotEmpty: true,
// },
// {
// when: 'config_info.retirement.repository_id',
// isNotEmpty: true,
// },
// ],
// },
// },
// {
// component: componentTypes.TEXT_FIELD,
// id: 'config_info.retirement.execution_ttl',
// name: 'config_info.retirement.execution_ttl',
// label: __('Max TTL (mins)'),
// dataType: 'number',
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.log_output',
// name: 'config_info.retirement.log_output',
// label: __('Logging Output'),
// options: transformObjectToSelectOptions(logOutputTypes),
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.verbosity',
// name: 'config_info.retirement.verbosity',
// label: __('Verbosity'),
// options: transformObjectToSelectOptions(verbosityTypes),
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.remove_resources',
// name: 'config_info.retirement.remove_resources',
// label: __('Remove resources?'),
// options: [
// { label: 'No', value: 'no_with_playbook' },
// { label: 'Before Template runs', value: 'pre_with_playbook' },
// { label: 'After Template runs', value: "post_with_playbook'" },
// ],
// condition: {
// when: 'config_info.retirement.repository_id',
// isNotEmpty: true,
// },
// },
// {
// component: componentTypes.SELECT,
// id: 'config_info.retirement.remove_resources_with_no_repistory_id',
// name: 'config_info.retirement.remove_resources_with_no_repistory_id',
// label: __('Remove resources?'),
// options: [
// { label: 'No', value: 'no_without_playbook' },
// { label: 'Yes', value: 'yes_without_playbook' },
// ],
// condition: {
// when: 'config_info.retirement.repository_id',
// isEmpty: true,
// },
// },
// {
// component: 'key-value-list',
// id: 'config_info.retirement.extra_vars',
// name: 'config_info.retirement.extra_vars',
// label: __('Variables & Default Values'),
// keyLabel: __('Variable'),
// valueLabel: __('Default value'),
// },
// ],
// };
// return schema;
// };

const createSchema = ({
data,
Expand All @@ -251,10 +514,13 @@ const createSchema = ({
currencies,
repositories,
provisionRepositoryId,
// retirementRepositoryId,
cloudTypes,
dialogs,
provisionCloudType,
// retirementCloudType,
provisionEsclationDisplay,
// retirementEsclationDisplay,
} = data;

const {
Expand Down Expand Up @@ -292,6 +558,19 @@ const createSchema = ({
dialogs
),
},
// {
// ...retirementTabSchema(
// repositories,
// setData,
// retirementRepositoryId,
// currentRegion,
// retirementEsclationDisplay,
// cloudTypes,
// retirementCloudType,
// logOutputTypes,
// verbosityTypes
// ),
// },
],
},
];
Expand Down
8 changes: 5 additions & 3 deletions app/javascript/components/workflows/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import { rowData } from '../miq-data-table/helper';

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

/** Function to return the cell data for a row item. */
const celInfo = (workflow) => [
const cellInfo = (workflow) => [
{ text: workflow.configuration_script_source ? workflow.configuration_script_source.name : '' },
{ text: workflow.name },
];

/** Function to return the row information for the list */
const rowInfo = (headers, response) => {
const headerKeys = headers.map((item) => item.key);
const rows = response.resources.filter((item) => item.payload).map((workflow) => ({
id: workflow.id.toString(), cells: celInfo(workflow), clickable: true,
id: workflow.id.toString(), cells: cellInfo(workflow), clickable: true,
}));
const miqRows = rowData(headerKeys, rows, false);
return miqRows.rowItems;
Expand Down
Loading
Loading