mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 01:25:36 -05:00
* moving test files and inital refactoring * relayer extension host code * fix imports * make insights work * relayer dashboard * relayer notebooks * moveing more code around * formatting * accept angular as browser * fix serializer * add missing files * remove declarations from extensions * fix build errors * more relayering * change urls to relative to help code relayering * remove layering to prep for merge * fix hygiene errors * fix hygiene errors * fix tests
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { ITaskService } from 'sql/platform/tasks/common/tasksService';
|
|
import { MainThreadBackgroundTaskManagementShape, SqlMainContext, ExtHostBackgroundTaskManagementShape, SqlExtHostContext } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
|
|
|
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
|
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
|
import { Disposable } from 'vs/base/common/lifecycle';
|
|
|
|
|
|
import * as azdata from 'azdata';
|
|
|
|
export enum TaskStatus {
|
|
NotStarted = 0,
|
|
InProgress = 1,
|
|
Succeeded = 2,
|
|
SucceededWithWarning = 3,
|
|
Failed = 4,
|
|
Canceled = 5,
|
|
Canceling = 6
|
|
}
|
|
|
|
@extHostNamedCustomer(SqlMainContext.MainThreadBackgroundTaskManagement)
|
|
export class MainThreadBackgroundTaskManagement extends Disposable implements MainThreadBackgroundTaskManagementShape {
|
|
private readonly _proxy: ExtHostBackgroundTaskManagementShape;
|
|
|
|
constructor(
|
|
context: IExtHostContext,
|
|
@ITaskService private _taskService: ITaskService
|
|
) {
|
|
super();
|
|
this._proxy = context.getProxy(SqlExtHostContext.ExtHostBackgroundTaskManagement);
|
|
this._register(this._taskService.onTaskComplete(task => {
|
|
if (task.status === TaskStatus.Canceling) {
|
|
this._proxy.$onTaskCanceled(task.id);
|
|
}
|
|
}));
|
|
}
|
|
|
|
$registerTask(taskInfo: azdata.TaskInfo): void {
|
|
this._taskService.createNewTask(taskInfo);
|
|
this._proxy.$onTaskRegistered(taskInfo.taskId);
|
|
}
|
|
|
|
$updateTask(taskProgressInfo: azdata.TaskProgressInfo): void {
|
|
this._taskService.updateTask(taskProgressInfo);
|
|
}
|
|
}
|