Remove related code in DomainSelector
This commit is contained in:
@@ -8,65 +8,23 @@
|
|||||||
size="md"
|
size="md"
|
||||||
:label="userStore.currentDomain.domainName"
|
:label="userStore.currentDomain.domainName"
|
||||||
:disable-dropdown="true"
|
:disable-dropdown="true"
|
||||||
dropdown-icon='none'
|
dropdown-icon="none"
|
||||||
:disable="true"
|
:disable="true"
|
||||||
>
|
>
|
||||||
<q-list>
|
|
||||||
<q-item :active="isCurrentDomain(domain)" active-class="active-domain-item" v-for="domain in domains" :key="domain.domainName"
|
|
||||||
clickable v-close-popup @click="onItemClick(domain)">
|
|
||||||
<q-item-section side>
|
|
||||||
<q-icon name="share" size="sm" :color="isCurrentDomain(domain) ? 'orange': ''" text-color="white"></q-icon>
|
|
||||||
</q-item-section>
|
|
||||||
<q-item-section>
|
|
||||||
<q-item-label>{{domain.domainName}}</q-item-label>
|
|
||||||
<q-item-label caption>{{domain.kintoneUrl}}</q-item-label>
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-btn-dropdown>
|
</q-btn-dropdown>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts" >
|
<script setup lang="ts">
|
||||||
import { IDomainInfo } from 'src/types/DomainTypes';
|
|
||||||
import { useAuthStore } from 'stores/useAuthStore';
|
import { useAuthStore } from 'stores/useAuthStore';
|
||||||
import { useDomainStore } from 'src/stores/useDomainStore';
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
const userStore = useAuthStore();
|
const userStore = useAuthStore();
|
||||||
const domainStore = useDomainStore();
|
|
||||||
const route = useRoute()
|
|
||||||
const domains = computed(() => domainStore.userDomains);
|
|
||||||
|
|
||||||
(async ()=>{
|
|
||||||
await domainStore.loadUserDomains();
|
|
||||||
})();
|
|
||||||
|
|
||||||
const isUnclickable = computed(()=>{
|
|
||||||
return route.path.startsWith('/FlowChart/') || domains.value === undefined || domains.value.length === 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
const isCurrentDomain=(domain:IDomainInfo)=>{
|
|
||||||
return domain.id === userStore.currentDomain.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
const onItemClick=(domain:IDomainInfo)=>{
|
|
||||||
console.log(domain);
|
|
||||||
userStore.setCurrentDomain(domain);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.q-btn.disabled.customized-disabled-btn {
|
.q-btn.disabled.customized-disabled-btn {
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
cursor: default !important;
|
cursor: default !important;
|
||||||
}
|
|
||||||
|
|
||||||
.q-item.active-domain-item {
|
* {
|
||||||
color: inherit;
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.q-btn.disabled.customized-disabled-btn * {
|
|
||||||
cursor: default !important;
|
cursor: default !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -144,10 +144,6 @@ onMounted(async () => {
|
|||||||
await getApps();
|
await getApps();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => authStore.currentDomain.id, async () => {
|
|
||||||
await getApps();
|
|
||||||
});
|
|
||||||
|
|
||||||
const filterInitRows = (row: {id: string}) => {
|
const filterInitRows = (row: {id: string}) => {
|
||||||
return !rowIds.has(row.id);
|
return !rowIds.has(row.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,13 +142,11 @@
|
|||||||
import { ref, onMounted, computed } from 'vue';
|
import { ref, onMounted, computed } from 'vue';
|
||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
import { useAuthStore } from 'stores/useAuthStore';
|
import { useAuthStore } from 'stores/useAuthStore';
|
||||||
import { useDomainStore } from 'stores/useDomainStore';
|
|
||||||
import ShareDomainDialog from 'components/ShareDomain/ShareDomainDialog.vue';
|
import ShareDomainDialog from 'components/ShareDomain/ShareDomainDialog.vue';
|
||||||
import TableActionMenu from 'components/TableActionMenu.vue';
|
import TableActionMenu from 'components/TableActionMenu.vue';
|
||||||
import { IDomain, IDomainDisplay, IDomainOwnerDisplay, IDomainSubmit } from '../types/DomainTypes';
|
import { IDomain, IDomainDisplay, IDomainOwnerDisplay, IDomainSubmit } from '../types/DomainTypes';
|
||||||
|
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const domainStore = useDomainStore();
|
|
||||||
const inactiveRowClass = (row: IDomainOwnerDisplay) => row.domainActive ? '' : 'inactive-row';
|
const inactiveRowClass = (row: IDomainOwnerDisplay) => row.domainActive ? '' : 'inactive-row';
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@@ -329,7 +327,6 @@ const onSubmit = () => {
|
|||||||
await authStore.setCurrentDomain();
|
await authStore.setCurrentDomain();
|
||||||
}
|
}
|
||||||
getDomain();
|
getDomain();
|
||||||
domainStore.loadUserDomains();
|
|
||||||
closeDg();
|
closeDg();
|
||||||
onReset();
|
onReset();
|
||||||
addEditLoading.value = false;
|
addEditLoading.value = false;
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import { defineStore } from 'pinia';
|
|
||||||
import { api } from 'boot/axios';
|
|
||||||
import { IDomainInfo, IDomain } from '../types/DomainTypes';
|
|
||||||
|
|
||||||
export const useDomainStore = defineStore('domain', {
|
|
||||||
state: () => ({
|
|
||||||
userDomains: [] as IDomainInfo[],
|
|
||||||
}),
|
|
||||||
actions: {
|
|
||||||
async loadUserDomains(): Promise<IDomainInfo[]> {
|
|
||||||
const resp = await api.get(`api/domain`);
|
|
||||||
const domains = resp.data as IDomain[];
|
|
||||||
this.userDomains = domains
|
|
||||||
.filter(data => data.is_active)
|
|
||||||
.map((data) => ({
|
|
||||||
id: data.id,
|
|
||||||
domainName: data.name,
|
|
||||||
kintoneUrl: data.url,
|
|
||||||
}));
|
|
||||||
return this.userDomains;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user