diff --git a/frontend/src/components/ShareDomain/ShareDomainDialog.vue b/frontend/src/components/ShareDomain/ShareDomainDialog.vue index dd7e99d..8922055 100644 --- a/frontend/src/components/ShareDomain/ShareDomainDialog.vue +++ b/frontend/src/components/ShareDomain/ShareDomainDialog.vue @@ -18,11 +18,17 @@ :options="canSharedUserFilteredOptions" clearable :placeholder="canSharedUserFilter ? '' : domain.domainActive ? '権限を付与するユーザーを選択' : 'ドメインが無効なため、権限を付与できません'" - @filter="filterFn" - :display-value="canSharedUserFilter?`${canSharedUserFilter.fullName} (${canSharedUserFilter.email})`:''"> + @filter="filterFn"> + + + + + + @@ -62,7 +82,8 @@ interface Props { } interface IUserDisplayWithShareRole extends IUserDisplay { - role: number; + isRemoving: boolean; + role: number; // 2: 所有者,1: 管理者, 0: 利用者 } const props = defineProps(); @@ -73,7 +94,6 @@ const emit = defineEmits<{ }>(); const addLoading = ref(false); -const removingUser = ref(); const loading = ref(true); const visible = ref(props.modelValue); @@ -158,12 +178,11 @@ const shareTo = async (user: IUserDisplayWithShareRole) => { } const removeShareTo = async (user: IUserDisplayWithShareRole) => { - removingUser.value = user; loading.value = true; + user.isRemoving = true; await api.delete(`api/domain/${props.domain.id}/${user.id}`) await loadShared(); loading.value = false; - removingUser.value = undefined; }; const loadShared = async () => { @@ -175,7 +194,7 @@ const loadShared = async () => { const val = itemToDisplay(item); sharedUsersIdSet.add(val.id); return val; - }); + }).reverse().sort((a: IUserDisplayWithShareRole, b: IUserDisplayWithShareRole) => b.role - a.role); canSharedUsers.value = allUsers.value.filter((item) => !sharedUsersIdSet.has(item.id)); canSharedUserFilteredOptions.value = canSharedUsers.value; @@ -197,6 +216,10 @@ const getUsers = async () => { loading.value = false; } +function isOwner(userId: number) { + return userId === props.domain.owner.id +} + const itemToDisplay = (item: IUser) => { return { id: item.id, @@ -207,7 +230,7 @@ const itemToDisplay = (item: IUser) => { email: item.email, isSuperuser: item.is_superuser, isActive: item.is_active, - role: 0, // TODO + role: isOwner(item.id) ? 2 : 0, // TODO } as IUserDisplayWithShareRole } diff --git a/frontend/src/components/ShareDomain/SharingUserList.vue b/frontend/src/components/ShareDomain/SharingUserList.vue index 08d52ee..5607889 100644 --- a/frontend/src/components/ShareDomain/SharingUserList.vue +++ b/frontend/src/components/ShareDomain/SharingUserList.vue @@ -10,10 +10,17 @@ - @@ -37,9 +44,10 @@ const columns = [ { name: 'id', label: 'ID', field: 'id', align: 'left', sortable: true }, { name: 'fullName', label: '名前', field: 'fullName', align: 'left', sortable: true }, { name: 'email', label: '電子メール', field: 'email', align: 'left', sortable: true }, + { name: 'role', label: '権限', field: 'role', align: 'left', sortable: true }, { name: 'actions', label: '', field: 'actions', sortable: false }, ]; const filter = ref(''); -const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 10 }); +const pagination = ref({ rowsPerPage: 10 }); \ No newline at end of file