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",
"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",

View File

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

View File

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

View File

@ -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}
/>
)}
</Wrapper>