diff --git a/package-lock.json b/package-lock.json index bcf165c0..780839a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,10 +9,11 @@ "version": "1.10.0", "license": "MIT", "dependencies": { + "@ag-grid-community/core": "^32.3.3", "@vscode/webview-ui-toolkit": "^1.4.0", "@windozer/node-q": "^2.6.0", - "ag-grid-community": "^32.3.2", - "axios": "^1.7.7", + "ag-grid-community": "^32.3.3", + "axios": "^1.7.9", "chevrotain": "^10.5.0", "extract-zip": "^2.0.1", "fs-extra": "^11.2.0", @@ -61,7 +62,7 @@ "mocha-junit-reporter": "^2.2.1", "mocha-multi-reporters": "^1.5.1", "mock-fs": "^5.4.1", - "prettier": "^3.3.3", + "prettier": "^3.4.1", "rimraf": "^6.0.1", "sinon": "^17.0.1", "typescript": "^5.4.5", @@ -75,6 +76,16 @@ "vscode": "^1.86.0" } }, + "node_modules/@ag-grid-community/core": { + "version": "32.3.3", + "resolved": "https://registry.npmjs.org/@ag-grid-community/core/-/core-32.3.3.tgz", + "integrity": "sha512-JMr5ahDjjl+pvQbBM1/VrfVFlioCVnMl1PKWc6MC1ENhpXT1+CPQdfhUEUw2VytOulQeQ4eeP0pFKPuBZ5Jn2g==", + "license": "MIT", + "dependencies": { + "ag-charts-types": "10.3.3", + "tslib": "^2.3.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.24.2", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", @@ -1846,18 +1857,18 @@ } }, "node_modules/ag-charts-types": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.3.1.tgz", - "integrity": "sha512-oZvu9vJLk6lmzaYi0TmVVmHFZJpVNFziU0bnllx4wR3muXCmnxz5LouKIZ8CYnNiC7VO5HmHNlFu+0DmEO5zxg==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.3.3.tgz", + "integrity": "sha512-8rmyquaTkwfP4Lzei/W/cbkq9wwEl8+grIo3z97mtxrMIXh9sHJK1oJipd/u08MmBZrca5Jjtn5F1+UNPu/4fQ==", "license": "MIT" }, "node_modules/ag-grid-community": { - "version": "32.3.2", - "resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-32.3.2.tgz", - "integrity": "sha512-ZrgS7+F0JKV6+sy7VQdt+9xhOJd6TAnXXEmw20ByG6AZdcIDEKBRHW7TfNwUqisXJjGKoaXnYByuMz7rL9PcPg==", + "version": "32.3.3", + "resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-32.3.3.tgz", + "integrity": "sha512-KhSJ3B6mwRFA4cLjNjOZkDndJBh8o83794ZHl4Q7xP9MJf43oCN9qoZ8pyBanohgpVfLcP0scYYCr9xIlzjdiA==", "license": "MIT", "dependencies": { - "ag-charts-types": "10.3.1" + "ag-charts-types": "10.3.3" } }, "node_modules/agent-base": { @@ -1948,9 +1959,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", @@ -4511,9 +4522,9 @@ } }, "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", + "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", "dev": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index 749aef6b..40045552 100644 --- a/package.json +++ b/package.json @@ -993,7 +993,7 @@ "mocha-junit-reporter": "^2.2.1", "mocha-multi-reporters": "^1.5.1", "mock-fs": "^5.4.1", - "prettier": "^3.3.3", + "prettier": "^3.4.1", "rimraf": "^6.0.1", "sinon": "^17.0.1", "typescript": "^5.4.5", @@ -1004,10 +1004,11 @@ "vscode-test": "^1.6.1" }, "dependencies": { + "@ag-grid-community/core": "^32.3.3", "@vscode/webview-ui-toolkit": "^1.4.0", "@windozer/node-q": "^2.6.0", - "ag-grid-community": "^32.3.2", - "axios": "^1.7.7", + "ag-grid-community": "^32.3.3", + "axios": "^1.7.9", "chevrotain": "^10.5.0", "extract-zip": "^2.0.1", "fs-extra": "^11.2.0", diff --git a/src/services/resultsPanelProvider.ts b/src/services/resultsPanelProvider.ts index 3d62c1b3..30c87b3e 100644 --- a/src/services/resultsPanelProvider.ts +++ b/src/services/resultsPanelProvider.ts @@ -24,6 +24,7 @@ import * as utils from "../utils/execution"; import { getNonce } from "../utils/getNonce"; import { getUri } from "../utils/getUri"; import { kdbOutputLog } from "../utils/core"; +import { GridOptions } from "ag-grid-community"; import { StructuredTextResults } from "../models/queryResult"; export class KdbResultsViewProvider implements WebviewViewProvider { @@ -208,22 +209,29 @@ export class KdbResultsViewProvider implements WebviewViewProvider { updatedExtractColumnDefs(results: StructuredTextResults) { const { columns } = results; + const columnDefs = columns.map((column) => { const cellDataType = this.kdbToAgGridCellType(column.type); - const headerName = `${column.name}`; + const headerName = column.type + ? `${column.name} [${column.type}]` + : column.name; + return { field: column.name, - headerName, - cellDataType, + headerName: headerName, + cellDataType: cellDataType, cellRendererParams: { disabled: cellDataType === "boolean" }, - headerTooltip: column.type ? column.type : undefined, }; }); return columnDefs; } - convertToGrid(results: any, isInsights: boolean, connVersion?: number): any { + convertToGrid( + results: any, + isInsights: boolean, + connVersion?: number, + ): GridOptions { let rowData = []; let columnDefs = []; if (connVersion && connVersion >= 1.12) { @@ -285,7 +293,7 @@ export class KdbResultsViewProvider implements WebviewViewProvider { ext.resultPanelCSV = this.convertToCsv(rowData).join("\n"); } - return { + const gridOptions: GridOptions = { defaultColDef: { sortable: true, resizable: true, @@ -305,6 +313,8 @@ export class KdbResultsViewProvider implements WebviewViewProvider { tooltipShowDelay: 200, loading: true, }; + + return gridOptions; } isVisible(): boolean { @@ -422,6 +432,7 @@ export class KdbResultsViewProvider implements WebviewViewProvider { window.addEventListener('message', event => { const message = event.data; + console.log(event) if (message.command === 'setGridOptions') { const columnWidths = saveColumnWidths(); const gridOptions = message.gridOptions; diff --git a/src/webview/styles/resultsPanel.css b/src/webview/styles/resultsPanel.css index c181e93a..1b41888e 100644 --- a/src/webview/styles/resultsPanel.css +++ b/src/webview/styles/resultsPanel.css @@ -28,3 +28,24 @@ body { .results-txt { white-space: pre; } + +/* styles.css */ + +.custom-ag-grid-header { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; + width: 100%; +} + +.custom-ag-grid-header-title { + font-weight: bold; + font-size: 14px; +} + +.custom-ag-grid-header-subtitle { + font-size: 12px; + color: #666666; +}