Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
23 changes: 20 additions & 3 deletions web/src/pages/settings/SettingsLdapPage/SettingsLdapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? '',
Expand Down Expand Up @@ -233,7 +238,9 @@ const PageForm = () => {
<SizedBox height={ThemeSpacing.Xl} />
<EvenSplit>
<form.AppField name="ldap_bind_password">
{(field) => <field.FormInput label="Bind password" required notNull />}
{(field) => (
<field.FormInput label="Bind password" required notNull type="password" />
)}
</form.AppField>
<form.AppField name="ldap_sync_groups">
{(field) => (
Expand Down Expand Up @@ -391,15 +398,25 @@ const PageForm = () => {
>
{({ isDefaultValue, isSubmitting }) => (
<>
<TooltipProvider disabled={!(!isAppLdapEnabled || !isDefaultValue)}>
<TooltipProvider
disabled={
!(!isAppLdapEnabled || !isDefaultValue) ||
!canUseBusinessLicenseCheck
}
>
<TooltipTrigger>
<div>
<Button
type="button"
variant="outlined"
text={`Test connection`}
iconLeft={IconKind.Refresh}
disabled={isSubmitting || !isDefaultValue || !isAppLdapEnabled}
disabled={
isSubmitting ||
!isDefaultValue ||
!isAppLdapEnabled ||
!canUseBusinessLicenseCheck
}
loading={testInProgress}
onClick={() => {
handleLdapTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
Loading