mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
fix panel issues
This commit is contained in:
@@ -157,5 +157,6 @@ export const VIEW_CONTAINER = Registry.as<IViewContainersRegistry>(ViewContainer
|
||||
name: localize('dataexplorer.name', "Connections"),
|
||||
ctorDescriptor: new SyncDescriptor(DataExplorerViewPaneContainer),
|
||||
icon: 'dataExplorer',
|
||||
order: 0
|
||||
order: 0,
|
||||
storageId: `${VIEWLET_ID}.state`
|
||||
}, ViewContainerLocation.Sidebar);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -8,16 +8,18 @@ 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 { TasksPanel } from 'sql/workbench/contrib/tasks/browser/tasksPanel';
|
||||
import * as lifecycle from 'vs/base/common/lifecycle';
|
||||
import * as ext from 'vs/workbench/common/contributions';
|
||||
import { ITaskService } from 'sql/workbench/services/tasks/common/tasksService';
|
||||
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { PanelRegistry, Extensions as PanelExtensions, PanelDescriptor } from 'vs/workbench/browser/panel';
|
||||
import { TASKS_PANEL_ID } from 'sql/workbench/contrib/tasks/common/tasks';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { ToggleTasksAction } from 'sql/workbench/contrib/tasks/browser/tasksActions';
|
||||
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainer, ViewContainerLocation, IViewsRegistry } from 'vs/workbench/common/views';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { TASKS_CONTAINER_ID, TASKS_VIEW_ID } from 'sql/workbench/contrib/tasks/common/tasks';
|
||||
import { TaskHistoryView } from 'sql/workbench/contrib/tasks/browser/tasksView';
|
||||
|
||||
export class StatusUpdater extends lifecycle.Disposable implements ext.IWorkbenchContribution {
|
||||
static ID = 'data.taskhistory.statusUpdater';
|
||||
@@ -32,7 +34,7 @@ export class StatusUpdater extends lifecycle.Disposable implements ext.IWorkbenc
|
||||
super();
|
||||
|
||||
this._register(this.taskService.onAddNewTask(args => {
|
||||
this.panelService.openPanel(TASKS_PANEL_ID, true);
|
||||
this.panelService.openPanel(TASKS_CONTAINER_ID, true);
|
||||
this.onServiceChange();
|
||||
}));
|
||||
|
||||
@@ -46,7 +48,7 @@ export class StatusUpdater extends lifecycle.Disposable implements ext.IWorkbenc
|
||||
lifecycle.dispose(this.badgeHandle);
|
||||
let numOfInProgressTask: number = this.taskService.getNumberOfInProgressTasks();
|
||||
let badge: NumberBadge = new NumberBadge(numOfInProgressTask, n => localize('inProgressTasksChangesBadge', "{0} in progress tasks", n));
|
||||
this.badgeHandle = this.activityBarService.showActivity(TASKS_PANEL_ID, badge, 'taskhistory-viewlet-label');
|
||||
this.badgeHandle = this.activityBarService.showActivity(TASKS_CONTAINER_ID, badge, 'taskhistory-viewlet-label');
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
@@ -70,15 +72,26 @@ registry.registerWorkbenchAction(
|
||||
localize('viewCategory', "View")
|
||||
);
|
||||
|
||||
// Register Output Panel
|
||||
Registry.as<PanelRegistry>(PanelExtensions.Panels).registerPanel(PanelDescriptor.create(
|
||||
TasksPanel,
|
||||
TASKS_PANEL_ID,
|
||||
localize('tasks', "Tasks"),
|
||||
'output',
|
||||
20,
|
||||
ToggleTasksAction.ID
|
||||
));
|
||||
// markers view container
|
||||
const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
|
||||
id: TASKS_CONTAINER_ID,
|
||||
name: localize('tasks', "Tasks"),
|
||||
hideIfEmpty: true,
|
||||
order: 20,
|
||||
ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [TASKS_CONTAINER_ID, { mergeViewWithContainerWhenSingleView: true, donotShowContainerTitleWhenMergedWithContainer: true }]),
|
||||
storageId: `${TASKS_CONTAINER_ID}.storage`,
|
||||
focusCommand: {
|
||||
id: ToggleTasksAction.ID
|
||||
}
|
||||
}, ViewContainerLocation.Panel);
|
||||
|
||||
Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews([{
|
||||
id: TASKS_VIEW_ID,
|
||||
name: localize('tasks', "Tasks"),
|
||||
canToggleVisibility: false,
|
||||
canMoveView: false,
|
||||
ctorDescriptor: new SyncDescriptor(TaskHistoryView),
|
||||
}], VIEW_CONTAINER);
|
||||
|
||||
// Register StatusUpdater
|
||||
(<ext.IWorkbenchContributionsRegistry>Registry.as(ext.Extensions.Workbench)).registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Restored);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
|
||||
import { ToggleViewAction } from 'vs/workbench/browser/actions/layoutActions';
|
||||
import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { TASKS_PANEL_ID } from 'sql/workbench/contrib/tasks/common/tasks';
|
||||
import { TASKS_VIEW_ID } from 'sql/workbench/contrib/tasks/common/tasks';
|
||||
|
||||
export class ToggleTasksAction extends ToggleViewAction {
|
||||
|
||||
@@ -22,6 +22,6 @@ export class ToggleTasksAction extends ToggleViewAction {
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
|
||||
) {
|
||||
super(id, label, TASKS_PANEL_ID, viewsService, viewDescriptorService, contextKeyService, layoutService);
|
||||
super(id, label, TASKS_VIEW_ID, viewsService, viewDescriptorService, contextKeyService, layoutService);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +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/tasksPanel';
|
||||
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 { TaskHistoryView } from 'sql/workbench/contrib/tasks/browser/tasksView';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { Panel } from 'vs/workbench/browser/panel';
|
||||
import { TASKS_PANEL_ID } from 'sql/workbench/contrib/tasks/common/tasks';
|
||||
|
||||
export class TasksPanel extends Panel {
|
||||
|
||||
private _taskHistoryView: TaskHistoryView;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService
|
||||
) {
|
||||
super(TASKS_PANEL_ID, telemetryService, themeService, storageService);
|
||||
}
|
||||
|
||||
public create(parent: HTMLElement): void {
|
||||
super.create(parent);
|
||||
this._taskHistoryView = this.instantiationService.createInstance(TaskHistoryView);
|
||||
this._taskHistoryView.renderBody(parent);
|
||||
}
|
||||
|
||||
public setVisible(visible: boolean): void {
|
||||
super.setVisible(visible);
|
||||
this._taskHistoryView.setVisible(visible);
|
||||
}
|
||||
|
||||
public layout({ height }: Dimension): void {
|
||||
this._taskHistoryView.layout(height);
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,17 @@ 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 } from 'vs/base/browser/dom';
|
||||
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';
|
||||
|
||||
import { TaskHistoryRenderer } from 'sql/workbench/contrib/tasks/browser/tasksRenderer';
|
||||
import { TaskHistoryDataSource } from 'sql/workbench/contrib/tasks/browser/tasksDataSource';
|
||||
@@ -27,25 +34,34 @@ import { IExpandableTree } from 'sql/workbench/services/objectExplorer/browser/t
|
||||
/**
|
||||
* TaskHistoryView implements the dynamic tree view.
|
||||
*/
|
||||
export class TaskHistoryView extends Disposable {
|
||||
export class TaskHistoryView extends ViewPane {
|
||||
private _messages: HTMLElement;
|
||||
private _tree: ITree;
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@ITaskService private _taskService: ITaskService,
|
||||
@IErrorMessageService private _errorMessageService: IErrorMessageService,
|
||||
@IThemeService private _themeService: IThemeService
|
||||
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,
|
||||
@ITaskService private readonly taskService: ITaskService,
|
||||
@IErrorMessageService private readonly errorMessageService: IErrorMessageService
|
||||
) {
|
||||
super();
|
||||
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the view body
|
||||
*/
|
||||
public renderBody(container: HTMLElement): void {
|
||||
super.renderBody(container);
|
||||
|
||||
let taskNode = this._taskService.getAllTasks();
|
||||
let taskNode = this.taskService.getAllTasks();
|
||||
|
||||
// Add div to display no task executed message
|
||||
this._messages = append(container, $('div.empty-task-message'));
|
||||
@@ -56,17 +72,17 @@ export class TaskHistoryView extends Disposable {
|
||||
let noTaskMessage = localize('noTaskMessage', "No task history to display.");
|
||||
append(this._messages, $('span')).innerText = noTaskMessage;
|
||||
|
||||
this._tree = this._register(this.createTaskHistoryTree(container, this._instantiationService));
|
||||
this._tree = this._register(this.createTaskHistoryTree(container, this.instantiationService));
|
||||
this._register(this._tree.onDidChangeSelection((event) => this.onSelected(event)));
|
||||
|
||||
// Theme styler
|
||||
this._register(attachListStyler(this._tree, this._themeService));
|
||||
this._register(attachListStyler(this._tree, this.themeService));
|
||||
|
||||
this._register(this._taskService.onAddNewTask(args => {
|
||||
this._register(this.taskService.onAddNewTask(args => {
|
||||
hide(this._messages);
|
||||
this.refreshTree();
|
||||
}));
|
||||
this._register(this._taskService.onTaskComplete(task => {
|
||||
this._register(this.taskService.onTaskComplete(task => {
|
||||
this.updateTask(task);
|
||||
}));
|
||||
|
||||
@@ -118,7 +134,7 @@ export class TaskHistoryView extends Disposable {
|
||||
}
|
||||
|
||||
//Get the tree Input
|
||||
let treeInput = this._taskService.getAllTasks();
|
||||
let treeInput = this.taskService.getAllTasks();
|
||||
if (treeInput) {
|
||||
this._tree.setInput(treeInput).then(async () => {
|
||||
// Make sure to expand all folders that where expanded in the previous session
|
||||
@@ -143,7 +159,7 @@ export class TaskHistoryView extends Disposable {
|
||||
if (isDoubleClick) {
|
||||
if (task.status === TaskStatus.Failed) {
|
||||
let err = task.taskName + ': ' + task.message;
|
||||
this._errorMessageService.showDialog(Severity.Error, localize('taskError', "Task error"), err);
|
||||
this.errorMessageService.showDialog(Severity.Error, localize('taskError', "Task error"), err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,18 +168,8 @@ export class TaskHistoryView extends Disposable {
|
||||
/**
|
||||
* set the layout of the view
|
||||
*/
|
||||
public layout(height: number): void {
|
||||
public layoutBody(height: number, width: number): void {
|
||||
super.layoutBody(height, width);
|
||||
this._tree.layout(height);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the visibility of the view
|
||||
*/
|
||||
public setVisible(visible: boolean): void {
|
||||
if (visible) {
|
||||
this._tree.onVisible();
|
||||
} else {
|
||||
this._tree.onHidden();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
/**
|
||||
* Tasks panel id
|
||||
*/
|
||||
export const TASKS_PANEL_ID = 'workbench.panel.tasks';
|
||||
export const TASKS_CONTAINER_ID = 'workbench.panel.tasks';
|
||||
export const TASKS_VIEW_ID = 'workbench.panel.tasks.view';
|
||||
|
||||
Reference in New Issue
Block a user