some UI
This commit is contained in:
@@ -29,14 +29,14 @@
|
||||
|
||||
<template v-slot:item="props">
|
||||
<div class="q-pa-sm">
|
||||
<domain-card :item="props.row">
|
||||
<domain-card :item="props.row" :active-id="activeDomainId">
|
||||
<template v-slot:actions>
|
||||
<q-card-actions align="right">
|
||||
<q-chip v-if="isActive(props.row.id)" outline color="teal" text-color="white" icon="done">
|
||||
<q-chip class="no-border" v-if="isActive(props.row.id)" outline color="primary" text-color="white" icon="done">
|
||||
既定
|
||||
</q-chip>
|
||||
<q-btn flat v-else :loading="activeDomainLoadingId === props.row.id" :disable="deleteDomainLoadingId === props.row.id" @click="activeDomain(props.row)">既定にする</q-btn>
|
||||
<q-btn flat :disable="isNotOwner(props.row.id) || activeDomainLoadingId === props.row.id" :text-color="isNotOwner(props.row.id)?'grey':''" :loading="deleteDomainLoadingId === props.row.id" @click="clickDeleteConfirm(props.row)">削除</q-btn>
|
||||
<q-btn flat :disable="isNotOwner(props.row.owner.id) || activeDomainLoadingId === props.row.id" :text-color="isNotOwner(props.row.owner.id)?'grey':''" :loading="deleteDomainLoadingId === props.row.id" @click="clickDeleteConfirm(props.row)">削除</q-btn>
|
||||
</q-card-actions>
|
||||
</template>
|
||||
</domain-card>
|
||||
@@ -70,6 +70,7 @@
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { api } from 'boot/axios';
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
import { IDomainOwnerDisplay } from '../types/DomainTypes';
|
||||
|
||||
import ShowDialog from 'components/ShowDialog.vue';
|
||||
import DomainCard from 'components/UserDomain/DomainCard.vue';
|
||||
@@ -77,7 +78,7 @@ import DomainSelect from 'components/DomainSelect.vue';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const pagination = ref({ sortBy: 'id', rowsPerPage: 0 });
|
||||
const rows = ref([] as any[]);
|
||||
const rows = ref<IDomainOwnerDisplay[]>([]);
|
||||
const rowIds = new Set<string>();
|
||||
const initLoading = ref(true);
|
||||
const addUserDomainLoading = ref(false);
|
||||
@@ -88,7 +89,7 @@ const columns = [
|
||||
{ name: 'id' },
|
||||
{ name: 'name', required: true, label: 'Name', align: 'left', field: 'name', sortable: true },
|
||||
{ name: 'url', align: 'center', label: 'Domain', field: 'url', sortable: true },
|
||||
{ name: 'kintoneuser', label: 'User', field: 'kintoneuser', sortable: true },
|
||||
{ name: 'kintoneuser', label: 'User', field: 'user', sortable: true },
|
||||
];
|
||||
const userDomainTableFilter = ref();
|
||||
|
||||
@@ -162,7 +163,7 @@ const isActive = computed(() => (id: number) => {
|
||||
});
|
||||
|
||||
const isNotOwner = computed(() => (ownerId: string) => {
|
||||
return ownerId == authStore.userId;
|
||||
return ownerId !== authStore.userId;
|
||||
});
|
||||
|
||||
const getDomain = async (userId? : string) => {
|
||||
@@ -171,16 +172,27 @@ const getDomain = async (userId? : string) => {
|
||||
activeDomainId.value = resp?.data?.data?.id;
|
||||
const domainResult = userId ? await api.get(`api/domain?userId=${userId}`) : await api.get(`api/domain`);
|
||||
const domains = domainResult.data as any[];
|
||||
rows.value = domains.reduce((acc, item) => {
|
||||
rows.value = domains.sort((a, b) => a.id - b.id).reduce((acc, item) => {
|
||||
rowIds.add(item.id);
|
||||
if (item.is_active) {
|
||||
acc.push({
|
||||
id: item.id,
|
||||
tenantid: item.tenantid,
|
||||
domainActive: item.is_active,
|
||||
name: item.name,
|
||||
url: item.url,
|
||||
kintoneuser: item.kintoneuser,
|
||||
ownerEmail: item.owner.email,
|
||||
owner: item.owner.first_name + ' ' + item.owner.last_name,
|
||||
user: item.kintoneuser,
|
||||
password: item.kintonepwd,
|
||||
owner: {
|
||||
id: item.owner.id,
|
||||
firstName: item.owner.first_name,
|
||||
lastName: item.owner.last_name,
|
||||
fullNameSearch: (item.owner.last_name + item.owner.first_name).toLowerCase(),
|
||||
fullName: item.owner.last_name + ' ' + item.owner.first_name,
|
||||
email: item.owner.email,
|
||||
isActive: item.owner.is_active,
|
||||
isSuperuser: item.owner.is_superuser,
|
||||
}
|
||||
})
|
||||
}
|
||||
return acc;
|
||||
|
||||
Reference in New Issue
Block a user