Skip to content

Commit 5046148

Browse files
committed
Merge branch 'main' into feature/notebooks
2 parents 009157c + c077816 commit 5046148

File tree

5 files changed

+32
-23
lines changed

5 files changed

+32
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-db2i",
33
"displayName": "Db2 for IBM i",
44
"description": "Db2 for IBM i tools in VS Code",
5-
"version": "0.10.1",
5+
"version": "0.10.2",
66
"preview": true,
77
"engines": {
88
"vscode": "^1.70.0"

src/IBMiDetail.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { commands } from "vscode";
12
import { getInstance } from "./base";
23
import { ServerComponent } from "./connection/serverComponent";
34

@@ -19,6 +20,7 @@ export class IBMiDetail {
1920

2021
setFeatureSupport(featureId: Db2FeatureIds, supported: boolean) {
2122
this.features[featureId] = supported;
23+
commands.executeCommand(`setContext`, `vscode-db2i:${featureId}Supported`, supported);
2224
}
2325

2426
getVersion() {
@@ -30,6 +32,12 @@ export class IBMiDetail {
3032
}
3133

3234
async fetchSystemInfo() {
35+
// Disable all features
36+
const features = Object.keys(featureRequirements) as Db2FeatureIds[];
37+
for (const featureId of features) {
38+
this.setFeatureSupport(featureId, false);
39+
}
40+
3341
const instance = getInstance();
3442
const content = instance.getContent();
3543

@@ -52,7 +60,6 @@ export class IBMiDetail {
5260
levelCheckFailed = true;
5361
}
5462

55-
const features = Object.keys(featureRequirements) as Db2FeatureIds[];
5663
for (const featureId of features) {
5764
const requiredLevelForFeature = featureRequirements[featureId][String(this.version)];
5865
const supported = requiredLevelForFeature && this.db2Level >= requiredLevelForFeature;

src/config.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export async function onConnectOrServerInstall(): Promise<boolean> {
3535
await ServerComponent.checkForUpdate();
3636

3737
updateStatusBar();
38-
toggleViews();
3938

4039
if (ServerComponent.isInstalled()) {
4140
JobManagerView.setVisible(true);
@@ -83,15 +82,6 @@ export function initConfig(context: ExtensionContext) {
8382
});
8483
}
8584

86-
export function toggleViews() {
87-
const features = osDetail.getFeatures();
88-
89-
const featureIds = Object.keys(features) as (keyof typeof features)[];
90-
for (const featureId of featureIds) {
91-
commands.executeCommand(`setContext`, `vscode-db2i:${featureId}Supported`, features[featureId]);
92-
}
93-
}
94-
9585
export async function askAboutNewJob(startup?: boolean): Promise<boolean> {
9686
const instance = getInstance();
9787
const connection = instance.getConnection();

src/connection/serverComponent.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ export class ServerComponent {
107107
command: `echo ${ExecutablePathDir}`
108108
});
109109

110-
if (commandResult.code === 0 && commandResult.stderr === ``) {
110+
this.writeOutput(JSON.stringify(commandResult));
111+
112+
if (commandResult.code === 0) {
113+
const stuffInStderr = commandResult.stderr.length > 0;
111114
const remotePath = path.posix.join(commandResult.stdout, basename);
112115

113116
ServerComponent.writeOutput(JSON.stringify({remotePath, ExecutablePathDir}));
@@ -122,14 +125,17 @@ export class ServerComponent {
122125

123126
await Config.setServerComponentName(basename);
124127

128+
if (stuffInStderr) {
129+
ServerComponent.writeOutput(`Server component was uploaded to ${remotePath} but there was something in stderr, which is not right. It might be worth seeing your user profile startup scripts.`);
130+
}
131+
125132
window.showInformationMessage(`Db2 for IBM i extension server component has been updated!`);
126133
this.installed = true;
127134
updateResult = UpdateStatus.JUST_UPDATED;
128135

129136
} else {
130137
updateResult = UpdateStatus.FAILED;
131138

132-
this.writeOutput(JSON.stringify(commandResult));
133139
window.showErrorMessage(`Something went really wrong when trying to fetch your home directory.`).then(chosen => {
134140
if (chosen === `Show`) {
135141
this.outputChannel.show();

src/views/jobManager/selfCodes/selfCodesResultsView.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Uri,
1010
Disposable
1111
} from "vscode";
12-
import { JobManager } from "../../../config";
12+
import { JobManager, osDetail } from "../../../config";
1313
import { SelfCodeNode, SelfIleStackFrame } from "./nodes";
1414
import { openExampleCommand } from "../../examples/exampleBrowser";
1515
import { SQLExample } from "../../examples";
@@ -94,15 +94,21 @@ export class selfCodesResultsView implements TreeDataProvider<any> {
9494
where user_name = current_user
9595
order by logged_time desc`;
9696

97-
const result = await selected.job.query<SelfCodeNode>(content).run(10000);
98-
if (result.success) {
99-
const data: SelfCodeNode[] = result.data.map((row) => ({
100-
...row,
101-
INITIAL_STACK: JSON.parse(row.INITIAL_STACK as unknown as string)
102-
}));
97+
try {
98+
const result = await selected.job.query<SelfCodeNode>(content).run(10000);
99+
if (result.success) {
100+
const data: SelfCodeNode[] = result.data.map((row) => ({
101+
...row,
102+
INITIAL_STACK: JSON.parse(row.INITIAL_STACK as unknown as string)
103+
}));
103104

104-
105-
return data;
105+
106+
return data;
107+
}
108+
} catch (e) {
109+
this.setRefreshEnabled(false);
110+
osDetail.setFeatureSupport(`SELF`, false);
111+
vscode.window.showErrorMessage(`An error occured fetching SELF code errors, and therefore will be disabled.`);
106112
}
107113
}
108114

0 commit comments

Comments
 (0)