strict compile for sql/workbench/contrib/queryHistory (#12579)

This commit is contained in:
Charles Gagnon
2020-09-23 10:36:00 -07:00
committed by GitHub
parent f8eb203643
commit 4a089131fc
4 changed files with 13 additions and 16 deletions

View File

@@ -19,7 +19,7 @@ export class QueryHistoryDataSource implements IDataSource {
if (element instanceof QueryHistoryNode && element.info) { if (element instanceof QueryHistoryNode && element.info) {
return element.info.id; return element.info.id;
} }
return undefined; return '';
} }
/** /**

View File

@@ -15,5 +15,5 @@ export class QueryHistoryNode {
public children: QueryHistoryNode[] = []; public children: QueryHistoryNode[] = [];
constructor( constructor(
public info: QueryHistoryInfo) { } public info: QueryHistoryInfo | undefined) { }
} }

View File

@@ -42,7 +42,7 @@ export class QueryHistoryRenderer implements IRenderer {
* Returns a template ID for a given element. * Returns a template ID for a given element.
*/ */
public getTemplateId(tree: ITree, element: QueryHistoryNode): string { public getTemplateId(tree: ITree, element: QueryHistoryNode): string {
return element.info.id; return element.info?.id || '';
} }
/** /**
@@ -63,7 +63,7 @@ export class QueryHistoryRenderer implements IRenderer {
* Render a element, given an object bag returned by the template * Render a element, given an object bag returned by the template
*/ */
public renderElement(tree: ITree, element: QueryHistoryNode, templateId: string, templateData: IQueryHistoryItemTemplateData): void { public renderElement(tree: ITree, element: QueryHistoryNode, templateId: string, templateData: IQueryHistoryItemTemplateData): void {
let taskStatus; let taskStatus = '';
if (element && element.info) { if (element && element.info) {
templateData.icon.className = 'query-history-icon'; templateData.icon.className = 'query-history-icon';
if (element.info.status === QueryStatus.Succeeded) { if (element.info.status === QueryStatus.Succeeded) {

View File

@@ -34,8 +34,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
* QueryHistoryView implements the dynamic tree view for displaying Query History * QueryHistoryView implements the dynamic tree view for displaying Query History
*/ */
export class QueryHistoryView extends ViewPane { export class QueryHistoryView extends ViewPane {
private _messages: HTMLElement; private _messages!: HTMLElement;
private _tree: ITree; private _tree!: ITree;
private _actionProvider: QueryHistoryActionProvider; private _actionProvider: QueryHistoryActionProvider;
constructor( constructor(
@@ -87,11 +87,10 @@ export class QueryHistoryView extends ViewPane {
const controller = instantiationService.createInstance(QueryHistoryController, this._actionProvider); const controller = instantiationService.createInstance(QueryHistoryController, this._actionProvider);
const dnd = new DefaultDragAndDrop(); const dnd = new DefaultDragAndDrop();
const filter = new DefaultFilter(); const filter = new DefaultFilter();
const sorter = null;
const accessibilityProvider = new DefaultAccessibilityProvider(); const accessibilityProvider = new DefaultAccessibilityProvider();
return new Tree(treeContainer, { return new Tree(treeContainer, {
dataSource, renderer, controller, dnd, filter, sorter, accessibilityProvider dataSource, renderer, controller, dnd, filter, sorter: undefined, accessibilityProvider
}, { }, {
indentPixels: 10, indentPixels: 10,
twistiePixels: 20, twistiePixels: 20,
@@ -103,15 +102,13 @@ export class QueryHistoryView extends ViewPane {
let selectedElement: any; let selectedElement: any;
let targetsToExpand: any[]; let targetsToExpand: any[];
if (this._tree) { const selection = this._tree.getSelection();
const selection = this._tree.getSelection(); if (selection && selection.length === 1) {
if (selection && selection.length === 1) { selectedElement = <any>selection[0];
selectedElement = <any>selection[0];
}
// convert to old VS Code tree interface with expandable methods
const expandableTree: IExpandableTree = <IExpandableTree>this._tree;
targetsToExpand = expandableTree.getExpandedElements();
} }
// convert to old VS Code tree interface with expandable methods
const expandableTree: IExpandableTree = <IExpandableTree>this._tree;
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));