diff --git a/src/services/resultsPanelProvider.ts b/src/services/resultsPanelProvider.ts index bf27c9d4..333a4141 100644 --- a/src/services/resultsPanelProvider.ts +++ b/src/services/resultsPanelProvider.ts @@ -146,12 +146,11 @@ export class KdbResultsViewProvider implements WebviewViewProvider { return Object.keys(results.meta).map((key: string) => { const sanitizedKey = this.sanitizeString(key); const type = results.meta[key]; - const headerTooltip = type; + const headerName = type ? `${sanitizedKey} [${type}]` : sanitizedKey; const cellDataType = this.kdbToAgGridCellType(type); return { field: sanitizedKey, - headerName: sanitizedKey, - headerTooltip, + headerName, cellDataType, }; }); @@ -159,13 +158,12 @@ export class KdbResultsViewProvider implements WebviewViewProvider { return Object.keys(results.rows[0]).map((key: string) => { const sanitizedKey = this.sanitizeString(key); const type = results.meta[key]; - const headerTooltip = type; + const headerName = type ? `${sanitizedKey} [${type}]` : sanitizedKey; const cellDataType = type != undefined ? this.kdbToAgGridCellType(type) : undefined; return { field: sanitizedKey, - headerName: sanitizedKey, - headerTooltip, + headerName, cellDataType, }; }); @@ -211,10 +209,11 @@ export class KdbResultsViewProvider implements WebviewViewProvider { const { columns } = results; const columnDefs = columns.map((column) => { + const sanitizedKey = this.sanitizeString(column.name); const cellDataType = this.kdbToAgGridCellType(column.type); const headerName = column.type - ? `${column.name} [${column.type}]` - : column.name; + ? `${sanitizedKey} [${column.type}]` + : sanitizedKey; return { field: column.name, diff --git a/test/suite/panels.test.ts b/test/suite/panels.test.ts index 3fbd6c65..52435751 100644 --- a/test/suite/panels.test.ts +++ b/test/suite/panels.test.ts @@ -211,14 +211,12 @@ describe("WebPanels", () => { { field: "index", headerName: "Index", cellDataType: "number" }, { field: "prop1", - headerName: "prop1", - headerTooltip: "type1", + headerName: "prop1 [type1]", cellDataType: "text", }, { field: "prop2", - headerName: "prop2", - headerTooltip: "type2", + headerName: "prop2 [type2]", cellDataType: "text", }, ], @@ -333,14 +331,12 @@ describe("WebPanels", () => { { field: "index", headerName: "Index", cellDataType: "number" }, { field: "prop1", - headerName: "prop1", - headerTooltip: "type1", + headerName: "prop1 [type1]", cellDataType: "text", }, { field: "prop2", - headerName: "prop2", - headerTooltip: "type2", + headerName: "prop2 [type2]", cellDataType: "text", }, ], @@ -392,18 +388,8 @@ describe("WebPanels", () => { ], columnDefs: [ { field: "index", headerName: "Index", cellDataType: "number" }, - { - field: "sym", - headerName: "sym", - headerTooltip: "type1", - cellDataType: "text", - }, - { - field: "val", - headerName: "val", - headerTooltip: "type2", - cellDataType: "text", - }, + { field: "sym", headerName: "sym [type1]", cellDataType: "text" }, + { field: "val", headerName: "val [type2]", cellDataType: "text" }, ], domLayout: "autoHeight", pagination: true, @@ -445,8 +431,7 @@ describe("WebPanels", () => { { field: "index", headerName: "Index", cellDataType: "number" }, { field: "value", - headerName: "value", - headerTooltip: "type1", + headerName: "value [type1]", cellDataType: "text", }, ],