Skip to content

Commit

Permalink
add types to header of new results params
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip-Carneiro committed Dec 4, 2024
1 parent 25ae5ba commit 4afa302
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 25 deletions.
43 changes: 27 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
23 changes: 17 additions & 6 deletions src/services/resultsPanelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand All @@ -305,6 +313,8 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
tooltipShowDelay: 200,
loading: true,
};

return gridOptions;
}

isVisible(): boolean {
Expand Down Expand Up @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions src/webview/styles/resultsPanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 4afa302

Please sign in to comment.