diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index 3207c225b2..d8a63e8790 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -258,7 +258,10 @@ "Statistics": "Statistics", "StorageManagement": "Storage management", "StoragePeriod": "Storage period", - "StorageQuotaWarningDescription": "Storage quota of {{quotaLimit}} is enabled for users of this {{productName}}. Limitations can occur during data import.", + "StorageQuotaWarningDescription": "Storage quota is enabled for this {{productName}}: {{roomsQuotaLimit}} for rooms, {{usersQuotaLimit}} for users. Limitations can occur during data import.", + "RoomsQuotaWarningDescription": "Storage quota is enabled for this {{productName}}: {{roomsQuotaLimit}} for rooms. Limitations can occur during data import.", + "UsersQuotaWarningDescription": "Storage quota is enabled for this {{productName}}: {{usersQuotaLimit}} for users. Limitations can occur during data import.", + "StudioTimeLanguageSettings": "Language and Time Zone Settings", "Submit": "Submit", "SuccessfullySaveGreetingSettingsMessage": "Welcome Page settings have been successfully saved", diff --git a/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.tsx b/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.tsx index d105e757e8..cf53f8b9f3 100644 --- a/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.tsx +++ b/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.tsx @@ -39,8 +39,34 @@ export const WarningQuotaDialog = ({ visible, onClickRedirect, onCloseDialog, - defaultQuota, + defaultRoomsQuota, + defaultUsersQuota, + isDefaultRoomsQuotaSet, + isDefaultUsersQuotaSet, }: WarningQuotaDialogProps) => { + const getWarningDescription = () => { + if (isDefaultRoomsQuotaSet && isDefaultUsersQuotaSet) { + return t("Settings:StorageQuotaWarningDescription", { + usersQuotaLimit: getConvertedSize(t, defaultUsersQuota), + roomsQuotaLimit: getConvertedSize(t, defaultRoomsQuota), + productName: t("Common:ProductName"), + }); + } + if (isDefaultRoomsQuotaSet) { + return t("Settings:RoomsQuotaWarningDescription", { + roomsQuotaLimit: getConvertedSize(t, defaultRoomsQuota), + productName: t("Common:ProductName"), + }); + } + if (isDefaultUsersQuotaSet) { + return t("Settings:UsersQuotaWarningDescription", { + usersQuotaLimit: getConvertedSize(t, defaultUsersQuota), + productName: t("Common:ProductName"), + }); + } + return ""; + }; + return ( {t("Common:Warning")} - {t("Settings:StorageQuotaWarningDescription", { - quotaLimit: getConvertedSize(t, defaultQuota), - productName: t("Common:ProductName"), - })} + {getWarningDescription()} {t("Settings:WantToContinue")} diff --git a/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.types.ts b/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.types.ts index 2d887912d4..a827e0431c 100644 --- a/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.types.ts +++ b/packages/client/src/components/dialogs/WarningQuotaDialog/WarningQuotaDialog.types.ts @@ -31,5 +31,8 @@ export interface WarningQuotaDialogProps { visible: boolean; onCloseDialog: () => void; onClickRedirect: () => void; - defaultQuota: number; + defaultRoomsQuota: number; + defaultUsersQuota: number; + isDefaultRoomsQuotaSet?: boolean; + isDefaultUsersQuotaSet?: boolean; } diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/components/SelectFileStep.tsx b/packages/client/src/pages/PortalSettings/categories/data-import/components/SelectFileStep.tsx index 35afcaf1c5..5cbde38822 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/components/SelectFileStep.tsx +++ b/packages/client/src/pages/PortalSettings/categories/data-import/components/SelectFileStep.tsx @@ -156,8 +156,8 @@ const SelectFileStep = (props: SelectFileStepProps) => { migratingWorkspace, setMigratingWorkspace, uploadFiles, - defaultUsersQuota, - defaultRoomsQuota, + defaultUsersQuota = 0, + defaultRoomsQuota = 0, isDefaultUsersQuotaSet, isDefaultRoomsQuotaSet, warningQuotaDialogVisible, @@ -168,7 +168,6 @@ const SelectFileStep = (props: SelectFileStepProps) => { migratorName === migratingWorkspace, ); const [progress, setProgress] = useState(0); - const [defaultQuota, setDefaultQuota] = useState(0); const [isInfiniteProgress, setIsInfiniteProgress] = useState(true); const [isNetworkError, setIsNetworkError] = useState(false); const [isFileError, setIsFileError] = useState(false); @@ -184,17 +183,11 @@ const SelectFileStep = (props: SelectFileStepProps) => { const navigate = useNavigate(); useEffect(() => { - setWarningQuotaDialogVisible( - isDefaultUsersQuotaSet || isDefaultRoomsQuotaSet, - ); - setDefaultQuota((defaultUsersQuota || defaultRoomsQuota) ?? 0); - }, [ - defaultUsersQuota, - defaultRoomsQuota, - isDefaultRoomsQuotaSet, - isDefaultUsersQuotaSet, - setWarningQuotaDialogVisible, - ]); + const isQuotaWarningVisible = + isDefaultUsersQuotaSet || isDefaultRoomsQuotaSet; + setWarningQuotaDialogVisible(isQuotaWarningVisible); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isDefaultUsersQuotaSet, isDefaultRoomsQuotaSet]); const onClickRedirect = () => { navigate("/portal-settings/management/disk-space"); @@ -510,7 +503,10 @@ const SelectFileStep = (props: SelectFileStepProps) => { visible={warningQuotaDialogVisible} onCloseDialog={() => setWarningQuotaDialogVisible(false)} onClickRedirect={onClickRedirect} - defaultQuota={defaultQuota} + defaultRoomsQuota={defaultRoomsQuota} + defaultUsersQuota={defaultUsersQuota} + isDefaultRoomsQuotaSet={isDefaultRoomsQuotaSet} + isDefaultUsersQuotaSet={isDefaultUsersQuotaSet} /> )}