Skip to content

Commit

Permalink
feat: show progress bar when switching is not finished (#12753)
Browse files Browse the repository at this point in the history
* feat: show progress bar when switching is not finished

* fix: update string per comment
  • Loading branch information
HuihuiWu-Microsoft authored Nov 20, 2024
1 parent afee6ea commit a47b209
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/vscode-extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"teamstoolkit.commands.selectTutorials.title": "View How-to Guides",
"teamstoolkit.commands.switchTenant.m365.title": "Switch between your available tenants for Microsoft 365 account",
"teamstoolkit.commands.switchTenant.azure.title": "Switch between your available tenants for Azure account",
"teamstoolkit.commands.switchTenant.progressbar.title": "Switch tenant",
"teamstoolkit.commands.switchTenant.progressbar.detail": "Teams Toolkit is now switching to the newly selected tenant.",
"teamstoolkit.commands.signOut.title": "Sign Out",
"teamstoolkit.commands.checkCopilotAccess.title": "Check Copilot Access",
"teamstoolkit.commands.updateManifest.title": "Update Teams App",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ export async function onSwitchM365Tenant(...args: unknown[]): Promise<void> {
};
const result = await VS_CODE_UI.selectOption(config);
if (result.isOk()) {
const progressHandler = VS_CODE_UI.createProgressBar(
localize("teamstoolkit.commands.switchTenant.progressbar.title"),
1
);
await progressHandler.start();
await progressHandler.next(localize("teamstoolkit.commands.switchTenant.progressbar.detail"));
const switchRes = await M365TokenInstance.switchTenant(result.value.result as string);
await progressHandler.end(switchRes.isOk());
if (switchRes.isOk()) {
ExtTelemetry.sendTelemetryEvent(TelemetryEvent.SwitchTenant, {
[TelemetryProperty.AccountType]: AccountType.M365,
Expand Down Expand Up @@ -100,7 +107,14 @@ export async function onSwitchAzureTenant(...args: unknown[]): Promise<void> {
const result = await VS_CODE_UI.selectOption(config);
let error: any;
if (result.isOk()) {
const progressHandler = VS_CODE_UI.createProgressBar(
localize("teamstoolkit.commands.switchTenant.progressbar.title"),
1
);
await progressHandler.start();
await progressHandler.next(localize("teamstoolkit.commands.switchTenant.progressbar.detail"));
const switchRes = await azureAccountManager.switchTenant(result.value.result as string);
await progressHandler.end(switchRes.isOk());
if (switchRes.isOk()) {
ExtTelemetry.sendTelemetryEvent(TelemetryEvent.SwitchTenant, {
[TelemetryProperty.AccountType]: AccountType.Azure,
Expand Down

0 comments on commit a47b209

Please sign in to comment.