mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Azure extension changes (#4987)
* removed search box * removed commented code
This commit is contained in:
@@ -110,6 +110,14 @@
|
|||||||
{
|
{
|
||||||
"command": "mssqlCluster.livy.cmd.submitFileToSparkJob",
|
"command": "mssqlCluster.livy.cmd.submitFileToSparkJob",
|
||||||
"title": "%title.submitSparkJob%"
|
"title": "%title.submitSparkJob%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "mssql.searchServers",
|
||||||
|
"title": "%title.searchServers%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "mssql.clearSearchServerResult",
|
||||||
|
"title": "%title.clearSearchServerResult%"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outputChannels": [
|
"outputChannels": [
|
||||||
|
|||||||
@@ -24,5 +24,8 @@
|
|||||||
"title.openYarnHistory": "View Yarn History",
|
"title.openYarnHistory": "View Yarn History",
|
||||||
"title.tasks": "Tasks",
|
"title.tasks": "Tasks",
|
||||||
"title.installPackages": "Install Packages",
|
"title.installPackages": "Install Packages",
|
||||||
"title.configurePython": "Configure Python for Notebooks"
|
"title.configurePython": "Configure Python for Notebooks",
|
||||||
|
|
||||||
|
"title.searchServers": "Search: Servers",
|
||||||
|
"title.clearSearchServerResult": "Search: Clear Search Server Results"
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ import { OpenSparkJobSubmissionDialogCommand, OpenSparkJobSubmissionDialogFromFi
|
|||||||
import { OpenSparkYarnHistoryTask } from './sparkFeature/historyTask';
|
import { OpenSparkYarnHistoryTask } from './sparkFeature/historyTask';
|
||||||
import { MssqlObjectExplorerNodeProvider, mssqlOutputChannel } from './objectExplorerNodeProvider/objectExplorerNodeProvider';
|
import { MssqlObjectExplorerNodeProvider, mssqlOutputChannel } from './objectExplorerNodeProvider/objectExplorerNodeProvider';
|
||||||
import { CmsService } from './cms/cmsService';
|
import { CmsService } from './cms/cmsService';
|
||||||
|
import { registerSearchServerCommand } from './objectExplorerNodeProvider/command';
|
||||||
|
|
||||||
const baseConfig = require('./config.json');
|
const baseConfig = require('./config.json');
|
||||||
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
|
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
|
||||||
@@ -120,6 +121,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<MssqlE
|
|||||||
vscode.window.showErrorMessage('Failed to start Sql tools service');
|
vscode.window.showErrorMessage('Failed to start Sql tools service');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerSearchServerCommand(appContext);
|
||||||
let contextProvider = new ContextProvider();
|
let contextProvider = new ContextProvider();
|
||||||
context.subscriptions.push(contextProvider);
|
context.subscriptions.push(contextProvider);
|
||||||
context.subscriptions.push(credentialsStore);
|
context.subscriptions.push(credentialsStore);
|
||||||
|
|||||||
@@ -174,3 +174,18 @@ export abstract class ProgressCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function registerSearchServerCommand(appContext: AppContext): void {
|
||||||
|
appContext.apiWrapper.registerCommand('mssql.searchServers', () => {
|
||||||
|
vscode.window.showInputBox({
|
||||||
|
placeHolder: localize('mssql.searchServers', 'Search Server Names')
|
||||||
|
}).then((stringSearch) => {
|
||||||
|
if (stringSearch) {
|
||||||
|
vscode.commands.executeCommand('registeredServers.searchServer', (stringSearch));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
appContext.apiWrapper.registerCommand('mssql.clearSearchServerResult', () => {
|
||||||
|
vscode.commands.executeCommand('registeredServers.clearSearchServerResult');
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import 'vs/css!./media/serverTreeActions';
|
import 'vs/css!./media/serverTreeActions';
|
||||||
import * as errors from 'vs/base/common/errors';
|
import * as errors from 'vs/base/common/errors';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import Severity from 'vs/base/common/severity';
|
import Severity from 'vs/base/common/severity';
|
||||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||||
@@ -34,6 +34,7 @@ import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMess
|
|||||||
import { ServerTreeActionProvider } from 'sql/parts/objectExplorer/viewlet/serverTreeActionProvider';
|
import { ServerTreeActionProvider } from 'sql/parts/objectExplorer/viewlet/serverTreeActionProvider';
|
||||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||||
import { isHidden } from 'sql/base/browser/dom';
|
import { isHidden } from 'sql/base/browser/dom';
|
||||||
|
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ServerTreeview implements the dynamic tree view.
|
* ServerTreeview implements the dynamic tree view.
|
||||||
@@ -72,6 +73,7 @@ export class ServerTreeView {
|
|||||||
this._treeSelectionHandler.onTreeActionStateChange(false);
|
this._treeSelectionHandler.onTreeActionStateChange(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.registerCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,6 +98,25 @@ export class ServerTreeView {
|
|||||||
return this._tree;
|
return this._tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Register search related commands
|
||||||
|
*/
|
||||||
|
public registerCommands(): void {
|
||||||
|
CommandsRegistry.registerCommand({
|
||||||
|
id: 'registeredServers.searchServer',
|
||||||
|
handler: (accessor: ServicesAccessor, ...args: any[]) => {
|
||||||
|
this.searchTree(args[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CommandsRegistry.registerCommand({
|
||||||
|
id: 'registeredServers.clearSearchServerResult',
|
||||||
|
handler: (accessor: ServicesAccessor, ...args: any[]) => {
|
||||||
|
this.refreshTree();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the view body
|
* Render the view body
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,10 +32,8 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
|
|||||||
export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
||||||
|
|
||||||
private _root: HTMLElement;
|
private _root: HTMLElement;
|
||||||
private _searchBox: InputBox;
|
|
||||||
private _toDisposeViewlet: IDisposable[] = [];
|
private _toDisposeViewlet: IDisposable[] = [];
|
||||||
private _serverTreeView: ServerTreeView;
|
private _serverTreeView: ServerTreeView;
|
||||||
private _clearSearchAction: ClearSearchAction;
|
|
||||||
private _addServerAction: IAction;
|
private _addServerAction: IAction;
|
||||||
private _addServerGroupAction: IAction;
|
private _addServerGroupAction: IAction;
|
||||||
private _activeConnectionsFilterAction: ActiveConnectionsFilterAction;
|
private _activeConnectionsFilterAction: ActiveConnectionsFilterAction;
|
||||||
@@ -53,7 +51,6 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
|||||||
|
|
||||||
super(VIEWLET_ID, configurationService, layoutService, telemetryService, _themeService, storageService);
|
super(VIEWLET_ID, configurationService, layoutService, telemetryService, _themeService, storageService);
|
||||||
|
|
||||||
this._clearSearchAction = this._instantiationService.createInstance(ClearSearchAction, ClearSearchAction.ID, ClearSearchAction.LABEL, this);
|
|
||||||
this._addServerAction = this._instantiationService.createInstance(AddServerAction,
|
this._addServerAction = this._instantiationService.createInstance(AddServerAction,
|
||||||
AddServerAction.ID,
|
AddServerAction.ID,
|
||||||
AddServerAction.LABEL);
|
AddServerAction.LABEL);
|
||||||
@@ -79,24 +76,6 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
|||||||
super.create(parent);
|
super.create(parent);
|
||||||
this._root = parent;
|
this._root = parent;
|
||||||
const viewletContainer = DOM.append(parent, DOM.$('div.server-explorer-viewlet'));
|
const viewletContainer = DOM.append(parent, DOM.$('div.server-explorer-viewlet'));
|
||||||
const searchBoxContainer = DOM.append(viewletContainer, DOM.$('div.search-box'));
|
|
||||||
this._searchBox = new InputBox(
|
|
||||||
searchBoxContainer,
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
placeholder: localize('Search server names', 'Search server names'),
|
|
||||||
actions: [this._clearSearchAction],
|
|
||||||
ariaLabel: localize('Search server names', 'Search server names')
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this._searchBox.onDidChange(() => {
|
|
||||||
this.search(this._searchBox.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Theme styler
|
|
||||||
this._toDisposeViewlet.push(attachInputBoxStyler(this._searchBox, this._themeService));
|
|
||||||
|
|
||||||
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
|
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
|
||||||
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
|
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
|
||||||
warn('render registered servers: ' + error);
|
warn('render registered servers: ' + error);
|
||||||
@@ -105,7 +84,6 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
|||||||
|
|
||||||
public search(value: string): void {
|
public search(value: string): void {
|
||||||
if (value) {
|
if (value) {
|
||||||
this._clearSearchAction.enabled = true;
|
|
||||||
this._serverTreeView.searchTree(value);
|
this._serverTreeView.searchTree(value);
|
||||||
} else {
|
} else {
|
||||||
this.clearSearch();
|
this.clearSearch();
|
||||||
@@ -129,7 +107,6 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public layout({ height, width }: DOM.Dimension): void {
|
public layout({ height, width }: DOM.Dimension): void {
|
||||||
this._searchBox.layout();
|
|
||||||
this._serverTreeView.layout(height - 36); // account for search box
|
this._serverTreeView.layout(height - 36); // account for search box
|
||||||
DOM.toggleClass(this._root, 'narrow', width <= 350);
|
DOM.toggleClass(this._root, 'narrow', width <= 350);
|
||||||
}
|
}
|
||||||
@@ -140,9 +117,6 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
|||||||
|
|
||||||
public clearSearch() {
|
public clearSearch() {
|
||||||
this._serverTreeView.refreshTree();
|
this._serverTreeView.refreshTree();
|
||||||
this._searchBox.value = '';
|
|
||||||
this._clearSearchAction.enabled = false;
|
|
||||||
this._searchBox.focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
|
|||||||
@@ -31,10 +31,8 @@ import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/com
|
|||||||
export class ConnectionViewletPanel extends ViewletPanel {
|
export class ConnectionViewletPanel extends ViewletPanel {
|
||||||
|
|
||||||
private _root: HTMLElement;
|
private _root: HTMLElement;
|
||||||
private _searchBox: InputBox;
|
|
||||||
private _toDisposeViewlet: IDisposable[] = [];
|
private _toDisposeViewlet: IDisposable[] = [];
|
||||||
private _serverTreeView: ServerTreeView;
|
private _serverTreeView: ServerTreeView;
|
||||||
private _clearSearchAction: ClearSearchAction;
|
|
||||||
private _addServerAction: IAction;
|
private _addServerAction: IAction;
|
||||||
private _addServerGroupAction: IAction;
|
private _addServerGroupAction: IAction;
|
||||||
private _activeConnectionsFilterAction: ActiveConnectionsFilterAction;
|
private _activeConnectionsFilterAction: ActiveConnectionsFilterAction;
|
||||||
@@ -54,7 +52,7 @@ export class ConnectionViewletPanel extends ViewletPanel {
|
|||||||
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
|
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
|
||||||
) {
|
) {
|
||||||
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService);
|
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService);
|
||||||
this._clearSearchAction = this.instantiationService.createInstance(ClearSearchAction, ClearSearchAction.ID, ClearSearchAction.LABEL, this);
|
//this._clearSearchAction = this.instantiationService.createInstance(ClearSearchAction, ClearSearchAction.ID, ClearSearchAction.LABEL, this);
|
||||||
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
|
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
|
||||||
AddServerAction.ID,
|
AddServerAction.ID,
|
||||||
AddServerAction.LABEL);
|
AddServerAction.LABEL);
|
||||||
@@ -77,24 +75,6 @@ export class ConnectionViewletPanel extends ViewletPanel {
|
|||||||
|
|
||||||
renderBody(container: HTMLElement): void {
|
renderBody(container: HTMLElement): void {
|
||||||
const viewletContainer = DOM.append(container, DOM.$('div.server-explorer-viewlet'));
|
const viewletContainer = DOM.append(container, DOM.$('div.server-explorer-viewlet'));
|
||||||
const searchBoxContainer = DOM.append(viewletContainer, DOM.$('div.search-box'));
|
|
||||||
this._searchBox = new InputBox(
|
|
||||||
searchBoxContainer,
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
placeholder: localize('Search server names', 'Search server names'),
|
|
||||||
actions: [this._clearSearchAction],
|
|
||||||
ariaLabel: localize('Search server names', 'Search server names')
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this._searchBox.onDidChange(() => {
|
|
||||||
this.search(this._searchBox.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Theme styler
|
|
||||||
this._toDisposeViewlet.push(attachInputBoxStyler(this._searchBox, this.themeService));
|
|
||||||
|
|
||||||
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
|
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
|
||||||
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
|
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
|
||||||
console.warn('render registered servers: ' + error);
|
console.warn('render registered servers: ' + error);
|
||||||
@@ -103,7 +83,6 @@ export class ConnectionViewletPanel extends ViewletPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
layoutBody(size: number): void {
|
layoutBody(size: number): void {
|
||||||
this._searchBox.layout();
|
|
||||||
this._serverTreeView.layout(size - 46); // account for search box and horizontal scroll bar
|
this._serverTreeView.layout(size - 46); // account for search box and horizontal scroll bar
|
||||||
DOM.toggleClass(this._root, 'narrow', this._root.clientWidth < 300);
|
DOM.toggleClass(this._root, 'narrow', this._root.clientWidth < 300);
|
||||||
}
|
}
|
||||||
@@ -140,14 +119,10 @@ export class ConnectionViewletPanel extends ViewletPanel {
|
|||||||
|
|
||||||
public clearSearch() {
|
public clearSearch() {
|
||||||
this._serverTreeView.refreshTree();
|
this._serverTreeView.refreshTree();
|
||||||
this._searchBox.value = '';
|
|
||||||
this._clearSearchAction.enabled = false;
|
|
||||||
this._searchBox.focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public search(value: string): void {
|
public search(value: string): void {
|
||||||
if (value) {
|
if (value) {
|
||||||
this._clearSearchAction.enabled = true;
|
|
||||||
this._serverTreeView.searchTree(value);
|
this._serverTreeView.searchTree(value);
|
||||||
} else {
|
} else {
|
||||||
this.clearSearch();
|
this.clearSearch();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { DISCONNECT_COMMAND_ID, MANAGE_COMMAND_ID, NEW_QUERY_COMMAND_ID, REFRESH
|
|||||||
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
||||||
group: 'connection',
|
group: 'connection',
|
||||||
order: 4,
|
order: 3,
|
||||||
command: {
|
command: {
|
||||||
id: DISCONNECT_COMMAND_ID,
|
id: DISCONNECT_COMMAND_ID,
|
||||||
title: localize('disconnect', 'Disconnect')
|
title: localize('disconnect', 'Disconnect')
|
||||||
@@ -20,6 +20,7 @@ MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|||||||
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
||||||
group: 'connection',
|
group: 'connection',
|
||||||
|
order: 2,
|
||||||
command: {
|
command: {
|
||||||
id: NEW_QUERY_COMMAND_ID,
|
id: NEW_QUERY_COMMAND_ID,
|
||||||
title: localize('newQuery', 'New Query')
|
title: localize('newQuery', 'New Query')
|
||||||
@@ -29,7 +30,7 @@ MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|||||||
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
||||||
group: 'connection',
|
group: 'connection',
|
||||||
order: 4,
|
order: 1,
|
||||||
command: {
|
command: {
|
||||||
id: MANAGE_COMMAND_ID,
|
id: MANAGE_COMMAND_ID,
|
||||||
title: localize('manage', 'Manage')
|
title: localize('manage', 'Manage')
|
||||||
|
|||||||
Reference in New Issue
Block a user