mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 01:25:37 -05:00
fix panel issues
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
import { QUERY_HISTORY_PANEL_ID } from 'sql/workbench/contrib/queryHistory/common/constants';
|
||||
import { QUERY_HISTORY_VIEW_ID } from 'sql/workbench/contrib/queryHistory/common/constants';
|
||||
import { RunQueryOnConnectionMode } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
@@ -30,7 +30,7 @@ export class ToggleQueryHistoryAction extends ToggleViewAction {
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
|
||||
) {
|
||||
super(id, label, QUERY_HISTORY_PANEL_ID, viewsService, viewDescriptorService, contextKeyService, layoutService);
|
||||
super(id, label, QUERY_HISTORY_VIEW_ID, viewsService, viewDescriptorService, contextKeyService, layoutService);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,48 +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/queryHistoryPanel';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
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 { QueryHistoryView } from 'sql/workbench/contrib/queryHistory/browser/queryHistoryView';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { Panel } from 'vs/workbench/browser/panel';
|
||||
import { QUERY_HISTORY_PANEL_ID } from 'sql/workbench/contrib/queryHistory/common/constants';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
|
||||
export class QueryHistoryPanel extends Panel {
|
||||
|
||||
private _queryHistoryView: QueryHistoryView;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService
|
||||
) {
|
||||
super(QUERY_HISTORY_PANEL_ID, telemetryService, themeService, storageService);
|
||||
}
|
||||
|
||||
public create(parent: HTMLElement): void {
|
||||
super.create(parent);
|
||||
this._queryHistoryView = this.instantiationService.createInstance(QueryHistoryView);
|
||||
this._queryHistoryView.renderBody(parent);
|
||||
}
|
||||
|
||||
public setVisible(visible: boolean): void {
|
||||
super.setVisible(visible);
|
||||
this._queryHistoryView.setVisible(visible);
|
||||
}
|
||||
|
||||
public layout({ height }: Dimension): void {
|
||||
this._queryHistoryView.layout(height);
|
||||
}
|
||||
|
||||
getActions(): IAction[] {
|
||||
return this._queryHistoryView.getActions();
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { DefaultFilter, DefaultDragAndDrop, DefaultAccessibilityProvider } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { localize } from 'vs/nls';
|
||||
import { hide, $, append, show } from 'vs/base/browser/dom';
|
||||
@@ -22,21 +21,38 @@ import { IQueryHistoryService } from 'sql/workbench/services/queryHistory/common
|
||||
import { QueryHistoryNode } from 'sql/workbench/contrib/queryHistory/browser/queryHistoryNode';
|
||||
import { QueryHistoryInfo } from 'sql/workbench/services/queryHistory/common/queryHistoryInfo';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { IViewDescriptorService } from 'vs/workbench/common/views';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
|
||||
/**
|
||||
* QueryHistoryView implements the dynamic tree view for displaying Query History
|
||||
*/
|
||||
export class QueryHistoryView extends Disposable {
|
||||
export class QueryHistoryView extends ViewPane {
|
||||
private _messages: HTMLElement;
|
||||
private _tree: ITree;
|
||||
private _actionProvider: QueryHistoryActionProvider;
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IThemeService private _themeService: IThemeService,
|
||||
@IQueryHistoryService private readonly _queryHistoryService: IQueryHistoryService
|
||||
options: IViewPaneOptions,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IOpenerService openerService: IOpenerService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IQueryHistoryService private readonly queryHistoryService: IQueryHistoryService
|
||||
) {
|
||||
super();
|
||||
this._actionProvider = this._instantiationService.createInstance(QueryHistoryActionProvider);
|
||||
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||
this._actionProvider = this.instantiationService.createInstance(QueryHistoryActionProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,12 +65,12 @@ export class QueryHistoryView extends Disposable {
|
||||
const noQueriesMessage = localize('noQueriesMessage', "No queries to display.");
|
||||
append(this._messages, $('span')).innerText = noQueriesMessage;
|
||||
|
||||
this._tree = this._register(this.createQueryHistoryTree(container, this._instantiationService));
|
||||
this._tree = this._register(this.createQueryHistoryTree(container, this.instantiationService));
|
||||
|
||||
// Theme styler
|
||||
this._register(attachListStyler(this._tree, this._themeService));
|
||||
this._register(attachListStyler(this._tree, this.themeService));
|
||||
|
||||
this._queryHistoryService.onInfosUpdated((nodes: QueryHistoryInfo[]) => {
|
||||
this.queryHistoryService.onInfosUpdated((nodes: QueryHistoryInfo[]) => {
|
||||
this.refreshTree();
|
||||
});
|
||||
|
||||
@@ -97,7 +113,7 @@ export class QueryHistoryView extends Disposable {
|
||||
targetsToExpand = expandableTree.getExpandedElements();
|
||||
}
|
||||
|
||||
const nodes: QueryHistoryNode[] = this._queryHistoryService.getQueryHistoryInfos().map(i => new QueryHistoryNode(i));
|
||||
const nodes: QueryHistoryNode[] = this.queryHistoryService.getQueryHistoryInfos().map(i => new QueryHistoryNode(i));
|
||||
|
||||
if (nodes.length > 0) {
|
||||
hide(this._messages);
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
/**
|
||||
* Query History panel id
|
||||
*/
|
||||
export const QUERY_HISTORY_PANEL_ID = 'workbench.panel.queryHistory';
|
||||
export const QUERY_HISTORY_CONTAINER_ID = 'workbench.panel.queryHistory';
|
||||
export const QUERY_HISTORY_VIEW_ID = 'workbench.panel.queryHistory.view';
|
||||
|
||||
@@ -10,12 +10,14 @@ import { localize } from 'vs/nls';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { QueryHistoryPanel } from 'sql/workbench/contrib/queryHistory/browser/queryHistoryPanel';
|
||||
import { PanelRegistry, Extensions as PanelExtensions, PanelDescriptor } from 'vs/workbench/browser/panel';
|
||||
import { QUERY_HISTORY_PANEL_ID } from 'sql/workbench/contrib/queryHistory/common/constants';
|
||||
import { ToggleQueryHistoryAction } from 'sql/workbench/contrib/queryHistory/browser/queryHistoryActions';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IConfigurationRegistry, ConfigurationScope, Extensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { ViewContainer, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewsRegistry, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { QUERY_HISTORY_CONTAINER_ID, QUERY_HISTORY_VIEW_ID } from 'sql/workbench/contrib/queryHistory/common/constants';
|
||||
import { QueryHistoryView } from 'sql/workbench/contrib/queryHistory/browser/queryHistoryView';
|
||||
|
||||
export class QueryHistoryWorkbenchContribution implements IWorkbenchContribution {
|
||||
|
||||
@@ -82,16 +84,6 @@ export class QueryHistoryWorkbenchContribution implements IWorkbenchContribution
|
||||
localize('viewCategory', "View")
|
||||
);
|
||||
|
||||
// Register Output Panel
|
||||
Registry.as<PanelRegistry>(PanelExtensions.Panels).registerPanel(PanelDescriptor.create(
|
||||
QueryHistoryPanel,
|
||||
QUERY_HISTORY_PANEL_ID,
|
||||
localize('queryHistory', "Query History"),
|
||||
'output',
|
||||
20,
|
||||
ToggleQueryHistoryAction.ID
|
||||
));
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
||||
group: '4_panels',
|
||||
command: {
|
||||
@@ -100,6 +92,27 @@ export class QueryHistoryWorkbenchContribution implements IWorkbenchContribution
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
|
||||
// markers view container
|
||||
const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
|
||||
id: QUERY_HISTORY_CONTAINER_ID,
|
||||
name: localize('queryHistory', "Query History"),
|
||||
hideIfEmpty: true,
|
||||
order: 20,
|
||||
ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [QUERY_HISTORY_CONTAINER_ID, { mergeViewWithContainerWhenSingleView: true, donotShowContainerTitleWhenMergedWithContainer: true }]),
|
||||
storageId: `${QUERY_HISTORY_CONTAINER_ID}.storage`,
|
||||
focusCommand: {
|
||||
id: ToggleQueryHistoryAction.ID
|
||||
}
|
||||
}, ViewContainerLocation.Panel);
|
||||
|
||||
Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews([{
|
||||
id: QUERY_HISTORY_VIEW_ID,
|
||||
name: localize('queryHistory', "Query History"),
|
||||
canToggleVisibility: false,
|
||||
canMoveView: false,
|
||||
ctorDescriptor: new SyncDescriptor(QueryHistoryView),
|
||||
}], VIEW_CONTAINER);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user