diff --git a/frontend/src/components/ShareDomain/ShareDomainDialog.vue b/frontend/src/components/ShareDomain/ShareDomainDialog.vue
index 0ea591b..9b69ec0 100644
--- a/frontend/src/components/ShareDomain/ShareDomainDialog.vue
+++ b/frontend/src/components/ShareDomain/ShareDomainDialog.vue
@@ -22,7 +22,8 @@
:display-value="canSharedUserFilter?`${canSharedUserFilter.fullName} (${canSharedUserFilter.email})`:''">
-
+
+
@@ -35,7 +36,13 @@
-
+
@@ -61,6 +68,10 @@ interface Props {
domain: IDomainOwnerDisplay;
}
+interface IUserDisplayWithShareRole extends IUserDisplay {
+ role: number;
+}
+
const props = defineProps();
const emit = defineEmits<{
@@ -69,17 +80,22 @@ const emit = defineEmits<{
}>();
const addLoading = ref(false);
-const removingUser = ref();
+const removingUser = ref();
const loading = ref(true);
const visible = ref(props.modelValue);
-const allUsers = ref([]);
-const sharedUsers = ref([]);
+const allUsers = ref([]);
+const sharedUsers = ref([]);
const sharedUsersIdSet = new Set();
-const canSharedUsers = ref([]);
-const canSharedUserFilter = ref();
-const canSharedUserFilteredOptions = ref([]);
+const canSharedUsers = ref([]);
+const canSharedUserFilter = ref();
+const canSharedUserFilteredOptions = ref([]);
+const roleOptions = [
+ { value: 0, label: '利用者' },
+ { value: 1, label: '管理者' },
+]
+const canSharedRole = ref<{value: number, label: string}>(roleOptions[0]);
const filterFn = (val:string, update: (cb: () => void) => void) => {
update(() => {
@@ -99,6 +115,9 @@ watch(
visible.value = newValue;
sharedUsers.value = [];
canSharedUserFilter.value = undefined
+ canSharedRole.value = roleOptions[0];
+ loading.value = false;
+ addLoading.value = false;
if (newValue) {
await loadShared();
}
@@ -130,7 +149,7 @@ const checkClose = () => {
}).onCancel(() => {
close();
}).onOk(() => {
- shareTo(canSharedUserFilter.value as IUserDisplay);
+ shareTo(canSharedUserFilter.value as IUserDisplayWithShareRole);
});
};
@@ -138,17 +157,21 @@ const close = () => {
emit('close');
};
-const shareTo = async (user: IUserDisplay) => {
+const shareTo = async (user: IUserDisplayWithShareRole) => {
addLoading.value = true;
loading.value = true;
- await api.post(`api/domain/${user.id}?domainid=${props.domain.id}`)
+ await api.post(`api/userdomain`, {
+ 'userid': user.id,
+ 'domainid': props.domain.id
+ })
await loadShared();
canSharedUserFilter.value = undefined;
+ canSharedRole.value = roleOptions[0];
loading.value = false;
addLoading.value = false;
}
-const removeShareTo = async (user: IUserDisplay) => {
+const removeShareTo = async (user: IUserDisplayWithShareRole) => {
removingUser.value = user;
loading.value = true;
await api.delete(`api/domain/${props.domain.id}/${user.id}`)
@@ -157,6 +180,25 @@ const removeShareTo = async (user: IUserDisplay) => {
removingUser.value = undefined;
};
+const updateSharedRole = async (user: IUserDisplayWithShareRole, role: number) => {
+ Dialog.create({
+ message: roleOptions[role].label + 'に切り替えますか?',
+ persistent: true,
+ ok: {
+ color: 'primary',
+ label: 'はい'
+ },
+ cancel: 'いいえ',
+ }).onCancel(() => {
+ user.role = role == 0 ? 1 : 0;
+ }).onOk(async () => {
+ loading.value = true;
+ // TODO
+ // await
+ loading.value = false;
+ });
+};
+
const loadShared = async () => {
loading.value = true;
sharedUsersIdSet.clear();
@@ -198,7 +240,8 @@ const itemToDisplay = (item: IUser) => {
email: item.email,
isSuperuser: item.is_superuser,
isActive: item.is_active,
- } as IUserDisplay
+ role: 0, // TODO
+ } as IUserDisplayWithShareRole
}
diff --git a/frontend/src/components/ShareDomain/SharingUserList.vue b/frontend/src/components/ShareDomain/SharingUserList.vue
index 8c244a5..08d52ee 100644
--- a/frontend/src/components/ShareDomain/SharingUserList.vue
+++ b/frontend/src/components/ShareDomain/SharingUserList.vue
@@ -11,7 +11,7 @@
-
+
diff --git a/frontend/src/pages/TenantDomain.vue b/frontend/src/pages/TenantDomain.vue
index 04a89d9..da0b6d8 100644
--- a/frontend/src/pages/TenantDomain.vue
+++ b/frontend/src/pages/TenantDomain.vue
@@ -112,23 +112,28 @@
+
ドメイン利用権限を確認中
-
-
- 削除してもよろしいですか?
-
-
+
+
ドメインは使用中です。削除してもよろしいですか?
+
+
+
+ 削除してもよろしいですか?
+
+
-
+
+
@@ -171,7 +176,7 @@ const columns = [
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
const loading = ref(false);
const addEditLoading = ref(false);
-const deleteLoadingState = ref(-1); // -1: loading, 0: allow, > 0: user count
+const deleteLoadingState = ref(-1); // -2: deleteLoading, -1: loading, 0: allow, > 0: user count
const filter = ref('');
const rows = ref([]);
@@ -269,15 +274,17 @@ async function removeRow(row: IDomainOwnerDisplay) {
}
const deleteDomain = () => {
+ deleteLoadingState.value = -2;
api.delete(`api/domain/${editId.value}`).then(({ data }) => {
if (!data.data) {
// TODO dialog
}
+ confirm.value = false;
+ deleteLoadingState.value = -1;
getDomain();
// authStore.setCurrentDomain();
})
editId.value = 0; // set in removeRow()
- deleteLoadingState.value = -1;
};
function editRow(row) {