Skip to content

Commit eed858e

Browse files
committed
Use abstract class
1 parent 856032d commit eed858e

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/commands/StartingResourcesLogStep.ts renamed to src/commands/StartingResourcesLogStepBase.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ type StartingResourcesLogContext = IActionContext & Partial<ExecuteActivityConte
2020
/**
2121
* Use to display primary Azure resources to the output and activity log
2222
*/
23-
export class StartingResourcesLogStep<T extends StartingResourcesLogContext> extends AzureWizardPromptStep<T> {
23+
export abstract class StartingResourcesLogStepBase<T extends StartingResourcesLogContext> extends AzureWizardPromptStep<T> {
2424
public hideStepCount: boolean = true;
2525
protected hasLogged: boolean = false;
2626

27+
abstract configureStartingResources?(context: T): void | Promise<void>;
28+
2729
public async configureBeforePrompt(context: T): Promise<void> {
2830
if (this.hasLogged) {
2931
return;
3032
}
33+
await this.configureStartingResources?.(context);
3134
await this.logStartingResources(context);
3235
}
3336

src/commands/editContainer/ContainerEditStartingResourcesLogStep.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,16 @@ import { type ResourceGroup } from "@azure/arm-resources";
77
import { LocationListStep, ResourceGroupListStep } from "@microsoft/vscode-azext-azureutils";
88
import { nonNullValue, nonNullValueAndProp } from "@microsoft/vscode-azext-utils";
99
import { localize } from "../../utils/localize";
10-
import { StartingResourcesLogStep } from "../StartingResourcesLogStep";
10+
import { StartingResourcesLogStepBase } from "../StartingResourcesLogStepBase";
1111
import { type ContainerEditContext } from "./ContainerEditContext";
1212

13-
export class ContainerEditStartingResourcesLogStep<T extends ContainerEditContext> extends StartingResourcesLogStep<T> {
14-
override async configureBeforePrompt(context: T): Promise<void> {
15-
if (this.hasLogged) {
16-
return;
17-
}
18-
13+
export class ContainerEditStartingResourcesLogStep<T extends ContainerEditContext> extends StartingResourcesLogStepBase<T> {
14+
async configureStartingResources(context: T): Promise<void> {
1915
const resourceGroups: ResourceGroup[] = await ResourceGroupListStep.getResourceGroups(context);
2016
context.resourceGroup = nonNullValue(
2117
resourceGroups.find(rg => rg.name === context.containerApp?.resourceGroup),
2218
localize('containerAppResourceGroup', 'Expected to find the container app\'s resource group.'),
2319
);
24-
2520
await LocationListStep.setLocation(context, nonNullValueAndProp(context.containerApp, 'location'));
26-
await this.logStartingResources(context);
2721
}
2822
}

0 commit comments

Comments
 (0)