diff --git a/extensions/kusto/package.json b/extensions/kusto/package.json index 2335df5229..63319d87dd 100644 --- a/extensions/kusto/package.json +++ b/extensions/kusto/package.json @@ -223,7 +223,8 @@ "path": { "light": "resources/light/azureDE.svg", "dark": "resources/dark/azureDE_inverse.svg" - } + }, + "default": true }, { "id": "kusto:cluster", diff --git a/src/sql/platform/capabilities/common/capabilitiesService.ts b/src/sql/platform/capabilities/common/capabilitiesService.ts index 4e1f57683d..f5a2874bb2 100644 --- a/src/sql/platform/capabilities/common/capabilitiesService.ts +++ b/src/sql/platform/capabilities/common/capabilitiesService.ts @@ -22,7 +22,7 @@ export const clientCapabilities = { export interface ConnectionProviderProperties { providerId: string; - iconPath?: URI | IconPath | { id: string, path: IconPath }[] + iconPath?: URI | IconPath | { id: string, path: IconPath, default?: boolean }[] displayName: string; notebookKernelAlias?: string; azureResource?: string; diff --git a/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeRenderer.ts b/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeRenderer.ts index 48572f7cc8..ee655ab9eb 100644 --- a/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeRenderer.ts +++ b/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeRenderer.ts @@ -99,7 +99,6 @@ class ConnectionProfileTemplate extends Disposable { set(element: ConnectionProfile) { if (!this._isCompact) { - let iconPath: IconPath | undefined = getIconPath(element, this._connectionManagementService); if (this._connectionManagementService.isConnected(undefined, element)) { this._connectionStatusBadge.classList.remove('disconnected'); this._connectionStatusBadge.classList.add('connected'); @@ -107,9 +106,11 @@ class ConnectionProfileTemplate extends Disposable { this._connectionStatusBadge.classList.remove('connected'); this._connectionStatusBadge.classList.add('disconnected'); } - renderServerIcon(this._icon, iconPath); } + let iconPath: IconPath | undefined = getIconPath(element, this._connectionManagementService); + renderServerIcon(this._icon, iconPath); + let label = element.title; if (!element.isConnectionOptionsValid) { label = localize('loading', "Loading..."); @@ -259,16 +260,14 @@ function getIconPath(connection: ConnectionProfile, connectionManagementService: } let iconId = connectionManagementService.getConnectionIconId(connection.id); - if (!iconId) { return undefined; } - let providerProperties = connectionManagementService.getProviderProperties(connection.providerName); if (!providerProperties) { return undefined; } let iconPath: IconPath | undefined = undefined; - let pathConfig: URI | IconPath | { id: string, path: IconPath }[] | undefined = providerProperties['iconPath']; + let pathConfig: URI | IconPath | { id: string, path: IconPath, default?: boolean }[] | undefined = providerProperties['iconPath']; if (Array.isArray(pathConfig)) { for (const e of pathConfig) { - if (!e.id || e.id === iconId) { + if (!e.id || e.id === iconId || (!iconId && e.default)) { iconPath = e.path; connection['iconPath'] = iconPath; break; diff --git a/src/sql/workbench/services/objectExplorer/browser/iconRenderer.ts b/src/sql/workbench/services/objectExplorer/browser/iconRenderer.ts index aaf96d34b4..a91755ee24 100644 --- a/src/sql/workbench/services/objectExplorer/browser/iconRenderer.ts +++ b/src/sql/workbench/services/objectExplorer/browser/iconRenderer.ts @@ -10,7 +10,7 @@ import { URI } from 'vs/base/common/uri'; class IconRenderer { private iconRegistered: Set = new Set(); - public registerIcon(path: URI | IconPath): string | undefined { + public registerIcon(path: URI | IconPath | undefined): string | undefined { if (!path) { return undefined; } let iconPath: IconPath = this.toIconPath(path); let iconUid: string | undefined = this.getIconUid(iconPath); @@ -37,8 +37,7 @@ class IconRenderer { } } - public putIcon(element: HTMLElement, path: URI | IconPath): void { - if (!element || !path) { return undefined; } + public putIcon(element: HTMLElement, path: URI | IconPath | undefined): void { let iconUid: string | undefined = this.registerIcon(path); element.id = iconUid ?? ''; } diff --git a/src/sql/workbench/services/objectExplorer/browser/serverTreeRenderer.ts b/src/sql/workbench/services/objectExplorer/browser/serverTreeRenderer.ts index 473701eea2..7d7fc40015 100644 --- a/src/sql/workbench/services/objectExplorer/browser/serverTreeRenderer.ts +++ b/src/sql/workbench/services/objectExplorer/browser/serverTreeRenderer.ts @@ -171,16 +171,14 @@ export class ServerTreeRenderer implements IRenderer { } let iconId = this._connectionManagementService.getConnectionIconId(connection.id); - if (!iconId) { return undefined; } - let providerProperties = this._connectionManagementService.getProviderProperties(connection.providerName); if (!providerProperties) { return undefined; } let iconPath: IconPath | undefined = undefined; - let pathConfig: URI | IconPath | { id: string, path: IconPath }[] | undefined = providerProperties.iconPath; + let pathConfig: URI | IconPath | { id: string, path: IconPath, default?: boolean }[] | undefined = providerProperties.iconPath; if (Array.isArray(pathConfig)) { for (const e of pathConfig) { - if (!e.id || e.id === iconId) { + if (!e.id || e.id === iconId || (!iconId && e.default)) { iconPath = e.path; connection['iconPath'] = iconPath; break; @@ -199,9 +197,7 @@ export class ServerTreeRenderer implements IRenderer { private renderServerIcon(element: HTMLElement, iconPath: IconPath | undefined, isConnected: boolean): void { if (!element) { return; } - if (iconPath) { - iconRenderer.putIcon(element, iconPath); - } + iconRenderer.putIcon(element, iconPath); let badgeToRemove: string = isConnected ? badgeRenderer.serverDisconnected : badgeRenderer.serverConnected; let badgeToAdd: string = isConnected ? badgeRenderer.serverConnected : badgeRenderer.serverDisconnected; badgeRenderer.removeBadge(element, badgeToRemove); @@ -209,19 +205,21 @@ export class ServerTreeRenderer implements IRenderer { } private renderConnection(connection: ConnectionProfile, templateData: IConnectionTemplateData): void { + + let isConnected = this._connectionManagementService.isConnected(undefined, connection); if (!this._isCompact) { - let iconPath = this.getIconPath(connection); - if (this._connectionManagementService.isConnected(undefined, connection)) { + if (isConnected) { templateData.icon.classList.remove('disconnected'); templateData.icon.classList.add('connected'); - this.renderServerIcon(templateData.icon, iconPath, true); } else { templateData.icon.classList.remove('connected'); templateData.icon.classList.add('disconnected'); - this.renderServerIcon(templateData.icon, iconPath, false); } } + let iconPath = this.getIconPath(connection); + this.renderServerIcon(templateData.icon, iconPath, isConnected); + let label = connection.title; if (!connection.isConnectionOptionsValid) { label = localize('loading', "Loading...");