-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0331eee
commit 7aac202
Showing
7 changed files
with
174 additions
and
82 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...e-shared/src/components/dashboard/resource-quota-card/AppliedClusterResourceQuotaItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as React from 'react'; | ||
import * as _ from 'lodash'; | ||
import { | ||
getQuotaResourceTypes, | ||
QuotaScopesInline, | ||
QuotaGaugeCharts, | ||
} from '@console/internal/components/resource-quota'; | ||
import { ResourceLink } from '@console/internal/components/utils/resource-link'; | ||
import { AppliedClusterResourceQuotaModel } from '@console/internal/models'; | ||
import { referenceForModel, K8sResourceKind } from '@console/internal/module/k8s'; | ||
|
||
import './resource-quota-card.scss'; | ||
|
||
const AppliedClusterResourceQuotaItem: React.FC<AppliedClusterResourceQuotaItemProps> = ({ | ||
resourceQuota, | ||
namespace, | ||
}) => { | ||
const resourceTypes = getQuotaResourceTypes(resourceQuota); | ||
const scopes = _.get(resourceQuota, 'spec.scopes'); | ||
return ( | ||
<> | ||
<div> | ||
<ResourceLink | ||
kind={referenceForModel(AppliedClusterResourceQuotaModel)} | ||
name={resourceQuota.metadata.name} | ||
className="co-resource-item--truncate co-resource-quota-card__item-title" | ||
namespace={namespace} | ||
inline | ||
/> | ||
{scopes && <QuotaScopesInline scopes={scopes} />} | ||
</div> | ||
<QuotaGaugeCharts | ||
quota={resourceQuota} | ||
resourceTypes={resourceTypes} | ||
namespace={namespace} | ||
chartClassName="co-resource-quota-card__chart" | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default AppliedClusterResourceQuotaItem; | ||
|
||
type AppliedClusterResourceQuotaItemProps = { | ||
resourceQuota: K8sResourceKind; | ||
namespace: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.