Skip to content

Commit

Permalink
Merge pull request #4204 from dlabrecq/ocp2
Browse files Browse the repository at this point in the history
Fix when costDistribution dropdown is shown
  • Loading branch information
dlabrecq authored Feb 20, 2025
2 parents 9a9de90 + 057a995 commit 115f7d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/routes/details/ocpDetails/detailsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import React from 'react';
import type { WrappedComponentProps } from 'react-intl';
import { injectIntl } from 'react-intl';
import { connect } from 'react-redux';
import { ComputedReportItemValueType } from 'routes/components/charts/common';
import { CostDistribution } from 'routes/components/costDistribution';
import { Currency } from 'routes/components/currency';
import { DateRange } from 'routes/components/dateRange';
Expand Down Expand Up @@ -130,8 +129,6 @@ class DetailsHeaderBase extends React.Component<DetailsHeaderProps, DetailsHeade
const { currentDateRangeType } = this.state;

const showContent = report && !providersError && providers?.meta?.count > 0;
const showCostDistribution = costDistribution === ComputedReportItemValueType.distributed; // Always show -- see https://issues.redhat.com/browse/COST-5870

const { cost, infrastructureCost, supplementaryCost } = getTotalCost(report, costDistribution);

return (
Expand Down Expand Up @@ -169,7 +166,7 @@ class DetailsHeaderBase extends React.Component<DetailsHeaderProps, DetailsHeade
timeScopeValue={timeScopeValue}
/>
</FlexItem>
{showCostDistribution && (
{costDistribution && (
<FlexItem>
<CostDistribution costDistribution={costDistribution} onSelect={onCostDistributionSelect} />
</FlexItem>
Expand Down
6 changes: 2 additions & 4 deletions src/routes/explorer/explorerHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import React from 'react';
import type { WrappedComponentProps } from 'react-intl';
import { injectIntl } from 'react-intl';
import { connect } from 'react-redux';
import { ComputedReportItemValueType } from 'routes/components/charts/common';
import { CostDistribution } from 'routes/components/costDistribution';
import { CostType } from 'routes/components/costType';
import { Currency } from 'routes/components/currency';
Expand Down Expand Up @@ -304,9 +303,8 @@ class ExplorerHeaderBase extends React.Component<ExplorerHeaderProps, ExplorerHe
const tagPathsType = getTagReportPathsType(perspective);

const showContent = report && !providersError && providers?.meta?.count > 0;
const showCostDistribution = costDistribution === ComputedReportItemValueType.distributed; // Always show -- see https://issues.redhat.com/browse/COST-5870

const { cost, infrastructureCost, supplementaryCost } = getTotalCost(report, costDistribution);

const dateRange = intl.formatDateTimeRange(new Date(startDate + 'T00:00:00'), new Date(endDate + 'T00:00:00'), {
day: 'numeric',
month: 'long',
Expand Down Expand Up @@ -349,7 +347,7 @@ class ExplorerHeaderBase extends React.Component<ExplorerHeaderProps, ExplorerHe
tagPathsType={tagPathsType}
/>
</FlexItem>
{showCostDistribution && (
{costDistribution && (
<FlexItem>
<CostDistribution costDistribution={costDistribution} onSelect={onCostDistributionSelect} />
</FlexItem>
Expand Down

0 comments on commit 115f7d4

Please sign in to comment.