Skip to content

Commit 969367b

Browse files
committed
Fixed the connection issue
1 parent 92865e4 commit 969367b

6 files changed

Lines changed: 44 additions & 34 deletions

File tree

javascripts/components/appUtils.js

Lines changed: 16 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascripts/components/appUtils.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascripts/components/helper_classes.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sfdx-data-move-utility-desktop-app",
3-
"version": "3.1.12",
3+
"version": "3.1.14",
44
"description": "Data Loader SFDX Plugin (SFDMU) GUI Application",
55
"main": "main.js",
66
"scripts": {

ts/components/appUtils.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,11 @@ export class AppUtils {
293293
return this._parseForceOrgDisplayResult(response.cliCommand, response.commandOutput);
294294
}
295295
let response = await AppUtils.execSfdxCommand("force:org:display --json", userName);
296-
let result = new ForceOrgDisplayResult(JSON.parse(response.commandOutput));
296+
let commandOutput = JSON.parse(response.commandOutput);
297+
if (!commandOutput.result) {
298+
return new ForceOrgDisplayResult();
299+
}
300+
let result = new ForceOrgDisplayResult(commandOutput.result);
297301
result.cliCommand = response.cliCommand;
298302
result.commandOutput = response.commandOutput;
299303
return result;
@@ -471,10 +475,10 @@ export class AppUtils {
471475
};
472476

473477
public static async connectOrg(org: Org): Promise<void> {
474-
let result = await this.execForceOrgDisplay(org.orgName);
478+
let result = await this.execForceOrgDisplay(org.orgName, true);
475479
if (result.isConnected) {
476-
org.instanceUrl = result.InstanceUrl;
477-
org.accessToken = result.AccessToken;
480+
org.instanceUrl = result.instanceUrl;
481+
org.accessToken = result.accessToken;
478482
} else {
479483
throw new Error(RESOURCES.Home_Error_UnableToConnect);
480484
}
@@ -822,20 +826,21 @@ export class AppUtils {
822826
output.commandOutput = commandResult;
823827
output.cliCommand = cliCommand;
824828
lines.forEach(line => {
829+
line = line.trim();
825830
if (line.startsWith("Access Token"))
826-
output.AccessToken = line.split(' ').pop();
831+
output.accessToken = line.split(' ').pop();
827832
if (line.startsWith("Client Id"))
828-
output.ClientId = line.split(' ').pop();
833+
output.clientId = line.split(' ').pop();
829834
if (line.startsWith("Connected Status"))
830-
output.ConnectedStatus = line.split(' ').pop();
835+
output.connectedStatus = line.split(' ').pop();
831836
if (line.startsWith("Status"))
832-
output.Status = line.split(' ').pop();
837+
output.status = line.split(' ').pop();
833838
if (line.startsWith("Id"))
834-
output.OrgId = line.split(' ').pop();
839+
output.orgId = line.split(' ').pop();
835840
if (line.startsWith("Instance Url"))
836-
output.InstanceUrl = line.split(' ').pop();
841+
output.instanceUrl = line.split(' ').pop();
837842
if (line.startsWith("Username"))
838-
output.Username = line.split(' ').pop();
843+
output.username = line.split(' ').pop();
839844
});
840845
return output;
841846
};

ts/components/helper_classes.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@ export class ForceOrgDisplayResult {
7474
}
7575
}
7676

77-
AccessToken: string;
78-
ClientId: string;
79-
ConnectedStatus: string;
80-
Status: string;
81-
OrgId: string;
82-
UserId: string;
83-
InstanceUrl: string;
84-
Username: string;
77+
accessToken: string;
78+
clientId: string;
79+
connectedStatus: string;
80+
status: string;
81+
orgId: string;
82+
userId: string;
83+
instanceUrl: string;
84+
username: string;
8585
commandOutput: string;
8686
cliCommand: string;
8787

8888
get isConnected() {
89-
return this.ConnectedStatus == "Connected" || this.Status == "Active";
89+
return this.connectedStatus == "Connected" || this.status == "Active";
9090
}
9191
}
9292

0 commit comments

Comments
 (0)