mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Azure pane in connection dialog (#11736)
* azure pane in connection dialog * fix layering * fix issues * fix test * more test fixes * add back double click to connect for non-contributed views
This commit is contained in:
@@ -175,10 +175,18 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dataExplorer": {
|
"dataExplorer": {
|
||||||
"azureResource": [
|
"dialog/connection": [
|
||||||
|
{
|
||||||
|
"id": "azureResourceExplorer_dialog",
|
||||||
|
"name": "%azure.resource.explorer.title%",
|
||||||
|
"when": "config.workbench.enablePreviewFeatures"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dataExplorer": [
|
||||||
{
|
{
|
||||||
"id": "azureResourceExplorer",
|
"id": "azureResourceExplorer",
|
||||||
"name": "%azure.resource.explorer.title%"
|
"name": "%azure.resource.explorer.title%",
|
||||||
|
"when": "!config.workbench.enablePreviewFeatures"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { TreeItem, ExtensionNodeType, Account } from 'azdata';
|
import { TreeItem, ExtensionNodeType, Account } from 'azdata';
|
||||||
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ export class AzureResourceDatabaseTreeDataProvider extends ResourceTreeDataProvi
|
|||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
databaseService: IAzureResourceService<azureResource.AzureResourceDatabase>,
|
databaseService: IAzureResourceService<azureResource.AzureResourceDatabase>,
|
||||||
private _extensionContext: ExtensionContext
|
private _extensionContext: vscode.ExtensionContext
|
||||||
) {
|
) {
|
||||||
super(databaseService);
|
super(databaseService);
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ export class AzureResourceDatabaseTreeDataProvider extends ResourceTreeDataProvi
|
|||||||
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: TreeItemCollapsibleState.Collapsed,
|
collapsibleState: vscode.workspace.getConfiguration('workbench').get<boolean>('enablePreviewFeatures') ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.database,
|
contextValue: AzureResourceItemType.database,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
@@ -71,7 +71,7 @@ export class AzureResourceDatabaseTreeDataProvider extends ResourceTreeDataProvi
|
|||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/folder.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/folder.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: TreeItemCollapsibleState.Collapsed,
|
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseContainer
|
contextValue: AzureResourceItemType.databaseContainer
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
||||||
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export class AzureResourceDatabaseServerTreeDataProvider extends ResourceTreeDat
|
|||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
|
databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
|
||||||
private _extensionContext: ExtensionContext
|
private _extensionContext: vscode.ExtensionContext
|
||||||
) {
|
) {
|
||||||
super(databaseServerService);
|
super(databaseServerService);
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ export class AzureResourceDatabaseServerTreeDataProvider extends ResourceTreeDat
|
|||||||
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: TreeItemCollapsibleState.Collapsed,
|
collapsibleState: vscode.workspace.getConfiguration('workbench').get<boolean>('enablePreviewFeatures') ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseServer,
|
contextValue: AzureResourceItemType.databaseServer,
|
||||||
payload: {
|
payload: {
|
||||||
id: generateGuid(),
|
id: generateGuid(),
|
||||||
@@ -72,7 +72,7 @@ export class AzureResourceDatabaseServerTreeDataProvider extends ResourceTreeDat
|
|||||||
dark: this._extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
|
dark: this._extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
|
||||||
light: this._extensionContext.asAbsolutePath('resources/light/folder.svg')
|
light: this._extensionContext.asAbsolutePath('resources/light/folder.svg')
|
||||||
},
|
},
|
||||||
collapsibleState: TreeItemCollapsibleState.Collapsed,
|
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
|
||||||
contextValue: AzureResourceItemType.databaseServerContainer
|
contextValue: AzureResourceItemType.databaseServerContainer
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<azurec
|
|||||||
registerAzureServices(appContext);
|
registerAzureServices(appContext);
|
||||||
const azureResourceTree = new AzureResourceTreeProvider(appContext);
|
const azureResourceTree = new AzureResourceTreeProvider(appContext);
|
||||||
pushDisposable(vscode.window.registerTreeDataProvider('azureResourceExplorer', azureResourceTree));
|
pushDisposable(vscode.window.registerTreeDataProvider('azureResourceExplorer', azureResourceTree));
|
||||||
|
pushDisposable(vscode.window.registerTreeDataProvider('azureResourceExplorer_dialog', azureResourceTree));
|
||||||
pushDisposable(vscode.workspace.onDidChangeConfiguration(e => onDidChangeConfiguration(e), this));
|
pushDisposable(vscode.workspace.onDidChangeConfiguration(e => onDidChangeConfiguration(e), this));
|
||||||
registerAzureResourceCommands(appContext, azureResourceTree);
|
registerAzureResourceCommands(appContext, azureResourceTree);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ITreeViewDataProvider, ITreeItem as vsITreeItem, IViewDescriptor, ITreeView as vsITreeView } from 'vs/workbench/common/views';
|
import { ITreeViewDataProvider, ITreeItem as vsITreeItem, IViewDescriptor, ITreeView as vsITreeView } from 'vs/workbench/common/views';
|
||||||
|
import { Event } from 'vs/base/common/event';
|
||||||
import { IConnectionProfile, NodeInfo } from 'azdata';
|
import { IConnectionProfile, NodeInfo } from 'azdata';
|
||||||
|
|
||||||
export enum NodeType {
|
export enum NodeType {
|
||||||
@@ -32,10 +33,8 @@ export interface ITreeItem extends vsITreeItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ITreeView extends vsITreeView {
|
export interface ITreeView extends vsITreeView {
|
||||||
|
|
||||||
collapse(element: ITreeItem): boolean
|
collapse(element: ITreeItem): boolean
|
||||||
root: ITreeItem;
|
readonly onDidChangeSelection: Event<ITreeItem[]>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TreeViewItemHandleArg = {
|
export type TreeViewItemHandleArg = {
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
|||||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { coalesce } from 'vs/base/common/arrays';
|
import { coalesce } from 'vs/base/common/arrays';
|
||||||
|
|
||||||
import { CustomTreeView, TreeViewPane } from 'sql/workbench/browser/parts/views/treeView';
|
|
||||||
import { VIEWLET_ID } from 'sql/workbench/contrib/dataExplorer/browser/dataExplorerViewlet';
|
import { VIEWLET_ID } from 'sql/workbench/contrib/dataExplorer/browser/dataExplorerViewlet';
|
||||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||||
import { ICustomViewDescriptor } from 'vs/workbench/api/browser/viewsExtensionPoint';
|
import { ICustomViewDescriptor } from 'vs/workbench/api/browser/viewsExtensionPoint';
|
||||||
|
import { CustomTreeView as VSCustomTreeView } from 'vs/workbench/contrib/views/browser/treeView';
|
||||||
|
import { TreeViewPane } from 'vs/workbench/browser/parts/views/treeView';
|
||||||
|
import { CustomTreeView } from 'sql/workbench/contrib/views/browser/treeView';
|
||||||
|
|
||||||
interface IUserFriendlyViewDescriptor {
|
interface IUserFriendlyViewDescriptor {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -39,7 +41,7 @@ const viewDescriptor: IJSONSchema = {
|
|||||||
when: {
|
when: {
|
||||||
description: localize('vscode.extension.contributes.view.when', "Condition which must be true to show this view"),
|
description: localize('vscode.extension.contributes.view.when', "Condition which must be true to show this view"),
|
||||||
type: 'string'
|
type: 'string'
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,7 +64,6 @@ const dataExplorerContribution: IJSONSchema = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const dataExplorerExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }>({ extensionPoint: 'dataExplorer', jsonSchema: dataExplorerContribution });
|
const dataExplorerExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }>({ extensionPoint: 'dataExplorer', jsonSchema: dataExplorerContribution });
|
||||||
|
|
||||||
export class DataExplorerContainerExtensionHandler implements IWorkbenchContribution {
|
export class DataExplorerContainerExtensionHandler implements IWorkbenchContribution {
|
||||||
@@ -86,9 +87,8 @@ export class DataExplorerContainerExtensionHandler implements IWorkbenchContribu
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let container = this.viewContainersRegistry.get(VIEWLET_ID);
|
let container = this.viewContainersRegistry.get(entry.key);
|
||||||
if (!container) {
|
if (!container) {
|
||||||
collector.warn(localize('ViewsContainerDoesnotExist', "View container '{0}' does not exist and all views registered to it will be added to 'Data Explorer'.", entry.key));
|
|
||||||
container = this.viewContainersRegistry.get(VIEWLET_ID);
|
container = this.viewContainersRegistry.get(VIEWLET_ID);
|
||||||
}
|
}
|
||||||
const registeredViews = Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getViews(container);
|
const registeredViews = Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getViews(container);
|
||||||
@@ -111,7 +111,7 @@ export class DataExplorerContainerExtensionHandler implements IWorkbenchContribu
|
|||||||
when: ContextKeyExpr.deserialize(item.when),
|
when: ContextKeyExpr.deserialize(item.when),
|
||||||
canToggleVisibility: true,
|
canToggleVisibility: true,
|
||||||
canMoveView: true,
|
canMoveView: true,
|
||||||
treeView: this.instantiationService.createInstance(CustomTreeView, item.id, item.name),
|
treeView: container.id === VIEWLET_ID ? this.instantiationService.createInstance(CustomTreeView, item.id, item.name) : this.instantiationService.createInstance(VSCustomTreeView, item.id, item.name),
|
||||||
collapsed: this.showCollapsed(container),
|
collapsed: this.showCollapsed(container),
|
||||||
extensionId: extension.description.identifier,
|
extensionId: extension.description.identifier,
|
||||||
originalContainerId: entry.key
|
originalContainerId: entry.key
|
||||||
@@ -154,4 +154,3 @@ export class DataExplorerContainerExtensionHandler implements IWorkbenchContribu
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
DISCONNECT_COMMAND_ID, REFRESH_COMMAND_ID
|
DISCONNECT_COMMAND_ID, REFRESH_COMMAND_ID
|
||||||
} from './nodeCommands.common';
|
} from './nodeCommands.common';
|
||||||
import { ContextKeyExpr, ContextKeyNotEqualsExpr } from 'vs/platform/contextkey/common/contextkey';
|
import { ContextKeyExpr, ContextKeyNotEqualsExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { NodeContextKey } from 'sql/workbench/browser/parts/views/nodeContext';
|
import { NodeContextKey } from 'sql/workbench/contrib/views/browser/nodeContext';
|
||||||
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
||||||
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { INodeContextValue } from 'sql/workbench/browser/parts/views/nodeContext';
|
|
||||||
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
import { Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||||
@@ -12,6 +11,7 @@ import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilit
|
|||||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||||
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
||||||
import { isWindows } from 'vs/base/common/platform';
|
import { isWindows } from 'vs/base/common/platform';
|
||||||
|
import { INodeContextValue } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
||||||
|
|
||||||
export class NodeContextUtils extends Disposable {
|
export class NodeContextUtils extends Disposable {
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
|||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
|
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
|
||||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { NodeContextKey } from 'sql/workbench/browser/parts/views/nodeContext';
|
import { NodeContextKey } from 'sql/workbench/contrib/views/browser/nodeContext';
|
||||||
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
||||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewl
|
|||||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||||
import { Extensions as ViewContainerExtensions, IViewDescriptor, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views';
|
import { Extensions as ViewContainerExtensions, IViewDescriptor, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation, IViewDescriptorService, ITreeViewDescriptor } from 'vs/workbench/common/views';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||||
import { Registry } from 'vs/platform/registry/common/platform';
|
import { Registry } from 'vs/platform/registry/common/platform';
|
||||||
@@ -35,7 +35,6 @@ import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
|||||||
import { QueryBuilder, ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
import { QueryBuilder, ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||||
import { IFileService } from 'vs/platform/files/common/files';
|
import { IFileService } from 'vs/platform/files/common/files';
|
||||||
import { getOutOfWorkspaceEditorResources } from 'vs/workbench/contrib/search/common/search';
|
import { getOutOfWorkspaceEditorResources } from 'vs/workbench/contrib/search/common/search';
|
||||||
import { TreeViewPane } from 'sql/workbench/browser/parts/views/treeView';
|
|
||||||
import { NotebookSearchView } from 'sql/workbench/contrib/notebook/browser/notebookExplorer/notebookSearch';
|
import { NotebookSearchView } from 'sql/workbench/contrib/notebook/browser/notebookExplorer/notebookSearch';
|
||||||
import * as path from 'vs/base/common/path';
|
import * as path from 'vs/base/common/path';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
@@ -265,20 +264,15 @@ export class NotebookExplorerViewPaneContainer extends ViewPaneContainer {
|
|||||||
if (this.views.length > 1) {
|
if (this.views.length > 1) {
|
||||||
let filesToIncludeFiltered: string = '';
|
let filesToIncludeFiltered: string = '';
|
||||||
this.views.forEach(async (v) => {
|
this.views.forEach(async (v) => {
|
||||||
let booksViewPane = (<TreeViewPane>this.getView(v.id));
|
const { treeView } = (<ITreeViewDescriptor>Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getView(v.id));
|
||||||
if (booksViewPane?.treeView?.root) {
|
let items = await treeView?.dataProvider.getChildren();
|
||||||
let root = booksViewPane.treeView.root;
|
items?.forEach(root => {
|
||||||
if (root.children) {
|
this.updateViewletsState();
|
||||||
let items = root.children;
|
let folderToSearch: IFolderQuery = { folder: URI.file(path.join(isString(root.tooltip) ? root.tooltip : root.tooltip.value, 'content')) };
|
||||||
items?.forEach(root => {
|
query.folderQueries.push(folderToSearch);
|
||||||
this.updateViewletsState();
|
filesToIncludeFiltered = filesToIncludeFiltered + path.join(folderToSearch.folder.fsPath, '**', '*.md') + ',' + path.join(folderToSearch.folder.fsPath, '**', '*.ipynb') + ',';
|
||||||
let folderToSearch: IFolderQuery = { folder: URI.file(path.join(isString(root.tooltip) ? root.tooltip : root.tooltip.value, 'content')) };
|
this.searchView.startSearch(query, null, filesToIncludeFiltered, false, this.searchWidget);
|
||||||
query.folderQueries.push(folderToSearch);
|
});
|
||||||
filesToIncludeFiltered = filesToIncludeFiltered + path.join(folderToSearch.folder.fsPath, '**', '*.md') + ',' + path.join(folderToSearch.folder.fsPath, '**', '*.ipynb') + ',';
|
|
||||||
this.searchView.startSearch(query, null, filesToIncludeFiltered, false, this.searchWidget);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,19 +5,13 @@
|
|||||||
|
|
||||||
import { ConnectionContextKey } from 'sql/workbench/services/connection/common/connectionContextKey';
|
import { ConnectionContextKey } from 'sql/workbench/services/connection/common/connectionContextKey';
|
||||||
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
|
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
|
||||||
import { ITreeItem } from 'sql/workbench/common/views';
|
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
import { Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
|
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
|
||||||
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
import { MssqlNodeContext, INodeContextValue } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
||||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||||
|
|
||||||
export interface INodeContextValue {
|
|
||||||
node: ITreeItem;
|
|
||||||
viewId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class NodeContextKey extends Disposable implements IContextKey<INodeContextValue> {
|
export class NodeContextKey extends Disposable implements IContextKey<INodeContextValue> {
|
||||||
|
|
||||||
static IsConnectable = new RawContextKey<boolean>('isConnectable', false);
|
static IsConnectable = new RawContextKey<boolean>('isConnectable', false);
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Event, Emitter } from 'vs/base/common/event';
|
||||||
import { IDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { IAction, ActionRunner, IActionViewItemProvider } from 'vs/base/common/actions';
|
import { IAction, ActionRunner, IActionViewItemProvider } from 'vs/base/common/actions';
|
||||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||||
@@ -12,8 +12,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
|||||||
import { IMenuService, MenuId, MenuItemAction, registerAction2, Action2, SubmenuItemAction } from 'vs/platform/actions/common/actions';
|
import { IMenuService, MenuId, MenuItemAction, registerAction2, Action2, SubmenuItemAction } from 'vs/platform/actions/common/actions';
|
||||||
import { MenuEntryActionViewItem, createAndFillInContextMenuActions, SubmenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
import { MenuEntryActionViewItem, createAndFillInContextMenuActions, SubmenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||||
import { IContextKeyService, ContextKeyExpr, ContextKeyEqualsExpr, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
import { IContextKeyService, ContextKeyExpr, ContextKeyEqualsExpr, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ITreeViewDescriptor, IViewsRegistry, ITreeItemLabel, Extensions, IViewDescriptorService, ViewContainer, ViewContainerLocation } from 'vs/workbench/common/views';
|
import { TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ITreeItemLabel, IViewDescriptorService, ViewContainer, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||||
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||||
@@ -27,86 +26,24 @@ import { dirname, basename } from 'vs/base/common/resources';
|
|||||||
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
|
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
import { FileKind } from 'vs/platform/files/common/files';
|
import { FileKind } from 'vs/platform/files/common/files';
|
||||||
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
|
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
|
||||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { timeout } from 'vs/base/common/async';
|
import { timeout } from 'vs/base/common/async';
|
||||||
import { textLinkForeground, textCodeBlockBackground, focusBorder, listFilterMatchHighlight, listFilterMatchHighlightBorder } from 'vs/platform/theme/common/colorRegistry';
|
import { textLinkForeground, textCodeBlockBackground, focusBorder, listFilterMatchHighlight, listFilterMatchHighlightBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||||
import { isString } from 'vs/base/common/types';
|
import { isString } from 'vs/base/common/types';
|
||||||
import { ILabelService } from 'vs/platform/label/common/label';
|
import { ILabelService } from 'vs/platform/label/common/label';
|
||||||
import { Registry } from 'vs/platform/registry/common/platform';
|
|
||||||
import { IListVirtualDelegate, IIdentityProvider } from 'vs/base/browser/ui/list/list';
|
import { IListVirtualDelegate, IIdentityProvider } from 'vs/base/browser/ui/list/list';
|
||||||
import { ITreeRenderer, ITreeNode, IAsyncDataSource, ITreeContextMenuEvent } from 'vs/base/browser/ui/tree/tree';
|
import { ITreeRenderer, ITreeNode, IAsyncDataSource, ITreeContextMenuEvent } from 'vs/base/browser/ui/tree/tree';
|
||||||
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
|
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
|
||||||
import { CollapseAllAction } from 'vs/base/browser/ui/tree/treeDefaults';
|
import { CollapseAllAction } from 'vs/base/browser/ui/tree/treeDefaults';
|
||||||
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
|
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
|
||||||
import { SIDE_BAR_BACKGROUND, PANEL_BACKGROUND } from 'vs/workbench/common/theme';
|
import { SIDE_BAR_BACKGROUND, PANEL_BACKGROUND } from 'vs/workbench/common/theme';
|
||||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
|
||||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
|
||||||
import { firstIndex } from 'vs/base/common/arrays';
|
import { firstIndex } from 'vs/base/common/arrays';
|
||||||
import { ITreeItem, ITreeView } from 'sql/workbench/common/views';
|
import { ITreeItem, ITreeView } from 'sql/workbench/common/views';
|
||||||
import { UserCancelledConnectionError } from 'sql/base/common/errors';
|
import { UserCancelledConnectionError } from 'sql/base/common/errors';
|
||||||
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
|
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
|
||||||
import { NodeContextKey } from 'sql/workbench/browser/parts/views/nodeContext';
|
import { NodeContextKey } from 'sql/workbench/contrib/views/browser/nodeContext';
|
||||||
import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||||
|
|
||||||
export class TreeViewPane extends ViewPane {
|
|
||||||
|
|
||||||
public readonly treeView: ITreeView;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
options: IViewletViewOptions,
|
|
||||||
@IKeybindingService keybindingService: IKeybindingService,
|
|
||||||
@IContextMenuService contextMenuService: IContextMenuService,
|
|
||||||
@IConfigurationService configurationService: IConfigurationService,
|
|
||||||
@IContextKeyService contextKeyService: IContextKeyService,
|
|
||||||
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
|
|
||||||
@IInstantiationService instantiationService: IInstantiationService,
|
|
||||||
@IOpenerService openerService: IOpenerService,
|
|
||||||
@IThemeService themeService: IThemeService,
|
|
||||||
@ITelemetryService telemetryService: ITelemetryService,
|
|
||||||
) {
|
|
||||||
super({ ...(options as IViewPaneOptions), titleMenuId: MenuId.ViewTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
||||||
const { treeView } = (<ITreeViewDescriptor>Registry.as<IViewsRegistry>(Extensions.ViewsRegistry).getView(options.id));
|
|
||||||
this.treeView = treeView as ITreeView;
|
|
||||||
this._register(this.treeView.onDidChangeActions(() => this.updateActions(), this));
|
|
||||||
this._register(this.treeView.onDidChangeTitle((newTitle) => this.updateTitle(newTitle)));
|
|
||||||
this._register(toDisposable(() => this.treeView.setVisibility(false)));
|
|
||||||
this._register(this.onDidChangeBodyVisibility(() => this.updateTreeVisibility()));
|
|
||||||
this._register(this.treeView.onDidChangeWelcomeState(() => this._onDidChangeViewWelcomeState.fire()));
|
|
||||||
this.updateTreeVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
focus(): void {
|
|
||||||
super.focus();
|
|
||||||
this.treeView.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
renderBody(container: HTMLElement): void {
|
|
||||||
super.renderBody(container);
|
|
||||||
|
|
||||||
if (this.treeView instanceof TreeView) {
|
|
||||||
this.treeView.show(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldShowWelcome(): boolean {
|
|
||||||
return ((this.treeView.dataProvider === undefined) || !!this.treeView.dataProvider.isTreeEmpty) && (this.treeView.message === undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
layoutBody(height: number, width: number): void {
|
|
||||||
super.layoutBody(height, width);
|
|
||||||
this.treeView.layout(height, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
getOptimalWidth(): number {
|
|
||||||
return this.treeView.getOptimalWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
private updateTreeVisibility(): void {
|
|
||||||
this.treeView.setVisibility(this.isBodyVisible());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Root implements ITreeItem {
|
class Root implements ITreeItem {
|
||||||
label = { label: 'root' };
|
label = { label: 'root' };
|
||||||
handle = '0';
|
handle = '0';
|
||||||
@@ -450,11 +450,11 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
|||||||
this.handleOnCancel(this._connectionDialog.newConnectionParams);
|
this.handleOnCancel(this._connectionDialog.newConnectionParams);
|
||||||
});
|
});
|
||||||
this._connectionDialog.onConnect((profile) => {
|
this._connectionDialog.onConnect((profile) => {
|
||||||
this.handleOnConnect(this._connectionDialog.newConnectionParams, profile);
|
this.handleOnConnect(this._connectionDialog.newConnectionParams, profile as IConnectionProfile);
|
||||||
});
|
});
|
||||||
this._connectionDialog.onShowUiComponent((input) => this.handleShowUiComponent(input));
|
this._connectionDialog.onShowUiComponent((input) => this.handleShowUiComponent(input));
|
||||||
this._connectionDialog.onInitDialog(() => this.handleInitDialog());
|
this._connectionDialog.onInitDialog(() => this.handleInitDialog());
|
||||||
this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input));
|
this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input as IConnectionProfile));
|
||||||
this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection());
|
this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection());
|
||||||
this._connectionDialog.render();
|
this._connectionDialog.render();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,32 +7,23 @@ import 'vs/css!./media/connectionDialog';
|
|||||||
import { Button } from 'sql/base/browser/ui/button/button';
|
import { Button } from 'sql/base/browser/ui/button/button';
|
||||||
import { attachButtonStyler } from 'sql/platform/theme/common/styler';
|
import { attachButtonStyler } from 'sql/platform/theme/common/styler';
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
|
||||||
import { Modal } from 'sql/workbench/browser/modal/modal';
|
import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||||
import { IConnectionManagementService, INewConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
import { IConnectionManagementService, INewConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
||||||
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
|
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
|
||||||
import { TreeCreationUtils } from 'sql/workbench/services/objectExplorer/browser/treeCreationUtils';
|
|
||||||
import { TreeUpdateUtils, IExpandableTree } from 'sql/workbench/services/objectExplorer/browser/treeUpdateUtils';
|
|
||||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
|
||||||
import { TabbedPanel, PanelTabIdentifier } from 'sql/base/browser/ui/panel/panel';
|
import { TabbedPanel, PanelTabIdentifier } from 'sql/base/browser/ui/panel/panel';
|
||||||
import { RecentConnectionTreeController, RecentConnectionActionsProvider } from 'sql/workbench/services/connection/browser/recentConnectionTreeController';
|
|
||||||
import { SavedConnectionTreeController } from 'sql/workbench/services/connection/browser/savedConnectionTreeController';
|
|
||||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||||
import { ClearRecentConnectionsAction } from 'sql/workbench/services/connection/browser/connectionActions';
|
|
||||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Event, Emitter } from 'vs/base/common/event';
|
||||||
import { ICancelableEvent } from 'vs/base/parts/tree/browser/treeDefaults';
|
|
||||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
|
||||||
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import * as styler from 'vs/platform/theme/common/styler';
|
import * as styler from 'vs/platform/theme/common/styler';
|
||||||
import * as DOM from 'vs/base/browser/dom';
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
import { SIDE_BAR_BACKGROUND, PANEL_SECTION_HEADER_BACKGROUND, PANEL_SECTION_HEADER_FOREGROUND, PANEL_SECTION_HEADER_BORDER, PANEL_SECTION_DRAG_AND_DROP_BACKGROUND, PANEL_SECTION_BORDER } from 'vs/workbench/common/theme';
|
||||||
import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeService';
|
import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||||
@@ -40,13 +31,30 @@ import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
|||||||
import { entries } from 'sql/base/common/collections';
|
import { entries } from 'sql/base/common/collections';
|
||||||
import { attachTabbedPanelStyler, attachModalDialogStyler } from 'sql/workbench/common/styler';
|
import { attachTabbedPanelStyler, attachModalDialogStyler } from 'sql/workbench/common/styler';
|
||||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||||
|
import { IViewPaneContainer, IView, IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainerLocation, IViewDescriptorService, ViewContainer, IViewContainerModel, IAddedViewDescriptorRef, IViewDescriptorRef, ITreeViewDescriptor } from 'vs/workbench/common/views';
|
||||||
|
import { IAction, IActionViewItem } from 'vs/base/common/actions';
|
||||||
|
import { Registry } from 'vs/platform/registry/common/platform';
|
||||||
|
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||||
|
import { ViewPane, IPaneColors } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||||
|
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||||
|
import { ITreeView } from 'sql/workbench/common/views';
|
||||||
|
import { IConnectionProfile } from 'azdata';
|
||||||
|
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||||
|
import { TreeUpdateUtils, IExpandableTree } from 'sql/workbench/services/objectExplorer/browser/treeUpdateUtils';
|
||||||
|
import { SavedConnectionTreeController } from 'sql/workbench/services/connection/browser/savedConnectionTreeController';
|
||||||
|
import { TreeCreationUtils } from 'sql/workbench/services/objectExplorer/browser/treeCreationUtils';
|
||||||
|
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||||
|
import { ICancelableEvent } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||||
|
import { RecentConnectionTreeController, RecentConnectionActionsProvider } from 'sql/workbench/services/connection/browser/recentConnectionTreeController';
|
||||||
|
import { ClearRecentConnectionsAction } from 'sql/workbench/services/connection/browser/connectionActions';
|
||||||
|
import { combinedDisposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||||
|
|
||||||
export interface OnShowUIResponse {
|
export interface OnShowUIResponse {
|
||||||
selectedProviderDisplayName: string;
|
selectedProviderDisplayName: string;
|
||||||
container: HTMLElement;
|
container: HTMLElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ConnectionDialogWidget extends Modal {
|
export class ConnectionDialogWidget extends Modal implements IViewPaneContainer {
|
||||||
private _body: HTMLElement;
|
private _body: HTMLElement;
|
||||||
private _recentConnection: HTMLElement;
|
private _recentConnection: HTMLElement;
|
||||||
private _noRecentConnection: HTMLElement;
|
private _noRecentConnection: HTMLElement;
|
||||||
@@ -87,18 +95,24 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
|
|
||||||
private _connecting = false;
|
private _connecting = false;
|
||||||
|
|
||||||
|
readonly viewContainer: ViewContainer;
|
||||||
|
protected readonly viewContainerModel: IViewContainerModel;
|
||||||
|
private paneItems: { pane: ViewPane, disposable: IDisposable }[] = [];
|
||||||
|
private orthogonalSize = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private providerDisplayNameOptions: string[],
|
private providerDisplayNameOptions: string[],
|
||||||
private selectedProviderType: string,
|
private selectedProviderType: string,
|
||||||
private providerNameToDisplayNameMap: { [providerDisplayName: string]: string },
|
private providerNameToDisplayNameMap: { [providerDisplayName: string]: string },
|
||||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
|
||||||
|
@IContextMenuService private readonly contextMenuService: IContextMenuService,
|
||||||
|
@IContextViewService private readonly contextViewService: IContextViewService,
|
||||||
|
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
|
||||||
@IThemeService themeService: IThemeService,
|
@IThemeService themeService: IThemeService,
|
||||||
@ILayoutService layoutService: ILayoutService,
|
@ILayoutService layoutService: ILayoutService,
|
||||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||||
@IContextKeyService contextKeyService: IContextKeyService,
|
@IContextKeyService contextKeyService: IContextKeyService,
|
||||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
|
||||||
@IContextViewService private _contextViewService: IContextViewService,
|
|
||||||
@IClipboardService clipboardService: IClipboardService,
|
@IClipboardService clipboardService: IClipboardService,
|
||||||
@ILogService logService: ILogService,
|
@ILogService logService: ILogService,
|
||||||
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService
|
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService
|
||||||
@@ -114,6 +128,14 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
textResourcePropertiesService,
|
textResourcePropertiesService,
|
||||||
contextKeyService,
|
contextKeyService,
|
||||||
{ hasSpinner: true, spinnerTitle: localize('connecting', "Connecting"), hasErrors: true });
|
{ hasSpinner: true, spinnerTitle: localize('connecting', "Connecting"), hasErrors: true });
|
||||||
|
|
||||||
|
const container = viewDescriptorService.getViewContainerById(VIEW_CONTAINER.id);
|
||||||
|
if (!container) {
|
||||||
|
throw new Error('Could not find container');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.viewContainer = container;
|
||||||
|
this.viewContainerModel = viewDescriptorService.getViewContainerModel(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,7 +164,7 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicate listings (CMS uses the same display name)
|
// Remove duplicate listings (CMS uses the same display name)
|
||||||
let uniqueProvidersMap = this._connectionManagementService.getUniqueConnectionProvidersByNameMap(filteredProviderMap);
|
let uniqueProvidersMap = this.connectionManagementService.getUniqueConnectionProvidersByNameMap(filteredProviderMap);
|
||||||
this._providerTypeSelectBox.setOptions(Object.keys(uniqueProvidersMap).map(k => uniqueProvidersMap[k]));
|
this._providerTypeSelectBox.setOptions(Object.keys(uniqueProvidersMap).map(k => uniqueProvidersMap[k]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +176,7 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
this._body = DOM.append(container, DOM.$('.connection-dialog'));
|
this._body = DOM.append(container, DOM.$('.connection-dialog'));
|
||||||
|
|
||||||
const connectTypeLabel = localize('connectType', "Connection type");
|
const connectTypeLabel = localize('connectType', "Connection type");
|
||||||
this._providerTypeSelectBox = new SelectBox(this.providerDisplayNameOptions, this.selectedProviderType, this._contextViewService, undefined, { ariaLabel: connectTypeLabel });
|
this._providerTypeSelectBox = new SelectBox(this.providerDisplayNameOptions, this.selectedProviderType, this.contextViewService, undefined, { ariaLabel: connectTypeLabel });
|
||||||
// Recent connection tab
|
// Recent connection tab
|
||||||
const recentConnectionTab = DOM.$('.connection-recent-tab');
|
const recentConnectionTab = DOM.$('.connection-recent-tab');
|
||||||
const recentConnectionContainer = DOM.append(recentConnectionTab, DOM.$('.connection-recent', { id: 'recentConnection' }));
|
const recentConnectionContainer = DOM.append(recentConnectionTab, DOM.$('.connection-recent', { id: 'recentConnection' }));
|
||||||
@@ -205,7 +227,7 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
|
|
||||||
if (c === savedConnectionTabId && expandableTree.getContentHeight() === 0) {
|
if (c === savedConnectionTabId && expandableTree.getContentHeight() === 0) {
|
||||||
// Update saved connection tree
|
// Update saved connection tree
|
||||||
await TreeUpdateUtils.structuralTreeUpdate(this._savedConnectionTree, 'saved', this._connectionManagementService, this._providers);
|
await TreeUpdateUtils.structuralTreeUpdate(this._savedConnectionTree, 'saved', this.connectionManagementService, this._providers);
|
||||||
|
|
||||||
if (expandableTree.getContentHeight() > 0) {
|
if (expandableTree.getContentHeight() > 0) {
|
||||||
DOM.hide(this._noSavedConnection);
|
DOM.hide(this._noSavedConnection);
|
||||||
@@ -230,6 +252,17 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
this._connectionUIContainer = DOM.$('.connection-provider-info', { id: 'connectionProviderInfo' });
|
this._connectionUIContainer = DOM.$('.connection-provider-info', { id: 'connectionProviderInfo' });
|
||||||
this._body.append(this._connectionUIContainer);
|
this._body.append(this._connectionUIContainer);
|
||||||
|
|
||||||
|
this._register(this.viewContainerModel.onDidAddVisibleViewDescriptors(added => this.onDidAddViewDescriptors(added)));
|
||||||
|
this._register(this.viewContainerModel.onDidRemoveVisibleViewDescriptors(removed => this.onDidRemoveViewDescriptors(removed)));
|
||||||
|
const addedViews: IAddedViewDescriptorRef[] = this.viewContainerModel.visibleViewDescriptors.map((viewDescriptor, index) => {
|
||||||
|
const size = this.viewContainerModel.getSize(viewDescriptor.id);
|
||||||
|
const collapsed = this.viewContainerModel.isCollapsed(viewDescriptor.id);
|
||||||
|
return ({ viewDescriptor, index, size, collapsed });
|
||||||
|
});
|
||||||
|
if (addedViews.length) {
|
||||||
|
this.onDidAddViewDescriptors(addedViews);
|
||||||
|
}
|
||||||
|
|
||||||
this._register(this._themeService.onDidColorThemeChange(e => this.updateTheme(e)));
|
this._register(this._themeService.onDidColorThemeChange(e => this.updateTheme(e)));
|
||||||
this.updateTheme(this._themeService.getColorTheme());
|
this.updateTheme(this._themeService.getColorTheme());
|
||||||
}
|
}
|
||||||
@@ -320,7 +353,7 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
const container = DOM.append(recentConnectionContainer, DOM.$('.recent-titles-container'));
|
const container = DOM.append(recentConnectionContainer, DOM.$('.recent-titles-container'));
|
||||||
const actionsContainer = DOM.append(container, DOM.$('.connection-history-actions'));
|
const actionsContainer = DOM.append(container, DOM.$('.connection-history-actions'));
|
||||||
this._actionbar = this._register(new ActionBar(actionsContainer, { animated: false }));
|
this._actionbar = this._register(new ActionBar(actionsContainer, { animated: false }));
|
||||||
const clearAction = this._instantiationService.createInstance(ClearRecentConnectionsAction, ClearRecentConnectionsAction.ID, ClearRecentConnectionsAction.LABEL);
|
const clearAction = this.instantiationService.createInstance(ClearRecentConnectionsAction, ClearRecentConnectionsAction.ID, ClearRecentConnectionsAction.LABEL);
|
||||||
clearAction.useConfirmationMessage = true;
|
clearAction.useConfirmationMessage = true;
|
||||||
clearAction.onRecentConnectionsRemoved(() => this.open(false));
|
clearAction.onRecentConnectionsRemoved(() => this.open(false));
|
||||||
this._actionbar.push(clearAction, { icon: true, label: true });
|
this._actionbar.push(clearAction, { icon: true, label: true });
|
||||||
@@ -328,25 +361,26 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
const treeContainer = DOM.append(divContainer, DOM.$('.explorer-servers'));
|
const treeContainer = DOM.append(divContainer, DOM.$('.explorer-servers'));
|
||||||
const leftClick = (element: any, eventish: ICancelableEvent, origin: string) => {
|
const leftClick = (element: any, eventish: ICancelableEvent, origin: string) => {
|
||||||
// element will be a server group if the tree is clicked rather than a item
|
// element will be a server group if the tree is clicked rather than a item
|
||||||
|
const isDoubleClick = origin === 'mouse' && (eventish as MouseEvent).detail === 2;
|
||||||
if (element instanceof ConnectionProfile) {
|
if (element instanceof ConnectionProfile) {
|
||||||
this.onConnectionClick({ payload: { origin: origin, originalEvent: eventish } }, element);
|
this.onConnectionClick(element, isDoubleClick);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const actionProvider = this._instantiationService.createInstance(RecentConnectionActionsProvider);
|
const actionProvider = this.instantiationService.createInstance(RecentConnectionActionsProvider);
|
||||||
const controller = new RecentConnectionTreeController(leftClick, actionProvider, this._connectionManagementService, this._contextMenuService);
|
const controller = new RecentConnectionTreeController(leftClick, actionProvider, this.connectionManagementService, this.contextMenuService);
|
||||||
actionProvider.onRecentConnectionRemoved(() => {
|
actionProvider.onRecentConnectionRemoved(() => {
|
||||||
const recentConnections: ConnectionProfile[] = this._connectionManagementService.getRecentConnections();
|
const recentConnections: ConnectionProfile[] = this.connectionManagementService.getRecentConnections();
|
||||||
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from action provider: ${err}`));
|
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from action provider: ${err}`));
|
||||||
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
|
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
|
||||||
recentConnections.forEach(conn => conn.dispose());
|
recentConnections.forEach(conn => conn.dispose());
|
||||||
});
|
});
|
||||||
controller.onRecentConnectionRemoved(() => {
|
controller.onRecentConnectionRemoved(() => {
|
||||||
const recentConnections: ConnectionProfile[] = this._connectionManagementService.getRecentConnections();
|
const recentConnections: ConnectionProfile[] = this.connectionManagementService.getRecentConnections();
|
||||||
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from controller : ${err}`));
|
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from controller : ${err}`));
|
||||||
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
|
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
|
||||||
recentConnections.forEach(conn => conn.dispose());
|
recentConnections.forEach(conn => conn.dispose());
|
||||||
});
|
});
|
||||||
this._recentConnectionTree = TreeCreationUtils.createConnectionTree(treeContainer, this._instantiationService, controller);
|
this._recentConnectionTree = TreeCreationUtils.createConnectionTree(treeContainer, this.instantiationService, controller);
|
||||||
|
|
||||||
// Theme styler
|
// Theme styler
|
||||||
this._register(styler.attachListStyler(this._recentConnectionTree, this._themeService));
|
this._register(styler.attachListStyler(this._recentConnectionTree, this._themeService));
|
||||||
@@ -365,13 +399,14 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
const treeContainer = DOM.append(divContainer, DOM.$('.explorer-servers'));
|
const treeContainer = DOM.append(divContainer, DOM.$('.explorer-servers'));
|
||||||
const leftClick = (element: any, eventish: ICancelableEvent, origin: string) => {
|
const leftClick = (element: any, eventish: ICancelableEvent, origin: string) => {
|
||||||
// element will be a server group if the tree is clicked rather than a item
|
// element will be a server group if the tree is clicked rather than a item
|
||||||
|
const isDoubleClick = origin === 'mouse' && (eventish as MouseEvent).detail === 2;
|
||||||
if (element instanceof ConnectionProfile) {
|
if (element instanceof ConnectionProfile) {
|
||||||
this.onConnectionClick({ payload: { origin: origin, originalEvent: eventish } }, element);
|
this.onConnectionClick(element, isDoubleClick);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const controller = new SavedConnectionTreeController(leftClick);
|
const controller = new SavedConnectionTreeController(leftClick);
|
||||||
this._savedConnectionTree = TreeCreationUtils.createConnectionTree(treeContainer, this._instantiationService, controller);
|
this._savedConnectionTree = TreeCreationUtils.createConnectionTree(treeContainer, this.instantiationService, controller);
|
||||||
|
|
||||||
// Theme styler
|
// Theme styler
|
||||||
this._register(styler.attachListStyler(this._savedConnectionTree, this._themeService));
|
this._register(styler.attachListStyler(this._savedConnectionTree, this._themeService));
|
||||||
@@ -384,15 +419,11 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
DOM.append(noSavedConnectionContainer, DOM.$('.no-saved-connections')).innerText = noSavedConnectionLabel;
|
DOM.append(noSavedConnectionContainer, DOM.$('.no-saved-connections')).innerText = noSavedConnectionLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private onConnectionClick(event: any, element: IConnectionProfile) {
|
private onConnectionClick(element: IConnectionProfile, connect: boolean = false) {
|
||||||
const isMouseOrigin = event.payload && (event.payload.origin === 'mouse');
|
if (connect) {
|
||||||
const isDoubleClick = isMouseOrigin && event.payload.originalEvent && event.payload.originalEvent.detail === 2;
|
|
||||||
if (isDoubleClick) {
|
|
||||||
this.connect(element);
|
this.connect(element);
|
||||||
} else {
|
} else {
|
||||||
if (element) {
|
this._onFillinConnectionInputs.fire(element);
|
||||||
this._onFillinConnectionInputs.fire(element);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,19 +442,23 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
DOM.hide(this._recentConnection);
|
DOM.hide(this._recentConnection);
|
||||||
DOM.show(this._noRecentConnection);
|
DOM.show(this._noRecentConnection);
|
||||||
}
|
}
|
||||||
await TreeUpdateUtils.structuralTreeUpdate(this._recentConnectionTree, 'recent', this._connectionManagementService, this._providers);
|
await TreeUpdateUtils.structuralTreeUpdate(this._recentConnectionTree, 'recent', this.connectionManagementService, this._providers);
|
||||||
|
|
||||||
// reset saved connection tree
|
// // reset saved connection tree
|
||||||
await this._savedConnectionTree.setInput([]);
|
await this._savedConnectionTree.setInput([]);
|
||||||
|
|
||||||
// call layout with view height
|
// call layout with view height
|
||||||
this.layout();
|
|
||||||
this.initDialog();
|
this.initDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected layout(height?: number): void {
|
protected layout(height: number): void {
|
||||||
// Height is the overall height. Since we're laying out a specific component, always get its actual height
|
// Height is the overall height. Since we're laying out a specific component, always get its actual height
|
||||||
this._recentConnectionTree.layout(DOM.getTotalHeight(this._recentConnectionTree.getHTMLElement()));
|
const width = DOM.getContentWidth(this._body);
|
||||||
|
this.orthogonalSize = width;
|
||||||
|
for (const { pane } of this.paneItems) {
|
||||||
|
pane.orthogonalSize = width;
|
||||||
|
}
|
||||||
|
this._panel.layout(new DOM.Dimension(this.orthogonalSize, height - 38 - 35 - 326)); // height - connection title - connection type input - connection widget
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -478,4 +513,132 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
public get databaseDropdownExpanded(): boolean {
|
public get databaseDropdownExpanded(): boolean {
|
||||||
return this._databaseDropdownExpanded;
|
return this._databaseDropdownExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#region ViewletContainer
|
||||||
|
public readonly onDidAddViews: Event<IView[]> = Event.None;
|
||||||
|
public readonly onDidRemoveViews: Event<IView[]> = Event.None;
|
||||||
|
public readonly onDidChangeViewVisibility: Event<IView> = Event.None;
|
||||||
|
public get views(): IView[] {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisible(visible: boolean): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
isVisible(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
focus(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
getActions(): IAction[] {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
getSecondaryActions(): IAction[] {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
getActionViewItem(action: IAction): IActionViewItem {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
|
||||||
|
getView(viewId: string): IView {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
|
||||||
|
saveState(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
private onDidRemoveViewDescriptors(removed: IViewDescriptorRef[]): void {
|
||||||
|
for (const ref of removed) {
|
||||||
|
this.removePane(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private removePane(ref: IViewDescriptorRef): void {
|
||||||
|
const item = this.paneItems.find(p => p.pane.id === ref.viewDescriptor.id);
|
||||||
|
this._panel.removeTab(item.pane.id);
|
||||||
|
dispose(item.disposable);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDidAddViewDescriptors(added: IAddedViewDescriptorRef[]): ViewPane[] {
|
||||||
|
const panesToAdd: { pane: ViewPane, size: number, treeView: ITreeView }[] = [];
|
||||||
|
|
||||||
|
for (const { viewDescriptor, size } of added) {
|
||||||
|
const treeViewDescriptor = viewDescriptor as ITreeViewDescriptor;
|
||||||
|
const pane = this.createView(treeViewDescriptor,
|
||||||
|
{
|
||||||
|
id: viewDescriptor.id,
|
||||||
|
title: viewDescriptor.name,
|
||||||
|
expanded: true
|
||||||
|
});
|
||||||
|
|
||||||
|
pane.render();
|
||||||
|
|
||||||
|
panesToAdd.push({ pane, size: size || pane.minimumSize, treeView: treeViewDescriptor.treeView as ITreeView });
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addPanes(panesToAdd);
|
||||||
|
|
||||||
|
const panes: ViewPane[] = [];
|
||||||
|
for (const { pane } of panesToAdd) {
|
||||||
|
pane.setVisible(this.isVisible());
|
||||||
|
pane.headerVisible = false;
|
||||||
|
panes.push(pane);
|
||||||
|
}
|
||||||
|
return panes;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected createView(viewDescriptor: ITreeViewDescriptor, options: IViewletViewOptions): ViewPane {
|
||||||
|
return (this.instantiationService as any).createInstance(viewDescriptor.ctorDescriptor.ctor, ...(viewDescriptor.ctorDescriptor.staticArguments || []), options) as ViewPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
private addPanes(panes: { pane: ViewPane, treeView: ITreeView, size: number }[]): void {
|
||||||
|
|
||||||
|
for (const { pane, treeView, size } of panes) {
|
||||||
|
this.addPane({ pane, treeView }, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// this._onDidAddViews.fire(panes.map(({ pane }) => pane));
|
||||||
|
}
|
||||||
|
|
||||||
|
private addPane({ pane, treeView }: { pane: ViewPane, treeView: ITreeView }, size: number): void {
|
||||||
|
const paneStyler = styler.attachStyler<IPaneColors>(this._themeService, {
|
||||||
|
headerForeground: PANEL_SECTION_HEADER_FOREGROUND,
|
||||||
|
headerBackground: PANEL_SECTION_HEADER_BACKGROUND,
|
||||||
|
headerBorder: PANEL_SECTION_HEADER_BORDER,
|
||||||
|
dropBackground: PANEL_SECTION_DRAG_AND_DROP_BACKGROUND,
|
||||||
|
leftBorder: PANEL_SECTION_BORDER
|
||||||
|
}, pane);
|
||||||
|
|
||||||
|
const disposable = combinedDisposable(pane, paneStyler);
|
||||||
|
const paneItem = { pane, disposable };
|
||||||
|
treeView.onDidChangeSelection(e => {
|
||||||
|
if (e.length > 0 && e[0].payload) {
|
||||||
|
this.onConnectionClick(e[0].payload);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.paneItems.push(paneItem);
|
||||||
|
this._panel.pushTab({
|
||||||
|
identifier: pane.id,
|
||||||
|
title: pane.title,
|
||||||
|
view: {
|
||||||
|
focus: () => pane.focus(),
|
||||||
|
layout: d => pane.layout(d.height),
|
||||||
|
render: e => e.appendChild(pane.element),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const VIEW_CONTAINER = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
|
||||||
|
id: 'dialog/connection',
|
||||||
|
name: 'ConnectionDialog',
|
||||||
|
ctorDescriptor: new SyncDescriptor(class { }),
|
||||||
|
order: 0,
|
||||||
|
storageId: `dialog/connection.state`
|
||||||
|
}, ViewContainerLocation.Dialog);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
flex: 1 1;
|
flex: 1 1;
|
||||||
min-height: 120px;
|
min-height: 120px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 0px 11px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.connection-dialog .tab-container {
|
.connection-dialog .tab-container {
|
||||||
|
|||||||
@@ -40,14 +40,17 @@ suite('ConnectionDialogService tests', () => {
|
|||||||
new TestCapabilitiesService());
|
new TestCapabilitiesService());
|
||||||
(connectionDialogService as any)._connectionManagementService = mockConnectionManagementService.object;
|
(connectionDialogService as any)._connectionManagementService = mockConnectionManagementService.object;
|
||||||
mockConnectionDialog = TypeMoq.Mock.ofType(ConnectionDialogWidget, TypeMoq.MockBehavior.Strict,
|
mockConnectionDialog = TypeMoq.Mock.ofType(ConnectionDialogWidget, TypeMoq.MockBehavior.Strict,
|
||||||
undefined,
|
undefined, // providerDisplayNameOptions
|
||||||
undefined,
|
undefined, // selectedProviderType
|
||||||
undefined,
|
undefined, // providerNameToDisplayNameMap
|
||||||
undefined,
|
undefined, // instantiationService
|
||||||
undefined,
|
undefined, // connectionManagementService
|
||||||
undefined,
|
undefined, // contextMenuService
|
||||||
undefined,
|
undefined, // contextViewService
|
||||||
undefined,
|
{ getViewContainerById: () => ({}), getViewContainerModel: () => ({}) }, // viewDescriptorService
|
||||||
|
undefined, // themeService
|
||||||
|
undefined, // layoutService
|
||||||
|
undefined, // telemetryService
|
||||||
new MockContextKeyService()
|
new MockContextKeyService()
|
||||||
);
|
);
|
||||||
mockConnectionDialog.setup(c => c.resetConnection());
|
mockConnectionDialog.setup(c => c.resetConnection());
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { INodeContextValue } from 'sql/workbench/browser/parts/views/nodeContext';
|
|
||||||
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
import { Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||||
@@ -14,6 +13,12 @@ import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
|||||||
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
||||||
import { DatabaseEngineEdition } from 'sql/workbench/api/common/sqlExtHostTypes';
|
import { DatabaseEngineEdition } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||||
import { isWindows } from 'vs/base/common/platform';
|
import { isWindows } from 'vs/base/common/platform';
|
||||||
|
import { ITreeItem } from 'sql/workbench/common/views';
|
||||||
|
|
||||||
|
export interface INodeContextValue {
|
||||||
|
node: ITreeItem;
|
||||||
|
viewId: string;
|
||||||
|
}
|
||||||
|
|
||||||
export class MssqlNodeContext extends Disposable {
|
export class MssqlNodeContext extends Disposable {
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export class TreeUpdateUtils {
|
|||||||
/**
|
/**
|
||||||
* Set input for the tree.
|
* Set input for the tree.
|
||||||
*/
|
*/
|
||||||
public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): Promise<void> {
|
public static structuralTreeUpdate(tree: ITree, viewKey: 'recent' | 'active' | 'saved', connectionManagementService: IConnectionManagementService, providers?: string[]): Promise<void> {
|
||||||
// convert to old VS Code tree interface with expandable methods
|
// convert to old VS Code tree interface with expandable methods
|
||||||
let expandableTree: IExpandableTree = <IExpandableTree>tree;
|
let expandableTree: IExpandableTree = <IExpandableTree>tree;
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ export class TreeUpdateUtils {
|
|||||||
targetsToExpand = expandableTree.getExpandedElements();
|
targetsToExpand = expandableTree.getExpandedElements();
|
||||||
}
|
}
|
||||||
let groups;
|
let groups;
|
||||||
let treeInput = new ConnectionProfileGroup('root', null, undefined, undefined, undefined);
|
let treeInput = new ConnectionProfileGroup('root', null, undefined);
|
||||||
if (viewKey === 'recent') {
|
if (viewKey === 'recent') {
|
||||||
groups = connectionManagementService.getRecentConnections(providers);
|
groups = connectionManagementService.getRecentConnections(providers);
|
||||||
treeInput.addConnections(groups);
|
treeInput.addConnections(groups);
|
||||||
@@ -71,7 +71,7 @@ export class TreeUpdateUtils {
|
|||||||
} else if (viewKey === 'saved') {
|
} else if (viewKey === 'saved') {
|
||||||
treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService, providers);
|
treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService, providers);
|
||||||
}
|
}
|
||||||
const previousTreeInput: any = tree.getInput();
|
const previousTreeInput = tree.getInput();
|
||||||
return tree.setInput(treeInput).then(async () => {
|
return tree.setInput(treeInput).then(async () => {
|
||||||
if (previousTreeInput instanceof Disposable) {
|
if (previousTreeInput instanceof Disposable) {
|
||||||
previousTreeInput.dispose();
|
previousTreeInput.dispose();
|
||||||
@@ -83,7 +83,6 @@ export class TreeUpdateUtils {
|
|||||||
if (selectedElement) {
|
if (selectedElement) {
|
||||||
tree.select(selectedElement);
|
tree.select(selectedElement);
|
||||||
}
|
}
|
||||||
tree.getFocus();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ export class ProgressService extends Disposable implements IProgressService {
|
|||||||
return this.withViewProgress(location, task, { ...options, location });
|
return this.withViewProgress(location, task, { ...options, location });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.viewDescriptorService.getViewLocationById(location) === ViewContainerLocation.Dialog) { // {{SQL CARBON EDIT}} bypass progress for dialog @todo
|
||||||
|
return task({ report: () => { return; } });
|
||||||
|
}
|
||||||
|
|
||||||
throw new Error(`Bad progress location: ${location}`);
|
throw new Error(`Bad progress location: ${location}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user