open control plane links with orgSlug

This commit is contained in:
Nate 2025-02-05 17:14:39 -08:00
parent 284ad970d7
commit c401e1832f
5 changed files with 12 additions and 5 deletions

View file

@ -27,6 +27,7 @@ export interface OrganizationDescription {
id: string;
iconUrl: string;
name: string;
slug: string | undefined; // TODO: This doesn't need to be undefined, just doing while transitioning the backend
}
export class ProfileLifecycleManager {

View file

@ -315,7 +315,11 @@ export class Core {
on("controlPlane/openUrl", async (msg) => {
const env = await getControlPlaneEnv(this.ide.getIdeSettings());
await this.messenger.request("openUrl", `${env.APP_URL}${msg.data.path}`);
let url = `${env.APP_URL}${msg.data.path}`;
if (msg.data.orgSlug) {
url += `?org=${msg.data.orgSlug}`;
}
await this.messenger.request("openUrl", url);
});
on("controlPlane/listOrganizations", async (msg) => {

View file

@ -197,6 +197,6 @@ export type ToCoreFromIdeOrWebviewProtocol = {
{ contextItems: ContextItem[] },
];
"clipboardCache/add": [{ content: string }, void];
"controlPlane/openUrl": [{ path: string }, void];
"controlPlane/openUrl": [{ path: string; orgSlug: string | undefined }, void];
"controlPlane/listOrganizations": [undefined, OrganizationDescription[]];
};

View file

@ -1,11 +1,11 @@
import { ChevronRightIcon } from "@heroicons/react/24/outline";
import { useContext } from "react";
import { Button, ButtonSubtext } from "../../..";
import { useAuth } from "../../../../context/Auth";
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
import { hasPassedFTL } from "../../../../util/freeTrial";
import ContinueLogo from "../../../gui/ContinueLogo";
import { useOnboardingCard } from "../../hooks";
import { hasPassedFTL } from "../../../../util/freeTrial";
import { useContext } from "react";
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
export default function MainTab({
onRemainLocal,
@ -29,6 +29,7 @@ export default function MainTab({
function openPastFreeTrialOnboarding() {
ideMessenger.post("controlPlane/openUrl", {
path: "setup-models",
orgSlug: auth.selectedOrganization?.slug,
});
onboardingCard.close(isDialog);
}

View file

@ -25,6 +25,7 @@ export function AssistantSelectOptions(props: AssistantSelectOptionsProps) {
function onNewAssistant() {
ideMessenger.post("controlPlane/openUrl", {
path: "new",
orgSlug: selectedOrganization?.slug,
});
}