Open in azure portal (#10535)

* initial commit to get it working

* Change configuration to use package.nls.json

* Make the necessary plumbing

* Support multi cloud

* Move the menu item to the bottom

* Fix failing tests

* Fix the tests
This commit is contained in:
Amir Omidi
2020-05-29 19:59:29 -07:00
committed by GitHub
parent b2e0291a95
commit 7d31239e64
28 changed files with 146 additions and 31 deletions

View File

@@ -34,6 +34,7 @@ export class MssqlNodeContext extends Disposable {
static NodeType = new RawContextKey<string>('nodeType', undefined);
static NodeLabel = new RawContextKey<string>('nodeLabel', undefined);
static EngineEdition = new RawContextKey<number>('engineEdition', DatabaseEngineEdition.Unknown);
static CanOpenInAzurePortal = new RawContextKey<boolean>('canOpenInAzurePortal', false);
// Scripting context keys
static CanScriptAsSelect = new RawContextKey<boolean>('canScriptAsSelect', false);
@@ -48,6 +49,7 @@ export class MssqlNodeContext extends Disposable {
private nodeLabelKey: IContextKey<string>;
private isDatabaseOrServerKey: IContextKey<boolean>;
private engineEditionKey: IContextKey<number>;
private canOpenInAzurePortal: IContextKey<boolean>;
private canScriptAsSelectKey: IContextKey<boolean>;
private canEditDataKey: IContextKey<boolean>;
@@ -71,6 +73,7 @@ export class MssqlNodeContext extends Disposable {
this.setNodeProvider();
this.setIsCloud();
this.setEngineEdition();
this.setCanOpenInPortal();
if (node.type) {
this.setIsDatabaseOrServer();
this.nodeTypeKey.set(node.type);
@@ -98,6 +101,7 @@ export class MssqlNodeContext extends Disposable {
this.canScriptAsExecuteKey = MssqlNodeContext.CanScriptAsExecute.bindTo(this.contextKeyService);
this.canScriptAsAlterKey = MssqlNodeContext.CanScriptAsAlter.bindTo(this.contextKeyService);
this.nodeProviderKey = MssqlNodeContext.NodeProvider.bindTo(this.contextKeyService);
this.canOpenInAzurePortal = MssqlNodeContext.CanOpenInAzurePortal.bindTo(this.contextKeyService);
}
/**
@@ -121,6 +125,16 @@ export class MssqlNodeContext extends Disposable {
}
}
private setCanOpenInPortal(): void {
const connectionProfile = this.nodeContextValue.node.payload;
if (connectionProfile &&
connectionProfile.azureResourceId &&
connectionProfile.azureTenantId &&
connectionProfile.azurePortalEndpoint) {
this.canOpenInAzurePortal.set(true);
}
}
/**
* Helper function to set engine edition
*/