File tree Expand file tree Collapse file tree 2 files changed +41
-8
lines changed
Expand file tree Collapse file tree 2 files changed +41
-8
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ export class InsightsConnection {
8686 await this . getConfig ( ) ;
8787 await this . getApiConfig ( ) ;
8888 await this . getMeta ( ) ;
89+ await this . startScratchpadSession ( ) ;
8990 }
9091 } ) ;
9192 return this . connected ;
@@ -805,6 +806,46 @@ export class InsightsConnection {
805806 }
806807 }
807808
809+ public async startScratchpadSession ( ) : Promise < void > {
810+ if ( this . connected && this . connEndpoints ) {
811+ const body : ScratchpadRequestBody = {
812+ expression : "" ,
813+ language : "q" ,
814+ context : "." ,
815+ sampleFn : "first" ,
816+ sampleSize : 1 ,
817+ } ;
818+ const scratchpadURL = new url . URL (
819+ this . connEndpoints . scratchpad . scratchpad ,
820+ this . node . details . server ,
821+ ) ;
822+ const options = await this . getOptions (
823+ true ,
824+ customHeadersJson ,
825+ "POST" ,
826+ scratchpadURL . toString ( ) ,
827+ body ,
828+ ) ;
829+
830+ if ( options === undefined ) {
831+ return ;
832+ }
833+
834+ notify ( "REST" , MessageKind . DEBUG , {
835+ logger,
836+ params : { url : options . url } ,
837+ } ) ;
838+
839+ return await axios ( options ) . then ( ( _res : any ) => {
840+ notify (
841+ `Scratchpad created for connection: ${ this . connLabel } .` ,
842+ MessageKind . DEBUG ,
843+ { logger } ,
844+ ) ;
845+ } ) ;
846+ }
847+ }
848+
808849 public async getScratchpadQuery (
809850 body : ScratchpadRequestBody ,
810851 isPython ?: boolean ,
Original file line number Diff line number Diff line change @@ -41,14 +41,6 @@ export function clearWorkspaceLabels() {
4141 getWorkspaceLabelsConnMap ( ) ;
4242
4343 if ( ext . connLabelList . length === 0 ) {
44- notify (
45- "Cleaning connection mappings for nonexistent labels." ,
46- MessageKind . DEBUG ,
47- {
48- logger,
49- telemetry : "Label.Cleanup.NoLabels" ,
50- } ,
51- ) ;
5244 workspace . getConfiguration ( ) . update ( "kdb.labelsConnectionMap" , [ ] , true ) ;
5345 return ;
5446 }
You can’t perform that action at this time.
0 commit comments