show ai gateway resource details in launcher

This commit is contained in:
miloschwartz
2026-08-11 14:41:07 -04:00
parent e0a66e79bb
commit 98f5e39a7f
18 changed files with 1069 additions and 124 deletions
@@ -8,6 +8,8 @@ import {
InfoSectionTitle
} from "@app/components/InfoSection";
import { PrivateResourceInfoSections } from "@app/components/PrivateResourceInfoBox";
import { LauncherInferenceApiKeysSection } from "@app/components/resource-launcher/LauncherInferenceApiKeysSection";
import { LauncherInferenceModelsSection } from "@app/components/resource-launcher/LauncherInferenceModelsSection";
import {
SettingsSection,
SettingsSectionBody,
@@ -146,7 +148,8 @@ function HealthStatusDisplay({
);
}
const PUBLIC_AUTH_BROWSER_MODES = ["http", "ssh", "rdp", "vnc"];
const PUBLIC_AUTH_METHODS_MODES = ["http", "ssh", "rdp", "vnc"];
const PUBLIC_AUTH_BADGE_MODES = [...PUBLIC_AUTH_METHODS_MODES, "inference"];
function AuthMethodStatusDisplay({ enabled }: { enabled: boolean }) {
const t = useTranslations();
@@ -227,20 +230,24 @@ function PublicResourceAuthMethods({
}
function PublicResourceDetails({
orgId,
launcherResource,
resource,
authInfo
}: {
orgId: string;
launcherResource: LauncherResource;
resource: GetResourceResponse;
authInfo: GetResourceAuthInfoResponse;
}) {
const t = useTranslations();
const supportsAuth = PUBLIC_AUTH_BROWSER_MODES.includes(
resource.mode || ""
);
const mode = resource.mode || "";
const isInference = mode === "inference";
const showAuthBadge = PUBLIC_AUTH_BADGE_MODES.includes(mode);
const showAuthMethods = PUBLIC_AUTH_METHODS_MODES.includes(mode);
const showHealth = !isInference;
const authState = derivePublicAuthState(resource.mode, authInfo);
const infoSectionCount = supportsAuth ? 4 : 3;
const infoSectionCount = 2 + (showAuthBadge ? 1 : 0) + (showHealth ? 1 : 0);
return (
<div className="space-y-4">
@@ -275,7 +282,7 @@ function PublicResourceDetails({
/>
</InfoSectionContent>
</InfoSection>
{supportsAuth ? (
{showAuthBadge ? (
<InfoSection>
<InfoSectionTitle>
{t("authentication")}
@@ -295,30 +302,54 @@ function PublicResourceDetails({
</InfoSectionContent>
</InfoSection>
) : null}
<InfoSection>
<InfoSectionTitle>{t("health")}</InfoSectionTitle>
<InfoSectionContent>
<HealthStatusDisplay health={resource.health} />
</InfoSectionContent>
</InfoSection>
{showHealth ? (
<InfoSection>
<InfoSectionTitle>
{t("health")}
</InfoSectionTitle>
<InfoSectionContent>
<HealthStatusDisplay
health={resource.health}
/>
</InfoSectionContent>
</InfoSection>
) : null}
</InfoSections>
</SettingsSectionBody>
</SettingsSection>
{supportsAuth ? (
{showAuthMethods ? (
<PublicResourceAuthMethods authInfo={authInfo} />
) : null}
{isInference ? (
<>
<LauncherInferenceModelsSection
orgId={orgId}
params={{
resourceType: "public",
resourceId: resource.resourceId
}}
/>
<LauncherInferenceApiKeysSection
orgId={orgId}
resourceGuid={resource.resourceGuid}
/>
</>
) : null}
</div>
);
}
function PrivateResourceDetails({
orgId,
launcherResource,
resource
}: {
orgId: string;
launcherResource: LauncherResource;
resource: GetSiteResourceResponse;
}) {
const t = useTranslations();
const isInference = resource.mode === "inference";
return (
<div className="space-y-4">
@@ -365,6 +396,15 @@ function PrivateResourceDetails({
/>
</SettingsSectionBody>
</SettingsSection>
{isInference ? (
<LauncherInferenceModelsSection
orgId={orgId}
params={{
resourceType: "site",
siteResourceId: resource.siteResourceId
}}
/>
) : null}
</div>
);
}
@@ -405,6 +445,7 @@ function LauncherResourcePanelBody({
if (detail.resourceType === "public") {
return (
<PublicResourceDetails
orgId={orgId}
launcherResource={resource}
resource={detail.data}
authInfo={detail.authInfo}
@@ -414,6 +455,7 @@ function LauncherResourcePanelBody({
return (
<PrivateResourceDetails
orgId={orgId}
launcherResource={resource}
resource={detail.data}
/>