Skip to content

Commit daa4010

Browse files
Reinstate reconnect option from status bar panel of isfs-type workspace (fix #1787) (#1788)
1 parent 6cbd463 commit daa4010

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/commands/serverActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function serverActions(): Promise<void> {
4141
label: "Toggle Connection",
4242
});
4343
}
44-
if (active) {
44+
if (active || api.externalServer) {
4545
actions.push({
4646
id: "refreshConnection",
4747
label: "Refresh Connection",

src/extension.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ export async function checkConnection(
375375
return;
376376
}
377377
let connInfo = api.connInfo;
378-
if (!active) {
378+
if (!active && !api.externalServer) {
379379
panel.text = `${PANEL_LABEL} $(warning)`;
380380
panel.tooltip = new vscode.MarkdownString(
381381
`Connection to${
@@ -426,7 +426,11 @@ export async function checkConnection(
426426
api.clearCookies();
427427
}
428428

429-
// Why must this be recreated here? Maybe in case something has updated connection details since we last fetched them.
429+
// Before recreating the api object (in case something has updated connection details since we last fetched them?)
430+
// if this is an external server, remove it from the inactive list because its presence there would block the reconnect that we want to be attempting
431+
if (api.externalServer) {
432+
inactiveServerIds.delete(api.serverId);
433+
}
430434
api = new AtelierAPI(apiTarget, false);
431435

432436
if (!api.config.host || !api.config.port || !api.config.ns) {
@@ -460,9 +464,9 @@ export async function checkConnection(
460464
.serverInfo(true, serverInfoTimeout)
461465
.then(gotServerInfo)
462466
.catch(async (error) => {
463-
let message = error.message;
467+
let message = error ? error.message : "Unknown error";
464468
let errorMessage;
465-
if (error.statusCode === 401) {
469+
if (error?.statusCode === 401) {
466470
let success = false;
467471
message = "Not Authorized.";
468472
errorMessage = `Authorization error: Check your credentials in Settings, and that you have sufficient privileges on the /api/atelier web application on ${connInfo}`;

0 commit comments

Comments
 (0)