Skip to content

Commit 55a917a

Browse files
authored
Make starting resources always go to the front of the activity child list (#976)
1 parent 0072cf3 commit 55a917a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/commands/StartingResourcesLogStep.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { type ContainerApp, type ManagedEnvironment } from "@azure/arm-appcontai
77
import { type Registry } from "@azure/arm-containerregistry";
88
import { type ResourceGroup } from "@azure/arm-resources";
99
import { LocationListStep, type ILocationWizardContext } from "@microsoft/vscode-azext-azureutils";
10-
import { ActivityChildItem, ActivityChildType, activityInfoIcon, AzureWizardPromptStep, createContextValue, prependOrInsertAfterLastInfoChild, type ActivityInfoChild, type ExecuteActivityContext, type IActionContext } from "@microsoft/vscode-azext-utils";
10+
import { ActivityChildItem, ActivityChildType, activityInfoIcon, AzureWizardPromptStep, createContextValue, type ExecuteActivityContext, type IActionContext } from "@microsoft/vscode-azext-utils";
1111
import { activityInfoContext } from "../constants";
1212
import { ext } from "../extensionVariables";
1313
import { localize } from "../utils/localize";
@@ -47,61 +47,63 @@ export class StartingResourcesLogStep<T extends StartingResourcesLogContext> ext
4747
}
4848

4949
protected async logStartingResources(context: T): Promise<void> {
50+
const startingResources: ActivityChildItem[] = [];
51+
5052
// Resource group
5153
if (context.resourceGroup) {
52-
prependOrInsertAfterLastInfoChild(context,
54+
startingResources.push(
5355
new ActivityChildItem({
5456
contextValue: createContextValue([startingResourcesContext, activityInfoContext]),
5557
label: localize('useResourceGroup', 'Use resource group "{0}"', context.resourceGroup.name),
5658
activityType: ActivityChildType.Info,
5759
iconPath: activityInfoIcon,
5860
stepId: this.id,
59-
}) as ActivityInfoChild,
61+
})
6062
);
6163
ext.outputChannel.appendLog(localize('usingResourceGroup', 'Using resource group "{0}".', context.resourceGroup.name));
6264
}
6365
context.telemetry.properties.existingResourceGroup = String(!!context.resourceGroup);
6466

6567
// Managed environment
6668
if (context.managedEnvironment) {
67-
prependOrInsertAfterLastInfoChild(context,
69+
startingResources.push(
6870
new ActivityChildItem({
6971
label: localize('useManagedEnvironment', 'Use managed environment "{0}"', context.managedEnvironment.name),
7072
contextValue: createContextValue([startingResourcesContext, activityInfoContext]),
7173
activityType: ActivityChildType.Info,
7274
iconPath: activityInfoIcon,
7375
stepId: this.id,
74-
}) as ActivityInfoChild,
76+
})
7577
);
7678
ext.outputChannel.appendLog(localize('usingManagedEnvironment', 'Using managed environment "{0}".', context.managedEnvironment.name));
7779
}
7880
context.telemetry.properties.existingEnvironment = String(!!context.managedEnvironment);
7981

8082
// Container registry
8183
if (context.registry) {
82-
prependOrInsertAfterLastInfoChild(context,
84+
startingResources.push(
8385
new ActivityChildItem({
8486
label: localize('useAcr', 'Use container registry "{0}"', context.registry.name),
8587
contextValue: createContextValue([startingResourcesContext, activityInfoContext]),
8688
activityType: ActivityChildType.Info,
8789
iconPath: activityInfoIcon,
8890
stepId: this.id,
89-
}) as ActivityInfoChild,
91+
})
9092
);
9193
ext.outputChannel.appendLog(localize('usingAcr', 'Using Azure Container Registry "{0}".', context.registry.name));
9294
}
9395
context.telemetry.properties.existingRegistry = String(!!context.registry);
9496

9597
// Container app
9698
if (context.containerApp) {
97-
prependOrInsertAfterLastInfoChild(context,
99+
startingResources.push(
98100
new ActivityChildItem({
99101
label: localize('useContainerApp', 'Use container app "{0}"', context.containerApp.name),
100102
contextValue: createContextValue([startingResourcesContext, activityInfoContext]),
101103
activityType: ActivityChildType.Info,
102104
iconPath: activityInfoIcon,
103105
stepId: this.id,
104-
}) as ActivityInfoChild,
106+
})
105107
);
106108
ext.outputChannel.appendLog(localize('usingContainerApp', 'Using container app "{0}".', context.containerApp.name));
107109
}
@@ -113,5 +115,8 @@ export class StartingResourcesLogStep<T extends StartingResourcesLogContext> ext
113115
ext.outputChannel.appendLog(localize('usingLocation', 'Using location: "{0}".', location));
114116
}
115117
context.telemetry.properties.existingLocation = String(!!LocationListStep.hasLocation(context));
118+
119+
// Add the starting resources to the front of the list
120+
context.activityChildren?.unshift(...startingResources);
116121
}
117122
}

0 commit comments

Comments
 (0)