Skip to content

Commit

Permalink
Merge pull request #474 from KxSystems/quick-fix-results-tab
Browse files Browse the repository at this point in the history
fix results tab
  • Loading branch information
Philip-Carneiro-KX authored Dec 12, 2024
2 parents bd76119 + cae4f74 commit 09eee87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
15 changes: 7 additions & 8 deletions src/services/resultsPanelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,26 +146,24 @@ 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,
};
});
} else {
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,
};
});
Expand Down Expand Up @@ -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,
Expand Down
29 changes: 7 additions & 22 deletions test/suite/panels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
Expand Down Expand Up @@ -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",
},
],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -445,8 +431,7 @@ describe("WebPanels", () => {
{ field: "index", headerName: "Index", cellDataType: "number" },
{
field: "value",
headerName: "value",
headerTooltip: "type1",
headerName: "value [type1]",
cellDataType: "text",
},
],
Expand Down

0 comments on commit 09eee87

Please sign in to comment.