From 5ec3f88b87f67e891ff7770a3288e3ccfaf6806e Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 15:55:44 -0700 Subject: [PATCH] fix loading hub blocks when signed out --- core/config/yaml/loadYaml.ts | 4 + core/control-plane/client.ts | 10 ++- .../mainInput/Lump/sections/RulesSection.tsx | 88 +++++++++---------- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 98a4d96e5..fdeffce07 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -51,6 +51,10 @@ export class LocalPlatformClient implements PlatformClient { ) {} async resolveFQSNs(fqsns: FQSN[]): Promise<(SecretResult | undefined)[]> { + if (fqsns.length === 0) { + return []; + } + const response = await this.client.resolveFQSNs(fqsns, this.orgScopeId); return response; } diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index dee4d7ef4..77a3dc108 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -5,6 +5,7 @@ import { FQSN, FullSlug, SecretResult, + SecretType, } from "@continuedev/config-yaml"; import fetch, { RequestInit, Response } from "node-fetch"; @@ -46,7 +47,14 @@ export class ControlPlaneClient { ): Promise<(SecretResult | undefined)[]> { const userId = await this.userId; if (!userId) { - throw new Error("No user id"); + return fqsns.map((fqsn) => ({ + found: false, + fqsn, + secretLocation: { + secretName: fqsn.secretName, + secretType: SecretType.NotFound, + }, + })); } const resp = await this.request("ide/sync-secrets", { diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 200472b22..d24316e9e 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -86,62 +86,56 @@ export function RulesSection() { }); return ( -
- {mergedRules.length === 0 ? ( -
-

No rules defined yet

-
- ) : ( -
- {mergedRules.map((rule, index) => { - if (!rule.ruleFromYaml) { - return ( - - ideMessenger.post("config/openProfile", { - profileId: undefined, - }) - } - title="Locally Defined Rule" - /> - ); - } +
+
+ {mergedRules.map((rule, index) => { + if (!rule.ruleFromYaml) { + return ( + + ideMessenger.post("config/openProfile", { + profileId: undefined, + }) + } + title="Locally Defined Rule" + /> + ); + } - if (typeof rule.ruleFromYaml === "string") { - const slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`; - - return ( - openUrl(`${slug}/new-version`)} - title="Inline Rule" - /> - ); - } - - if (!rule.ruleFromYaml?.uses) { - return null; - } - - const ruleSlug = rule.ruleFromYaml?.uses; + if (typeof rule.ruleFromYaml === "string") { + const slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`; return ( openUrl(`${ruleSlug}/new-version`)} - title={ruleSlug} + onClick={() => openUrl(`${slug}/new-version`)} + title="Inline Rule" /> ); - })} -
- )} + } + + if (!rule.ruleFromYaml?.uses) { + return null; + } + + const ruleSlug = rule.ruleFromYaml?.uses; + + return ( + openUrl(`${ruleSlug}/new-version`)} + title={ruleSlug} + /> + ); + })} +
);