Skip to content

Commit 8d41bed

Browse files
authored
Remove the 'Edit Secret Name..." command (#501)
* Add placeholder * Remove edit secret name * Small changes
1 parent d56d2c8 commit 8d41bed

File tree

6 files changed

+6
-78
lines changed

6 files changed

+6
-78
lines changed

package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@
130130
"title": "%containerApps.addSecret%",
131131
"category": "Azure Container Apps"
132132
},
133-
{
134-
"command": "containerApps.editSecretName",
135-
"title": "%containerApps.editSecretName%",
136-
"category": "Azure Container Apps"
137-
},
138133
{
139134
"command": "containerApps.editSecretValue",
140135
"title": "%containerApps.editSecretValue%",
@@ -473,11 +468,6 @@
473468
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /secretsItem/i",
474469
"group": "1@1"
475470
},
476-
{
477-
"command": "containerApps.editSecretName",
478-
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /secretItem/i",
479-
"group": "1@1"
480-
},
481471
{
482472
"command": "containerApps.editSecretValue",
483473
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /secretItem/i",

package.nls.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"containerApps.toggleVisibility": "Switch Ingress Visibility...",
2020
"containerApps.editTargetPort": "Edit Target Port...",
2121
"containerApps.addSecret": "Add Secret...",
22-
"containerApps.editSecretName": "Edit Secret Name...",
2322
"containerApps.editSecretValue": "Edit Secret Value...",
2423
"containerApps.deleteSecret": "Delete Secret...",
2524
"containerApps.chooseRevisionMode": "Choose Revision Mode...",

src/commands/registerCommands.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import { addScaleRule } from './scaling/scaleRule/addScaleRule/addScaleRule';
3737
import { deleteScaleRule } from './scaling/scaleRule/deleteScaleRule/deleteScaleRule';
3838
import { addSecret } from './secret/addSecret/addSecret';
3939
import { deleteSecret } from './secret/deleteSecret/deleteSecret';
40-
import { editSecretName } from './secret/editSecret/editSecretName';
4140
import { editSecretValue } from './secret/editSecret/editSecretValue';
4241

4342
export function registerCommands(): void {
@@ -73,7 +72,6 @@ export function registerCommands(): void {
7372

7473
// secret
7574
registerCommandWithTreeNodeUnwrapping('containerApps.addSecret', addSecret);
76-
registerCommandWithTreeNodeUnwrapping('containerApps.editSecretName', editSecretName);
7775
registerCommandWithTreeNodeUnwrapping('containerApps.editSecretValue', editSecretValue);
7876
registerCommandWithTreeNodeUnwrapping('containerApps.deleteSecret', deleteSecret);
7977

src/commands/secret/editSecret/SecretUpdateStep.ts renamed to src/commands/secret/editSecret/SecretValueUpdateStep.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,27 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { AzureWizardExecuteStep, nonNullProp, nonNullValue } from "@microsoft/vscode-azext-utils";
6+
import { AzureWizardExecuteStep, nonNullProp } from "@microsoft/vscode-azext-utils";
77
import type { Progress } from "vscode";
88
import { ext } from "../../../extensionVariables";
99
import { ContainerAppModel, getContainerEnvelopeWithSecrets } from "../../../tree/ContainerAppItem";
1010
import { localize } from "../../../utils/localize";
1111
import { updateContainerApp } from "../../updateContainerApp";
1212
import type { ISecretContext } from "../ISecretContext";
1313

14-
export class SecretUpdateStep extends AzureWizardExecuteStep<ISecretContext> {
14+
export class SecretValueUpdateStep extends AzureWizardExecuteStep<ISecretContext> {
1515
public priority: number = 850;
1616

1717
public async execute(context: ISecretContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
1818
const containerApp: ContainerAppModel = nonNullProp(context, 'containerApp');
1919
const containerAppEnvelope = await getContainerEnvelopeWithSecrets(context, context.subscription, containerApp);
2020

21-
let updatedSecret: string | undefined;
22-
if (context.newSecretName) {
23-
context.activityTitle = localize('updatingSecretName', 'Update secret name from "{0}" to "{1}" in container app "{2}"', context.secretName, context.newSecretName, containerApp.name);
24-
updatedSecret = localize('updatedSecretName', 'Updated secret name from "{0}" to "{1}" in container app "{2}".', context.secretName, context.newSecretName, containerApp.name);
25-
} else if (context.newSecretValue) {
26-
updatedSecret = localize('updatedSecretValue', 'Updated secret value for "{0}" in container app "{1}".', context.secretName, containerApp.name);
27-
}
28-
2921
progress.report({ message: localize('updatingSecret', 'Updating secret...') });
3022

3123
let didUpdateSecret: boolean = false;
3224
containerAppEnvelope.configuration.secrets ||= [];
3325
containerAppEnvelope.configuration.secrets.forEach((secret) => {
3426
if (secret.name === context.secretName) {
35-
secret.name = context.newSecretName ?? secret.name;
3627
secret.value = context.newSecretValue ?? secret.value;
3728
didUpdateSecret = true;
3829
}
@@ -44,10 +35,10 @@ export class SecretUpdateStep extends AzureWizardExecuteStep<ISecretContext> {
4435

4536
await updateContainerApp(context, context.subscription, containerAppEnvelope);
4637

47-
ext.outputChannel.appendLog(nonNullValue(updatedSecret));
38+
ext.outputChannel.appendLog(localize('updatedSecretValue', 'Updated secret value for "{0}" in container app "{1}".', context.secretName, containerApp.name));
4839
}
4940

5041
public shouldExecute(context: ISecretContext): boolean {
51-
return !!context.secretName && (!!context.newSecretName || !!context.newSecretValue);
42+
return !!context.secretName && !!context.newSecretValue;
5243
}
5344
}

src/commands/secret/editSecret/editSecretName.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/commands/secret/editSecret/editSecretValue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { localize } from "../../../utils/localize";
1111
import { pickSecret } from "../../../utils/pickItem/pickSecret";
1212
import type { ISecretContext } from "../ISecretContext";
1313
import { SecretValueStep } from "../addSecret/SecretValueStep";
14-
import { SecretUpdateStep } from "./SecretUpdateStep";
14+
import { SecretValueUpdateStep } from "./SecretValueUpdateStep";
1515

1616
export async function editSecretValue(context: IActionContext, node?: SecretItem): Promise<void> {
1717
const item: SecretItem = node ?? await pickSecret(context);
@@ -32,7 +32,7 @@ export async function editSecretValue(context: IActionContext, node?: SecretItem
3232
];
3333

3434
const executeSteps: AzureWizardExecuteStep<ISecretContext>[] = [
35-
new SecretUpdateStep()
35+
new SecretValueUpdateStep()
3636
];
3737

3838
const wizard: AzureWizard<ISecretContext> = new AzureWizard(wizardContext, {

0 commit comments

Comments
 (0)