fix deeplink handling
This commit is contained in:
@@ -328,7 +328,7 @@ export class ConfigHandler {
|
||||
}
|
||||
|
||||
// Org id: check id validity, save selection, switch and reload
|
||||
async setSelectedOrgId(orgId: string) {
|
||||
async setSelectedOrgId(orgId: string, profileId?: string) {
|
||||
if (orgId === this.currentOrg.id) {
|
||||
return;
|
||||
}
|
||||
@@ -346,8 +346,13 @@ export class ConfigHandler {
|
||||
});
|
||||
|
||||
this.currentOrg = org;
|
||||
this.currentProfile = org.currentProfile;
|
||||
await this.reloadConfig();
|
||||
|
||||
if (profileId) {
|
||||
this.setSelectedProfileId(profileId);
|
||||
} else {
|
||||
this.currentProfile = org.currentProfile;
|
||||
await this.reloadConfig();
|
||||
}
|
||||
}
|
||||
|
||||
// Profile id: check id validity, save selection, switch and reload
|
||||
|
||||
@@ -819,7 +819,10 @@ export class Core {
|
||||
});
|
||||
|
||||
on("didChangeSelectedOrg", async (msg) => {
|
||||
await this.configHandler.setSelectedOrgId(msg.data.id);
|
||||
await this.configHandler.setSelectedOrgId(
|
||||
msg.data.id,
|
||||
msg.data.profileId,
|
||||
);
|
||||
});
|
||||
|
||||
on("didChangeControlPlaneSessionInfo", async (msg) => {
|
||||
|
||||
@@ -3,6 +3,6 @@ import { ToWebviewFromIdeOrCoreProtocol } from "./webview.js";
|
||||
|
||||
export type ToCoreFromWebviewProtocol = ToCoreFromIdeOrWebviewProtocol & {
|
||||
didChangeSelectedProfile: [{ id: string }, void];
|
||||
didChangeSelectedOrg: [{ id: string }, void];
|
||||
didChangeSelectedOrg: [{ id: string; profileId?: string }, void];
|
||||
};
|
||||
export type ToWebviewFromCoreProtocol = ToWebviewFromIdeOrCoreProtocol;
|
||||
|
||||
@@ -202,16 +202,10 @@ export class VsCodeExtension {
|
||||
let profileId = queryParams.get("profile_id");
|
||||
let orgId = queryParams.get("org_id");
|
||||
|
||||
if (orgId) {
|
||||
if (orgId === "null") {
|
||||
orgId = null;
|
||||
}
|
||||
if (orgId && orgId !== "null") {
|
||||
// In case org id is passed with profile id
|
||||
// Make sure org is updated before profile is set
|
||||
if (profileId) {
|
||||
if (profileId === "null") {
|
||||
profileId = null;
|
||||
}
|
||||
if (profileId && profileId !== "null") {
|
||||
this.core.invoke("didChangeSelectedOrg", {
|
||||
id: orgId,
|
||||
profileId,
|
||||
@@ -221,10 +215,7 @@ export class VsCodeExtension {
|
||||
id: orgId,
|
||||
});
|
||||
}
|
||||
} else if (profileId) {
|
||||
if (profileId === "null") {
|
||||
profileId = null;
|
||||
}
|
||||
} else if (profileId && profileId !== "null") {
|
||||
this.core.invoke("didChangeSelectedProfile", {
|
||||
id: profileId,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user