Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gitar] Cleaning up stale flag: displayTrafficDataUsage with value true #8481

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => ({
Expand Down Expand Up @@ -108,13 +107,11 @@ export const BillingPlan: FC<IBillingPlanProps> = ({ 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(
Expand All @@ -124,13 +121,7 @@ export const BillingPlan: FC<IBillingPlanProps> = ({ instanceStatus }) => {
);
const totalTraffic = toTrafficUsageSum(trafficData);
return calculateOverageCost(totalTraffic, includedTraffic);
}, [
displayTrafficDataUsageEnabled,
includedTraffic,
traffic,
currentPeriod,
endpointsInfo,
]);
}, [true, includedTraffic, traffic, currentPeriod, endpointsInfo]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha took me a while to see this one. can probably remove the 'true' here xD


const totalCost = planPrice + paidAssignedPrice + overageCost;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -197,8 +196,6 @@ export const NetworkTrafficUsage: VFC = () => {
datasets,
};

const flagEnabled = useUiFlag('displayTrafficDataUsage');

useEffect(() => {
setDatasets(toChartData(labels, traffic, endpointsInfo));
}, [labels, traffic]);
Expand Down Expand Up @@ -235,7 +232,7 @@ export const NetworkTrafficUsage: VFC = () => {

return (
<ConditionallyRender
condition={isOss() || !flagEnabled}
condition={isOss()}
show={<Alert severity='warning'>Not enabled.</Alert>}
elseShow={
<>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/interfaces/uiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export type UiFlags = {
featureSearchFeedbackPosting?: boolean;
userAccessUIEnabled?: boolean;
outdatedSdksBanner?: boolean;
displayTrafficDataUsage?: boolean;
estimateTrafficDataCost?: boolean;
disableShowContextFieldSelectionValues?: boolean;
projectOverviewRefactorFeedback?: boolean;
Expand Down
5 changes: 0 additions & 5 deletions src/lib/types/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export type IFlagKey =
| 'showInactiveUsers'
| 'killScheduledChangeRequestCache'
| 'collectTrafficDataUsage'
| 'displayTrafficDataUsage'
| 'estimateTrafficDataCost'
| 'useMemoizedActiveTokens'
| 'queryMissingTokens'
Expand Down Expand Up @@ -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,
Expand Down
Loading