Skip to content

Commit 731683a

Browse files
authored
chore: display the starting date when the license becomes active (#21162)
display the the not before date from the licenses endpoint to display a Valid from license date in the UI
1 parent 7fc8ee4 commit 731683a

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

site/src/api/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ export type DeploymentConfig = Readonly<{
359359

360360
type Claims = {
361361
license_expires: number;
362+
// nbf is a standard JWT claim for "not before" - the license valid from date
363+
nbf?: number;
362364
account_type?: string;
363365
account_id?: string;
364366
trial: boolean;

site/src/pages/DeploymentSettingsPage/LicensesSettingsPage/LicenseCard.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ export const LicenseCard: FC<LicenseCardProps> = ({
8585
{userLimitActual} {` / ${currentUserLimit || "Unlimited"}`}
8686
</span>
8787
</Stack>
88+
{license.claims.nbf && (
89+
<Stack
90+
direction="column"
91+
spacing={0}
92+
alignItems="center"
93+
width="134px" // standardize width of date column
94+
>
95+
<span css={styles.secondaryMaincolor}>Valid From</span>
96+
<span css={styles.licenseExpires} className="license-valid-from">
97+
{dayjs.unix(license.claims.nbf).format("MMMM D, YYYY")}
98+
</span>
99+
</Stack>
100+
)}
88101
<Stack
89102
direction="column"
90103
spacing={0}

site/src/testHelpers/entities.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,7 @@ export const MockLicenseResponse: GetLicensesResponse[] = [
34833483
version: 1,
34843484
features: {},
34853485
license_expires: 3420244800,
3486+
nbf: 1660104000, // valid from 8/10/2022
34863487
},
34873488
},
34883489
{
@@ -3497,6 +3498,7 @@ export const MockLicenseResponse: GetLicensesResponse[] = [
34973498
version: 1,
34983499
features: {},
34993500
license_expires: 3420244800,
3501+
nbf: 1660104000, // valid from 8/10/2022
35003502
},
35013503
},
35023504
{
@@ -3510,6 +3512,7 @@ export const MockLicenseResponse: GetLicensesResponse[] = [
35103512
version: 1,
35113513
features: {},
35123514
license_expires: 3420244800,
3515+
nbf: 1660104000, // valid from 8/10/2022
35133516
},
35143517
},
35153518
{
@@ -3523,6 +3526,7 @@ export const MockLicenseResponse: GetLicensesResponse[] = [
35233526
version: 1,
35243527
features: {},
35253528
license_expires: 1660104000,
3529+
nbf: 1628568000, // valid from 8/10/2021
35263530
},
35273531
},
35283532
{
@@ -3536,6 +3540,7 @@ export const MockLicenseResponse: GetLicensesResponse[] = [
35363540
version: 1,
35373541
features: {},
35383542
license_expires: 1682346425,
3543+
nbf: 1650810425, // valid from 4/24/2022
35393544
},
35403545
},
35413546
];

0 commit comments

Comments
 (0)