mirror of
https://github.com/ansible/awx.git
synced 2024-10-30 05:25:29 +03:00
Update instance groups
* Simplify criteria to instance group to be considered unavailable * Round values for used capacity See: https://github.com/ansible/awx/issues/7467
This commit is contained in:
parent
aa637d515a
commit
21330a54cb
@ -39,13 +39,6 @@ function InstanceGroupDetails({ instanceGroup, i18n }) {
|
||||
|
||||
const { error, dismissError } = useDismissableError(deleteError);
|
||||
|
||||
const isAvailable = item => {
|
||||
return (
|
||||
(item.policy_instance_minimum || item.policy_instance_percentage) &&
|
||||
item.capacity
|
||||
);
|
||||
};
|
||||
|
||||
const verifyIsIsolated = item => {
|
||||
if (item.is_isolated) {
|
||||
return (
|
||||
@ -89,10 +82,12 @@ function InstanceGroupDetails({ instanceGroup, i18n }) {
|
||||
dataCy="instance-group-policy-instance-percentage"
|
||||
content={`${instanceGroup.policy_instance_percentage} %`}
|
||||
/>
|
||||
{isAvailable(instanceGroup) ? (
|
||||
{instanceGroup.capacity ? (
|
||||
<DetailBadge
|
||||
label={i18n._(t`Used capacity`)}
|
||||
content={`${100 - instanceGroup.percent_capacity_remaining} %`}
|
||||
content={`${Math.round(
|
||||
100 - instanceGroup.percent_capacity_remaining
|
||||
)} %`}
|
||||
dataCy="instance-group-used-capacity"
|
||||
/>
|
||||
) : (
|
||||
|
@ -60,23 +60,16 @@ function InstanceGroupListItem({
|
||||
}) {
|
||||
const labelId = `check-action-${instanceGroup.id}`;
|
||||
|
||||
const isAvailable = item => {
|
||||
return (
|
||||
(item.policy_instance_minimum || item.policy_instance_percentage) &&
|
||||
item.capacity
|
||||
);
|
||||
};
|
||||
|
||||
const isContainerGroup = item => {
|
||||
return item.is_containerized;
|
||||
};
|
||||
|
||||
function usedCapacity(item) {
|
||||
if (!isContainerGroup(item)) {
|
||||
if (isAvailable(item)) {
|
||||
if (item.capacity) {
|
||||
return (
|
||||
<Progress
|
||||
value={100 - item.percent_capacity_remaining}
|
||||
value={Math.round(100 - item.percent_capacity_remaining)}
|
||||
measureLocation={ProgressMeasureLocation.top}
|
||||
size={ProgressSize.sm}
|
||||
title={i18n._(t`Used capacity`)}
|
||||
|
@ -53,7 +53,7 @@ function InstanceListItem({
|
||||
if (item.enabled) {
|
||||
return (
|
||||
<Progress
|
||||
value={100 - item.percent_capacity_remaining}
|
||||
value={Math.round(100 - item.percent_capacity_remaining)}
|
||||
measureLocation={ProgressMeasureLocation.top}
|
||||
size={ProgressSize.sm}
|
||||
title={i18n._(t`Used capacity`)}
|
||||
|
Loading…
Reference in New Issue
Block a user