mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): fix console resource usage tooltip (#6629)
This commit is contained in:
parent
5a522226d5
commit
fa6f8ef498
1 changed files with 44 additions and 44 deletions
|
@ -104,54 +104,54 @@ function PlanUsage({ periodicUsage: rawPeriodicUsage }: Props) {
|
||||||
isEnterprisePlan ||
|
isEnterprisePlan ||
|
||||||
(onlyShowPeriodicUsage && (key === 'mauLimit' || key === 'tokenLimit'))
|
(onlyShowPeriodicUsage && (key === 'mauLimit' || key === 'tokenLimit'))
|
||||||
)
|
)
|
||||||
.map((key) => {
|
.map((key) => ({
|
||||||
const parsedUsage = getUsageByKey(key, {
|
usage: getUsageByKey(key, {
|
||||||
periodicUsage,
|
periodicUsage,
|
||||||
countBasedUsage: currentSubscriptionUsage,
|
countBasedUsage: currentSubscriptionUsage,
|
||||||
basicQuota: currentSubscriptionBasicQuota,
|
basicQuota: currentSubscriptionBasicQuota,
|
||||||
});
|
}),
|
||||||
return {
|
usageKey: 'subscription.usage.usage_description_with_limited_quota',
|
||||||
usage: parsedUsage,
|
titleKey: `subscription.usage.${titleKeyMap[key]}`,
|
||||||
usageKey: 'subscription.usage.usage_description_with_limited_quota',
|
unitPrice: usageKeyPriceMap[key],
|
||||||
titleKey: `subscription.usage.${titleKeyMap[key]}`,
|
...cond(
|
||||||
unitPrice: usageKeyPriceMap[key],
|
(key === 'tokenLimit' || key === 'mauLimit' || isPaidTenant) && {
|
||||||
...cond(
|
quota: currentSubscriptionQuota[key],
|
||||||
(key === 'tokenLimit' || key === 'mauLimit' || isPaidTenant) && {
|
}
|
||||||
quota: currentSubscriptionQuota[key],
|
),
|
||||||
}
|
...cond(
|
||||||
),
|
isPaidTenant && {
|
||||||
...cond(
|
basicQuota: currentSubscriptionBasicQuota[key],
|
||||||
isPaidTenant && {
|
// Do not show tooltip if the basic quota is null (unlimited) for m2m/API resource add-on.
|
||||||
basicQuota: currentSubscriptionBasicQuota[key],
|
...cond(
|
||||||
// Do not show tooltip if the basic quota is null (unlimited) and the usage is number-typed.
|
!(
|
||||||
...cond(
|
currentSubscriptionBasicQuota[key] === null &&
|
||||||
!(currentSubscriptionBasicQuota[key] === null && typeof parsedUsage === 'number') && {
|
(key === 'machineToMachineLimit' || key === 'resourcesLimit')
|
||||||
tooltipKey: `subscription.usage.${
|
) && {
|
||||||
isEnterprisePlan ? enterpriseTooltipKeyMap[key] : tooltipKeyMap[key]
|
tooltipKey: `subscription.usage.${
|
||||||
}`,
|
isEnterprisePlan ? enterpriseTooltipKeyMap[key] : tooltipKeyMap[key]
|
||||||
}
|
}`,
|
||||||
),
|
|
||||||
// Show tooltip for number-typed basic quota for 'organizationsLimit'.
|
|
||||||
...cond(
|
|
||||||
key === 'organizationsLimit' &&
|
|
||||||
typeof currentSubscriptionBasicQuota[key] === 'number' &&
|
|
||||||
currentSubscriptionBasicQuota[key] > 0 && {
|
|
||||||
tooltipKey:
|
|
||||||
'subscription.usage.organizations.tooltip_for_enterprise_with_numbered_basic_quota',
|
|
||||||
}
|
|
||||||
),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
// Hide the quota notice for Pro plans if the basic quota is 0.
|
|
||||||
// Per current pricing model design, it should apply to `enterpriseSsoLimit`.
|
|
||||||
...cond(
|
|
||||||
planId === ReservedPlanId.Pro &&
|
|
||||||
currentSubscriptionBasicQuota[key] === 0 && {
|
|
||||||
isQuotaNoticeHidden: true,
|
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
};
|
// Show tooltip for number-typed basic quota for 'organizationsLimit'.
|
||||||
});
|
...cond(
|
||||||
|
key === 'organizationsLimit' &&
|
||||||
|
typeof currentSubscriptionBasicQuota[key] === 'number' &&
|
||||||
|
currentSubscriptionBasicQuota[key] > 0 && {
|
||||||
|
tooltipKey:
|
||||||
|
'subscription.usage.organizations.tooltip_for_enterprise_with_numbered_basic_quota',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
// Hide the quota notice for Pro plans if the basic quota is 0.
|
||||||
|
// Per current pricing model design, it should apply to `enterpriseSsoLimit`.
|
||||||
|
...cond(
|
||||||
|
planId === ReservedPlanId.Pro &&
|
||||||
|
currentSubscriptionBasicQuota[key] === 0 && {
|
||||||
|
isQuotaNoticeHidden: true,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in a new issue