From 31f889734d737e4a237a0357441e1642f7ae8fbb Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Tue, 31 May 2022 17:09:13 -0230 Subject: [PATCH 1/2] Fixes calculation for total_egress_modified --- .../interfaces/Billing/Subscription/Subscription.tsx | 4 +--- studio/hooks/queries/useProjectPaygStatistics.ts | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/studio/components/interfaces/Billing/Subscription/Subscription.tsx b/studio/components/interfaces/Billing/Subscription/Subscription.tsx index 2c1dcb66f09..c56b86c5677 100644 --- a/studio/components/interfaces/Billing/Subscription/Subscription.tsx +++ b/studio/components/interfaces/Billing/Subscription/Subscription.tsx @@ -3,11 +3,9 @@ import dayjs from 'dayjs' import { sum } from 'lodash' import { useRouter } from 'next/router' import { Loading, Button } from '@supabase/ui' -import { Dictionary } from '@supabase/grid' - import { formatBytes } from 'lib/helpers' import { STRIPE_PRODUCT_IDS } from 'lib/constants' -import { useStore, useSubscriptionStats } from 'hooks' +import { useStore } from 'hooks' import CostBreakdownRow from './CostBreakdownRow' import { StripeSubscription } from './Subscription.types' import { deriveFeatureCost, deriveProductCost } from '../PAYGUsage/PAYGUsage.utils' diff --git a/studio/hooks/queries/useProjectPaygStatistics.ts b/studio/hooks/queries/useProjectPaygStatistics.ts index 37b11a69ec5..ee4507ff5e4 100644 --- a/studio/hooks/queries/useProjectPaygStatistics.ts +++ b/studio/hooks/queries/useProjectPaygStatistics.ts @@ -50,7 +50,7 @@ function getPaygStats(data: any): PaygStats { let dataModified: any = [] data.map((x: any) => { - dataModified.push({ ...x, total_egress_modified: x.total_egress == undefined ? 0 : x.total_egress - x.total_storage_egress == undefined ? 0 : x.total_storage_egress }) + dataModified.push({ ...x, total_egress_modified: (x.total_egress == undefined ? 0 : x.total_egress) - (x.total_storage_egress == undefined ? 0 : x.total_storage_egress) }) }) chargeableProducts.forEach((product) => { @@ -73,5 +73,6 @@ function getPaygStats(data: any): PaygStats { } }) }) + return paygStats } From 42eb1d7a6158ddf087a51f344a365e1c188b44d7 Mon Sep 17 00:00:00 2001 From: Hieu Pham Date: Wed, 1 Jun 2022 14:35:54 +0700 Subject: [PATCH 2/2] chore: clean up org.project_limit (#7074) * chore: clean up unused org.project_limit * chore: tidy up Organization interface --- .../BillingSettings/AWSMarketplaceSubscription.tsx | 3 +-- studio/types/base.ts | 7 +------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/studio/components/interfaces/Organization/BillingSettings/AWSMarketplaceSubscription.tsx b/studio/components/interfaces/Organization/BillingSettings/AWSMarketplaceSubscription.tsx index 5a7acdac437..cf175daa039 100644 --- a/studio/components/interfaces/Organization/BillingSettings/AWSMarketplaceSubscription.tsx +++ b/studio/components/interfaces/Organization/BillingSettings/AWSMarketplaceSubscription.tsx @@ -9,8 +9,7 @@ const AWSMarketplaceSubscription: FC = ({ organization }) => { return (
- This organization is subscribed via AWS Marketplace, with a limit of{' '} - {organization.project_limit} projects and expiring on{' '} + This organization is subscribed via AWS Marketplace. The subscription expires on{' '} {organization.aws_marketplace.Entitlements[0].ExpirationDate.slice(0, 10)}. diff --git a/studio/types/base.ts b/studio/types/base.ts index 7d7bf5145f8..f89b9da7edf 100644 --- a/studio/types/base.ts +++ b/studio/types/base.ts @@ -3,13 +3,8 @@ export interface Organization { slug: string name: string billing_email: string - project_limit: number - members: any[] - projects: any[] is_owner?: boolean stripe_customer_id?: string - total_free_projects?: number - total_paid_projects?: number } export interface ProjectBase { @@ -38,7 +33,7 @@ export interface Project extends ProjectBase { * We use this status to check if a project instance is HEALTHY or not * If not we will show ConnectingState and run a polling until it's back online */ - postgrestStatus?: 'ONLINE' | 'OFFLINE' + postgrestStatus?: 'ONLINE' | 'OFFLINE' } export interface User {