Web: Client: Dialogs. WarningQuoataDialog. fixed display rooms quota and users quota

This commit is contained in:
Elyor Djalilov 2024-08-06 17:57:41 +05:00
parent 5385a81f5c
commit 0d7f50ba22
4 changed files with 47 additions and 22 deletions

View File

@ -258,7 +258,10 @@
"Statistics": "Statistics", "Statistics": "Statistics",
"StorageManagement": "Storage management", "StorageManagement": "Storage management",
"StoragePeriod": "Storage period", "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", "StudioTimeLanguageSettings": "Language and Time Zone Settings",
"Submit": "Submit", "Submit": "Submit",
"SuccessfullySaveGreetingSettingsMessage": "Welcome Page settings have been successfully saved", "SuccessfullySaveGreetingSettingsMessage": "Welcome Page settings have been successfully saved",

View File

@ -39,8 +39,34 @@ export const WarningQuotaDialog = ({
visible, visible,
onClickRedirect, onClickRedirect,
onCloseDialog, onCloseDialog,
defaultQuota, defaultRoomsQuota,
defaultUsersQuota,
isDefaultRoomsQuotaSet,
isDefaultUsersQuotaSet,
}: WarningQuotaDialogProps) => { }: 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 ( return (
<ModalDialog <ModalDialog
autoMaxHeight autoMaxHeight
@ -51,10 +77,7 @@ export const WarningQuotaDialog = ({
<ModalDialog.Header>{t("Common:Warning")}</ModalDialog.Header> <ModalDialog.Header>{t("Common:Warning")}</ModalDialog.Header>
<ModalDialog.Body> <ModalDialog.Body>
<Text noSelect style={{ marginBottom: "16px" }}> <Text noSelect style={{ marginBottom: "16px" }}>
{t("Settings:StorageQuotaWarningDescription", { {getWarningDescription()}
quotaLimit: getConvertedSize(t, defaultQuota),
productName: t("Common:ProductName"),
})}
</Text> </Text>
<Text noSelect>{t("Settings:WantToContinue")}</Text> <Text noSelect>{t("Settings:WantToContinue")}</Text>
</ModalDialog.Body> </ModalDialog.Body>

View File

@ -31,5 +31,8 @@ export interface WarningQuotaDialogProps {
visible: boolean; visible: boolean;
onCloseDialog: () => void; onCloseDialog: () => void;
onClickRedirect: () => void; onClickRedirect: () => void;
defaultQuota: number; defaultRoomsQuota: number;
defaultUsersQuota: number;
isDefaultRoomsQuotaSet?: boolean;
isDefaultUsersQuotaSet?: boolean;
} }

View File

@ -156,8 +156,8 @@ const SelectFileStep = (props: SelectFileStepProps) => {
migratingWorkspace, migratingWorkspace,
setMigratingWorkspace, setMigratingWorkspace,
uploadFiles, uploadFiles,
defaultUsersQuota, defaultUsersQuota = 0,
defaultRoomsQuota, defaultRoomsQuota = 0,
isDefaultUsersQuotaSet, isDefaultUsersQuotaSet,
isDefaultRoomsQuotaSet, isDefaultRoomsQuotaSet,
warningQuotaDialogVisible, warningQuotaDialogVisible,
@ -168,7 +168,6 @@ const SelectFileStep = (props: SelectFileStepProps) => {
migratorName === migratingWorkspace, migratorName === migratingWorkspace,
); );
const [progress, setProgress] = useState(0); const [progress, setProgress] = useState(0);
const [defaultQuota, setDefaultQuota] = useState(0);
const [isInfiniteProgress, setIsInfiniteProgress] = useState(true); const [isInfiniteProgress, setIsInfiniteProgress] = useState(true);
const [isNetworkError, setIsNetworkError] = useState(false); const [isNetworkError, setIsNetworkError] = useState(false);
const [isFileError, setIsFileError] = useState(false); const [isFileError, setIsFileError] = useState(false);
@ -184,17 +183,11 @@ const SelectFileStep = (props: SelectFileStepProps) => {
const navigate = useNavigate(); const navigate = useNavigate();
useEffect(() => { useEffect(() => {
setWarningQuotaDialogVisible( const isQuotaWarningVisible =
isDefaultUsersQuotaSet || isDefaultRoomsQuotaSet, isDefaultUsersQuotaSet || isDefaultRoomsQuotaSet;
); setWarningQuotaDialogVisible(isQuotaWarningVisible);
setDefaultQuota((defaultUsersQuota || defaultRoomsQuota) ?? 0); // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [isDefaultUsersQuotaSet, isDefaultRoomsQuotaSet]);
defaultUsersQuota,
defaultRoomsQuota,
isDefaultRoomsQuotaSet,
isDefaultUsersQuotaSet,
setWarningQuotaDialogVisible,
]);
const onClickRedirect = () => { const onClickRedirect = () => {
navigate("/portal-settings/management/disk-space"); navigate("/portal-settings/management/disk-space");
@ -510,7 +503,10 @@ const SelectFileStep = (props: SelectFileStepProps) => {
visible={warningQuotaDialogVisible} visible={warningQuotaDialogVisible}
onCloseDialog={() => setWarningQuotaDialogVisible(false)} onCloseDialog={() => setWarningQuotaDialogVisible(false)}
onClickRedirect={onClickRedirect} onClickRedirect={onClickRedirect}
defaultQuota={defaultQuota} defaultRoomsQuota={defaultRoomsQuota}
defaultUsersQuota={defaultUsersQuota}
isDefaultRoomsQuotaSet={isDefaultRoomsQuotaSet}
isDefaultUsersQuotaSet={isDefaultUsersQuotaSet}
/> />
)} )}
</Wrapper> </Wrapper>