Skip to content

Commit ab5bfb2

Browse files
committed
Rename context vars
1 parent 8fe805b commit ab5bfb2

File tree

10 files changed

+31
-31
lines changed

10 files changed

+31
-31
lines changed

src/commands/scaling/addScaleRule/AddScaleRuleStep.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ export class AddScaleRuleStep<T extends IAddScaleRuleContext> extends RevisionDr
2828
this.updateRevisionDraftWithTemplate();
2929

3030
const resourceName = context.containerApp.revisionsMode === KnownActiveRevisionsMode.Single ? context.containerApp.name : this.baseItem.revision.name;
31-
ext.outputChannel.appendLog(localize('addedScaleRule', 'Added {0} rule "{1}" to "{2}" (draft)', context.ruleType, context.ruleName, resourceName));
31+
ext.outputChannel.appendLog(localize('addedScaleRule', 'Added {0} rule "{1}" to "{2}" (draft)', context.newRuleType, context.newRuleName, resourceName));
3232
}
3333

3434
public shouldExecute(context: IAddScaleRuleContext): boolean {
35-
return !!context.ruleName && !!context.ruleType;
35+
return !!context.newRuleName && !!context.newRuleType;
3636
}
3737

3838
private buildRule(context: IAddScaleRuleContext): ScaleRule {
39-
const scaleRule: ScaleRule = { name: context.ruleName };
40-
switch (context.ruleType) {
39+
const scaleRule: ScaleRule = { name: context.newRuleName };
40+
switch (context.newRuleType) {
4141
case ScaleRuleTypes.HTTP:
4242
scaleRule.http = {
4343
metadata: {
@@ -47,9 +47,9 @@ export class AddScaleRuleStep<T extends IAddScaleRuleContext> extends RevisionDr
4747
break;
4848
case ScaleRuleTypes.Queue:
4949
scaleRule.azureQueue = {
50-
queueName: context.queueName,
51-
queueLength: context.queueLength,
52-
auth: [{ secretRef: context.secretRef, triggerParameter: context.triggerParameter }]
50+
queueName: context.newQueueName,
51+
queueLength: context.newQueueLength,
52+
auth: [{ secretRef: context.newQueueSecretRef, triggerParameter: context.newQueueTriggerParameter }]
5353
}
5454
break;
5555
default:
@@ -58,7 +58,7 @@ export class AddScaleRuleStep<T extends IAddScaleRuleContext> extends RevisionDr
5858
}
5959

6060
private integrateRule(context: IAddScaleRuleContext, scaleRules: ScaleRule[], scaleRule: ScaleRule): void {
61-
switch (context.ruleType) {
61+
switch (context.newRuleType) {
6262
case ScaleRuleTypes.HTTP:
6363
// Portal only allows one HTTP rule per revision
6464
const idx: number = scaleRules.findIndex((rule) => rule.http);

src/commands/scaling/addScaleRule/IAddScaleRuleContext.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ export interface IAddScaleRuleContext extends IContainerAppContext, ExecuteActiv
1414
parentResourceName: string;
1515

1616
// Base Rule Properties
17-
ruleName?: string;
18-
ruleType?: string;
17+
newRuleName?: string;
18+
newRuleType?: string;
1919

2020
// HTTP Rule Properties
21-
concurrentRequests?: string;
21+
newHttpConcurrentRequests?: string;
2222

2323
// Queue Rule Properties
24-
queueName?: string;
25-
queueLength?: number;
26-
secretRef?: string;
27-
triggerParameter?: string;
24+
newQueueName?: string;
25+
newQueueLength?: number;
26+
newQueueSecretRef?: string;
27+
newQueueTriggerParameter?: string;
2828

2929
scaleRule?: ScaleRule;
3030
}

src/commands/scaling/addScaleRule/ScaleRuleNameStep.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ export class ScaleRuleNameStep extends AzureWizardPromptStep<IAddScaleRuleContex
1313
public hideStepCount: boolean = true;
1414

1515
public async prompt(context: IAddScaleRuleContext): Promise<void> {
16-
context.ruleName = (await context.ui.showInputBox({
16+
context.newRuleName = (await context.ui.showInputBox({
1717
prompt: localize('scaleRuleNamePrompt', 'Enter a name for the new scale rule.'),
1818
validateInput: this.validateInput,
1919
asyncValidationTask: (name: string) => this.validateNameAvailable(context, name)
2020
})).trim();
2121
}
2222

2323
public shouldPrompt(context: IAddScaleRuleContext): boolean {
24-
return !context.ruleName;
24+
return !context.newRuleName;
2525
}
2626

2727
private validateInput(name: string | undefined): string | undefined {

src/commands/scaling/addScaleRule/ScaleRuleTypeListStep.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ export class ScaleRuleTypeListStep extends AzureWizardPromptStep<IAddScaleRuleCo
2222
return { label: type };
2323
});
2424

25-
context.ruleType = (await context.ui.showQuickPick(qpItems, {
25+
context.newRuleType = (await context.ui.showQuickPick(qpItems, {
2626
placeHolder: localize('chooseScaleType', 'Choose scale type')
2727
})).label;
2828
}
2929

3030
public shouldPrompt(context: IAddScaleRuleContext): boolean {
31-
return !context.ruleType;
31+
return !context.newRuleType;
3232
}
3333

3434
public async getSubWizard(context: IAddScaleRuleContext): Promise<IWizardOptions<IAddScaleRuleContext>> {
3535
const promptSteps: AzureWizardPromptStep<IAddScaleRuleContext>[] = [];
36-
switch (context.ruleType) {
36+
switch (context.newRuleType) {
3737
case ScaleRuleTypes.HTTP:
3838
promptSteps.push(new HttpConcurrentRequestsStep());
3939
break;

src/commands/scaling/addScaleRule/addScaleRule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function addScaleRule(context: IActionContext, node?: ScaleRuleGrou
4040

4141
await wizard.prompt();
4242

43-
wizardContext.activityTitle = localize('addScaleRuleTitle', 'Add {0} rule "{1}" to "{2}" (draft)', wizardContext.ruleType, wizardContext.ruleName, parentResource.name);
43+
wizardContext.activityTitle = localize('addScaleRuleTitle', 'Add {0} rule "{1}" to "{2}" (draft)', wizardContext.newRuleType, wizardContext.newRuleName, parentResource.name);
4444

4545
await wizard.execute();
4646
}

src/commands/scaling/addScaleRule/http/HttpConcurrentRequestsStep.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import { PositiveRealNumberBaseStep } from '../PositiveRealNumberBaseStep';
99

1010
export class HttpConcurrentRequestsStep extends PositiveRealNumberBaseStep {
1111
public async prompt(context: IAddScaleRuleContext): Promise<void> {
12-
context.concurrentRequests = (await context.ui.showInputBox({
12+
context.newHttpConcurrentRequests = (await context.ui.showInputBox({
1313
prompt: localize('concurrentRequestsPrompt', 'Enter the number of concurrent requests.'),
1414
validateInput: this.validateInput
1515
})).trim();
1616
}
1717

1818
public shouldPrompt(context: IAddScaleRuleContext): boolean {
19-
return !context.concurrentRequests;
19+
return !context.newHttpConcurrentRequests;
2020
}
2121
}
2222

src/commands/scaling/addScaleRule/queue/QueueAuthSecretStep.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export class QueueAuthSecretStep extends AzureWizardPromptStep<IAddScaleRuleCont
2222
const qpItems: QuickPickItem[] = secrets.map((secret) => {
2323
return { label: nonNullProp(secret, "name") };
2424
});
25-
context.secretRef = (await context.ui.showQuickPick(qpItems, { placeHolder })).label;
25+
context.newQueueSecretRef = (await context.ui.showQuickPick(qpItems, { placeHolder })).label;
2626
}
2727

2828
public shouldPrompt(context: IAddScaleRuleContext): boolean {
29-
return context.secretRef === undefined;
29+
return context.newQueueSecretRef === undefined;
3030
}
3131
}

src/commands/scaling/addScaleRule/queue/QueueAuthTriggerStep.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import type { IAddScaleRuleContext } from '../IAddScaleRuleContext';
99

1010
export class QueueAuthTriggerStep extends AzureWizardPromptStep<IAddScaleRuleContext> {
1111
public async prompt(context: IAddScaleRuleContext): Promise<void> {
12-
context.triggerParameter = (await context.ui.showInputBox({
12+
context.newQueueTriggerParameter = (await context.ui.showInputBox({
1313
prompt: localize('queueAuthTriggerPrompt', 'Enter a corresponding trigger parameter.'),
1414
validateInput: this.validateInput
1515
})).trim();
1616
}
1717

1818
public shouldPrompt(context: IAddScaleRuleContext): boolean {
19-
return !context.triggerParameter;
19+
return !context.newQueueTriggerParameter;
2020
}
2121

2222
private validateInput(name: string | undefined): string | undefined {

src/commands/scaling/addScaleRule/queue/QueueLengthStep.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import { PositiveRealNumberBaseStep } from '../PositiveRealNumberBaseStep';
99

1010
export class QueueLengthStep extends PositiveRealNumberBaseStep {
1111
public async prompt(context: IAddScaleRuleContext): Promise<void> {
12-
context.queueLength = Number((await context.ui.showInputBox({
12+
context.newQueueLength = Number((await context.ui.showInputBox({
1313
prompt: localize('queueLengthPrompt', 'Enter a queue length.'),
1414
validateInput: this.validateInput
1515
})).trim());
1616
}
1717

1818
public shouldPrompt(context: IAddScaleRuleContext): boolean {
19-
return !context.queueLength;
19+
return !context.newQueueLength;
2020
}
2121
}
2222

src/commands/scaling/addScaleRule/queue/QueueNameStep.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import type { IAddScaleRuleContext } from '../IAddScaleRuleContext';
99

1010
export class QueueNameStep extends AzureWizardPromptStep<IAddScaleRuleContext> {
1111
public async prompt(context: IAddScaleRuleContext): Promise<void> {
12-
context.queueName = (await context.ui.showInputBox({
12+
context.newQueueName = (await context.ui.showInputBox({
1313
prompt: localize('queueNamePrompt', 'Enter a name for the queue.'),
1414
validateInput: this.validateInput
1515
})).trim();
1616
}
1717

1818
public shouldPrompt(context: IAddScaleRuleContext): boolean {
19-
return !context.queueName;
19+
return !context.newQueueName;
2020
}
2121

2222
private validateInput(name: string | undefined): string | undefined {

0 commit comments

Comments
 (0)