UI fix
This commit is contained in:
@@ -72,10 +72,13 @@ import { ref, watch, onMounted } from 'vue';
|
|||||||
import { IDomainOwnerDisplay } from '../../types/DomainTypes';
|
import { IDomainOwnerDisplay } from '../../types/DomainTypes';
|
||||||
import { IUser, IUserDisplay } from '../../types/UserTypes';
|
import { IUser, IUserDisplay } from '../../types/UserTypes';
|
||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
|
import { useAuthStore } from 'stores/useAuthStore';
|
||||||
import SharingUserList from 'components/ShareDomain/SharingUserList.vue';
|
import SharingUserList from 'components/ShareDomain/SharingUserList.vue';
|
||||||
import RoleLabel from 'components/ShareDomain/RoleLabel.vue';
|
import RoleLabel from 'components/ShareDomain/RoleLabel.vue';
|
||||||
import { Dialog } from 'quasar'
|
import { Dialog } from 'quasar'
|
||||||
|
|
||||||
|
const authStore = useAuthStore();
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
modelValue: boolean;
|
modelValue: boolean;
|
||||||
domain: IDomainOwnerDisplay;
|
domain: IDomainOwnerDisplay;
|
||||||
@@ -186,10 +189,17 @@ const removeShareTo = async (user: IUserDisplayWithShareRole) => {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
user.isRemoving = true;
|
user.isRemoving = true;
|
||||||
await props.removeSharedApi(user, props.domain);
|
await props.removeSharedApi(user, props.domain);
|
||||||
|
if (isCurrentDomain()) {
|
||||||
|
await authStore.loadCurrentDomain();
|
||||||
|
}
|
||||||
await loadShared();
|
await loadShared();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isCurrentDomain = () => {
|
||||||
|
return props.domain.id === authStore.currentDomain.id;
|
||||||
|
}
|
||||||
|
|
||||||
const loadShared = async () => {
|
const loadShared = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
sharedUsersIdSet.clear();
|
sharedUsersIdSet.clear();
|
||||||
|
|||||||
@@ -3,11 +3,15 @@
|
|||||||
<q-menu :max-width="maxWidth">
|
<q-menu :max-width="maxWidth">
|
||||||
<q-list dense :style="{ 'min-width': minWidth }">
|
<q-list dense :style="{ 'min-width': minWidth }">
|
||||||
<template v-for="(item, index) in actions" :key="index" >
|
<template v-for="(item, index) in actions" :key="index" >
|
||||||
<q-item v-if="isAction(item)" :class="item.class" clickable v-close-popup @click="item.action(row)">
|
<q-item v-if="isAction(item)" :disable="isFunction(item.disable) ? item.disable(row) : item.disable"
|
||||||
|
:class="item.class" clickable v-close-popup @click="item.action(row)">
|
||||||
<q-item-section side style="color: inherit;">
|
<q-item-section side style="color: inherit;">
|
||||||
<q-icon size="1.2em" :name="item.icon" />
|
<q-icon size="1.2em" :name="item.icon" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>{{ item.label }}</q-item-section>
|
<q-item-section>{{ item.label }}</q-item-section>
|
||||||
|
<q-tooltip v-if="item.tooltip && !isFunction(item.tooltip) || (isFunction(item.tooltip) && item.tooltip(row))" :delay="500" self="center middle">
|
||||||
|
{{ isFunction(item.tooltip) ? item.tooltip(row) : item.tooltip }}
|
||||||
|
</q-tooltip>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-separator v-else />
|
<q-separator v-else />
|
||||||
</template>
|
</template>
|
||||||
@@ -23,6 +27,8 @@ import { IDomainOwnerDisplay } from '../types/DomainTypes';
|
|||||||
interface Action {
|
interface Action {
|
||||||
label: string;
|
label: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
|
tooltip?: string|((row: IDomainOwnerDisplay) => string);
|
||||||
|
disable?: boolean|((row: IDomainOwnerDisplay) => boolean);
|
||||||
action: (row: any) => void|Promise<void>;
|
action: (row: any) => void|Promise<void>;
|
||||||
class?: string;
|
class?: string;
|
||||||
}
|
}
|
||||||
@@ -54,6 +60,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
isAction(item: MenuItem): item is Action {
|
isAction(item: MenuItem): item is Action {
|
||||||
return !('separator' in item);
|
return !('separator' in item);
|
||||||
|
},
|
||||||
|
|
||||||
|
isFunction(item: any): item is ((row: IDomainOwnerDisplay) => boolean|string) {
|
||||||
|
return typeof item === 'function';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
<!-- -1 loading -->
|
<!-- -1 loading -->
|
||||||
<q-card-section v-if="deleteLoadingState == -1" class="row items-center">
|
<q-card-section v-if="deleteLoadingState == -1" class="row items-center">
|
||||||
<q-spinner color="primary" size="2em"/>
|
<q-spinner color="primary" size="2em"/>
|
||||||
<span class="q-ml-sm">ドメイン利用/管理権限を確認中</span>
|
<span class="q-ml-sm">ドメイン利用権限を確認中</span>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<!-- > 0 can't delete -->
|
<!-- > 0 can't delete -->
|
||||||
<q-card-section v-else-if="deleteLoadingState > 0" class="row items-center">
|
<q-card-section v-else-if="deleteLoadingState > 0" class="row items-center">
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
<q-btn flat label="キャンセル" color="primary" v-close-popup />
|
<q-btn flat label="キャンセル" color="primary" v-close-popup />
|
||||||
<!-- > 0 can't delete -->
|
<!-- > 0 can't delete -->
|
||||||
<q-btn v-if="deleteLoadingState > 0" label="実行" color="primary" v-close-popup @click="openShareDg(SHARE_MANAGE, editId)" />
|
<q-btn v-if="deleteLoadingState > 0" label="実行" color="primary" v-close-popup @click="openShareDg(SHARE_USE, editId)" />
|
||||||
<!-- 0/-2 can delete -->
|
<!-- 0/-2 can delete -->
|
||||||
<q-btn flat v-else label="OK" :disabled="deleteLoadingState == -1" :loading="deleteLoadingState == -2" color="primary" @click="deleteDomain()" />
|
<q-btn flat v-else label="OK" :disabled="deleteLoadingState == -1" :loading="deleteLoadingState == -2" color="primary" @click="deleteDomain()" />
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
@@ -228,11 +228,17 @@ const SHARE_MANAGE = 'manage';
|
|||||||
const actionList = [
|
const actionList = [
|
||||||
{ label: '編集', icon: 'edit_note', action: editRow },
|
{ label: '編集', icon: 'edit_note', action: editRow },
|
||||||
{ label: '利用権限設定', icon: 'person_add_alt', action: (row: IDomainOwnerDisplay) => {openShareDg(SHARE_USE, row)} },
|
{ label: '利用権限設定', icon: 'person_add_alt', action: (row: IDomainOwnerDisplay) => {openShareDg(SHARE_USE, row)} },
|
||||||
{ label: '管理権限設定', icon: 'add_moderator', action: (row: IDomainOwnerDisplay) => {openShareDg(SHARE_MANAGE, row)} },
|
{ label: '管理権限設定', icon: 'add_moderator',
|
||||||
|
disable: (row: IDomainOwnerDisplay) => !isOwner(row),
|
||||||
|
tooltip: (row: IDomainOwnerDisplay) => isOwner(row) ? '' : 'ドメイン所有者でないため、操作できません',
|
||||||
|
action: (row: IDomainOwnerDisplay) => {openShareDg(SHARE_MANAGE, row)}
|
||||||
|
},
|
||||||
{ separator: true },
|
{ separator: true },
|
||||||
{ label: '削除', icon: 'delete_outline', class: 'text-red', action: removeRow },
|
{ label: '削除', icon: 'delete_outline', class: 'text-red', action: removeRow },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const isOwner = (row: IDomainOwnerDisplay) => row.owner.id === Number(authStore.userId);
|
||||||
|
|
||||||
const getDomain = async (filter?: (row: IDomainOwnerDisplay) => boolean) => {
|
const getDomain = async (filter?: (row: IDomainOwnerDisplay) => boolean) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const { data } = await api.get<{data:IDomain[]}>(`api/domains`);
|
const { data } = await api.get<{data:IDomain[]}>(`api/domains`);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const useAuthStore = defineStore('auth', {
|
|||||||
this.userId = tokenJson.sub;
|
this.userId = tokenJson.sub;
|
||||||
this.permissions = (tokenJson as any).permissions==='ALL' ? 'admin': 'user';
|
this.permissions = (tokenJson as any).permissions==='ALL' ? 'admin': 'user';
|
||||||
api.defaults.headers['Authorization'] = 'Bearer ' + this.token;
|
api.defaults.headers['Authorization'] = 'Bearer ' + this.token;
|
||||||
this.currentDomain = await this.getCurrentDomain();
|
await this.loadCurrentDomain();
|
||||||
this.userInfo = await this.getUserInfo();
|
this.userInfo = await this.getUserInfo();
|
||||||
router.push(this.returnUrl || '/');
|
router.push(this.returnUrl || '/');
|
||||||
return true;
|
return true;
|
||||||
@@ -69,10 +69,10 @@ export const useAuthStore = defineStore('auth', {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getCurrentDomain(): Promise<IDomainInfo> {
|
async loadCurrentDomain() {
|
||||||
const resp = await api.get(`api/defaultdomain`);
|
const resp = await api.get(`api/defaultdomain`);
|
||||||
const activedomain = resp?.data?.data;
|
const activedomain = resp?.data?.data;
|
||||||
return {
|
this.currentDomain = {
|
||||||
id: activedomain?.id,
|
id: activedomain?.id,
|
||||||
domainName: activedomain?.name,
|
domainName: activedomain?.name,
|
||||||
kintoneUrl: activedomain?.url,
|
kintoneUrl: activedomain?.url,
|
||||||
|
|||||||
Reference in New Issue
Block a user