Skip to content

Commit a719bda

Browse files
bjbennetCopilot
andauthored
fix(vscode): persist managed connector references (#9627)
Classify successful codeful connections by ARM resource ID so ApiManagement SDK connectors persist managedApiConnections without regressing local service-provider persistence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 9f29deb commit a719bda

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎apps/vs-code-react/src/app/languageServer/__test__/connectionView.test.tsx‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,23 @@ describe('LanguageServerConnectionView', () => {
171171
});
172172
});
173173

174+
it('persists an ApiManagement connection with an ARM ID as managed', () => {
175+
const { postMessage } = renderConnectionView({ connectorType: 'ApiManagement' });
176+
177+
fireEvent.click(screen.getByRole('button', { name: 'Managed success' }));
178+
179+
expect(postMessage).toHaveBeenCalledWith({
180+
command: ExtensionCommand.insert_connection,
181+
connection: {
182+
id: '/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Web/connections/managed',
183+
name: 'managed',
184+
},
185+
connectionReferences: {
186+
referenceOne: { connectionName: 'managed' },
187+
},
188+
});
189+
});
190+
174191
it('captures local addConnection data and sends it with the insert message', () => {
175192
const { postMessage } = renderConnectionView();
176193
const wrappedVscode = mocks.getDesignerServices.mock.calls[0][9];

‎apps/vs-code-react/src/app/languageServer/connectionView.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@microsoft/logic-apps-designer';
1010
import { useCallback, useContext, useMemo, useRef, useState } from 'react';
1111
import type { Connection, ConnectionCreationInfo } from '@microsoft/logic-apps-shared';
12-
import { getRecordEntry, Theme } from '@microsoft/logic-apps-shared';
12+
import { getRecordEntry, isArmResourceId, Theme } from '@microsoft/logic-apps-shared';
1313
import { getDesignerServices } from '../designer/servicesHelper';
1414
import { VSCodeContext } from '../../webviewCommunication';
1515
import { useDispatch, useSelector } from 'react-redux';
@@ -96,7 +96,7 @@ const ConnectionView = ({
9696
}, [sendMsgToVsix]);
9797

9898
const onConnectionSuccessful = (connection: Connection) => {
99-
if (isManagedConnector(connectorType)) {
99+
if (isArmResourceId(connection.id)) {
100100
// Managed API connection: send connectionReferences so the extension host
101101
// can persist them to connections.json (mirrors the designer save flow).
102102
const designerState = DesignerStore.getState();

0 commit comments

Comments
 (0)