diff --git a/web-admin/src/features/billing/banner/BillingBannerManager.svelte b/web-admin/src/features/billing/banner/BillingBannerManager.svelte index 1f7520f0edf..f15739f7a8c 100644 --- a/web-admin/src/features/billing/banner/BillingBannerManager.svelte +++ b/web-admin/src/features/billing/banner/BillingBannerManager.svelte @@ -2,7 +2,6 @@ import { onNavigate } from "$app/navigation"; import type { V1OrganizationPermissions } from "@rilldata/web-admin/client"; import BillingBannerManagerForAdmins from "@rilldata/web-admin/features/billing/banner/BillingBannerManagerForAdmins.svelte"; - import BillingBannerManagerForViewers from "@rilldata/web-admin/features/billing/banner/BillingBannerManagerForViewers.svelte"; import { BillingBannerID } from "@rilldata/web-common/components/banner/constants"; import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus"; @@ -20,6 +19,4 @@ {#if organizationPermissions.manageOrg} -{:else if organizationPermissions.readOrg && organizationPermissions.readProjects} - {/if} diff --git a/web-admin/src/features/billing/banner/BillingBannerManagerForViewers.svelte b/web-admin/src/features/billing/banner/BillingBannerManagerForViewers.svelte deleted file mode 100644 index 7b42f36ccb4..00000000000 --- a/web-admin/src/features/billing/banner/BillingBannerManagerForViewers.svelte +++ /dev/null @@ -1,26 +0,0 @@ - diff --git a/web-admin/src/features/billing/issues/useBillingIssueMessage.ts b/web-admin/src/features/billing/issues/useBillingIssueMessage.ts index bbc80690b17..849e842fe79 100644 --- a/web-admin/src/features/billing/issues/useBillingIssueMessage.ts +++ b/web-admin/src/features/billing/issues/useBillingIssueMessage.ts @@ -8,7 +8,6 @@ import { isTeamPlan, } from "@rilldata/web-admin/features/billing/plans/utils"; import { useCategorisedOrganizationBillingIssues } from "@rilldata/web-admin/features/billing/selectors"; -import { areAllProjectsHibernating } from "@rilldata/web-admin/features/organizations/selectors"; import type { BannerMessage } from "@rilldata/web-common/lib/event-bus/events"; import { derived } from "svelte/store"; @@ -32,32 +31,20 @@ export function useBillingIssueMessage(organization: string) { [ createAdminServiceGetOrganization(organization), useCategorisedOrganizationBillingIssues(organization), - areAllProjectsHibernating(organization), ], - ([orgResp, categorisedIssuesResp, allProjectsHibernatingResp]) => { - if ( - orgResp.isLoading || - categorisedIssuesResp.isLoading || - allProjectsHibernatingResp.isLoading - ) { + ([orgResp, categorisedIssuesResp]) => { + if (orgResp.isLoading || categorisedIssuesResp.isLoading) { return { isFetching: true, isLoading: true, error: undefined, }; } - if ( - orgResp.error || - categorisedIssuesResp.error || - allProjectsHibernatingResp.error - ) { + if (orgResp.error || categorisedIssuesResp.error) { return { isFetching: false, isLoading: false, - error: - orgResp.error ?? - categorisedIssuesResp.error ?? - allProjectsHibernatingResp.error, + error: orgResp.error ?? categorisedIssuesResp.error, }; } @@ -100,24 +87,6 @@ export function useBillingIssueMessage(organization: string) { }; } - if (allProjectsHibernatingResp.data) { - return { - isFetching: false, - isLoading: false, - error: undefined, - data: { - type: "default", - title: "Your org’s projects are hibernating.", - description: "", - iconType: "sleep", - cta: { - type: "wake-projects", - text: "Wake projects", - }, - }, - }; - } - return { isFetching: false, isLoading: false, diff --git a/web-admin/src/features/organizations/selectors.ts b/web-admin/src/features/organizations/selectors.ts index fd552749ad9..757ed9adbd4 100644 --- a/web-admin/src/features/organizations/selectors.ts +++ b/web-admin/src/features/organizations/selectors.ts @@ -4,26 +4,7 @@ import { type V1GetOrganizationResponse, type V1Organization, } from "@rilldata/web-admin/client"; -import { listProjectsForOrgQueryOptions } from "@rilldata/web-admin/features/projects/list-projects-query-options"; -import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient"; import type { FetchQueryOptions } from "@tanstack/query-core"; -import { createQuery } from "@tanstack/svelte-query"; - -export function areAllProjectsHibernating(organization: string) { - return createQuery({ - ...listProjectsForOrgQueryOptions(organization), - select: (data) => - data.projects?.length && - data.projects.every((p) => !p.primaryDeploymentId), - }); -} - -export async function fetchAllProjectsHibernating(organization: string) { - const projectsResp = await queryClient.fetchQuery( - listProjectsForOrgQueryOptions(organization), - ); - return projectsResp.projects?.every((p) => !p.primaryDeploymentId) ?? false; -} function normalizeOrganization( organization: string | V1Organization | undefined, diff --git a/web-admin/src/routes/[organization]/+page.svelte b/web-admin/src/routes/[organization]/+page.svelte index f3084a86e71..d7756a6b97f 100644 --- a/web-admin/src/routes/[organization]/+page.svelte +++ b/web-admin/src/routes/[organization]/+page.svelte @@ -1,8 +1,6 @@ @@ -49,11 +44,6 @@ {/if} - {:else if $allProjectsHibernating.data} - {:else}
diff --git a/web-admin/src/routes/[organization]/[project]/+layout.ts b/web-admin/src/routes/[organization]/[project]/+layout.ts index c53d813c0be..538b1baa8fc 100644 --- a/web-admin/src/routes/[organization]/[project]/+layout.ts +++ b/web-admin/src/routes/[organization]/[project]/+layout.ts @@ -1,11 +1,7 @@ -import { type RpcStatus } from "@rilldata/web-admin/client"; -import { hasBlockerIssues } from "@rilldata/web-admin/features/billing/selectors"; import { extractBranchFromPath } from "@rilldata/web-admin/features/branches/branch-utils.ts"; import { maybeRedirectToEditableDeployment } from "@rilldata/web-admin/features/branches/deployment-utils.ts"; import { isEditPage } from "@rilldata/web-admin/features/navigation/nav-utils.ts"; -import { fetchAllProjectsHibernating } from "@rilldata/web-admin/features/organizations/selectors"; -import { error, redirect } from "@sveltejs/kit"; -import { isAxiosError } from "axios"; +import { error } from "@sveltejs/kit"; export const load = async ({ params: { organization, project }, @@ -13,26 +9,10 @@ export const load = async ({ route, url, }) => { - const { organizationPermissions, issues } = await parent(); + const { organizationPermissions } = await parent(); if (!organizationPermissions.manageOrg) return; - let projectHibernating = false; - try { - projectHibernating = await fetchAllProjectsHibernating(organization); - } catch (e) { - if (!isAxiosError(e) || !e.response) { - throw error(500, "Error fetching projects for the organization"); - } - - throw error(e.response.status, e.response.data.message); - } - - // if all projects were hibernated due to a blocker issue on org then take the user to projects page - if (hasBlockerIssues(issues) && projectHibernating) { - throw redirect(307, `/${organization}`); - } - // Edit pages handle their own branch routing; everything below is non-edit only. if (isEditPage({ route })) return;