mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
add contrib/tasks to strict compile (#12034)
This commit is contained in:
@@ -24,7 +24,7 @@ import { TaskHistoryView } from 'sql/workbench/contrib/tasks/browser/tasksView';
|
||||
export class StatusUpdater extends lifecycle.Disposable implements ext.IWorkbenchContribution {
|
||||
static ID = 'data.taskhistory.statusUpdater';
|
||||
|
||||
private badgeHandle: lifecycle.IDisposable;
|
||||
private badgeHandle?: lifecycle.IDisposable;
|
||||
|
||||
constructor(
|
||||
@IActivityService private readonly activityBarService: IActivityService,
|
||||
|
||||
@@ -16,11 +16,7 @@ export class TaskHistoryDataSource implements IDataSource {
|
||||
* No more than one element may use a given identifier.
|
||||
*/
|
||||
public getId(tree: ITree, element: any): string {
|
||||
if (element instanceof TaskNode) {
|
||||
return (<TaskNode>element).id;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
return (<TaskNode>element).id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,10 +67,11 @@ export class TaskHistoryRenderer implements IRenderer {
|
||||
* Render a element, given an object bag returned by the template
|
||||
*/
|
||||
public renderElement(tree: ITree, element: TaskNode, templateId: string, templateData: ITaskHistoryTemplateData): void {
|
||||
let taskStatus;
|
||||
let taskStatus: string;
|
||||
if (element) {
|
||||
templateData.icon.className = 'task-icon';
|
||||
switch (element.status) {
|
||||
case TaskStatus.SucceededWithWarning:
|
||||
case TaskStatus.Succeeded:
|
||||
dom.addClass(templateData.icon, TaskHistoryRenderer.SUCCESS_CLASS);
|
||||
taskStatus = localize('succeeded', "succeeded");
|
||||
@@ -103,7 +104,7 @@ export class TaskHistoryRenderer implements IRenderer {
|
||||
templateData.label.textContent = element.taskName + ' ' + taskStatus;
|
||||
templateData.label.title = templateData.label.textContent;
|
||||
|
||||
let description: string;
|
||||
let description: string | undefined;
|
||||
// Determine the target name and set hover text equal to that
|
||||
// show target location if there is one, otherwise show server and database name
|
||||
if (element.targetLocation) {
|
||||
@@ -115,7 +116,7 @@ export class TaskHistoryRenderer implements IRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
templateData.description.textContent = description;
|
||||
templateData.description.textContent = description ?? '';
|
||||
templateData.description.title = templateData.description.textContent;
|
||||
|
||||
this.timer(element, templateData.time);
|
||||
|
||||
@@ -36,8 +36,8 @@ import { IExpandableTree } from 'sql/workbench/services/objectExplorer/browser/t
|
||||
* TaskHistoryView implements the dynamic tree view.
|
||||
*/
|
||||
export class TaskHistoryView extends ViewPane {
|
||||
private _messages: HTMLElement;
|
||||
private _tree: ITree;
|
||||
private _messages?: HTMLElement;
|
||||
private _tree?: ITree;
|
||||
|
||||
constructor(
|
||||
options: IViewPaneOptions,
|
||||
@@ -80,7 +80,7 @@ export class TaskHistoryView extends ViewPane {
|
||||
this._register(attachListStyler(this._tree, this.themeService));
|
||||
|
||||
this._register(this.taskService.onAddNewTask(args => {
|
||||
hide(this._messages);
|
||||
hide(this._messages!);
|
||||
this.refreshTree();
|
||||
}));
|
||||
this._register(this.taskService.onTaskComplete(task => {
|
||||
@@ -101,11 +101,10 @@ export class TaskHistoryView extends ViewPane {
|
||||
const controller = instantiationService.createInstance(TaskHistoryController, actionProvider);
|
||||
const dnd = new DefaultDragAndDrop();
|
||||
const filter = new DefaultFilter();
|
||||
const sorter = null;
|
||||
const accessibilityProvider = new DefaultAccessibilityProvider();
|
||||
|
||||
return new Tree(treeContainer, {
|
||||
dataSource, renderer, controller, dnd, filter, sorter, accessibilityProvider
|
||||
dataSource, renderer, controller, dnd, filter, accessibilityProvider
|
||||
}, {
|
||||
indentPixels: 10,
|
||||
twistiePixels: 20,
|
||||
@@ -114,7 +113,7 @@ export class TaskHistoryView extends ViewPane {
|
||||
}
|
||||
|
||||
private updateTask(task: TaskNode): void {
|
||||
this._tree.refresh(task).catch(err => errors.onUnexpectedError(err));
|
||||
this._tree!.refresh(task).catch(err => errors.onUnexpectedError(err));
|
||||
}
|
||||
|
||||
public refreshTree(): void {
|
||||
@@ -122,9 +121,9 @@ export class TaskHistoryView extends ViewPane {
|
||||
let targetsToExpand: any[];
|
||||
|
||||
// Focus
|
||||
this._tree.domFocus();
|
||||
|
||||
if (this._tree) {
|
||||
this._tree.domFocus();
|
||||
let selection = this._tree.getSelection();
|
||||
if (selection && selection.length === 1) {
|
||||
selectedElement = <any>selection[0];
|
||||
@@ -132,26 +131,27 @@ export class TaskHistoryView extends ViewPane {
|
||||
// convert to old VS Code tree interface with expandable methods
|
||||
let expandableTree: IExpandableTree = <IExpandableTree>this._tree;
|
||||
targetsToExpand = expandableTree.getExpandedElements();
|
||||
|
||||
//Get the tree Input
|
||||
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
|
||||
if (targetsToExpand) {
|
||||
await this._tree!.expandAll(targetsToExpand);
|
||||
}
|
||||
if (selectedElement) {
|
||||
this._tree!.select(selectedElement);
|
||||
}
|
||||
this._tree!.getFocus();
|
||||
}, errors.onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
//Get the tree Input
|
||||
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
|
||||
if (targetsToExpand) {
|
||||
await this._tree.expandAll(targetsToExpand);
|
||||
}
|
||||
if (selectedElement) {
|
||||
this._tree.select(selectedElement);
|
||||
}
|
||||
this._tree.getFocus();
|
||||
}, errors.onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
private onSelected(event: any) {
|
||||
let selection = this._tree.getSelection();
|
||||
let selection = this._tree!.getSelection();
|
||||
|
||||
if (selection && selection.length > 0 && (selection[0] instanceof TaskNode)) {
|
||||
let task = <TaskNode>selection[0];
|
||||
@@ -171,6 +171,8 @@ export class TaskHistoryView extends ViewPane {
|
||||
*/
|
||||
public layoutBody(height: number, width: number): void {
|
||||
super.layoutBody(height, width);
|
||||
this._tree.layout(height);
|
||||
if (this._tree) {
|
||||
this._tree.layout(height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class CancelAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
public run(element: TaskNode): Promise<boolean> {
|
||||
if (element instanceof TaskNode) {
|
||||
if (element instanceof TaskNode && element.providerName) {
|
||||
this._taskService.cancelTask(element.providerName, element.id).then((result) => {
|
||||
if (!result) {
|
||||
let error = localize('errorMsgFromCancelTask', "The task is failed to cancel.");
|
||||
|
||||
Reference in New Issue
Block a user