From 0b7014e0404fb0047ba6673eee8cafb19bc87207 Mon Sep 17 00:00:00 2001 From: Gitar Date: Fri, 18 Oct 2024 12:22:56 +0000 Subject: [PATCH 1/3] [Gitar] Updating TypeScript files --- frontend/src/interfaces/uiConfig.ts | 1 - src/lib/types/experimental.ts | 5 ----- 2 files changed, 6 deletions(-) diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index ca6c80965b00..7d3356f8fc30 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -78,7 +78,6 @@ export type UiFlags = { featureSearchFeedbackPosting?: boolean; userAccessUIEnabled?: boolean; outdatedSdksBanner?: boolean; - displayTrafficDataUsage?: boolean; estimateTrafficDataCost?: boolean; disableShowContextFieldSelectionValues?: boolean; projectOverviewRefactorFeedback?: boolean; diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index d1b77a883240..107a8b2ce212 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -36,7 +36,6 @@ export type IFlagKey = | 'showInactiveUsers' | 'killScheduledChangeRequestCache' | 'collectTrafficDataUsage' - | 'displayTrafficDataUsage' | 'estimateTrafficDataCost' | 'useMemoizedActiveTokens' | 'queryMissingTokens' @@ -211,10 +210,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_COLLECT_TRAFFIC_DATA_USAGE, false, ), - displayTrafficDataUsage: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_DISPLAY_TRAFFIC_DATA_USAGE, - false, - ), estimateTrafficDataCost: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_ESTIMATE_TRAFFIC_DATA_COST, false, From 89d0a4238499e2569e3bd62a9aba2a7bab0ac29d Mon Sep 17 00:00:00 2001 From: Gitar Date: Fri, 18 Oct 2024 12:22:56 +0000 Subject: [PATCH 2/3] [Gitar] Updating TSX files --- .../BillingDashboard/BillingPlan/BillingPlan.tsx | 13 ++----------- .../NetworkTrafficUsage/NetworkTrafficUsage.tsx | 5 +---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx b/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx index 8d5a3a09c727..52e8f151c313 100644 --- a/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx +++ b/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx @@ -17,7 +17,6 @@ import { GridCol } from 'component/common/GridCol/GridCol'; import { Badge } from 'component/common/Badge/Badge'; import { GridColLink } from './GridColLink/GridColLink'; import { useTrafficDataEstimation } from 'hooks/useTrafficData'; -import { useUiFlag } from 'hooks/useUiFlag'; import { useInstanceTrafficMetrics } from 'hooks/api/getters/useInstanceTrafficMetrics/useInstanceTrafficMetrics'; const StyledPlanBox = styled('aside')(({ theme }) => ({ @@ -108,13 +107,11 @@ export const BillingPlan: FC = ({ instanceStatus }) => { const freeAssigned = Math.min(eligibleUsers.length, seats); const paidAssigned = eligibleUsers.length - freeAssigned; const paidAssignedPrice = price.user * paidAssigned; - - const displayTrafficDataUsageEnabled = useUiFlag('displayTrafficDataUsage'); const includedTraffic = isPro() ? proPlanIncludedRequests : 0; const traffic = useInstanceTrafficMetrics(currentPeriod.key); const overageCost = useMemo(() => { - if (!displayTrafficDataUsageEnabled || !includedTraffic) { + if (!includedTraffic) { return 0; } const trafficData = toChartData( @@ -124,13 +121,7 @@ export const BillingPlan: FC = ({ instanceStatus }) => { ); const totalTraffic = toTrafficUsageSum(trafficData); return calculateOverageCost(totalTraffic, includedTraffic); - }, [ - displayTrafficDataUsageEnabled, - includedTraffic, - traffic, - currentPeriod, - endpointsInfo, - ]); + }, [true, includedTraffic, traffic, currentPeriod, endpointsInfo]); const totalCost = planPrice + paidAssignedPrice + overageCost; diff --git a/frontend/src/component/admin/network/NetworkTrafficUsage/NetworkTrafficUsage.tsx b/frontend/src/component/admin/network/NetworkTrafficUsage/NetworkTrafficUsage.tsx index 1246cafe4c76..7735b3992a2b 100644 --- a/frontend/src/component/admin/network/NetworkTrafficUsage/NetworkTrafficUsage.tsx +++ b/frontend/src/component/admin/network/NetworkTrafficUsage/NetworkTrafficUsage.tsx @@ -23,7 +23,6 @@ import { Bar } from 'react-chartjs-2'; import { useInstanceTrafficMetrics } from 'hooks/api/getters/useInstanceTrafficMetrics/useInstanceTrafficMetrics'; import type { Theme } from '@mui/material/styles/createTheme'; import Grid from '@mui/material/Grid'; -import { useUiFlag } from 'hooks/useUiFlag'; import { NetworkTrafficUsagePlanSummary } from './NetworkTrafficUsagePlanSummary'; import annotationPlugin from 'chartjs-plugin-annotation'; import { @@ -197,8 +196,6 @@ export const NetworkTrafficUsage: VFC = () => { datasets, }; - const flagEnabled = useUiFlag('displayTrafficDataUsage'); - useEffect(() => { setDatasets(toChartData(labels, traffic, endpointsInfo)); }, [labels, traffic]); @@ -235,7 +232,7 @@ export const NetworkTrafficUsage: VFC = () => { return ( Not enabled.} elseShow={ <> From ce818ccff675e2993c90bd9354b74853fa23d4c6 Mon Sep 17 00:00:00 2001 From: David Leek Date: Wed, 23 Oct 2024 14:30:16 +0200 Subject: [PATCH 3/3] chore: remove boolean true as usememo dependency --- .../admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx b/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx index 52e8f151c313..e417cc654c94 100644 --- a/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx +++ b/frontend/src/component/admin/billing/BillingDashboard/BillingPlan/BillingPlan.tsx @@ -121,7 +121,7 @@ export const BillingPlan: FC = ({ instanceStatus }) => { ); const totalTraffic = toTrafficUsageSum(trafficData); return calculateOverageCost(totalTraffic, includedTraffic); - }, [true, includedTraffic, traffic, currentPeriod, endpointsInfo]); + }, [includedTraffic, traffic, currentPeriod, endpointsInfo]); const totalCost = planPrice + paidAssignedPrice + overageCost;