Skip to content

Commit 06e1720

Browse files
committed
Use optional method
1 parent 856032d commit 06e1720

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/commands/StartingResourcesLogStep.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 StartingResourcesLogStep<T extends StartingResourcesLogContext> extends AzureWizardPromptStep<T> {
2424
public hideStepCount: boolean = true;
2525
protected hasLogged: boolean = false;
2626

27+
protected 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: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,12 @@ import { StartingResourcesLogStep } from "../StartingResourcesLogStep";
1111
import { type ContainerEditContext } from "./ContainerEditContext";
1212

1313
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-
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)