Skip to content

Commit 3c44633

Browse files
committed
Initial work on export
Signed-off-by: worksofliam <[email protected]>
1 parent 5bbdeef commit 3c44633

File tree

5 files changed

+313
-21
lines changed

5 files changed

+313
-21
lines changed

package-lock.json

Lines changed: 47 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@
8080
"order": 0,
8181
"description": "Default SELF setting for new jobs",
8282
"default": "*NONE",
83-
"enum": ["*NONE", "*ALL", "*ERROR", "*WARNING"]
83+
"enum": [
84+
"*NONE",
85+
"*ALL",
86+
"*ERROR",
87+
"*WARNING"
88+
]
8489
},
8590
"vscode-db2i.jobSelfViewAutoRefresh": {
8691
"type": "boolean",
@@ -133,12 +138,15 @@
133138
"order": 0,
134139
"description": "Descriptor to use for column headings when viewing data",
135140
"default": "Name",
136-
"enum": ["Name", "Label"],
141+
"enum": [
142+
"Name",
143+
"Label"
144+
],
137145
"enumDescriptions": [
138146
"Show the column name",
139147
"Show the column label\n'Extended metadata' must be set to true in the JDBC configuration"
140148
]
141-
},
149+
},
142150
"vscode-db2i.collapsedResultSet": {
143151
"type": "boolean",
144152
"description": "Make larger cells collapsed by default",
@@ -995,7 +1003,7 @@
9951003
"when": "view == jobManager && viewItem == sqlJob",
9961004
"group": "inline"
9971005
},
998-
{
1006+
{
9991007
"command": "vscode-db2i.jobManager.editSelfCodes",
10001008
"when": "view == jobManager && viewItem == sqlJob",
10011009
"group": "self@2"
@@ -1155,6 +1163,7 @@
11551163
"json-to-markdown-table": "^1.0.0",
11561164
"lru-cache": "^6.0.0",
11571165
"node-fetch": "^3.3.1",
1166+
"showdown": "^2.1.0",
11581167
"sql-formatter": "^14.0.0"
11591168
}
11601169
}

src/notebooks/Controller.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import * as vscode from 'vscode';
44
import * as mdTable from 'json-to-markdown-table';
55

66
import { getInstance } from '../base';
7-
import { CommandResult } from '@halcyontech/vscode-ibmi-types';
87
import { JobManager } from '../config';
98
import { ChartJsType, chartJsTypes, generateChartHTMLCell } from './logic/chartJs';
109
import { JobStatus } from '../connection/sqlJob';
11-
import { ChartDetail, chartTypes, generateChart } from './logic/chart';
10+
import { ChartDetail, generateChart } from './logic/chart';
1211
import { getStatementDetail } from './logic/statement';
1312

1413
export class IBMiController {

src/notebooks/logic/chartJs.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ export function generateChartHTMLCell(id: number, detail: ChartDetail, labels: s
1313

1414
const hasYaxis = detail.type === `bar` || detail.type === `line`;
1515

16-
const bodies = generateChartHTMLEmbedded(id, detail, labels, datasets);
16+
const bodies = generateChartHTMLEmbedded(id, detail, labels, datasets, `message`);
1717

18-
// TODO: remove hardcoded version: https://github.com/codefori/vscode-db2i/compare/0.1.0...0.1.1
1918
return /*html*/`
2019
<head>
2120
<script>${chartjs}</script>
@@ -24,12 +23,15 @@ export function generateChartHTMLCell(id: number, detail: ChartDetail, labels: s
2423
</script>
2524
</head>
2625
<body>
27-
${bodies.html}
26+
27+
<div style="max-height: 700px">
28+
${bodies.html}
29+
</div>
2830
</body>
2931
`;
3032
}
3133

32-
export function generateChartHTMLEmbedded(id: number, detail: ChartDetail, labels: string[], datasets: Dataset[], loadEvent: string = `message`): { html: string, script: string } {
34+
export function generateChartHTMLEmbedded(id: number, detail: ChartDetail, labels: string[], datasets: Dataset[], loadEvent: string = `load`): { html: string, script: string } {
3335
const chartData: ChartData = {
3436
labels,
3537
datasets,
@@ -93,9 +95,7 @@ export function generateChartHTMLEmbedded(id: number, detail: ChartDetail, label
9395
`;
9496

9597
const html = /*html*/`
96-
<div style="max-height: 700px">
97-
<canvas id="myChart${id}"></canvas>
98-
</div>
98+
<canvas id="myChart${id}"></canvas>
9999
<p id="errorText${id}"></p>
100100
`;
101101

0 commit comments

Comments
 (0)