Skip to content

Commit 719fc4f

Browse files
nturinskiCopilot
andauthored
Various bug fixes (#4588)
* Various bug fixes * Another site init * Update src/commands/deployments/connectToGitHub.ts Co-authored-by: Copilot <[email protected]> * Update connectToGitHub.ts --------- Co-authored-by: Copilot <[email protected]>
1 parent 8aa2894 commit 719fc4f

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

src/commands/addMIConnections/addRemoteMIConnections.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export async function addRemoteMIConnections(context: AddMIConnectionsContext, n
2020
const connections: Connection[] = [];
2121
if (!node) {
2222
context.functionapp = await pickFunctionApp(context);
23+
await context.functionapp.initSite(context);
2324
await addRemoteMIConnectionsInternal(context, connections);
2425
} else {
2526
if (node instanceof AppSettingTreeItem) {

src/commands/deployments/connectToGitHub.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export async function connectToGitHub(context: IActionContext, target?: GenericT
2121
deployments = <DeploymentsTreeItem>target.parent;
2222
}
2323

24+
await deployments.init(context);
2425
if (deployments.parent && isSlotTreeItem(deployments.parent)) {
26+
const siteItem = deployments.parent;
27+
await siteItem.initSite(context);
2528
await editScmType(context, deployments.site, deployments.subscription, ScmType.GitHub);
2629
await deployments.refresh(context);
2730
} else {

src/tree/ResolvedFunctionAppResource.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export class ResolvedFunctionAppResource extends ResolvedFunctionAppBase impleme
315315
}
316316
}
317317
}
318-
318+
const flexError = localize('flexFunctionAppDeploymentsNotSupported', 'Command not supported for Flex Consumption apps.');
319319
for (const expectedContextValue of expectedContextValues) {
320320
if (expectedContextValue instanceof RegExp) {
321321
const appSettingsContextValues = [AppSettingsTreeItem.contextValue, AppSettingTreeItem.contextValue];
@@ -324,10 +324,19 @@ export class ResolvedFunctionAppResource extends ResolvedFunctionAppBase impleme
324324
}
325325
const deploymentsContextValues = [DeploymentsTreeItem.contextValueConnected, DeploymentsTreeItem.contextValueUnconnected, DeploymentTreeItem.contextValue];
326326
if (matchContextValue(expectedContextValue, deploymentsContextValues)) {
327+
if (this.isFlex) {
328+
context.errorHandling.rethrow = true;
329+
throw new Error(flexError);
330+
}
331+
await this.deploymentsNode?.init(context);
327332
return this.deploymentsNode;
328333
}
329334

330335
if (matchContextValue(expectedContextValue, [ResolvedFunctionAppResource.slotContextValue])) {
336+
if (this.isFlex) {
337+
context.errorHandling.rethrow = true;
338+
throw new Error(flexError);
339+
}
331340
return this._slotsTreeItem;
332341
}
333342
}

src/tree/SlotTreeItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ProjectSource } from './projectContextValues';
1313
import { type RemoteFunctionTreeItem } from './remoteProject/RemoteFunctionTreeItem';
1414

1515
export function isSlotTreeItem(treeItem: SlotTreeItem | RemoteFunctionTreeItem | AzExtParentTreeItem): treeItem is SlotTreeItem {
16-
return !!(treeItem as SlotTreeItem).site;
16+
return !!(treeItem as SlotTreeItem).contextValue.includes('FunctionApp;')
1717
}
1818

1919
export class SlotTreeItem extends SlotContainerTreeItemBase {

0 commit comments

Comments
 (0)