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

Conversation

SasSwart
Copy link
Contributor

@SasSwart SasSwart commented Nov 29, 2024

This PR is the first iteration towards #15297

We cannot yet show license utilization over time, so we show current license utilization.
This is because we don't track user states over time. We only track the current user state. A graph over time filtering by active users would therefore not account for day to day changes in user state and be inaccurate.
DB schema migrations and related updates will follow that allow us to show license utilization over time.

image

@SasSwart SasSwart marked this pull request as ready for review November 29, 2024 09:38
Copy link

github-actions bot commented Nov 29, 2024


✔️ PR 15683 Updated successfully.
🚀 Access the credentials here.

cc: @SasSwart

@SasSwart SasSwart requested review from johnstcn and removed request for BrunoQuaresma November 29, 2024 11:10
Comment on lines 84 to 85
{entitlements!.features.user_limit.actual}/
{entitlements!.features.user_limit.limit} users)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to give these a similar treatment to licenseUtilizationPercentage and check if we can evaluate them based on whether entitlements is nil?

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor suggestion, otherwise LGTM (deferring approval for fe).

entitlements?.features?.user_limit?.limit
? entitlements.features.user_limit.actual /
entitlements.features.user_limit.limit
: undefined;
Copy link
Member

@mafredri mafredri Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Instead of just doing the percentage here, we could prepare the data format in a more convenient way to use in the template:

	const licenseInfo =
		entitlements?.features?.user_limit?.actual &&
		entitlements?.features?.user_limit?.limit
			? {
				valid: true,
				actual: entitlements.features.user_limit.actual,
				limit: entitlements.features.user_limit.limit
			} : {
				valid: false,
				actual: 0,
				limit: 0,
			};

Might not need to even init the actual/limit for the zero case but added it just in case.

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock.

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. Thanks for digging into the problem and finding the right solution.

One minor thing, that we can do after merge, is to improve the design a bit. cc.: @chrifro

Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@@ -42,6 +42,7 @@ const meta: Meta<typeof GeneralSettingsPageView> = {
deploymentDAUs: MockDeploymentDAUResponse,
invalidExperiments: [],
safeExperiments: [],
entitlements: undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
entitlements: undefined,

undefined is JavaScript's equivalent to a zero value, this doesn't do anything

…ralSettingsPageView.tsx

Co-authored-by: ケイラ <mckayla@hey.com>
@SasSwart SasSwart merged commit 7e1ac2e into main Dec 2, 2024
28 checks passed
@SasSwart SasSwart deleted the jjs/15297 branch December 2, 2024 19:27
stirby pushed a commit that referenced this pull request Dec 2, 2024
This PR is the first iteration towards #15297

We cannot yet show license utilization over time, so we show current
license utilization.
This is because we don't track user states over time. We only track the
current user state. A graph over time filtering by active users would
therefore not account for day to day changes in user state and be
inaccurate.
DB schema migrations and related updates will follow that allow us to
show license utilization over time.

![image](https://github.com/user-attachments/assets/91bd6e8c-e74c-4ef5-aa6b-271fd245da37)

---------

Co-authored-by: ケイラ <mckayla@hey.com>
(cherry picked from commit 7e1ac2e)
stirby added a commit that referenced this pull request Dec 3, 2024
- #15589
- #15683
- #15671

---------

Co-authored-by: Hugo Dutka <hugo@coder.com>
Co-authored-by: Sas Swart <sas.swart.cdk@gmail.com>
Co-authored-by: Spike Curtis <spike@coder.com>
Co-authored-by: Cian Johnston <cian@coder.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants