Skip to content

Commit a6be167

Browse files
committed
Merge branch 'refs/heads/main' into feature/object_locks
# Conflicts: # package.json # src/views/schemaBrowser/contributes.json # src/views/schemaBrowser/index.ts # src/views/schemaBrowser/statements.ts
2 parents 683e31a + 1d028cd commit a6be167

File tree

6 files changed

+337
-254
lines changed

6 files changed

+337
-254
lines changed

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@
332332
"title": "Get Indexes",
333333
"category": "Db2 for i"
334334
},
335+
{
336+
"command": "vscode-db2i.getAuthorities",
337+
"title": "Get Authorities",
338+
"category": "Db2 for i"
339+
},
335340
{
336341
"command": "vscode-db2i.getObjectLocks",
337342
"title": "Get Object Locks",
@@ -925,6 +930,11 @@
925930
"when": "viewItem == table || viewItem == schema",
926931
"group": "db2workWith@3"
927932
},
933+
{
934+
"command": "vscode-db2i.getAuthorities",
935+
"when": "viewItem == table || viewItem == view || viewItem == alias || viewItem == constraint || viewItem == function || viewItem == variable || viewItem == index || viewItem == procedure || viewItem == sequence || viewItem == package || viewItem == trigger || viewItem == type",
936+
"group": "db2workWith@4"
937+
},
928938
{
929939
"command": "vscode-db2i.getObjectLocks",
930940
"when": "viewItem == table || viewItem == view || viewItem == alias || viewItem == constraint || viewItem == function || viewItem == variable || viewItem == index || viewItem == procedure || viewItem == sequence || viewItem == package || viewItem == trigger || viewItem == type",

src/notebooks/logic/chartJs.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function generateChartHTMLEmbedded(id: number, detail: ChartDetail, label
3131

3232
const hasYaxis = detail.type === `bar` || detail.type === `line`;
3333

34-
const script = /*javascript*/`
34+
const script = /*javascript*/ `
3535
if (!window.ibmicharts) {
3636
window.ibmicharts = {};
3737
}
@@ -41,6 +41,11 @@ export function generateChartHTMLEmbedded(id: number, detail: ChartDetail, label
4141
if (!theChart) {
4242
const chartEle = document.getElementById('myChart${id}');
4343
if (chartEle) {
44+
const maxHeight = window.innerHeight * 0.8;
45+
const maxWidth = window.innerWidth * 0.8;
46+
const targetSize = Math.min(maxHeight, maxWidth);
47+
chartEle.style.maxHeight = targetSize + 'px';
48+
chartEle.style.maxWidth = targetSize + 'px';
4449
try {
4550
window.ibmicharts['myChart${id}'] = new Chart(chartEle.getContext('2d'), {
4651
type: '${detail.type}',

src/notebooks/logic/export.ts

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,38 @@ export const exportNotebookAsHtml = vscode.commands.registerCommand(`vscode-db2i
114114
}
115115

116116
if (fallbackToTable) {
117-
cellContents.push([
118-
`<table style="width: 100%; margin-left: auto; margin-right: auto;">`,
119-
`<thead>`,
120-
`<tr>`,
121-
columns.map(c => `<th>${c}</th>`).join(``),
122-
`</tr>`,
123-
`</thead>`,
124-
`<tbody>`,
125-
table.map(row => {
126-
return [
127-
`<tr>`,
128-
keys.map(key => `<td>${row[key]}</td>`).join(``),
129-
`</tr>`
130-
].join(``);
131-
}).join(``),
132-
`</tbody>`,
133-
`</table>`
134-
].join(``));
117+
cellContents.push(
118+
[
119+
`<table style="width: 100%; margin-left: auto; margin-right: auto;">`,
120+
`<thead>`,
121+
`<tr>`,
122+
columns
123+
.map(
124+
(c) =>
125+
`<th style="text-align: left;">${c}</th>`
126+
)
127+
.join(``),
128+
`</tr>`,
129+
`</thead>`,
130+
`<tbody>`,
131+
table
132+
.map((row) => {
133+
return [
134+
`<tr>`,
135+
keys
136+
.map(
137+
(key) =>
138+
`<td style="text-align: left;">${row[key]}</td>`
139+
)
140+
.join(``),
141+
`</tr>`,
142+
].join(``);
143+
})
144+
.join(``),
145+
`</tbody>`,
146+
`</table>`,
147+
].join(``)
148+
);
135149
}
136150
} else {
137151
// items.push(vscode.NotebookCellOutputItem.stderr(`No rows returned from statement.`));

src/views/schemaBrowser/contributes.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
"title": "Get Indexes",
5050
"category": "Db2 for i"
5151
},
52+
{
53+
"command": "vscode-db2i.getAuthorities",
54+
"title": "Get Authorities",
55+
"category": "Db2 for i"
56+
},
5257
{
5358
"command": "vscode-db2i.getObjectLocks",
5459
"title": "Get Object Locks",
@@ -162,6 +167,11 @@
162167
"when": "viewItem == table || viewItem == schema",
163168
"group": "db2workWith@3"
164169
},
170+
{
171+
"command": "vscode-db2i.getAuthorities",
172+
"when": "viewItem == table || viewItem == view || viewItem == alias || viewItem == constraint || viewItem == function || viewItem == variable || viewItem == index || viewItem == procedure || viewItem == sequence || viewItem == package || viewItem == trigger || viewItem == type",
173+
"group": "db2workWith@4"
174+
},
165175
{
166176
"command": "vscode-db2i.getObjectLocks",
167177
"when": "viewItem == table || viewItem == view || viewItem == alias || viewItem == constraint || viewItem == function || viewItem == variable || viewItem == index || viewItem == procedure || viewItem == sequence || viewItem == package || viewItem == trigger || viewItem == type",

src/views/schemaBrowser/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Configuration from "../../configuration";
1010
import Types from "../types";
1111
import Statement from "../../database/statement";
1212
import { copyUI } from "./copyUI";
13-
import { getAdvisedIndexesStatement, getIndexesStatement, getMTIStatement, getObjectLocksStatement } from "./statements";
13+
import { getAdvisedIndexesStatement, getIndexesStatement, getMTIStatement, getAuthoritiesStatement, getObjectLocksStatement } from "./statements";
1414

1515
const viewItem = {
1616
"tables": `table`,
@@ -187,6 +187,17 @@ export default class schemaBrowser {
187187
}
188188
}),
189189

190+
vscode.commands.registerCommand(`vscode-db2i.getAuthorities`, async (object: SQLObject) => {
191+
if (object) {
192+
const content = getAuthoritiesStatement(object.schema, object.name, object.type.toUpperCase(), object.tableType);
193+
vscode.commands.executeCommand(`vscode-db2i.runEditorStatement`, {
194+
content,
195+
qualifier: `statement`,
196+
open: false,
197+
});
198+
}
199+
}),
200+
190201
vscode.commands.registerCommand(`vscode-db2i.getObjectLocks`, async (object: SQLObject) => {
191202
if (object) {
192203
const content = getObjectLocksStatement(object.schema, object.name, object.type.toUpperCase(), object.tableType);
@@ -197,7 +208,7 @@ export default class schemaBrowser {
197208
});
198209
}
199210
}),
200-
211+
201212
vscode.commands.registerCommand(`vscode-db2i.advisedIndexes`, async (object: SQLObject|SchemaItem) => { //table
202213
if (object) {
203214
let content: string|undefined;

0 commit comments

Comments
 (0)