Web: Added ability to set default quota in section header of accounts.

This commit is contained in:
Tatiana Lopaeva 2023-08-14 13:01:49 +03:00
parent 084deba6c8
commit 148c0bfde7
4 changed files with 40 additions and 0 deletions

View File

@ -178,6 +178,18 @@ class AccessRightsStore {
return true; return true;
}; };
canSetDefaultQuota = () => {
const {
isOwner,
isAdmin,
isCustomQuota = true,
} = this.authStore.userStore.user;
if (!isOwner && !isAdmin) return false;
return isCustomQuota;
};
} }
export default AccessRightsStore; export default AccessRightsStore;

View File

@ -6,6 +6,7 @@ import InviteAgainReactSvgUrl from "PUBLIC_DIR/images/invite.again.react.svg?url
import DeleteReactSvgUrl from "PUBLIC_DIR/images/delete.react.svg?url"; import DeleteReactSvgUrl from "PUBLIC_DIR/images/delete.react.svg?url";
import ChangQuotaReactSvgUrl from "PUBLIC_DIR/images/change.quota.react.svg?url"; import ChangQuotaReactSvgUrl from "PUBLIC_DIR/images/change.quota.react.svg?url";
import DisableQuotaReactSvgUrl from "PUBLIC_DIR/images/disable.quota.react.svg?url"; import DisableQuotaReactSvgUrl from "PUBLIC_DIR/images/disable.quota.react.svg?url";
import DefaultQuotaReactSvgUrl from "PUBLIC_DIR/images/default.quota.react.svg?url";
import { makeAutoObservable } from "mobx"; import { makeAutoObservable } from "mobx";
import GroupsStore from "./GroupsStore"; import GroupsStore from "./GroupsStore";
import UsersStore from "./UsersStore"; import UsersStore from "./UsersStore";
@ -212,6 +213,7 @@ class PeopleStore {
hasFreeUsers, hasFreeUsers,
hasUsersToChangeQuota, hasUsersToChangeQuota,
hasUsersToDisableQuota, hasUsersToDisableQuota,
hasUsersToSetDefaultQuota,
selection, selection,
} = this.selectionStore; } = this.selectionStore;
const { const {
@ -312,6 +314,14 @@ class PeopleStore {
iconUrl: ChangQuotaReactSvgUrl, iconUrl: ChangQuotaReactSvgUrl,
onClick: () => this.changeUserQuota(selection), onClick: () => this.changeUserQuota(selection),
}, },
{
id: "menu-default-quota",
key: "default-quota",
label: "Set to default",
disabled: !hasUsersToSetDefaultQuota,
iconUrl: DefaultQuotaReactSvgUrl,
onClick: () => console.log("set to default", selection),
},
{ {
id: "menu-disable-quota", id: "menu-disable-quota",
key: "disable-quota", key: "disable-quota",

View File

@ -258,6 +258,12 @@ class SelectionStore {
return this.selection.every((x) => canDisableQuota(x)); return this.selection.every((x) => canDisableQuota(x));
} }
get hasUsersToSetDefaultQuota() {
const { canSetDefaultQuota } = this.peopleStore.accessRightsStore;
return this.selection.every((x) => canSetDefaultQuota(x));
}
} }
export default SelectionStore; export default SelectionStore;

View File

@ -0,0 +1,12 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_924_27536)">
<path d="M2.09426 12.5C2.26966 12.6708 2.60177 12.905 3.14478 13.1426C4.28496 13.6414 5.99999 14 8 14C10 14 11.715 13.6414 12.8552 13.1426C13.3982 12.905 13.7303 12.6708 13.9057 12.5L14 12.3945V11L16 9.5V12.5C16 14.433 12.4183 16 8 16C3.58172 16 0 14.433 0 12.5L0 9.5L2 11V12.3945L2.09426 12.5Z" fill="#333333"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.01128 6.76371C1.17589 7.40504 0 8.39245 0 9.50001C0 11.433 3.58172 13 8 13C12.4183 13 16 11.433 16 9.50001C16 8.39245 14.8241 7.40504 12.9887 6.76371C12.981 6.76541 12.9732 6.76702 12.9654 6.76857L12.4946 6.86175L12.7615 7.26027C13.0502 7.69158 13.0533 8.2839 12.7055 8.72305C12.6912 8.74101 12.6769 8.75889 12.6625 8.77668C12.7284 8.80316 12.7927 8.8301 12.8552 8.85745C13.3982 9.09502 13.7303 9.32917 13.9057 9.50001C13.7303 9.67086 13.3982 9.905 12.8552 10.1426C11.715 10.6414 10 11 8 11C5.99999 11 4.28496 10.6414 3.14478 10.1426C2.60177 9.905 2.26966 9.67086 2.09426 9.50001C2.26966 9.32917 2.60177 9.09502 3.14478 8.85745C3.20731 8.8301 3.27158 8.80316 3.33752 8.77668C3.32309 8.75889 3.30876 8.74101 3.29453 8.72305C2.94668 8.2839 2.94978 7.69158 3.23854 7.26028L3.50536 6.86175L3.03461 6.76857C3.02681 6.76702 3.01903 6.76541 3.01128 6.76371Z" fill="#333333"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.1834 1.0695C5.09582 1.01086 4.98049 1.01297 4.89788 1.07841C4.59414 1.31901 4.31901 1.59414 4.07841 1.89788C4.01297 1.98049 4.01086 2.09582 4.0695 2.1834L4.72788 3.16676C4.58471 3.42176 4.47048 3.6952 4.38965 3.98262L3.22878 4.21241C3.12536 4.23289 3.04528 4.31598 3.0332 4.42072C3.01127 4.61077 3 4.80407 3 5C3 5.19593 3.01127 5.38923 3.0332 5.57928C3.04528 5.68402 3.12536 5.76712 3.22878 5.78759L4.38965 6.01738C4.47048 6.3048 4.58471 6.57824 4.72788 6.83324L4.0695 7.8166C4.01086 7.90418 4.01297 8.01951 4.07841 8.10212C4.31901 8.40586 4.59414 8.68099 4.89788 8.92159C4.98049 8.98703 5.09582 8.98914 5.1834 8.9305L6.16676 8.27212C6.42176 8.41529 6.6952 8.52952 6.98262 8.61035L7.21241 9.77122C7.23289 9.87464 7.31598 9.95472 7.42072 9.9668C7.61077 9.98873 7.80407 10 8 10C8.19593 10 8.38923 9.98873 8.57928 9.9668C8.68402 9.95472 8.76712 9.87464 8.78759 9.77122L9.01738 8.61035C9.3048 8.52952 9.57824 8.41529 9.83324 8.27212L10.8166 8.9305C10.9042 8.98914 11.0195 8.98703 11.1021 8.92159C11.4059 8.68099 11.681 8.40586 11.9216 8.10212C11.987 8.01951 11.9891 7.90418 11.9305 7.8166L11.2721 6.83324C11.4153 6.57824 11.5295 6.3048 11.6103 6.01738L12.7712 5.78759C12.8746 5.76712 12.9547 5.68402 12.9668 5.57928C12.9887 5.38923 13 5.19593 13 5C13 4.80407 12.9887 4.61077 12.9668 4.42072C12.9547 4.31598 12.8746 4.23289 12.7712 4.21241L11.6104 3.98262C11.5295 3.6952 11.4153 3.42176 11.2721 3.16676L11.9305 2.1834C11.9891 2.09582 11.987 1.98049 11.9216 1.89788C11.681 1.59414 11.4059 1.31901 11.1021 1.07841C11.0195 1.01297 10.9042 1.01086 10.8166 1.0695L9.83324 1.72788C9.57824 1.58471 9.3048 1.47048 9.01738 1.38965L8.78759 0.228784C8.76712 0.125357 8.68402 0.0452805 8.57928 0.0331962C8.38923 0.01127 8.19593 0 8 0C7.80407 0 7.61077 0.01127 7.42072 0.0331962C7.31598 0.0452805 7.23289 0.125357 7.21241 0.228784L6.98262 1.38965C6.6952 1.47048 6.42176 1.58471 6.16676 1.72788L5.1834 1.0695ZM9.25 5C9.25 5.69036 8.69035 6.25 8 6.25C7.30964 6.25 6.75 5.69036 6.75 5C6.75 4.30964 7.30964 3.75 8 3.75C8.69035 3.75 9.25 4.30964 9.25 5Z" fill="#333333"/>
</g>
<defs>
<clipPath id="clip0_924_27536">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB