-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shortcut to switching to sovereign cloud within the tenant view #926
Merged
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a516192
initial commit
motm32 54fe554
changes
motm32 24c6878
rename and small changes
motm32 ec2ca42
add new auth
motm32 0ecbfb0
fix bugs and add support for sovereign clouds
motm32 a03dbf5
fix bugs
motm32 720fb6d
add another refresh
motm32 009a943
merge main
motm32 84257f3
merge conflict fix
motm32 418d488
removed tools files and other requested changes
motm32 93bd450
merge main
motm32 c7d09a3
change
motm32 9783ae0
add in sovereign cloud shortcut
motm32 3b9420c
Add default
motm32 f954000
merge main
motm32 64e4b04
another change
motm32 38cf73e
add back comma
motm32 65bbce6
open setting on custom
motm32 21a154e
merge main
motm32 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/commands/sovereignCloud/ConfigureSovereignCloudContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { IActionContext } from "@microsoft/vscode-azext-utils"; | ||
|
||
export interface ConfigureSovereignCloudContext extends IActionContext { | ||
sovereignCloud?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { AzureWizardPromptStep, IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; | ||
import { ConfigureSovereignCloudContext } from "./ConfigureSovereignCloudContext"; | ||
|
||
export class SovereignCloudListStep extends AzureWizardPromptStep<ConfigureSovereignCloudContext> { | ||
public async prompt(context: ConfigureSovereignCloudContext): Promise<void> { | ||
const picks: IAzureQuickPickItem<string>[] = [ | ||
{ label: 'Azure (Default)', data: '' }, | ||
{ label: 'Azure China', data: 'ChinaCloud' }, | ||
{ label: 'Azure US Government', data: 'USGovernment' }, | ||
{ label: 'A custom Microsoft Sovereign Cloud', data: 'custom' } | ||
] | ||
|
||
context.sovereignCloud = (await context.ui.showQuickPick(picks, { placeHolder: 'Select a sovereign cloud' })).data; | ||
} | ||
|
||
public shouldPrompt(context: ConfigureSovereignCloudContext): boolean { | ||
return !context.sovereignCloud; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { AzureWizardExecuteStep } from "@microsoft/vscode-azext-utils"; | ||
import * as vscode from 'vscode'; | ||
import { settingUtils } from "../../utils/settingUtils"; | ||
import { ConfigureSovereignCloudContext } from "./ConfigureSovereignCloudContext"; | ||
|
||
export class SovereignCloudSetStep extends AzureWizardExecuteStep<ConfigureSovereignCloudContext> { | ||
public priority: number = 10; | ||
|
||
public async execute(context: ConfigureSovereignCloudContext): Promise<void> { | ||
if (context.sovereignCloud === 'custom') { | ||
await vscode.commands.executeCommand('workbench.action.openSettings', 'microsoft-sovereign-cloud'); | ||
} else { | ||
await settingUtils.updateGlobalSetting('environment', context.sovereignCloud, 'microsoft-sovereign-cloud'); | ||
} | ||
} | ||
|
||
public shouldExecute(): boolean { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { AzureWizard } from "@microsoft/vscode-azext-utils"; | ||
import { ext } from "../../extensionVariables"; | ||
import { localize } from "../../utils/localize"; | ||
import { ConfigureSovereignCloudContext } from "./ConfigureSovereignCloudContext"; | ||
import { SovereignCloudListStep } from "./SovereignCloudListStep"; | ||
import { SovereignCloudSetStep } from "./SovereignCloudSetStep"; | ||
|
||
export async function configureSovereignCloud(context: ConfigureSovereignCloudContext): Promise<void> { | ||
const wizardContext: ConfigureSovereignCloudContext = { | ||
...context, | ||
}; | ||
|
||
const title: string = localize('selectSovereignCloud', 'Select Sovereign Cloud'); | ||
|
||
const wizard: AzureWizard<ConfigureSovereignCloudContext> = new AzureWizard(wizardContext, { | ||
title, | ||
promptSteps: [new SovereignCloudListStep()], | ||
executeSteps: [new SovereignCloudSetStep()], | ||
}); | ||
|
||
await wizard.prompt(); | ||
await wizard.execute(); | ||
|
||
// refresh resources and tenant view to accurrately reflect information for the selected sovereign cloud | ||
ext.actions.refreshAzureTree(); | ||
ext.actions.refreshTenantTree(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they pick custom, should we take them to the setting page so they can actually configure it? We can make this change later though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah we should change the custom since it will cause an error at the moment