File tree Expand file tree Collapse file tree 4 files changed +34
-7
lines changed
Expand file tree Collapse file tree 4 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,11 @@ import { Telemetry } from "../utils/telemetryClient";
4444import { LocalConnection } from "../classes/localConnection" ;
4545import { ConnectionManagementService } from "../services/connectionManagerService" ;
4646import { InsightsConnection } from "../classes/insightsConnection" ;
47- import { kdbOutputLog , offerConnectAction } from "../utils/core" ;
47+ import {
48+ kdbOutputLog ,
49+ noSelectedConnectionAction ,
50+ offerConnectAction ,
51+ } from "../utils/core" ;
4852import { ServerType } from "../models/connectionsModels" ;
4953
5054export async function addDataSource ( ) : Promise < void > {
@@ -118,6 +122,12 @@ export async function runDataSource(
118122 if ( DataSourcesPanel . running ) {
119123 return ;
120124 }
125+
126+ if ( connLabel === "" ) {
127+ noSelectedConnectionAction ( ) ;
128+ return ;
129+ }
130+
121131 DataSourcesPanel . running = true ;
122132 const connMngService = new ConnectionManagementService ( ) ;
123133 const selectedConnection =
Original file line number Diff line number Diff line change @@ -173,7 +173,10 @@ export function getServerForUri(uri: Uri) {
173173 "connectionMap" ,
174174 { } ,
175175 ) ;
176- return map [ relativePath ( uri ) ] ;
176+ const server = map [ relativePath ( uri ) ] ;
177+ const servers = getServers ( ) ;
178+
179+ return server && servers . includes ( server ) ? server : undefined ;
177180}
178181
179182/* istanbul ignore next */
Original file line number Diff line number Diff line change @@ -357,6 +357,12 @@ export function offerConnectAction(connLabel: string): void {
357357 } ) ;
358358}
359359
360+ export function noSelectedConnectionAction ( ) : void {
361+ window . showInformationMessage (
362+ `You didn't selected any existing connection to execute this action, please select a connection and try again.` ,
363+ ) ;
364+ }
365+
360366/* istanbul ignore next */
361367export function offerReconnectionAfterEdit ( connLabel : string ) : void {
362368 window
Original file line number Diff line number Diff line change @@ -914,17 +914,25 @@ export class KdbDataSourceView extends LitElement {
914914 }
915915
916916 renderActions ( ) {
917+ const selectedServerExists = this . servers . includes ( this . selectedServer ) ;
918+ if ( ! selectedServerExists ) {
919+ this . selectedServer = "" ;
920+ }
917921 return html `
918922 < sl-select
919923 label ="Connection "
920924 .value ="${ live ( this . selectedServer ) } "
921925 @sl-change ="${ this . requestServerChange } "
922926 ?disabled ="${ this . running } ">
923- < sl-option
924- .value ="${ live ( this . selectedServer ) } "
925- .selected ="${ live ( true ) } "
926- > ${ this . selectedServer || "(none)" } </ sl-option
927- >
927+ ${ ! selectedServerExists
928+ ? html `< sl-option .value ="${ live ( "" ) } " .selected ="${ live ( true ) } "
929+ > (none)</ sl-option
930+ > `
931+ : html `< sl-option
932+ .value ="${ live ( this . selectedServer ) } "
933+ .selected ="${ live ( true ) } "
934+ > ${ this . selectedServer } </ sl-option
935+ > ` }
928936 < small > Connections</ small >
929937 ${ this . servers . map (
930938 ( server ) => html `
You can’t perform that action at this time.
0 commit comments