Skip to content

feat(site): show license utilization in general settings #15683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow license utilization to render gracefully when a user exceeds th…
…eir limit
  • Loading branch information
SasSwart committed Dec 2, 2024
commit 2e2bfb74fdffed58c4ad6ac9fc5222d46c0ba312
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,23 @@ export const HighLicenseUtilization: Story = {
},
};

export const ExceedsLicenseUtilization: Story = {
args: {
entitlements: {
...MockEntitlementsWithUserLimit,
features: {
...MockEntitlementsWithUserLimit.features,
user_limit: {
...MockEntitlementsWithUserLimit.features.user_limit,
enabled: true,
actual: 100,
limit: 95,
entitlement: "entitled",
},
},
},
},
};
export const NoLicenseLimit: Story = {
args: {
entitlements: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,35 @@ export const GeneralSettingsPageView: FC<GeneralSettingsPageViewProps> = ({
</div>
)}
{licenseUtilizationPercentage && (
<div css={{ marginBottom: 24, height: 200 }}>
<ChartSection title="License Utilization">
<LinearProgress
variant="determinate"
value={licenseUtilizationPercentage * 100}
css={{
height: 24,
borderRadius: 4,
marginBottom: 8,
}}
/>
<span
css={{
fontSize: "0.75rem",
display: "block",
textAlign: "right",
}}
>
{Math.round(licenseUtilizationPercentage * 100)}% used (
{entitlements!.features.user_limit.actual}/
{entitlements!.features.user_limit.limit} users)
</span>
</ChartSection>
</div>
<ChartSection title="License Utilization">
<LinearProgress
variant="determinate"
value={(licenseUtilizationPercentage % 1) * 100}
color={
licenseUtilizationPercentage < 0.9
? "primary"
: licenseUtilizationPercentage < 1
? "warning"
: "error"
}
css={{
height: 24,
borderRadius: 4,
marginBottom: 8,
}}
/>
<span
css={{
fontSize: "0.75rem",
display: "block",
textAlign: "right",
}}
>
{Math.round(licenseUtilizationPercentage * 100)}% used (
{entitlements!.features.user_limit.actual}/
{entitlements!.features.user_limit.limit} users)
</span>
</ChartSection>
)}
{invalidExperiments.length > 0 && (
<Alert severity="warning">
Expand Down
Loading