diff --git a/web/src/pages/settings/SettingsIndexPage/tabs/SettingsLicenseTab/components/SettingsLicenseInfoSection/SettingsLicenseInfoSection.tsx b/web/src/pages/settings/SettingsIndexPage/tabs/SettingsLicenseTab/components/SettingsLicenseInfoSection/SettingsLicenseInfoSection.tsx index 2b597ad58..a6b3058fb 100644 --- a/web/src/pages/settings/SettingsIndexPage/tabs/SettingsLicenseTab/components/SettingsLicenseInfoSection/SettingsLicenseInfoSection.tsx +++ b/web/src/pages/settings/SettingsIndexPage/tabs/SettingsLicenseTab/components/SettingsLicenseInfoSection/SettingsLicenseInfoSection.tsx @@ -73,8 +73,8 @@ const ValidUntil = ({ validUntil }: ValidUntilProps) => { const nowDay = dayjs(); const diff = untilDay.diff(nowDay, 'days'); let res = untilDay.format('DD/MM/YYYY'); - if (diff > 0) { - res += ` (${diff} ${diff !== 1 ? 'days' : 'day'} left)`; + if (diff > 0 && diff <= 28) { + res += ` (${untilDay.fromNow(true)})`; } return res; }, [validUntil]); diff --git a/web/src/pages/settings/SettingsLdapPage/SettingsLdapPage.tsx b/web/src/pages/settings/SettingsLdapPage/SettingsLdapPage.tsx index d02dced69..a1d8eea52 100644 --- a/web/src/pages/settings/SettingsLdapPage/SettingsLdapPage.tsx +++ b/web/src/pages/settings/SettingsLdapPage/SettingsLdapPage.tsx @@ -120,6 +120,11 @@ const PageForm = () => { const { data: licenseInfo } = useSuspenseQuery(getLicenseInfoQueryOptions); const { data: settings } = useSuspenseQuery(getSettingsQueryOptions); + const canUseBusinessLicenseCheck = useMemo(() => { + if (licenseInfo === undefined) return false; + return canUseBusinessFeature(licenseInfo).result; + }, [licenseInfo]); + const defaultValues = useMemo((): FormFields => { return { ldap_group_search_base: settings?.ldap_group_search_base ?? '', @@ -233,7 +238,9 @@ const PageForm = () => { - {(field) => } + {(field) => ( + + )} {(field) => ( @@ -391,7 +398,12 @@ const PageForm = () => { > {({ isDefaultValue, isSubmitting }) => ( <> - + { variant="outlined" text={`Test connection`} iconLeft={IconKind.Refresh} - disabled={isSubmitting || !isDefaultValue || !isAppLdapEnabled} + disabled={ + isSubmitting || + !isDefaultValue || + !isAppLdapEnabled || + !canUseBusinessLicenseCheck + } loading={testInProgress} onClick={() => { handleLdapTest(); diff --git a/web/src/shared/components/PageTopBar/components/TopBarLicenseExpiration/TopBarLicenseExpiration.tsx b/web/src/shared/components/PageTopBar/components/TopBarLicenseExpiration/TopBarLicenseExpiration.tsx index 040f06359..158ec90e6 100644 --- a/web/src/shared/components/PageTopBar/components/TopBarLicenseExpiration/TopBarLicenseExpiration.tsx +++ b/web/src/shared/components/PageTopBar/components/TopBarLicenseExpiration/TopBarLicenseExpiration.tsx @@ -34,14 +34,14 @@ const Content = () => { const expiresDisplay = useMemo(() => { if (license === null || license.valid_until === null) return ''; - return dayjs(license.valid_until).fromNow(); + return dayjs.utc(license.valid_until).local().fromNow(); }, [license]); const daysToEnd = useMemo(() => { if (!isPresent(license)) return null; if (license.expired || license.valid_until === null) return 0; const current = dayjs(); - const expires = dayjs(license.valid_until); + const expires = dayjs.utc(license.valid_until).local(); return expires.diff(current, 'days'); }, [license]);