show/hide host metric subscription details

This commit is contained in:
Salma Kochay
2023-03-29 13:42:25 -04:00
committed by Hao Liu
parent 6d4f92e1e8
commit 64923e12fc

View File

@@ -24,7 +24,7 @@ const HelperText = styled(PFHelperText)`
`; `;
function SubscriptionDetail() { function SubscriptionDetail() {
const { me = {}, license_info, version } = useConfig(); const { me = {}, license_info, version, systemConfig } = useConfig();
const baseURL = '/settings/subscription'; const baseURL = '/settings/subscription';
const tabsArray = [ const tabsArray = [
{ {
@@ -56,35 +56,37 @@ function SubscriptionDetail() {
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardBody> <CardBody>
<DetailList> <DetailList>
<Detail {systemConfig?.SUBSCRIPTION_USAGE_MODEL === 'unique_managed_hosts' && (
dataCy="subscription-status" <Detail
label={t`Status`} dataCy="subscription-status"
value={ label={t`Status`}
license_info.compliant ? ( value={
<> license_info.compliant ? (
<Label variant="outline" color="green" icon={<CheckIcon />}> <>
{t`Compliant`} <Label variant="outline" color="green" icon={<CheckIcon />}>
</Label> {t`Compliant`}
<HelperText> </Label>
<HelperTextItem>{t`The number of hosts you have automated against is below your subscription count.`}</HelperTextItem> <HelperText>
</HelperText> <HelperTextItem>{t`The number of hosts you have automated against is below your subscription count.`}</HelperTextItem>
</> </HelperText>
) : ( </>
<> ) : (
<Label <>
variant="outline" <Label
color="red" variant="outline"
icon={<ExclamationCircleIcon />} color="red"
> icon={<ExclamationCircleIcon />}
{t`Out of compliance`} >
</Label> {t`Out of compliance`}
<HelperText> </Label>
<HelperTextItem>{t`You have automated against more hosts than your subscription allows.`}</HelperTextItem> <HelperText>
</HelperText> <HelperTextItem>{t`You have automated against more hosts than your subscription allows.`}</HelperTextItem>
</> </HelperText>
) </>
} )
/> }
/>
)}
{typeof automatedInstancesCount !== 'undefined' && {typeof automatedInstancesCount !== 'undefined' &&
automatedInstancesCount !== null && ( automatedInstancesCount !== null && (
<Detail <Detail
@@ -107,21 +109,27 @@ function SubscriptionDetail() {
label={t`Hosts imported`} label={t`Hosts imported`}
value={license_info.current_instances} value={license_info.current_instances}
/> />
<Detail {systemConfig?.SUBSCRIPTION_USAGE_MODEL === 'unique_managed_hosts' && (
dataCy="subscription-hosts-remaining" <Detail
label={t`Hosts remaining`} dataCy="subscription-hosts-remaining"
value={license_info.free_instances} label={t`Hosts remaining`}
/> value={license_info.free_instances}
<Detail />
dataCy="subscription-hosts-deleted" )}
label={t`Hosts deleted`} {systemConfig?.SUBSCRIPTION_USAGE_MODEL === 'unique_managed_hosts' && (
value={license_info.deleted_instances} <Detail
/> dataCy="subscription-hosts-deleted"
<Detail label={t`Hosts deleted`}
value={license_info.deleted_instances}
/>
)}
{systemConfig?.SUBSCRIPTION_USAGE_MODEL === 'unique_managed_hosts' && (
<Detail
dataCy="subscription-hosts-reactivated" dataCy="subscription-hosts-reactivated"
label={t`Active hosts previously deleted`} label={t`Active hosts previously deleted`}
value={license_info.reactivated_instances} value={license_info.reactivated_instances}
/> />
)}
{license_info.instance_count < 9999999 && ( {license_info.instance_count < 9999999 && (
<Detail <Detail
dataCy="subscription-hosts-available" dataCy="subscription-hosts-available"