Client:Pages:LDAP:SyncContainer Fixed import cron

This commit is contained in:
Akmal Isomadinov 2024-06-19 21:11:48 +05:00
parent a4bd4846d2
commit 2e7d0904f6
2 changed files with 6 additions and 10 deletions

View File

@ -31,7 +31,7 @@ import { useTranslation } from "react-i18next";
import { Box } from "@docspace/shared/components/box";
import { Text } from "@docspace/shared/components/text";
import { Button, ButtonSize } from "@docspace/shared/components/button";
import { Cron } from "@docspace/shared/components/cron";
import { Cron, getNextSynchronization } from "@docspace/shared/components/cron";
import { toastr } from "@docspace/shared/components/toast";
import ProgressContainer from "./ProgressContainer";
@ -50,7 +50,6 @@ const SyncContainer = ({
onChangeCron,
cron,
serverCron,
nextSyncDate,
theme,
isLdapEnabledOnServer,
@ -87,6 +86,10 @@ const SyncContainer = ({
const buttonSize = isDesktop() ? ButtonSize.small : ButtonSize.normal;
const nextSyncDate = React.useMemo(() => {
if (cron) return getNextSynchronization(cron);
}, [cron]);
const renderBody = () => (
<Box className="ldap_sync-container">
{!isMobileView && (
@ -144,7 +147,7 @@ const SyncContainer = ({
/>
</div>
<Text fontSize="12px" fontWeight={600} lineHeight="16px" noSelect>
{`${t("LdapNextSync")}: ${nextSyncDate.toFormat("DDDD tt")} UTC`}
{`${t("LdapNextSync")}: ${nextSyncDate?.toFormat("DDDD tt")} UTC`}
</Text>
<Button
tabIndex={-1}
@ -186,7 +189,6 @@ export default inject(({ currentQuotaStore, settingsStore, ldapStore }) => {
onChangeCron,
cron,
serverCron,
nextSyncDate,
isUIDisabled,
@ -202,7 +204,6 @@ export default inject(({ currentQuotaStore, settingsStore, ldapStore }) => {
onChangeCron,
cron,
serverCron,
nextSyncDate,
theme,
isLdapEnabledOnServer: serverSettings.EnableLdapAuthentication,

View File

@ -7,7 +7,6 @@ import {
saveCronLdap,
getCronLdap,
} from "@docspace/shared/api/settings";
import { getNextSynchronization } from "@docspace/shared/components/cron";
import { EmployeeType, LDAPOperation } from "@docspace/shared/enums";
import { makeAutoObservable, runInAction } from "mobx";
import isEqual from "lodash/isEqual";
@ -567,10 +566,6 @@ class LdapFormStore {
this.cron = cron;
};
get nextSyncDate() {
return getNextSynchronization(this.cron ?? "* * * * *");
}
setIsSslEnabled = (enabled) => {
this.isSslEnabled = enabled;
};