File tree Expand file tree Collapse file tree 4 files changed +31
-22
lines changed
views/jobManager/selfCodes Expand file tree Collapse file tree 4 files changed +31
-22
lines changed Original file line number Diff line number Diff line change 1+ import { commands } from "vscode" ;
12import { getInstance } from "./base" ;
23import { 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 ;
Original file line number Diff line number Diff 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-
9585export async function askAboutNewJob ( startup ?: boolean ) : Promise < boolean > {
9686 const instance = getInstance ( ) ;
9787 const connection = instance . getConnection ( ) ;
Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff line change 99 Uri ,
1010 Disposable
1111} from "vscode" ;
12- import { JobManager } from "../../../config" ;
12+ import { JobManager , osDetail } from "../../../config" ;
1313import { SelfCodeNode , SelfIleStackFrame } from "./nodes" ;
1414import { openExampleCommand } from "../../examples/exampleBrowser" ;
1515import { 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
You can’t perform that action at this time.
0 commit comments