Skip to content

Commit

Permalink
feat(vscode): Add Integration account source and export custom API ac…
Browse files Browse the repository at this point in the history
…tions to export advance options (#4097)

* Add options to advace export options

* Update styles and add logic for options isolation

* Update query to avoid multiple api calls

* Update styles for dropdown

* Add function to array dependency

* Update wording in options
  • Loading branch information
ccastrotrejo committed Feb 5, 2024
1 parent c1cb6d3 commit 6559428
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
12 changes: 9 additions & 3 deletions apps/vs-code-react/src/app/export/export.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
margin-top: 15px;

&-input {
width: 25%;
margin-right: 10px;

input::placeholder {
Expand All @@ -44,11 +43,14 @@
}

&-dropdown {
width: 350px;
max-width: 400px;
width: 100%;
}
}

&-filters > * {
width: 30%;
}

&-limit-selection {
margin-top: 10px;

Expand Down Expand Up @@ -134,6 +136,10 @@
&-title {
margin: 15px 0;
}
&-dropdown {
width: 450px;
margin: 16px 0;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ export const AdvancedOptions: React.FC = () => {
defaultMessage: 'Generate infrastructure templates',
description: 'Generate infrastructure templates',
}),
INTEGRATION_ACCOUNT_SOURCE: intl.formatMessage({
defaultMessage: 'Default to integration account as source for transformations and schema validation',
description: 'Default to integration account as source for transformations and schema validation',
}),
EXPORT_CUSTOM_API_ACTIONS_TO_API_MANAGEMENT_ACTIONS: intl.formatMessage({
defaultMessage: 'Export custom connector actions as API Management actions',
description: 'Export custom connector actions as API Management actions',
}),
};

const advancedOptions: IDropdownOption[] = [
Expand All @@ -52,6 +60,16 @@ export const AdvancedOptions: React.FC = () => {
selected: false,
disabled: isCloneConnectionsAvailable(selectedAdvanceOptions),
},
{
key: AdvancedOptionsTypes.integrationAccountSource,
text: intlText.INTEGRATION_ACCOUNT_SOURCE,
selected: false,
},
{
key: AdvancedOptionsTypes.exportCustomApiActionsToAPIManagementActions,
text: intlText.EXPORT_CUSTOM_API_ACTIONS_TO_API_MANAGEMENT_ACTIONS,
selected: false,
},
];

const onChangeOptions = useCallback(
Expand Down Expand Up @@ -83,6 +101,7 @@ export const AdvancedOptions: React.FC = () => {
onChange={onChangeOptions}
selectedKeys={selectedAdvanceOptions}
multiSelect
className="msla-export-workflows-advanced-options-dropdown"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ export const getAdvanceOptionsSelection = (
const updatedOptions = [...selectedAdvanceOptions];

if (!!hasInfrastructureTemplates(updatedOptions) && selectedOption.key === AdvancedOptionsTypes.generateInfrastructureTemplates) {
return [];
return updatedOptions.filter(
(option) => option !== AdvancedOptionsTypes.cloneConnections && option !== AdvancedOptionsTypes.generateInfrastructureTemplates
);
}

const index = updatedOptions.indexOf(selectedOption.key as AdvancedOptionsTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { filterWorkflows, getListColumns, getSelectedItems, parseResourceGroups,
import { SelectedList } from './selectedList';
import { Separator, ShimmeredDetailsList, Text, SelectionMode, Selection, MessageBar, MessageBarType } from '@fluentui/react';
import type { IDropdownOption } from '@fluentui/react';
import { isNullOrUndefined } from '@microsoft/utils-logic-apps';
import { useMemo, useRef, useState, useEffect } from 'react';
import { useIntl } from 'react-intl';
import { useQuery } from 'react-query';
Expand Down Expand Up @@ -82,7 +83,6 @@ export const WorkflowsSelection: React.FC = () => {

const onWorkflowsSuccess = (workflows: WorkflowsList[]) => {

Check warning on line 84 in apps/vs-code-react/src/app/export/workflowsSelection/workflowsSelection.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

The 'onWorkflowsSuccess' function makes the dependencies of useEffect Hook (at line 112) change on every render. Move it inside the useEffect callback. Alternatively, wrap the definition of 'onWorkflowsSuccess' in its own useCallback() Hook

Check warning on line 84 in apps/vs-code-react/src/app/export/workflowsSelection/workflowsSelection.tsx

View workflow job for this annotation

GitHub Actions / build (20.x)

The 'onWorkflowsSuccess' function makes the dependencies of useEffect Hook (at line 112) change on every render. Move it inside the useEffect callback. Alternatively, wrap the definition of 'onWorkflowsSuccess' in its own useCallback() Hook
const resourceGroups: IDropdownOption[] = !workflows ? [] : parseResourceGroups(workflows);

setRenderWorkflows(workflows);
setResourceGroups(resourceGroups);
allWorkflows.current = workflows;
Expand All @@ -97,10 +97,19 @@ export const WorkflowsSelection: React.FC = () => {
});
};

const { isLoading: isWorkflowsLoading } = useQuery<any>([QueryKeys.workflowsData, { location, iseId: selectedIse }], loadWorkflows, {
refetchOnWindowFocus: false,
onSuccess: onWorkflowsSuccess,
});
const { isLoading: isWorkflowsLoading, data: workflowsData } = useQuery<WorkflowsList[]>(
[QueryKeys.workflowsData, selectedSubscription, selectedIse, location],
loadWorkflows,
{
refetchOnWindowFocus: false,
}
);

useEffect(() => {
if (!isNullOrUndefined(workflowsData)) {
onWorkflowsSuccess(workflowsData);
}
}, [workflowsData, onWorkflowsSuccess]);

useEffect(() => {
const updatedItems = updateSelectedItems(allItemsSelected.current, renderWorkflows, selectedWorkflows);
Expand Down
2 changes: 2 additions & 0 deletions apps/vs-code-react/src/run-service/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,7 @@ export const AdvancedOptionsTypes = {
off: 'Off',
cloneConnections: 'cloneConnections',
generateInfrastructureTemplates: 'generateInfrastructureTemplates',
integrationAccountSource: 'integrationAccountSource',
exportCustomApiActionsToAPIManagementActions: 'exportCustomApiActionsToAPIManagementActions',
};
export type AdvancedOptionsTypes = (typeof AdvancedOptionsTypes)[keyof typeof AdvancedOptionsTypes];

0 comments on commit 6559428

Please sign in to comment.