mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 02:48:30 -05:00
* Kusto extension * Add kusto to extensions.ts * Remove objectExplorerNodeProvider * Removed some BDC items + CR cleanup * Cleanup unused strings in package.nls.json * Remove unused svgs, and some cleanup * Bringing objectExplorerNode back and hygiene changes * rename to KustoObjectExplorerNodeProvider * rename to KustoIconProvider * Cleanup SQL code * Fix compilation error * Clean up in objectExplorerNodeProvider folder * Some more clean up based on comments * apiWrapper add * changed to camelCase * Remove unused functions/files * Removed AgentServicesFeature * dacfx, cms, schemacompare clean up * Clean up and addressed few comments * Remove apWrapper from kusto extension * Addressed few comments * credentialstore and escapeexception changes * Added strict check for Kusto extension * Fix error and addressed comment * Saving Kusto files shoulf default to .kql * package.json changes * Fix objectExplorerNodeProvider * Amir/kusto fix (#11972) * Add the compiled extensions.js * Fix strict compile rules Co-authored-by: Monica Gupta <mogupt@microsoft.com> Co-authored-by: Amir Omidi <amomidi@microsoft.com>
76 lines
2.3 KiB
TypeScript
76 lines
2.3 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import * as vscode from 'vscode';
|
|
import * as azdata from 'azdata';
|
|
|
|
import * as types from './types';
|
|
|
|
export enum BuiltInCommands {
|
|
SetContext = 'setContext',
|
|
}
|
|
|
|
export enum ContextKeys {
|
|
ISCLOUD = 'kusto:iscloud',
|
|
EDITIONID = 'kusto:engineedition',
|
|
ISCLUSTER = 'kusto:iscluster',
|
|
SERVERMAJORVERSION = 'kusto:servermajorversion'
|
|
}
|
|
|
|
const isCloudEditions = [
|
|
5,
|
|
6
|
|
];
|
|
|
|
export function setCommandContext(key: ContextKeys | string, value: any) {
|
|
return vscode.commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
|
}
|
|
|
|
export default class ContextProvider {
|
|
private _disposables = new Array<vscode.Disposable>();
|
|
|
|
constructor() {
|
|
this._disposables.push(azdata.workspace.onDidOpenDashboard(this.onDashboardOpen, this));
|
|
this._disposables.push(azdata.workspace.onDidChangeToDashboard(this.onDashboardOpen, this));
|
|
}
|
|
|
|
public onDashboardOpen(e: azdata.DashboardDocument): void {
|
|
let iscloud: boolean = false;
|
|
let edition: number | undefined;
|
|
let isCluster: boolean = false; // TODO: Do we even need this for Kusto
|
|
let serverMajorVersion: number | undefined;
|
|
if (e.profile.providerName.toLowerCase() === 'kusto' && !types.isUndefinedOrNull(e.serverInfo) && !types.isUndefinedOrNull(e.serverInfo.engineEditionId)) {
|
|
if (isCloudEditions.some(i => i === e.serverInfo.engineEditionId)) {
|
|
iscloud = true;
|
|
} else {
|
|
iscloud = false;
|
|
}
|
|
|
|
edition = e.serverInfo.engineEditionId;
|
|
|
|
serverMajorVersion = e.serverInfo.serverMajorVersion;
|
|
}
|
|
|
|
if (iscloud === true || iscloud === false) {
|
|
setCommandContext(ContextKeys.ISCLOUD, iscloud);
|
|
}
|
|
|
|
if (!types.isUndefinedOrNull(edition)) {
|
|
setCommandContext(ContextKeys.EDITIONID, edition);
|
|
}
|
|
|
|
if (!types.isUndefinedOrNull(isCluster)) {
|
|
setCommandContext(ContextKeys.ISCLUSTER, isCluster);
|
|
}
|
|
|
|
if (!types.isUndefinedOrNull(serverMajorVersion)) {
|
|
setCommandContext(ContextKeys.SERVERMAJORVERSION, serverMajorVersion);
|
|
}
|
|
}
|
|
|
|
dispose(): void {
|
|
this._disposables = this._disposables.map(i => i.dispose());
|
|
}
|
|
}
|