put feature behind preview flag (#13147)

* put feature behind preview flag

* remove unused import
This commit is contained in:
Alan Ren
2020-10-30 10:17:54 -07:00
committed by GitHub
parent f5fc5c648e
commit 82d5fe3821
15 changed files with 30 additions and 37 deletions

View File

@@ -26,6 +26,7 @@ declare module 'azureResource' {
}
export interface IAzureResourceTreeDataProvider extends TreeDataProvider<IAzureResourceNode> {
browseConnectionMode: boolean;
}
export interface IAzureResourceNode {

View File

@@ -10,7 +10,7 @@ const localize = nls.loadMessageBundle();
import { azureResource } from 'azureResource';
import { AzureResourceItemType } from '../../../azureResource/constants';
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
@@ -28,12 +28,12 @@ export class AzureResourceDatabaseTreeDataProvider extends ResourceTreeDataProvi
protected getTreeItemForResource(database: azureResource.AzureResourceDatabase, account: Account): TreeItem {
return {
id: `databaseServer_${database.serverFullName}.database_${database.name}`,
label: isConnectionDialogBrowseViewEnabled() ? `${database.serverName}/${database.name} (${AzureResourceDatabaseTreeDataProvider.containerLabel}, ${database.subscription.name})` : `${database.name} (${database.serverName})`,
label: this.browseConnectionMode ? `${database.serverName}/${database.name} (${AzureResourceDatabaseTreeDataProvider.containerLabel}, ${database.subscription.name})` : `${database.name} (${database.serverName})`,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_database_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/sql_database.svg')
},
collapsibleState: isConnectionDialogBrowseViewEnabled() ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
collapsibleState: this.browseConnectionMode ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.database,
payload: {
id: generateGuid(),

View File

@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../../azureResource/constants';
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
import { azureResource } from 'azureResource';
@@ -29,12 +29,12 @@ export class AzureResourceDatabaseServerTreeDataProvider extends ResourceTreeDat
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
return {
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${AzureResourceDatabaseServerTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
label: this.browseConnectionMode ? `${databaseServer.name} (${AzureResourceDatabaseServerTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
},
collapsibleState: isConnectionDialogBrowseViewEnabled() ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
collapsibleState: this.browseConnectionMode ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.databaseServer,
payload: {
id: generateGuid(),

View File

@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../constants';
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
import { azureResource } from 'azureResource';
@@ -29,12 +29,12 @@ export class KustoTreeDataProvider extends ResourceTreeDataProviderBase<azureRes
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
return {
id: `Kusto_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${KustoTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
label: this.browseConnectionMode ? `${databaseServer.name} (${KustoTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/azureDE_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/azureDE.svg')
},
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
collapsibleState: this.browseConnectionMode ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.azureDataExplorer,
payload: {
id: generateGuid(),

View File

@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../constants';
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
import { azureResource } from 'azureResource';
@@ -29,12 +29,12 @@ export class PostgresServerArcTreeDataProvider extends ResourceTreeDataProviderB
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
return {
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${PostgresServerArcTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
label: this.browseConnectionMode ? `${databaseServer.name} (${PostgresServerArcTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
},
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
collapsibleState: this.browseConnectionMode ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.databaseServer,
payload: {
id: generateGuid(),

View File

@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../constants';
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
import { azureResource } from 'azureResource';
@@ -29,12 +29,12 @@ export class PostgresServerTreeDataProvider extends ResourceTreeDataProviderBase
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
return {
id: `databaseServer_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${PostgresServerTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
label: this.browseConnectionMode ? `${databaseServer.name} (${PostgresServerTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_server_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/sql_server.svg')
},
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
collapsibleState: this.browseConnectionMode ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.databaseServer,
payload: {
id: generateGuid(),

View File

@@ -12,6 +12,7 @@ import { AzureResourceErrorMessageUtil } from '../utils';
import { ResourceGraphClient } from '@azure/arm-resourcegraph';
export abstract class ResourceTreeDataProviderBase<T extends azureResource.AzureResource> implements azureResource.IAzureResourceTreeDataProvider {
public browseConnectionMode: boolean = false;
public constructor(protected _resourceService: IAzureResourceService<T>) {
}

View File

@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../constants';
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
import { azureResource } from 'azureResource';
@@ -29,12 +29,12 @@ export class SqlInstanceTreeDataProvider extends ResourceTreeDataProviderBase<az
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
return {
id: `sqlInstance_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${SqlInstanceTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
label: this.browseConnectionMode ? `${databaseServer.name} (${SqlInstanceTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_instance_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/sql_instance.svg')
},
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
collapsibleState: this.browseConnectionMode ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.databaseServer,
payload: {
id: generateGuid(),

View File

@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../constants';
import { generateGuid, isConnectionDialogBrowseViewEnabled } from '../../utils';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
import { azureResource } from 'azureResource';
@@ -29,12 +29,12 @@ export class SqlInstanceArcTreeDataProvider extends ResourceTreeDataProviderBase
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
return {
id: `sqlInstance_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: isConnectionDialogBrowseViewEnabled() ? `${databaseServer.name} (${SqlInstanceArcTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
label: this.browseConnectionMode ? `${databaseServer.name} (${SqlInstanceArcTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/sql_instance_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/sql_instance.svg')
},
collapsibleState: isConnectionDialogBrowseViewEnabled() ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
collapsibleState: this.browseConnectionMode ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.databaseServer,
payload: {
id: generateGuid(),

View File

@@ -54,7 +54,7 @@ export class AzureResourceService {
});
}
public async getChildren(resourceProviderId: string, element: azureResource.IAzureResourceNode): Promise<IAzureResourceNodeWithProviderId[]> {
public async getChildren(resourceProviderId: string, element: azureResource.IAzureResourceNode, browseConnectionMode: boolean = false): Promise<IAzureResourceNodeWithProviderId[]> {
await this.ensureResourceProvidersRegistered();
if (!(resourceProviderId in this._resourceProviders)) {
@@ -62,6 +62,7 @@ export class AzureResourceService {
}
const treeDataProvider = this._treeDataProviders[resourceProviderId];
treeDataProvider.browseConnectionMode = browseConnectionMode;
const children = await treeDataProvider.getChildren(element);
return children.map((child) => <IAzureResourceNodeWithProviderId>{

View File

@@ -113,7 +113,7 @@ export class FlatAccountTreeNode extends AzureResourceContainerTreeNodeBase {
for (const providerId of resourceProviderIds) {
const resourceTypes = await this._resourceService.getRootChildren(providerId, this.account, subscription, subscription.tenant);
for (const resourceType of resourceTypes) {
dataResources.push(...await this._resourceService.getChildren(providerId, resourceType.resourceNode));
dataResources.push(...await this._resourceService.getChildren(providerId, resourceType.resourceNode, true));
}
}
}

View File

@@ -13,7 +13,6 @@ import { AppContext } from '../appContext';
import { AzureResourceServiceNames } from './constants';
import { IAzureResourceSubscriptionFilterService, IAzureResourceSubscriptionService } from './interfaces';
import { AzureResourceGroupService } from './providers/resourceGroup/resourceGroupService';
import * as vscode from 'vscode';
const localize = nls.loadMessageBundle();
@@ -285,7 +284,3 @@ export async function getSelectedSubscriptions(appContext: AppContext, account?:
}
return result;
}
export function isConnectionDialogBrowseViewEnabled(): boolean {
return vscode.workspace.getConfiguration('connection').get<boolean>('dialog.browse');
}

View File

@@ -132,11 +132,6 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'default': true,
'description': localize('connection.parseClipboardForConnectionStringDescription', "Attempt to parse the contents of the clipboard when the connection dialog is opened or a paste is performed.")
},
'connection.dialog.browse': {
'type': 'boolean',
'default': false,
'description': localize('connection.dialog.browse', "(Experimental) Show the browser tab in the connection dialog for discovering new connections")
}
}
});

View File

@@ -50,7 +50,7 @@ import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilit
export type TreeElement = ConnectionDialogTreeProviderElement | ITreeItemFromProvider | SavedConnectionNode | ServerTreeElement;
export class ConnectionBrowseTab implements IPanelTab {
public readonly title = localize('connectionDialog.browser', "Browse");
public readonly title = localize('connectionDialog.browser', "Browse (Preview)");
public readonly identifier = 'connectionBrowse';
public readonly view = this.instantiationService.createInstance(ConnectionBrowserView);
constructor(@IInstantiationService private readonly instantiationService: IInstantiationService) { }

View File

@@ -125,8 +125,8 @@ export class ConnectionDialogWidget extends Modal {
{ hasSpinner: true, spinnerTitle: localize('connecting', "Connecting"), hasErrors: true });
this._register(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('connection.dialog.browse') && this.browsePanel) {
const doUseBrowsePanel = this._configurationService.getValue<boolean>('connection.dialog.browse');
if (e.affectsConfiguration('workbench.enablePreviewFeatures') && this.browsePanel) {
const doUseBrowsePanel = this._configurationService.getValue<boolean>('workbench.enablePreviewFeatures');
if (doUseBrowsePanel && !this._panel.contains(this.browsePanel)) {
this._panel.pushTab(this.browsePanel);
} else if (!doUseBrowsePanel && this._panel.contains(this.browsePanel)) {
@@ -281,7 +281,7 @@ export class ConnectionDialogWidget extends Modal {
}
});
if (this._configurationService.getValue<boolean>('connection.dialog.browse')) {
if (this._configurationService.getValue<boolean>('workbench.enablePreviewFeatures')) {
this._panel.pushTab(this.browsePanel);
}