mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 17:23:10 -05:00
Move Tasks Panel (#5162)
* moving tasks panel * fix css styling * clean up code * do a bunch of renaming
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ITaskService } from 'sql/platform/taskHistory/common/taskService';
|
||||
import { ITaskService } from 'sql/platform/tasks/common/tasksService';
|
||||
import { MainThreadBackgroundTaskManagementShape, SqlMainContext, ExtHostBackgroundTaskManagementShape, SqlExtHostContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
|
||||
@@ -19,7 +19,7 @@ import { IAdminService } from 'sql/workbench/services/admin/common/adminService'
|
||||
import { IJobManagementService } from 'sql/platform/jobManagement/common/interfaces';
|
||||
import { IBackupService } from 'sql/platform/backup/common/backupService';
|
||||
import { IRestoreService } from 'sql/platform/restore/common/restoreService';
|
||||
import { ITaskService } from 'sql/platform/taskHistory/common/taskService';
|
||||
import { ITaskService } from 'sql/platform/tasks/common/tasksService';
|
||||
import { IProfilerService } from 'sql/workbench/services/profiler/common/interfaces';
|
||||
import { ISerializationService } from 'sql/platform/serialization/common/serializationService';
|
||||
import { IFileBrowserService } from 'sql/platform/fileBrowser/common/interfaces';
|
||||
|
||||
@@ -1,134 +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!sql/media/actionBarLabel';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { localize } from 'vs/nls';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { VIEWLET_ID, TaskHistoryViewlet } from 'sql/workbench/parts/taskHistory/browser/taskHistoryViewlet';
|
||||
import * as lifecycle from 'vs/base/common/lifecycle';
|
||||
import * as ext from 'vs/workbench/common/contributions';
|
||||
import { ITaskService } from 'sql/platform/taskHistory/common/taskService';
|
||||
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { ToggleViewletAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
|
||||
export class StatusUpdater implements ext.IWorkbenchContribution {
|
||||
static ID = 'data.taskhistory.statusUpdater';
|
||||
|
||||
private badgeHandle: lifecycle.IDisposable;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
|
||||
constructor(
|
||||
@IActivityService private activityBarService: IActivityService,
|
||||
@ITaskService private _taskService: ITaskService,
|
||||
@IViewletService private _viewletService: IViewletService
|
||||
) {
|
||||
this.toDispose = [];
|
||||
|
||||
this.toDispose.push(this._taskService.onAddNewTask(args => {
|
||||
this.showTasksViewlet();
|
||||
this.onServiceChange();
|
||||
}));
|
||||
|
||||
this.toDispose.push(this._taskService.onTaskComplete(task => {
|
||||
this.onServiceChange();
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
private showTasksViewlet(): void {
|
||||
let activeViewlet: IViewlet = this._viewletService.getActiveViewlet();
|
||||
if (!activeViewlet || activeViewlet.getId() !== VIEWLET_ID) {
|
||||
this._viewletService.openViewlet(VIEWLET_ID, true);
|
||||
}
|
||||
}
|
||||
|
||||
private onServiceChange(): void {
|
||||
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(VIEWLET_ID, badge, 'taskhistory-viewlet-label');
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
return StatusUpdater.ID;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.toDispose = lifecycle.dispose(this.toDispose);
|
||||
lifecycle.dispose(this.badgeHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Viewlet Action
|
||||
export class TaskHistoryViewletAction extends ToggleViewletAction {
|
||||
public static ID = VIEWLET_ID;
|
||||
public static LABEL = localize({ key: 'showTaskHistory', comment: ['Show Task History'] }, 'Show Task History');
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IViewletService viewletService: IViewletService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
|
||||
) {
|
||||
super(viewletDescriptor, layoutService, viewletService);
|
||||
}
|
||||
}
|
||||
|
||||
// Viewlet
|
||||
const viewletDescriptor = new ViewletDescriptor(
|
||||
TaskHistoryViewlet,
|
||||
VIEWLET_ID,
|
||||
'Task History',
|
||||
'taskHistoryViewlet',
|
||||
1
|
||||
);
|
||||
|
||||
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).registerViewlet(viewletDescriptor);
|
||||
|
||||
// Register StatusUpdater
|
||||
(<ext.IWorkbenchContributionsRegistry>Registry.as(ext.Extensions.Workbench)).registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Restored);
|
||||
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
|
||||
registry.registerWorkbenchAction(
|
||||
new SyncActionDescriptor(
|
||||
TaskHistoryViewletAction,
|
||||
TaskHistoryViewletAction.ID,
|
||||
TaskHistoryViewletAction.LABEL,
|
||||
{ primary: KeyMod.CtrlCmd | KeyCode.KEY_T }),
|
||||
'View: Show Task History',
|
||||
localize('taskHistory.view', "View")
|
||||
);
|
||||
|
||||
let configurationRegistry = <IConfigurationRegistry>Registry.as(Extensions.Configuration);
|
||||
configurationRegistry.registerConfiguration({
|
||||
'id': 'taskHistory',
|
||||
'title': localize('taskHistory', 'Task History'),
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'datasource.task': {
|
||||
'description': localize('datasource.task', 'Operation Task Status'),
|
||||
'type': 'array'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
||||
group: '3_views',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize({ key: 'miViewTasks', comment: ['&& denotes a mnemonic'] }, "&&Tasks")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
@@ -1,83 +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!sql/media/icons/common-icons';
|
||||
import 'vs/css!./media/taskHistoryViewlet';
|
||||
import { Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import { toggleClass, 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 { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { TaskHistoryView } from 'sql/workbench/parts/taskHistory/browser/taskHistoryView';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
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 const VIEWLET_ID = 'workbench.view.taskHistory';
|
||||
|
||||
export class TaskHistoryViewlet extends Viewlet {
|
||||
|
||||
private _root: HTMLElement;
|
||||
private _toDisposeViewlet: IDisposable[] = [];
|
||||
private _taskHistoryView: TaskHistoryView;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(VIEWLET_ID, configurationService, layoutService, telemetryService, themeService, storageService);
|
||||
}
|
||||
|
||||
private onError(err: any): void {
|
||||
if (isPromiseCanceledError(err)) {
|
||||
return;
|
||||
}
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: err
|
||||
});
|
||||
}
|
||||
|
||||
public create(parent: HTMLElement): Promise<void> {
|
||||
super.create(parent);
|
||||
this._root = parent;
|
||||
this._taskHistoryView = this._instantiationService.createInstance(TaskHistoryView);
|
||||
this._taskHistoryView.renderBody(parent);
|
||||
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public setVisible(visible: boolean): void {
|
||||
super.setVisible(visible);
|
||||
this._taskHistoryView.setVisible(visible);
|
||||
}
|
||||
|
||||
public focus(): void {
|
||||
super.focus();
|
||||
}
|
||||
|
||||
public layout({ height, width }: Dimension): void {
|
||||
this._taskHistoryView.layout(height);
|
||||
toggleClass(this._root, 'narrow', width <= 350);
|
||||
}
|
||||
|
||||
public getOptimalWidth(): number {
|
||||
return 400;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._toDisposeViewlet = dispose(this._toDisposeViewlet);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,115 +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 { StopWatch } from 'vs/base/common/stopwatch';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
|
||||
export enum TaskStatus {
|
||||
NotStarted = 0,
|
||||
InProgress = 1,
|
||||
Succeeded = 2,
|
||||
SucceededWithWarning = 3,
|
||||
Failed = 4,
|
||||
Canceled = 5,
|
||||
Canceling = 6
|
||||
}
|
||||
|
||||
export enum TaskExecutionMode {
|
||||
execute = 0,
|
||||
script = 1,
|
||||
executeAndScript = 2,
|
||||
}
|
||||
|
||||
export class TaskNode {
|
||||
/**
|
||||
* id for TaskNode
|
||||
*/
|
||||
public id: string;
|
||||
|
||||
/**
|
||||
* string defining the type of the task - for example Backup, Restore
|
||||
*/
|
||||
public taskName: string;
|
||||
|
||||
/**
|
||||
* sever name
|
||||
*/
|
||||
public serverName: string;
|
||||
|
||||
/**
|
||||
* Database Name
|
||||
*/
|
||||
public databaseName: string;
|
||||
|
||||
/**
|
||||
* Provider Name
|
||||
*/
|
||||
public providerName: string;
|
||||
|
||||
|
||||
/**
|
||||
* The start time of the task
|
||||
*/
|
||||
public startTime: string;
|
||||
|
||||
/**
|
||||
* The end time of the task
|
||||
*/
|
||||
public endTime: string;
|
||||
|
||||
/**
|
||||
* The timer for the task
|
||||
*/
|
||||
public timer: StopWatch;
|
||||
|
||||
/**
|
||||
* Does this node have children
|
||||
*/
|
||||
public hasChildren: boolean;
|
||||
|
||||
/**
|
||||
* Children of this node
|
||||
*/
|
||||
public children: TaskNode[];
|
||||
|
||||
/**
|
||||
* Task's message
|
||||
*/
|
||||
public message: string;
|
||||
|
||||
/**
|
||||
* Status of the task
|
||||
*/
|
||||
public status: TaskStatus;
|
||||
|
||||
/**
|
||||
* Execution mode of task
|
||||
*/
|
||||
public taskExecutionMode: TaskExecutionMode;
|
||||
|
||||
/**
|
||||
* Indicates if the task can be canceled
|
||||
*/
|
||||
public isCancelable: boolean;
|
||||
|
||||
/**
|
||||
* Script of task operation
|
||||
*/
|
||||
public script: string;
|
||||
|
||||
constructor(taskName: string, serverName: string, databaseName: string, taskId: string = undefined, taskExecutionMode: TaskExecutionMode = TaskExecutionMode.execute, isCancelable: boolean = true) {
|
||||
this.id = taskId || generateUuid();
|
||||
|
||||
this.taskName = taskName;
|
||||
this.serverName = serverName;
|
||||
this.databaseName = databaseName;
|
||||
this.timer = StopWatch.create();
|
||||
this.startTime = new Date().toLocaleTimeString();
|
||||
this.status = TaskStatus.InProgress;
|
||||
this.hasChildren = false;
|
||||
this.taskExecutionMode = taskExecutionMode;
|
||||
this.isCancelable = isCancelable;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -12,8 +12,8 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* task title and description */
|
||||
.monaco-tree .monaco-tree-rows > .monaco-tree-row > .content > .task-group > .task-details > .title {
|
||||
/* task label and description */
|
||||
.monaco-tree .monaco-tree-rows > .monaco-tree-row > .content > .task-group > .task-details > .label {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
font-weight: 700;
|
||||
@@ -50,4 +50,4 @@
|
||||
.vs-dark .monaco-tree .monaco-tree-rows > .monaco-tree-row > .content > .task-group > .task-icon.not-started,
|
||||
.hc-black .monaco-tree .monaco-tree-rows > .monaco-tree-row > .content > .task-group > .task-icon.not-started {
|
||||
content: url('status_queuedtask_inverse.svg');
|
||||
}
|
||||
}
|
||||
94
src/sql/workbench/parts/tasks/browser/tasks.contribution.ts
Normal file
94
src/sql/workbench/parts/tasks/browser/tasks.contribution.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
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/parts/tasks/browser/tasksPanel';
|
||||
import * as lifecycle from 'vs/base/common/lifecycle';
|
||||
import * as ext from 'vs/workbench/common/contributions';
|
||||
import { ITaskService } from 'sql/platform/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/parts/tasks/common/tasks';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { ToggleTasksAction } from 'sql/workbench/parts/tasks/browser/tasksActions';
|
||||
|
||||
export class StatusUpdater implements ext.IWorkbenchContribution {
|
||||
static ID = 'data.taskhistory.statusUpdater';
|
||||
|
||||
private badgeHandle: lifecycle.IDisposable;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
|
||||
constructor(
|
||||
@IActivityService private readonly activityBarService: IActivityService,
|
||||
@ITaskService private readonly taskService: ITaskService,
|
||||
@IPanelService private readonly panelService: IPanelService
|
||||
) {
|
||||
this.toDispose = [];
|
||||
|
||||
this.toDispose.push(this.taskService.onAddNewTask(args => {
|
||||
this.panelService.openPanel(TASKS_PANEL_ID, true);
|
||||
this.onServiceChange();
|
||||
}));
|
||||
|
||||
this.toDispose.push(this.taskService.onTaskComplete(task => {
|
||||
this.onServiceChange();
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
private onServiceChange(): void {
|
||||
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');
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
return StatusUpdater.ID;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.toDispose = lifecycle.dispose(this.toDispose);
|
||||
lifecycle.dispose(this.badgeHandle);
|
||||
}
|
||||
}
|
||||
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
|
||||
registry.registerWorkbenchAction(
|
||||
new SyncActionDescriptor(
|
||||
ToggleTasksAction,
|
||||
ToggleTasksAction.ID,
|
||||
ToggleTasksAction.LABEL,
|
||||
{ primary: KeyMod.CtrlCmd | KeyCode.KEY_T }),
|
||||
'View: Show Task History',
|
||||
localize('viewCategory', "View")
|
||||
);
|
||||
|
||||
// Register Output Panel
|
||||
Registry.as<PanelRegistry>(PanelExtensions.Panels).registerPanel(new PanelDescriptor(
|
||||
TasksPanel,
|
||||
TASKS_PANEL_ID,
|
||||
localize('tasks', "Tasks"),
|
||||
'output',
|
||||
20,
|
||||
ToggleTasksAction.ID
|
||||
));
|
||||
|
||||
// Register StatusUpdater
|
||||
(<ext.IWorkbenchContributionsRegistry>Registry.as(ext.Extensions.Workbench)).registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Restored);
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
||||
group: '3_views',
|
||||
command: {
|
||||
id: TASKS_PANEL_ID,
|
||||
title: localize({ key: 'miViewTasks', comment: ['&& denotes a mnemonic'] }, "&&Tasks")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
@@ -7,8 +7,8 @@ import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ContributableActionProvider } from 'vs/workbench/browser/actions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TaskNode, TaskStatus, TaskExecutionMode } from 'sql/workbench/parts/taskHistory/common/taskNode';
|
||||
import { CancelAction, ScriptAction } from 'sql/workbench/parts/taskHistory/common/taskAction';
|
||||
import { TaskNode, TaskStatus, TaskExecutionMode } from 'sql/platform/tasks/common/tasksNode';
|
||||
import { CancelAction, ScriptAction } from 'sql/workbench/parts/tasks/common/tasksAction';
|
||||
|
||||
/**
|
||||
* Provides actions for the history tasks
|
||||
24
src/sql/workbench/parts/tasks/browser/tasksActions.ts
Normal file
24
src/sql/workbench/parts/tasks/browser/tasksActions.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { TogglePanelAction } from 'vs/workbench/browser/panel';
|
||||
import { TASKS_PANEL_ID } from 'sql/workbench/parts/tasks/common/tasks';
|
||||
|
||||
export class ToggleTasksAction extends TogglePanelAction {
|
||||
|
||||
public static readonly ID = 'workbench.action.tasks.toggleTasks';
|
||||
public static readonly LABEL = localize('toggleTasks', "Toggle Tasks");
|
||||
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IPanelService panelService: IPanelService,
|
||||
) {
|
||||
super(id, label, TASKS_PANEL_ID, panelService, layoutService);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { TaskHistoryActionProvider } from 'sql/workbench/parts/taskHistory/browser/taskHistoryActionProvider';
|
||||
import { TaskHistoryActionProvider } from 'sql/workbench/parts/tasks/browser/tasksActionProvider';
|
||||
|
||||
/**
|
||||
* Extends the tree controller to handle clicks on the tree elements
|
||||
@@ -77,4 +77,4 @@ export class TaskHistoryController extends treedefaults.DefaultController {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TaskNode } from 'sql/workbench/parts/taskHistory/common/taskNode';
|
||||
import { TaskNode } from 'sql/platform/tasks/common/tasksNode';
|
||||
|
||||
/**
|
||||
* Implements the DataSource(that returns a parent/children of an element) for the task history
|
||||
@@ -49,4 +49,4 @@ export class TaskHistoryDataSource implements IDataSource {
|
||||
public getParent(tree: ITree, element: any): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/sql/workbench/parts/tasks/browser/tasksPanel.ts
Normal file
43
src/sql/workbench/parts/tasks/browser/tasksPanel.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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/parts/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/parts/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);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ITree, IRenderer } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TaskNode, TaskStatus } from 'sql/workbench/parts/taskHistory/common/taskNode';
|
||||
import { TaskNode, TaskStatus } from 'sql/platform/tasks/common/tasksNode';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { localize } from 'vs/nls';
|
||||
import * as Utils from 'sql/platform/connection/common/utils';
|
||||
@@ -14,7 +14,7 @@ const $ = dom.$;
|
||||
export interface ITaskHistoryTemplateData {
|
||||
root: HTMLElement;
|
||||
icon: HTMLElement;
|
||||
title: HTMLSpanElement;
|
||||
label: HTMLSpanElement;
|
||||
description: HTMLSpanElement;
|
||||
time: HTMLSpanElement;
|
||||
}
|
||||
@@ -55,10 +55,10 @@ export class TaskHistoryRenderer implements IRenderer {
|
||||
const taskTemplate: ITaskHistoryTemplateData = Object.create(null);
|
||||
taskTemplate.root = dom.append(container, $('.task-group'));
|
||||
taskTemplate.icon = dom.append(taskTemplate.root, $('img.task-icon'));
|
||||
let titleContainer = dom.append(taskTemplate.root, $('div.task-details'));
|
||||
taskTemplate.title = dom.append(titleContainer, $('div.title'));
|
||||
taskTemplate.description = dom.append(titleContainer, $('div.description'));
|
||||
taskTemplate.time = dom.append(titleContainer, $('div.time'));
|
||||
let labelContainer = dom.append(taskTemplate.root, $('div.task-details'));
|
||||
taskTemplate.label = dom.append(labelContainer, $('div.label'));
|
||||
taskTemplate.description = dom.append(labelContainer, $('div.description'));
|
||||
taskTemplate.time = dom.append(labelContainer, $('div.time'));
|
||||
return taskTemplate;
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ export class TaskHistoryRenderer implements IRenderer {
|
||||
templateData.icon.title = taskStatus;
|
||||
|
||||
// Determine the task title and set hover text equal to that
|
||||
templateData.title.textContent = taskNode.taskName + ' ' + taskStatus;
|
||||
templateData.title.title = templateData.title.textContent;
|
||||
templateData.label.textContent = taskNode.taskName + ' ' + taskStatus;
|
||||
templateData.label.title = templateData.label.textContent;
|
||||
|
||||
// Determine the target name and set hover text equal to that
|
||||
let description = taskNode.serverName;
|
||||
@@ -15,12 +15,12 @@ import { DefaultFilter, DefaultDragAndDrop, DefaultAccessibilityProvider } from
|
||||
import { localize } from 'vs/nls';
|
||||
import { hide, $, append } from 'vs/base/browser/dom';
|
||||
|
||||
import { TaskHistoryRenderer } from 'sql/workbench/parts/taskHistory/browser/taskHistoryRenderer';
|
||||
import { TaskHistoryDataSource } from 'sql/workbench/parts/taskHistory/browser/taskHistoryDataSource';
|
||||
import { TaskHistoryController } from 'sql/workbench/parts/taskHistory/browser/taskHistoryController';
|
||||
import { TaskHistoryActionProvider } from 'sql/workbench/parts/taskHistory/browser/taskHistoryActionProvider';
|
||||
import { ITaskService } from 'sql/platform/taskHistory/common/taskService';
|
||||
import { TaskNode, TaskStatus } from 'sql/workbench/parts/taskHistory/common/taskNode';
|
||||
import { TaskHistoryRenderer } from 'sql/workbench/parts/tasks/browser/tasksRenderer';
|
||||
import { TaskHistoryDataSource } from 'sql/workbench/parts/tasks/browser/tasksDataSource';
|
||||
import { TaskHistoryController } from 'sql/workbench/parts/tasks/browser/tasksController';
|
||||
import { TaskHistoryActionProvider } from 'sql/workbench/parts/tasks/browser/tasksActionProvider';
|
||||
import { ITaskService } from 'sql/platform/tasks/common/tasksService';
|
||||
import { TaskNode, TaskStatus } from 'sql/platform/tasks/common/tasksNode';
|
||||
import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMessageService';
|
||||
import { IExpandableTree } from 'sql/workbench/parts/objectExplorer/browser/treeUpdateUtils';
|
||||
|
||||
9
src/sql/workbench/parts/tasks/common/tasks.ts
Normal file
9
src/sql/workbench/parts/tasks/common/tasks.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Tasks panel id
|
||||
*/
|
||||
export const TASKS_PANEL_ID = 'workbench.panel.tasks';
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ITaskService } from 'sql/platform/taskHistory/common/taskService';
|
||||
import { TaskNode } from 'sql/workbench/parts/taskHistory/common/taskNode';
|
||||
import { ITaskService } from 'sql/platform/tasks/common/tasksService';
|
||||
import { TaskNode } from 'sql/platform/tasks/common/tasksNode';
|
||||
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMessageService';
|
||||
@@ -65,4 +65,4 @@ export class ScriptAction extends Action {
|
||||
}
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user