fix loading hub blocks when signed out
This commit is contained in:
parent
2fd8112588
commit
5ec3f88b87
3 changed files with 54 additions and 48 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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", {
|
||||
|
|
|
|||
|
|
@ -86,62 +86,56 @@ export function RulesSection() {
|
|||
});
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{mergedRules.length === 0 ? (
|
||||
<div className="rounded-lg bg-[#1e1e1e] p-6">
|
||||
<p className="italic text-gray-400">No rules defined yet</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{mergedRules.map((rule, index) => {
|
||||
if (!rule.ruleFromYaml) {
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() =>
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
})
|
||||
}
|
||||
title="Locally Defined Rule"
|
||||
/>
|
||||
);
|
||||
}
|
||||
<div>
|
||||
<div className="space-y-3">
|
||||
{mergedRules.map((rule, index) => {
|
||||
if (!rule.ruleFromYaml) {
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() =>
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
})
|
||||
}
|
||||
title="Locally Defined Rule"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof rule.ruleFromYaml === "string") {
|
||||
const slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`;
|
||||
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() => 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 (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() => openUrl(`${ruleSlug}/new-version`)}
|
||||
title={ruleSlug}
|
||||
onClick={() => openUrl(`${slug}/new-version`)}
|
||||
title="Inline Rule"
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
}
|
||||
|
||||
if (!rule.ruleFromYaml?.uses) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ruleSlug = rule.ruleFromYaml?.uses;
|
||||
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() => openUrl(`${ruleSlug}/new-version`)}
|
||||
title={ruleSlug}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<AddBlockButton blockType="rules" />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue