Web: Client: Dialogs. WarningQuoataDialog. added tenant quota limit

This commit is contained in:
Elyor Djalilov 2024-08-07 17:35:21 +05:00
parent 32cb80dd66
commit 5a541a02d2
5 changed files with 51 additions and 22 deletions

View File

@ -258,10 +258,10 @@
"Statistics": "Statistics",
"StorageManagement": "Storage management",
"StoragePeriod": "Storage period",
"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.",
"StorageQuotaWarningDescription": "Storage quota is enabled for this {{productName}}: {{quotaLimits}}. Limitations can occur during data import.",
"RoomsQuotaLimit": "{{roomsQuotaLimit}} for rooms",
"UsersQuotaLimit": "{{usersQuotaLimit}} for users",
"TenantQuotaLimit": "{{tenantQuotaLimit}} for {{productName}}",
"StudioTimeLanguageSettings": "Language and Time Zone Settings",
"Submit": "Submit",
"SuccessfullySaveGreetingSettingsMessage": "Welcome Page settings have been successfully saved",

View File

@ -41,30 +41,45 @@ export const WarningQuotaDialog = ({
onCloseDialog,
defaultRoomsQuota,
defaultUsersQuota,
tenantCustomQuota,
isDefaultRoomsQuotaSet,
isDefaultUsersQuotaSet,
isTenantCustomQuotaSet,
}: WarningQuotaDialogProps) => {
const getWarningDescription = () => {
if (isDefaultRoomsQuotaSet && isDefaultUsersQuotaSet) {
return t("Settings:StorageQuotaWarningDescription", {
usersQuotaLimit: getConvertedSize(t, defaultUsersQuota),
roomsQuotaLimit: getConvertedSize(t, defaultRoomsQuota),
productName: t("Common:ProductName"),
});
}
const quotaLimits = [];
if (isDefaultRoomsQuotaSet) {
return t("Settings:RoomsQuotaWarningDescription", {
roomsQuotaLimit: getConvertedSize(t, defaultRoomsQuota),
productName: t("Common:ProductName"),
});
quotaLimits.push(
t("Settings:RoomsQuotaLimit", {
roomsQuotaLimit: getConvertedSize(t, defaultRoomsQuota),
}),
);
}
if (isDefaultUsersQuotaSet) {
return t("Settings:UsersQuotaWarningDescription", {
usersQuotaLimit: getConvertedSize(t, defaultUsersQuota),
productName: t("Common:ProductName"),
});
quotaLimits.push(
t("Settings:UsersQuotaLimit", {
usersQuotaLimit: getConvertedSize(t, defaultUsersQuota),
}),
);
}
return "";
if (isTenantCustomQuotaSet) {
quotaLimits.push(
t("Settings:TenantQuotaLimit", {
tenantQuotaLimit: getConvertedSize(t, tenantCustomQuota),
productName: t("Common:ProductName"),
}),
);
}
if (quotaLimits.length === 0) {
return "";
}
return t("Settings:StorageQuotaWarningDescription", {
quotaLimits: quotaLimits.join(", "),
productName: t("Common:ProductName"),
});
};
return (

View File

@ -33,6 +33,8 @@ export interface WarningQuotaDialogProps {
onClickRedirect: () => void;
defaultRoomsQuota: number;
defaultUsersQuota: number;
tenantCustomQuota: number;
isDefaultRoomsQuotaSet?: boolean;
isDefaultUsersQuotaSet?: boolean;
isTenantCustomQuotaSet?: boolean;
}

View File

@ -158,8 +158,10 @@ const SelectFileStep = (props: SelectFileStepProps) => {
uploadFiles,
defaultUsersQuota = 0,
defaultRoomsQuota = 0,
tenantCustomQuota = 0,
isDefaultUsersQuotaSet,
isDefaultRoomsQuotaSet,
isTenantCustomQuotaSet,
warningQuotaDialogVisible,
setWarningQuotaDialogVisible,
} = props as InjectedSelectFileStepProps;
@ -184,10 +186,12 @@ const SelectFileStep = (props: SelectFileStepProps) => {
useEffect(() => {
const isQuotaWarningVisible =
isDefaultUsersQuotaSet || isDefaultRoomsQuotaSet;
isDefaultUsersQuotaSet ||
isDefaultRoomsQuotaSet ||
isTenantCustomQuotaSet;
setWarningQuotaDialogVisible(isQuotaWarningVisible);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isDefaultUsersQuotaSet, isDefaultRoomsQuotaSet]);
}, [isDefaultUsersQuotaSet, isDefaultRoomsQuotaSet, isTenantCustomQuotaSet]);
const onClickRedirect = () => {
navigate("/portal-settings/management/disk-space");
@ -505,8 +509,10 @@ const SelectFileStep = (props: SelectFileStepProps) => {
onClickRedirect={onClickRedirect}
defaultRoomsQuota={defaultRoomsQuota}
defaultUsersQuota={defaultUsersQuota}
tenantCustomQuota={tenantCustomQuota}
isDefaultRoomsQuotaSet={isDefaultRoomsQuotaSet}
isDefaultUsersQuotaSet={isDefaultUsersQuotaSet}
isTenantCustomQuotaSet={isTenantCustomQuotaSet}
/>
)}
</Wrapper>
@ -540,8 +546,10 @@ export default inject<TStore>(
const {
isDefaultRoomsQuotaSet,
isDefaultUsersQuotaSet,
isTenantCustomQuotaSet,
defaultUsersQuota,
defaultRoomsQuota,
tenantCustomQuota,
} = currentQuotaStore;
return {
@ -562,8 +570,10 @@ export default inject<TStore>(
uploadFiles,
defaultUsersQuota,
defaultRoomsQuota,
tenantCustomQuota,
isDefaultRoomsQuotaSet,
isDefaultUsersQuotaSet,
isTenantCustomQuotaSet,
warningQuotaDialogVisible,
setWarningQuotaDialogVisible,
};

View File

@ -72,8 +72,10 @@ export interface InjectedSelectFileStepProps extends SelectFileStepProps {
uploadFiles: TStore["importAccountsStore"]["uploadFiles"];
defaultUsersQuota: TStore["currentQuotaStore"]["defaultUsersQuota"];
defaultRoomsQuota: TStore["currentQuotaStore"]["defaultRoomsQuota"];
tenantCustomQuota: TStore["currentQuotaStore"]["tenantCustomQuota"];
isDefaultUsersQuotaSet: TStore["currentQuotaStore"]["isDefaultUsersQuotaSet"];
isDefaultRoomsQuotaSet: TStore["currentQuotaStore"]["isDefaultRoomsQuotaSet"];
isTenantCustomQuotaSet: TStore["currentQuotaStore"]["isTenantCustomQuotaSet"];
warningQuotaDialogVisible: TStore["dialogsStore"]["warningQuotaDialogVisible"];
setWarningQuotaDialogVisible: TStore["dialogsStore"]["setWarningQuotaDialogVisible"];
}