Skip to content

Commit

Permalink
Bug 2037625: Always show RQ charts
Browse files Browse the repository at this point in the history
I spoke to Yadan and it sounds like there are user experience issues with the existing chart behavior for ResourceQuotas. Yadan thought it would be better to always display the charts rather than only display them if certain data points are set. I am removing the checks for all RQs, CRQs, and ACRQs so we can display the charts.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2037625
  • Loading branch information
rebeccaalpert committed Feb 9, 2022
1 parent b21bc03 commit e9d4df8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Card, CardBody, CardHeader, CardTitle } from '@patternfly/react-core';
import ResourceQuotaBody from '@console/shared/src/components/dashboard/resource-quota-card/ResourceQuotaBody';
import ResourceQuotaItem from '@console/shared/src/components/dashboard/resource-quota-card/ResourceQuotaItem';
import AppliedClusterResourceQuotaItem from '@console/shared/src/components/dashboard/resource-quota-card/AppliedClusterResourceQuotaItem';
import { getQuotaResourceTypes, hasComputeResources } from '../../resource-quota';
import { FirehoseResult, FirehoseResource } from '../../utils';
import { AppliedClusterResourceQuotaModel, ResourceQuotaModel } from '../../../models';
import { withDashboardResources, DashboardItemProps } from '../with-dashboard-resources';
Expand Down Expand Up @@ -56,26 +55,22 @@ export const ResourceQuotaCard = withDashboardResources(
</CardHeader>
<CardBody>
<ResourceQuotaBody error={!!rqLoadError} isLoading={!rqLoaded}>
{quotas
.filter((rq) => hasComputeResources(getQuotaResourceTypes(rq)))
.map((rq) => (
<ResourceQuotaItem key={rq.metadata.uid} resourceQuota={rq} />
))}
{quotas.map((rq) => (
<ResourceQuotaItem key={rq.metadata.uid} resourceQuota={rq} />
))}
</ResourceQuotaBody>
<ResourceQuotaBody
error={!!acrqLoadError}
isLoading={!acrqLoaded}
noText={t('public~No AppliedClusterResourceQuotas')}
>
{clusterQuotas
.filter((rq) => hasComputeResources(getQuotaResourceTypes(rq)))
.map((rq) => (
<AppliedClusterResourceQuotaItem
key={rq.metadata.uid}
resourceQuota={rq}
namespace={obj.metadata.name}
/>
))}
{clusterQuotas.map((rq) => (
<AppliedClusterResourceQuotaItem
key={rq.metadata.uid}
resourceQuota={rq}
namespace={obj.metadata.name}
/>
))}
</ResourceQuotaBody>
</CardBody>
</Card>
Expand Down
5 changes: 1 addition & 4 deletions frontend/public/components/resource-quota.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ export const hasComputeResources = (resourceTypes) => {
const Details = ({ obj: rq, match }) => {
const { t } = useTranslation();
const resourceTypes = getQuotaResourceTypes(rq);
const showChartRow = hasComputeResources(resourceTypes);
const scopes = rq.spec?.scopes ?? rq.spec?.quota?.scopes;
const reference = referenceFor(rq);
const isACRQ = reference === appliedClusterQuotaReference;
Expand All @@ -535,9 +534,7 @@ const Details = ({ obj: rq, match }) => {
<>
<div className="co-m-pane__body">
<SectionHeading text={text} />
{showChartRow && (
<QuotaGaugeCharts quota={rq} resourceTypes={resourceTypes} namespace={namespace} />
)}
<QuotaGaugeCharts quota={rq} resourceTypes={resourceTypes} namespace={namespace} />
<div className="row">
<div className="col-sm-6">
<ResourceSummary resource={rq}>
Expand Down

0 comments on commit e9d4df8

Please sign in to comment.