Add runtime issue clear action

This commit is contained in:
Nathan Flurry 2026-03-12 11:03:32 -07:00
parent ec8e816d0d
commit b224294b0e
11 changed files with 82 additions and 2 deletions

View file

@ -19,6 +19,7 @@ export interface FoundryAppClient {
selectOrganization(organizationId: string): Promise<void>;
updateOrganizationProfile(input: UpdateFoundryOrganizationProfileInput): Promise<void>;
triggerGithubSync(organizationId: string): Promise<void>;
clearOrganizationRuntimeIssues(organizationId: string, actorId?: string): Promise<void>;
completeHostedCheckout(organizationId: string, planId: FoundryBillingPlanId): Promise<void>;
openBillingPortal(organizationId: string): Promise<void>;
cancelScheduledRenewal(organizationId: string): Promise<void>;

View file

@ -163,6 +163,7 @@ export interface BackendClient {
selectAppOrganization(organizationId: string): Promise<FoundryAppSnapshot>;
updateAppOrganizationProfile(input: UpdateFoundryOrganizationProfileInput): Promise<FoundryAppSnapshot>;
triggerAppRepoImport(organizationId: string): Promise<FoundryAppSnapshot>;
clearAppOrganizationRuntimeIssues(organizationId: string, actorId?: string): Promise<FoundryAppSnapshot>;
reconnectAppGithub(organizationId: string): Promise<void>;
completeAppHostedCheckout(organizationId: string, planId: FoundryBillingPlanId): Promise<void>;
openAppBillingPortal(organizationId: string): Promise<void>;
@ -769,6 +770,15 @@ export function createBackendClient(options: BackendClientOptions): BackendClien
});
},
async clearAppOrganizationRuntimeIssues(organizationId: string, actorId?: string): Promise<FoundryAppSnapshot> {
return await appRequest<FoundryAppSnapshot>(`/app/organizations/${organizationId}/runtime-issues/clear`, {
method: "POST",
body: JSON.stringify({
actorId: actorId ?? null,
}),
});
},
async reconnectAppGithub(organizationId: string): Promise<void> {
await redirectTo(`/app/organizations/${organizationId}/reconnect`, {
method: "POST",

View file

@ -133,6 +133,7 @@ export interface MockFoundryAppClient {
selectOrganization(organizationId: string): Promise<void>;
updateOrganizationProfile(input: UpdateMockOrganizationProfileInput): Promise<void>;
triggerGithubSync(organizationId: string): Promise<void>;
clearOrganizationRuntimeIssues(organizationId: string, actorId?: string): Promise<void>;
completeHostedCheckout(organizationId: string, planId: MockBillingPlanId): Promise<void>;
openBillingPortal(organizationId: string): Promise<void>;
cancelScheduledRenewal(organizationId: string): Promise<void>;
@ -585,6 +586,21 @@ class MockFoundryAppStore implements MockFoundryAppClient {
this.importTimers.set(organizationId, timer);
}
async clearOrganizationRuntimeIssues(organizationId: string, actorId?: string): Promise<void> {
await this.injectAsyncLatency();
void actorId;
this.requireOrganization(organizationId);
this.updateOrganization(organizationId, (organization) => ({
...organization,
runtime: {
...organization.runtime,
status: "healthy",
errorCount: 0,
issues: [],
},
}));
}
async completeHostedCheckout(organizationId: string, planId: MockBillingPlanId): Promise<void> {
await this.injectAsyncLatency();
this.requireOrganization(organizationId);

View file

@ -253,6 +253,10 @@ export function createMockBackendClient(defaultWorkspaceId = "default"): Backend
return unsupportedAppSnapshot();
},
async clearAppOrganizationRuntimeIssues(): Promise<FoundryAppSnapshot> {
return unsupportedAppSnapshot();
},
async reconnectAppGithub(): Promise<void> {
notSupported("reconnectAppGithub");
},

View file

@ -80,6 +80,11 @@ class RemoteFoundryAppStore implements FoundryAppClient {
this.scheduleSyncPollingIfNeeded();
}
async clearOrganizationRuntimeIssues(organizationId: string, actorId?: string): Promise<void> {
this.snapshot = await this.backend.clearAppOrganizationRuntimeIssues(organizationId, actorId);
this.notify();
}
async completeHostedCheckout(organizationId: string, planId: FoundryBillingPlanId): Promise<void> {
await this.backend.completeAppHostedCheckout(organizationId, planId);
}