Removed duplicate connections code (#5045)
* removed duplicate connections code * removed old comment * removed unused code
@@ -3,12 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* Activity Bar - connection */
|
||||
.monaco-workbench > .activitybar .monaco-action-bar .action-label.connectionViewlet {
|
||||
-webkit-mask: url('icons/server_page_inverse.svg') no-repeat 50% 50%;
|
||||
-webkit-mask-size: 25px 25px;
|
||||
}
|
||||
|
||||
/* Activity Bar - task history */
|
||||
.monaco-workbench > .activitybar .monaco-action-bar .action-label.taskHistoryViewlet {
|
||||
-webkit-mask: url('icons/run_history_inverse.svg') no-repeat 50% 50%;
|
||||
|
||||
@@ -10,7 +10,6 @@ import { IConnectionManagementService } from 'sql/platform/connection/common/con
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
|
||||
import { ServerTreeView } from 'sql/parts/objectExplorer/viewlet/serverTreeView';
|
||||
import { ConnectionViewlet } from 'sql/workbench/parts/connection/electron-browser/connectionViewlet';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
@@ -377,27 +376,3 @@ export class DeleteConnectionAction extends Action {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to clear search results
|
||||
*/
|
||||
export class ClearSearchAction extends Action {
|
||||
public static ID = 'registeredServers.clearSearch';
|
||||
public static LABEL = localize('clearSearch', 'Clear Search');
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
private _viewlet: ConnectionViewlet | ConnectionViewletPanel,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
) {
|
||||
super(id, label);
|
||||
this.class = 'icon close';
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
public run(): Promise<boolean> {
|
||||
this._viewlet.clearSearch();
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/connectionViewlet';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { VIEWLET_ID } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ServerTreeView } from 'sql/parts/objectExplorer/viewlet/serverTreeView';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { AddServerAction, AddServerGroupAction, ActiveConnectionsFilterAction } from 'sql/parts/objectExplorer/viewlet/connectionTreeAction';
|
||||
import { warn } from 'sql/base/common/log';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
|
||||
export class ConnectionViewlet extends Viewlet {
|
||||
|
||||
private _root: HTMLElement;
|
||||
private _toDisposeViewlet: IDisposable[] = [];
|
||||
private _serverTreeView: ServerTreeView;
|
||||
private _addServerAction: IAction;
|
||||
private _addServerGroupAction: IAction;
|
||||
private _activeConnectionsFilterAction: ActiveConnectionsFilterAction;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IObjectExplorerService private objectExplorerService: IObjectExplorerService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
|
||||
super(VIEWLET_ID, configurationService, layoutService, telemetryService, themeService, storageService);
|
||||
|
||||
this._addServerAction = this._instantiationService.createInstance(AddServerAction,
|
||||
AddServerAction.ID,
|
||||
AddServerAction.LABEL);
|
||||
this._addServerGroupAction = this._instantiationService.createInstance(AddServerGroupAction,
|
||||
AddServerGroupAction.ID,
|
||||
AddServerGroupAction.LABEL);
|
||||
this._serverTreeView = this._instantiationService.createInstance(ServerTreeView);
|
||||
this._activeConnectionsFilterAction = this._serverTreeView.activeConnectionsFilterAction;
|
||||
this.objectExplorerService.registerServerTreeView(this._serverTreeView);
|
||||
}
|
||||
|
||||
public create(parent: HTMLElement): void {
|
||||
super.create(parent);
|
||||
this._root = parent;
|
||||
const viewletContainer = DOM.append(parent, DOM.$('div.server-explorer-viewlet'));
|
||||
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
|
||||
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
|
||||
warn('render registered servers: ' + error);
|
||||
});
|
||||
}
|
||||
|
||||
public search(value: string): void {
|
||||
if (value) {
|
||||
this._serverTreeView.searchTree(value);
|
||||
} else {
|
||||
this.clearSearch();
|
||||
}
|
||||
}
|
||||
|
||||
public setVisible(visible: boolean): void {
|
||||
super.setVisible(visible);
|
||||
this._serverTreeView.setVisible(visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return actions for the viewlet
|
||||
*/
|
||||
public getActions(): IAction[] {
|
||||
return [this._addServerAction, this._addServerGroupAction, this._activeConnectionsFilterAction];
|
||||
}
|
||||
|
||||
public focus(): void {
|
||||
super.focus();
|
||||
}
|
||||
|
||||
public layout({ height, width }: DOM.Dimension): void {
|
||||
this._serverTreeView.layout(height - 36); // account for search box
|
||||
DOM.toggleClass(this._root, 'narrow', width <= 350);
|
||||
}
|
||||
|
||||
public getOptimalWidth(): number {
|
||||
return 400;
|
||||
}
|
||||
|
||||
public clearSearch() {
|
||||
this._serverTreeView.refreshTree();
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._serverTreeView.dispose();
|
||||
this._toDisposeViewlet = dispose(this._toDisposeViewlet);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { localize } from 'vs/nls';
|
||||
import 'vs/css!./media/connectionViewletPanel';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IExtensionTipsService, IExtensionManagementServerService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
@@ -12,17 +12,15 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ServerTreeView } from 'sql/parts/objectExplorer/viewlet/serverTreeView';
|
||||
import {
|
||||
ClearSearchAction, ActiveConnectionsFilterAction,
|
||||
ActiveConnectionsFilterAction,
|
||||
AddServerAction, AddServerGroupAction
|
||||
} from 'sql/parts/objectExplorer/viewlet/connectionTreeAction';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
|
||||
@@ -52,7 +50,6 @@ export class ConnectionViewletPanel extends ViewletPanel {
|
||||
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
|
||||
) {
|
||||
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService);
|
||||
//this._clearSearchAction = this.instantiationService.createInstance(ClearSearchAction, ClearSearchAction.ID, ClearSearchAction.LABEL, this);
|
||||
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
|
||||
AddServerAction.ID,
|
||||
AddServerAction.LABEL);
|
||||
@@ -83,7 +80,7 @@ export class ConnectionViewletPanel extends ViewletPanel {
|
||||
}
|
||||
|
||||
layoutBody(size: number): void {
|
||||
this._serverTreeView.layout(size - 46); // account for search box and horizontal scroll bar
|
||||
this._serverTreeView.layout(size);
|
||||
DOM.toggleClass(this._root, 'narrow', this._root.clientWidth < 300);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,6 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
|
||||
this.disposables.push(this.viewletService.onDidViewletOpen(this.onViewletOpen, this, this.disposables));
|
||||
}
|
||||
|
||||
create(parent: HTMLElement): void {
|
||||
@@ -114,7 +113,6 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
|
||||
protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPanel[] {
|
||||
const addedViews = super.onDidAddViews(added);
|
||||
Promise.all(addedViews);
|
||||
return addedViews;
|
||||
}
|
||||
|
||||
@@ -122,12 +120,6 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
return this.instantiationService.createInstance(viewDescriptor.ctorDescriptor.ctor, options) as ViewletPanel;
|
||||
}
|
||||
|
||||
private onViewletOpen(viewlet: IViewlet): void {
|
||||
if (!viewlet || viewlet.getId() === VIEWLET_ID) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
super.dispose();
|
||||
|
||||
|
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
@@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
.server-explorer-viewlet .object-explorer-view {
|
||||
height: calc(100% - 36px);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.server-explorer-viewlet .server-group {
|
||||
|
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 1002 B |
|
Before Width: | Height: | Size: 1007 B After Width: | Height: | Size: 1007 B |
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |