Skip to content

Commit a6aeef0

Browse files
committed
Small cleanup of NanN display and license type
1 parent 153a7d6 commit a6aeef0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Frontend/src/composables/serviceLicense.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const emptyLicense: License = {
2525
license_status: LicenseStatus.Unavailable,
2626
license_extension_url: "",
2727
licenseEdition: computed(() => {
28-
return license.license_type && license.edition ? ", " + license.edition : "";
28+
return `${license.license_type}${license.edition ? `, ${license.edition}` : ""}`;
2929
}),
3030
formattedInstanceName: computed(() => {
3131
return license.instance_name || "Upgrade ServiceControl to v3.4.0+ to see more information about this license";
@@ -115,6 +115,7 @@ function getSubscriptionDaysLeft(license: UnwrapNestedRefs<License>) {
115115
const isExpiring = license.license_status === "ValidWithExpiringSubscription";
116116

117117
const expiringIn = useGetDayDiffFromToday(license.expiration_date);
118+
if (isNaN(expiringIn)) return "";
118119
if (!isExpiring) return " - " + expiringIn + " days left";
119120
if (expiringIn === 0) return " - expiring today";
120121
if (expiringIn === 1) return " - expiring tomorrow";
@@ -127,6 +128,7 @@ function getTrialDaysLeft(license: UnwrapNestedRefs<License>) {
127128
const isExpiring = license.license_status === "ValidWithExpiringTrial";
128129

129130
const expiringIn = useGetDayDiffFromToday(license.expiration_date);
131+
if (isNaN(expiringIn)) return "";
130132
if (!isExpiring) return " - " + expiringIn + " days left";
131133
if (expiringIn === 0) return " - expiring today";
132134
if (expiringIn === 1) return " - expiring tomorrow";
@@ -137,6 +139,7 @@ function getUpgradeDaysLeft(license: UnwrapNestedRefs<License>) {
137139
if (license.license_status === "InvalidDueToExpiredUpgradeProtection") return " - expired";
138140

139141
const expiringIn = useGetDayDiffFromToday(license.upgrade_protection_expiration);
142+
if (isNaN(expiringIn)) return "";
140143
if (expiringIn <= 0) return " - expired";
141144
if (expiringIn === 0) return " - expiring today";
142145
if (expiringIn === 1) return " - 1 day left";

0 commit comments

Comments
 (0)