mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
resource label update (#13129)
* resource label update * preserve existing behavior * fix connection group color * comments
This commit is contained in:
@@ -35,23 +35,29 @@ declare module 'azureResource' {
|
|||||||
readonly treeItem: TreeItem;
|
readonly treeItem: TreeItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IAzureSubscriptionInfo {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface AzureResource {
|
export interface AzureResource {
|
||||||
name: string;
|
name: string;
|
||||||
id: string;
|
id: string;
|
||||||
subscriptionId: string;
|
subscription: IAzureSubscriptionInfo;
|
||||||
resourceGroup?: string;
|
resourceGroup?: string;
|
||||||
tenant?: string;
|
tenant?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AzureResourceSubscription extends Omit<AzureResource, 'subscriptionId'> {
|
export interface AzureResourceSubscription extends Omit<AzureResource, 'subscription'> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AzureSqlResource extends AzureResource {
|
export interface AzureSqlResource extends AzureResource {
|
||||||
loginName: string;
|
loginName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AzureGraphResource extends Omit<AzureResource, 'tenant'> {
|
export interface AzureGraphResource extends Omit<AzureResource, 'tenant' | 'subscription'> {
|
||||||
tenantId: string;
|
tenantId: string;
|
||||||
|
subscriptionId: string;
|
||||||
type: string;
|
type: string;
|
||||||
location: string;
|
location: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,10 @@ export class AzureResourceDatabaseService implements IAzureResourceService<azure
|
|||||||
serverName: server.name,
|
serverName: server.name,
|
||||||
serverFullName: server.properties.fullyQualifiedDomainName,
|
serverFullName: server.properties.fullyQualifiedDomainName,
|
||||||
loginName: server.properties.administratorLogin,
|
loginName: server.properties.administratorLogin,
|
||||||
subscriptionId: db.subscriptionId,
|
subscription: {
|
||||||
|
id: db.subscriptionId,
|
||||||
|
name: (subscriptions.find(sub => sub.id === db.subscriptionId))?.name
|
||||||
|
},
|
||||||
tenant: db.tenantId,
|
tenant: db.tenantId,
|
||||||
resourceGroup: db.resourceGroup
|
resourceGroup: db.resourceGroup
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const localize = nls.loadMessageBundle();
|
|||||||
|
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
import { AzureResourceItemType } from '../../../azureResource/constants';
|
import { AzureResourceItemType } from '../../../azureResource/constants';
|
||||||
import { generateGuid } from '../../utils';
|
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
|
||||||
import { IAzureResourceService } from '../../interfaces';
|
import { IAzureResourceService } from '../../interfaces';
|
||||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||||
|
|
||||||
@@ -28,12 +28,12 @@ export class AzureResourceDatabaseTreeDataProvider extends ResourceTreeDataProvi
|
|||||||
protected getTreeItemForResource(database: azureResource.AzureResourceDatabase, account: Account): TreeItem {
|
protected getTreeItemForResource(database: azureResource.AzureResourceDatabase, account: Account): TreeItem {
|
||||||
return {
|
return {
|
||||||
id: `databaseServer_${database.serverFullName}.database_${database.name}`,
|
id: `databaseServer_${database.serverFullName}.database_${database.name}`,
|
||||||
label: `${database.name} (${database.serverName})`,
|
label: isConnectionDialogBrowseViewEnabled() ? `${database.serverName}/${database.name} (${AzureResourceDatabaseTreeDataProvider.containerLabel}, ${database.subscription.name})` : `${database.name} (${database.serverName})`,
|
||||||
iconPath: {
|
iconPath: {
|
||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_database_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_database_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/sql_database.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/sql_database.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: vscode.workspace.getConfiguration('connection').get<boolean>('dialog.browse') ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
|
collapsibleState: isConnectionDialogBrowseViewEnabled() ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.database,
|
contextValue: AzureResourceItemType.database,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase';
|
import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase';
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
|
|
||||||
|
|
||||||
export interface DbServerGraphData extends GraphData {
|
export interface DbServerGraphData extends GraphData {
|
||||||
properties: {
|
properties: {
|
||||||
fullyQualifiedDomainName: string;
|
fullyQualifiedDomainName: string;
|
||||||
@@ -30,7 +29,10 @@ export class AzureResourceDatabaseServerService extends ResourceServiceBase<DbSe
|
|||||||
fullName: resource.properties.fullyQualifiedDomainName,
|
fullName: resource.properties.fullyQualifiedDomainName,
|
||||||
loginName: resource.properties.administratorLogin,
|
loginName: resource.properties.administratorLogin,
|
||||||
defaultDatabaseName: 'master',
|
defaultDatabaseName: 'master',
|
||||||
subscriptionId: resource.subscriptionId,
|
subscription: {
|
||||||
|
id: resource.subscriptionId,
|
||||||
|
name: resource.subscriptionName
|
||||||
|
},
|
||||||
tenant: resource.tenantId,
|
tenant: resource.tenantId,
|
||||||
resourceGroup: resource.resourceGroup
|
resourceGroup: resource.resourceGroup
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
|
|||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { AzureResourceItemType } from '../../../azureResource/constants';
|
import { AzureResourceItemType } from '../../../azureResource/constants';
|
||||||
import { generateGuid } from '../../utils';
|
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
|
||||||
import { IAzureResourceService } from '../../interfaces';
|
import { IAzureResourceService } from '../../interfaces';
|
||||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
@@ -29,12 +29,12 @@ export class AzureResourceDatabaseServerTreeDataProvider extends ResourceTreeDat
|
|||||||
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
||||||
return {
|
return {
|
||||||
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
||||||
label: databaseServer.name,
|
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${AzureResourceDatabaseServerTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
|
||||||
iconPath: {
|
iconPath: {
|
||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: vscode.workspace.getConfiguration('connection').get<boolean>('dialog.browse') ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
|
collapsibleState: isConnectionDialogBrowseViewEnabled() ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseServer,
|
contextValue: AzureResourceItemType.databaseServer,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ export class KustoResourceService extends ResourceServiceBase<KustoGraphData, az
|
|||||||
fullName: resource.properties.uri.replace('https://', ''),
|
fullName: resource.properties.uri.replace('https://', ''),
|
||||||
loginName: '',
|
loginName: '',
|
||||||
defaultDatabaseName: '',
|
defaultDatabaseName: '',
|
||||||
subscriptionId: resource.subscriptionId,
|
subscription: {
|
||||||
|
id: resource.subscriptionId,
|
||||||
|
name: resource.subscriptionName
|
||||||
|
},
|
||||||
tenant: resource.tenantId,
|
tenant: resource.tenantId,
|
||||||
resourceGroup: resource.resourceGroup
|
resourceGroup: resource.resourceGroup
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,19 +4,19 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
||||||
import { TreeItemCollapsibleState, ExtensionContext, workspace } from 'vscode';
|
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { AzureResourceItemType } from '../../constants';
|
import { AzureResourceItemType } from '../../constants';
|
||||||
import { generateGuid } from '../../utils';
|
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
|
||||||
import { IAzureResourceService } from '../../interfaces';
|
import { IAzureResourceService } from '../../interfaces';
|
||||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
|
|
||||||
export class KustoTreeDataProvider extends ResourceTreeDataProviderBase<azureResource.AzureResourceDatabaseServer> {
|
export class KustoTreeDataProvider extends ResourceTreeDataProviderBase<azureResource.AzureResourceDatabaseServer> {
|
||||||
private static readonly containerId = 'azure.resource.providers.KustoContainer';
|
private static readonly containerId = 'azure.resource.providers.KustoContainer';
|
||||||
private static readonly containerLabel = localize('azure.resource.providers.KustoContainerLabel', "Azure Data Explorer Clusters");
|
private static readonly containerLabel = localize('azure.resource.providers.KustoContainerLabel', "Azure Data Explorer Cluster");
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
|
databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
|
||||||
@@ -29,12 +29,12 @@ export class KustoTreeDataProvider extends ResourceTreeDataProviderBase<azureRes
|
|||||||
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
||||||
return {
|
return {
|
||||||
id: `Kusto_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
id: `Kusto_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
||||||
label: databaseServer.name,
|
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${KustoTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
|
||||||
iconPath: {
|
iconPath: {
|
||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/azureDE_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/azureDE_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/azureDE.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/azureDE.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: workspace.getConfiguration('connection').get<boolean>('dialog.browse') ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.azureDataExplorer,
|
contextValue: AzureResourceItemType.azureDataExplorer,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ export class PostgresServerArcService extends ResourceServiceBase<PostgresArcSer
|
|||||||
fullName: resource.name,
|
fullName: resource.name,
|
||||||
loginName: resource.properties.admin,
|
loginName: resource.properties.admin,
|
||||||
defaultDatabaseName: 'postgres',
|
defaultDatabaseName: 'postgres',
|
||||||
subscriptionId: resource.subscriptionId,
|
subscription: {
|
||||||
|
id: resource.subscriptionId,
|
||||||
|
name: resource.subscriptionName
|
||||||
|
},
|
||||||
tenant: resource.tenantId,
|
tenant: resource.tenantId,
|
||||||
resourceGroup: resource.resourceGroup
|
resourceGroup: resource.resourceGroup
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
||||||
import { TreeItemCollapsibleState, ExtensionContext, workspace } from 'vscode';
|
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { AzureResourceItemType } from '../../constants';
|
import { AzureResourceItemType } from '../../constants';
|
||||||
import { generateGuid } from '../../utils';
|
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
|
||||||
import { IAzureResourceService } from '../../interfaces';
|
import { IAzureResourceService } from '../../interfaces';
|
||||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
@@ -29,12 +29,12 @@ export class PostgresServerArcTreeDataProvider extends ResourceTreeDataProviderB
|
|||||||
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
||||||
return {
|
return {
|
||||||
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
||||||
label: databaseServer.name,
|
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${PostgresServerArcTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
|
||||||
iconPath: {
|
iconPath: {
|
||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: workspace.getConfiguration('connection').get<boolean>('dialog.browse') ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseServer,
|
contextValue: AzureResourceItemType.databaseServer,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ export class PostgresServerService extends ResourceServiceBase<DbServerGraphData
|
|||||||
fullName: resource.properties.fullyQualifiedDomainName,
|
fullName: resource.properties.fullyQualifiedDomainName,
|
||||||
loginName: resource.properties.administratorLogin,
|
loginName: resource.properties.administratorLogin,
|
||||||
defaultDatabaseName: 'postgres',
|
defaultDatabaseName: 'postgres',
|
||||||
subscriptionId: resource.subscriptionId,
|
subscription: {
|
||||||
|
id: resource.subscriptionId,
|
||||||
|
name: resource.subscriptionName
|
||||||
|
},
|
||||||
tenant: resource.tenantId,
|
tenant: resource.tenantId,
|
||||||
resourceGroup: resource.resourceGroup
|
resourceGroup: resource.resourceGroup
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
||||||
import { TreeItemCollapsibleState, ExtensionContext, workspace } from 'vscode';
|
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { AzureResourceItemType } from '../../constants';
|
import { AzureResourceItemType } from '../../constants';
|
||||||
import { generateGuid } from '../../utils';
|
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
|
||||||
import { IAzureResourceService } from '../../interfaces';
|
import { IAzureResourceService } from '../../interfaces';
|
||||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
@@ -29,12 +29,12 @@ export class PostgresServerTreeDataProvider extends ResourceTreeDataProviderBase
|
|||||||
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
||||||
return {
|
return {
|
||||||
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
||||||
label: databaseServer.name,
|
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${PostgresServerTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
|
||||||
iconPath: {
|
iconPath: {
|
||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: workspace.getConfiguration('connection').get<boolean>('dialog.browse') ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseServer,
|
contextValue: AzureResourceItemType.databaseServer,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
|
|||||||
@@ -17,7 +17,10 @@ export class AzureResourceGroupService extends ResourceServiceBase<DbServerGraph
|
|||||||
return {
|
return {
|
||||||
id: resource.id,
|
id: resource.id,
|
||||||
name: resource.name,
|
name: resource.name,
|
||||||
subscriptionId: resource.subscriptionId,
|
subscription: {
|
||||||
|
id: resource.subscriptionId,
|
||||||
|
name: resource.subscriptionName
|
||||||
|
},
|
||||||
tenant: resource.tenantId
|
tenant: resource.tenantId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export abstract class ResourceTreeDataProviderBase<T extends azureResource.Azure
|
|||||||
|
|
||||||
export interface GraphData {
|
export interface GraphData {
|
||||||
subscriptionId: string,
|
subscriptionId: string,
|
||||||
|
subscriptionName?: string,
|
||||||
tenantId: string;
|
tenantId: string;
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -122,12 +123,13 @@ export abstract class ResourceServiceBase<T extends GraphData, U extends azureRe
|
|||||||
public async getResources(subscriptions: azureResource.AzureResourceSubscription[], credential: msRest.ServiceClientCredentials, account: azdata.Account): Promise<U[]> {
|
public async getResources(subscriptions: azureResource.AzureResourceSubscription[], credential: msRest.ServiceClientCredentials, account: azdata.Account): Promise<U[]> {
|
||||||
const convertedResources: U[] = [];
|
const convertedResources: U[] = [];
|
||||||
const resourceClient = new ResourceGraphClient(credential, { baseUri: account.properties.providerSettings.settings.armResource.endpoint });
|
const resourceClient = new ResourceGraphClient(credential, { baseUri: account.properties.providerSettings.settings.armResource.endpoint });
|
||||||
let graphResources = await queryGraphResources<T>(resourceClient, subscriptions, this.query);
|
const graphResources = await queryGraphResources<T>(resourceClient, subscriptions, this.query);
|
||||||
let ids = new Set<string>();
|
const ids = new Set<string>();
|
||||||
graphResources.forEach((res) => {
|
graphResources.forEach((res) => {
|
||||||
if (!ids.has(res.id)) {
|
if (!ids.has(res.id)) {
|
||||||
ids.add(res.id);
|
ids.add(res.id);
|
||||||
let converted = this.convertResource(res);
|
res.subscriptionName = subscriptions.find(sub => sub.id === res.subscriptionId).name;
|
||||||
|
const converted = this.convertResource(res);
|
||||||
convertedResources.push(converted);
|
convertedResources.push(converted);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ export class SqlInstanceResourceService extends ResourceServiceBase<SqlInstanceG
|
|||||||
fullName: resource.properties.fullyQualifiedDomainName,
|
fullName: resource.properties.fullyQualifiedDomainName,
|
||||||
loginName: resource.properties.administratorLogin,
|
loginName: resource.properties.administratorLogin,
|
||||||
defaultDatabaseName: 'master',
|
defaultDatabaseName: 'master',
|
||||||
subscriptionId: resource.subscriptionId,
|
subscription: {
|
||||||
|
id: resource.subscriptionId,
|
||||||
|
name: resource.subscriptionName
|
||||||
|
},
|
||||||
tenant: resource.tenantId,
|
tenant: resource.tenantId,
|
||||||
resourceGroup: resource.resourceGroup
|
resourceGroup: resource.resourceGroup
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
||||||
import { TreeItemCollapsibleState, ExtensionContext, workspace } from 'vscode';
|
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { AzureResourceItemType } from '../../constants';
|
import { AzureResourceItemType } from '../../constants';
|
||||||
import { generateGuid } from '../../utils';
|
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
|
||||||
import { IAzureResourceService } from '../../interfaces';
|
import { IAzureResourceService } from '../../interfaces';
|
||||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
@@ -29,12 +29,12 @@ export class SqlInstanceTreeDataProvider extends ResourceTreeDataProviderBase<az
|
|||||||
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
||||||
return {
|
return {
|
||||||
id: `sqlInstance_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
id: `sqlInstance_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
||||||
label: databaseServer.name,
|
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${SqlInstanceTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
|
||||||
iconPath: {
|
iconPath: {
|
||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_instance_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_instance_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/sql_instance.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/sql_instance.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: workspace.getConfiguration('connection').get<boolean>('dialog.browse') ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseServer,
|
contextValue: AzureResourceItemType.databaseServer,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ export class SqlInstanceArcResourceService extends ResourceServiceBase<SqlInstan
|
|||||||
fullName: resource.name,
|
fullName: resource.name,
|
||||||
loginName: resource.properties.admin,
|
loginName: resource.properties.admin,
|
||||||
defaultDatabaseName: 'master',
|
defaultDatabaseName: 'master',
|
||||||
subscriptionId: resource.subscriptionId,
|
subscription: {
|
||||||
|
id: resource.subscriptionId,
|
||||||
|
name: resource.subscriptionName
|
||||||
|
},
|
||||||
tenant: resource.tenantId,
|
tenant: resource.tenantId,
|
||||||
resourceGroup: resource.resourceGroup
|
resourceGroup: resource.resourceGroup
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
||||||
import { TreeItemCollapsibleState, ExtensionContext, workspace } from 'vscode';
|
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { AzureResourceItemType } from '../../constants';
|
import { AzureResourceItemType } from '../../constants';
|
||||||
import { generateGuid } from '../../utils';
|
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
|
||||||
import { IAzureResourceService } from '../../interfaces';
|
import { IAzureResourceService } from '../../interfaces';
|
||||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||||
import { azureResource } from 'azureResource';
|
import { azureResource } from 'azureResource';
|
||||||
@@ -29,12 +29,12 @@ export class SqlInstanceArcTreeDataProvider extends ResourceTreeDataProviderBase
|
|||||||
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
||||||
return {
|
return {
|
||||||
id: `sqlInstance_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
id: `sqlInstance_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
||||||
label: databaseServer.name,
|
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${SqlInstanceArcTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
|
||||||
iconPath: {
|
iconPath: {
|
||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_instance_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_instance_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/sql_instance.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/sql_instance.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: workspace.getConfiguration('connection').get<boolean>('dialog.browse') ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseServer,
|
contextValue: AzureResourceItemType.databaseServer,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { AppContext } from '../appContext';
|
|||||||
import { AzureResourceServiceNames } from './constants';
|
import { AzureResourceServiceNames } from './constants';
|
||||||
import { IAzureResourceSubscriptionFilterService, IAzureResourceSubscriptionService } from './interfaces';
|
import { IAzureResourceSubscriptionFilterService, IAzureResourceSubscriptionService } from './interfaces';
|
||||||
import { AzureResourceGroupService } from './providers/resourceGroup/resourceGroupService';
|
import { AzureResourceGroupService } from './providers/resourceGroup/resourceGroupService';
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
@@ -284,3 +285,7 @@ export async function getSelectedSubscriptions(appContext: AppContext, account?:
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isConnectionDialogBrowseViewEnabled(): boolean {
|
||||||
|
return vscode.workspace.getConfiguration('connection').get<boolean>('dialog.browse');
|
||||||
|
}
|
||||||
|
|||||||
@@ -76,7 +76,10 @@ const mockDatabases: azureResource.AzureResourceDatabase[] = [
|
|||||||
serverName: 'mock database server 1',
|
serverName: 'mock database server 1',
|
||||||
serverFullName: 'mock database server full name 1',
|
serverFullName: 'mock database server full name 1',
|
||||||
loginName: 'mock login',
|
loginName: 'mock login',
|
||||||
subscriptionId: 'mock_subscription',
|
subscription: {
|
||||||
|
id: 'mock_subscription',
|
||||||
|
name: 'mock_subscription'
|
||||||
|
},
|
||||||
resourceGroup: 'rg1'
|
resourceGroup: 'rg1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -85,7 +88,10 @@ const mockDatabases: azureResource.AzureResourceDatabase[] = [
|
|||||||
serverName: 'mock database server 2',
|
serverName: 'mock database server 2',
|
||||||
serverFullName: 'mock database server full name 2',
|
serverFullName: 'mock database server full name 2',
|
||||||
loginName: 'mock login',
|
loginName: 'mock login',
|
||||||
subscriptionId: 'mock_subscription',
|
subscription: {
|
||||||
|
id: 'mock_subscription',
|
||||||
|
name: 'mock_subscription'
|
||||||
|
},
|
||||||
resourceGroup: 'rg2'
|
resourceGroup: 'rg2'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -75,7 +75,10 @@ const mockDatabaseServers: azureResource.AzureResourceDatabaseServer[] = [
|
|||||||
fullName: 'mock database server full name 1',
|
fullName: 'mock database server full name 1',
|
||||||
loginName: 'mock login',
|
loginName: 'mock login',
|
||||||
defaultDatabaseName: 'master',
|
defaultDatabaseName: 'master',
|
||||||
subscriptionId: 'mock_subscription',
|
subscription: {
|
||||||
|
id: 'mock_subscription',
|
||||||
|
name: 'mock_subscription'
|
||||||
|
},
|
||||||
resourceGroup: 'rg1'
|
resourceGroup: 'rg1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -84,7 +87,10 @@ const mockDatabaseServers: azureResource.AzureResourceDatabaseServer[] = [
|
|||||||
fullName: 'mock database server full name 2',
|
fullName: 'mock database server full name 2',
|
||||||
loginName: 'mock login',
|
loginName: 'mock login',
|
||||||
defaultDatabaseName: 'master',
|
defaultDatabaseName: 'master',
|
||||||
subscriptionId: 'mock_subscription',
|
subscription: {
|
||||||
|
id: 'mock_subscription',
|
||||||
|
name: 'mock_subscription'
|
||||||
|
},
|
||||||
resourceGroup: 'rg2'
|
resourceGroup: 'rg2'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -88,7 +88,10 @@ function createContext(): TestContext {
|
|||||||
{
|
{
|
||||||
name: 'g1',
|
name: 'g1',
|
||||||
id: 'g1',
|
id: 'g1',
|
||||||
subscriptionId: 's1'
|
subscription: {
|
||||||
|
id: 's1',
|
||||||
|
name: 's1'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
workspaces: [{
|
workspaces: [{
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ const groups: azureResource.AzureResourceResourceGroup[] = [
|
|||||||
{
|
{
|
||||||
name: 'group',
|
name: 'group',
|
||||||
id: '3',
|
id: '3',
|
||||||
subscriptionId: 's1'
|
subscription: {
|
||||||
|
id: 's1',
|
||||||
|
name: 's1'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const workspaces: Workspace[] = [
|
const workspaces: Workspace[] = [
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ describe('Azure Models Component', () => {
|
|||||||
{
|
{
|
||||||
name: 'group',
|
name: 'group',
|
||||||
id: '3',
|
id: '3',
|
||||||
subscriptionId: 's1'
|
subscription: {
|
||||||
|
id: 's1',
|
||||||
|
name: 's1'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
let workspaces: Workspace[] = [
|
let workspaces: Workspace[] = [
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ describe('Predict Wizard', () => {
|
|||||||
{
|
{
|
||||||
name: 'group',
|
name: 'group',
|
||||||
id: '3',
|
id: '3',
|
||||||
subscriptionId: 's1'
|
subscription: {
|
||||||
|
id: 's1',
|
||||||
|
name: 's1'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
let workspaces: Workspace[] = [
|
let workspaces: Workspace[] = [
|
||||||
@@ -137,44 +140,44 @@ describe('Predict Wizard', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
view.on(ListModelsEventName, (args) => {
|
view.on(ListModelsEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListModelsEventName), { inputArgs: args, data: localModels });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListModelsEventName), { inputArgs: args, data: localModels });
|
||||||
});
|
});
|
||||||
view.on(ListAccountsEventName, (args) => {
|
view.on(ListAccountsEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListAccountsEventName), { inputArgs: args, data: accounts });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListAccountsEventName), { inputArgs: args, data: accounts });
|
||||||
});
|
});
|
||||||
view.on(ListSubscriptionsEventName, (args) => {
|
view.on(ListSubscriptionsEventName, (args) => {
|
||||||
|
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListSubscriptionsEventName), { inputArgs: args, data: subscriptions });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListSubscriptionsEventName), { inputArgs: args, data: subscriptions });
|
||||||
});
|
});
|
||||||
view.on(ListGroupsEventName, (args) => {
|
view.on(ListGroupsEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListGroupsEventName), { inputArgs: args, data: groups });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListGroupsEventName), { inputArgs: args, data: groups });
|
||||||
});
|
});
|
||||||
view.on(ListWorkspacesEventName, (args) => {
|
view.on(ListWorkspacesEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListWorkspacesEventName), { inputArgs: args, data: workspaces });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListWorkspacesEventName), { inputArgs: args, data: workspaces });
|
||||||
});
|
});
|
||||||
view.on(ListAzureModelsEventName, (args) => {
|
view.on(ListAzureModelsEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListAzureModelsEventName), { inputArgs: args, data: models });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListAzureModelsEventName), { inputArgs: args, data: models });
|
||||||
});
|
});
|
||||||
view.on(ListDatabaseNamesEventName, (args) => {
|
view.on(ListDatabaseNamesEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListDatabaseNamesEventName), { inputArgs: args, data: dbNames });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListDatabaseNamesEventName), { inputArgs: args, data: dbNames });
|
||||||
});
|
});
|
||||||
view.on(ListTableNamesEventName, (args) => {
|
view.on(ListTableNamesEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListTableNamesEventName), { inputArgs: args, data: tableNames });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListTableNamesEventName), { inputArgs: args, data: tableNames });
|
||||||
});
|
});
|
||||||
view.on(ListColumnNamesEventName, (args) => {
|
view.on(ListColumnNamesEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListColumnNamesEventName), { inputArgs: args, data: columnNames });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(ListColumnNamesEventName), { inputArgs: args, data: columnNames });
|
||||||
});
|
});
|
||||||
view.on(LoadModelParametersEventName, (args) => {
|
view.on(LoadModelParametersEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(LoadModelParametersEventName), { inputArgs: args, data: modelParameters });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(LoadModelParametersEventName), { inputArgs: args, data: modelParameters });
|
||||||
});
|
});
|
||||||
view.on(DownloadAzureModelEventName, (args) => {
|
view.on(DownloadAzureModelEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(DownloadAzureModelEventName), { inputArgs: args, data: 'path' });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(DownloadAzureModelEventName), { inputArgs: args, data: 'path' });
|
||||||
});
|
});
|
||||||
view.on(DownloadRegisteredModelEventName, (args) => {
|
view.on(DownloadRegisteredModelEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(DownloadRegisteredModelEventName), { inputArgs: args, data: 'path' });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(DownloadRegisteredModelEventName), { inputArgs: args, data: 'path' });
|
||||||
});
|
});
|
||||||
view.on(VerifyImportTableEventName, (args) => {
|
view.on(VerifyImportTableEventName, (args) => {
|
||||||
view.sendCallbackRequest(ViewBase.getCallbackEventName(VerifyImportTableEventName), { inputArgs: args, data: view.importTable });
|
view.sendCallbackRequest(ViewBase.getCallbackEventName(VerifyImportTableEventName), { inputArgs: args, data: view.importTable });
|
||||||
});
|
});
|
||||||
if (view.modelBrowsePage) {
|
if (view.modelBrowsePage) {
|
||||||
view.modelBrowsePage.modelSourceType = ModelSourceType.Azure;
|
view.modelBrowsePage.modelSourceType = ModelSourceType.Azure;
|
||||||
@@ -202,7 +205,7 @@ describe('Predict Wizard', () => {
|
|||||||
await view.columnsSelectionPage?.inputColumnsComponent?.loadWithTable(tableNames[0]);
|
await view.columnsSelectionPage?.inputColumnsComponent?.loadWithTable(tableNames[0]);
|
||||||
|
|
||||||
should.notEqual(view.columnsSelectionPage?.data, undefined, 'Data from column selection component should not be null');
|
should.notEqual(view.columnsSelectionPage?.data, undefined, 'Data from column selection component should not be null');
|
||||||
should.equal(view.columnsSelectionPage?.data?.inputColumns?.length, modelParameters.inputs.length, `unexpected number of inputs. ${view.columnsSelectionPage?.data?.inputColumns?.length}` );
|
should.equal(view.columnsSelectionPage?.data?.inputColumns?.length, modelParameters.inputs.length, `unexpected number of inputs. ${view.columnsSelectionPage?.data?.inputColumns?.length}`);
|
||||||
should.equal(view.columnsSelectionPage?.data?.outputColumns?.length, modelParameters.outputs.length, `unexpected number of outputs. ${view.columnsSelectionPage?.data?.outputColumns?.length}`);
|
should.equal(view.columnsSelectionPage?.data?.outputColumns?.length, modelParameters.outputs.length, `unexpected number of outputs. ${view.columnsSelectionPage?.data?.outputColumns?.length}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ let groups: azureResource.AzureResourceResourceGroup[] = [
|
|||||||
{
|
{
|
||||||
name: 'group',
|
name: 'group',
|
||||||
id: '3',
|
id: '3',
|
||||||
subscriptionId: 's1'
|
subscription: {
|
||||||
|
id: 's1',
|
||||||
|
name: 's1'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
let workspaces: Workspace[] = [
|
let workspaces: Workspace[] = [
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
|||||||
public parentId?: string;
|
public parentId?: string;
|
||||||
private _isRenamed = false;
|
private _isRenamed = false;
|
||||||
public readonly isRoot: boolean = false;
|
public readonly isRoot: boolean = false;
|
||||||
|
public readonly textColor: string = 'white'; // This value should come from the constructor when issue: https://github.com/microsoft/azuredatastudio/issues/13138 is fixed
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
public name: string,
|
public name: string,
|
||||||
public parent?: ConnectionProfileGroup,
|
public parent?: ConnectionProfileGroup,
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ export class ConnectionBrowserView extends Disposable implements IPanelView {
|
|||||||
export interface ITreeItemFromProvider {
|
export interface ITreeItemFromProvider {
|
||||||
readonly element: ITreeItem;
|
readonly element: ITreeItem;
|
||||||
readonly treeId?: string;
|
readonly treeId?: string;
|
||||||
getChildren?(): Promise<ITreeItemFromProvider[]>
|
getChildren?(): Promise<ITreeItemFromProvider[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function instanceOfITreeItemFromProvider(obj: any): obj is ITreeItemFromProvider {
|
export function instanceOfITreeItemFromProvider(obj: any): obj is ITreeItemFromProvider {
|
||||||
@@ -425,7 +425,11 @@ class DataSource implements IAsyncDataSource<TreeModel, TreeElement> {
|
|||||||
|
|
||||||
public get expandableTreeNodes(): TreeElement[] {
|
public get expandableTreeNodes(): TreeElement[] {
|
||||||
return this.treeNodes.filter(node => {
|
return this.treeNodes.filter(node => {
|
||||||
return instanceOfITreeItemFromProvider(node) && node.element.collapsibleState !== TreeItemCollapsibleState.None;
|
return (node instanceof TreeModel)
|
||||||
|
|| (node instanceof ConnectionDialogTreeProviderElement)
|
||||||
|
|| (node instanceof SavedConnectionNode)
|
||||||
|
|| (node instanceof ConnectionProfileGroup)
|
||||||
|
|| (instanceOfITreeItemFromProvider(node) && node.element.collapsibleState !== TreeItemCollapsibleState.None);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,11 +444,7 @@ class DataSource implements IAsyncDataSource<TreeModel, TreeElement> {
|
|||||||
children = (children as (ConnectionProfile | ConnectionProfileGroup)[]).filter(item => {
|
children = (children as (ConnectionProfile | ConnectionProfileGroup)[]).filter(item => {
|
||||||
return (item instanceof ConnectionProfileGroup) || this._filterRegex.test(item.title);
|
return (item instanceof ConnectionProfileGroup) || this._filterRegex.test(item.title);
|
||||||
});
|
});
|
||||||
} else if (
|
} else if (instanceOfITreeItemFromProvider(element)) {
|
||||||
!(element instanceof TreeModel) &&
|
|
||||||
!(element instanceof TreeNode) &&
|
|
||||||
!(element instanceof ConnectionDialogTreeProviderElement)
|
|
||||||
) {
|
|
||||||
children = (children as ITreeItemFromProvider[]).filter(item => {
|
children = (children as ITreeItemFromProvider[]).filter(item => {
|
||||||
return item.element.collapsibleState !== TreeItemCollapsibleState.None || this._filterRegex.test(item.element.label.label);
|
return item.element.collapsibleState !== TreeItemCollapsibleState.None || this._filterRegex.test(item.element.label.label);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class ConnectionProfileGroupTemplate extends Disposable {
|
|||||||
set(element: ConnectionProfileGroup) {
|
set(element: ConnectionProfileGroup) {
|
||||||
let rowElement = findParentElement(this._root, 'monaco-list-row');
|
let rowElement = findParentElement(this._root, 'monaco-list-row');
|
||||||
if (rowElement) {
|
if (rowElement) {
|
||||||
|
rowElement.style.color = element.textColor;
|
||||||
if (element.color) {
|
if (element.color) {
|
||||||
rowElement.style.background = element.color;
|
rowElement.style.background = element.color;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user