Remove related code in DomainSelector
This commit is contained in:
@@ -8,65 +8,23 @@
|
||||
size="md"
|
||||
:label="userStore.currentDomain.domainName"
|
||||
:disable-dropdown="true"
|
||||
dropdown-icon='none'
|
||||
dropdown-icon="none"
|
||||
: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>
|
||||
|
||||
</template>
|
||||
<script setup lang="ts" >
|
||||
import { IDomainInfo } from 'src/types/DomainTypes';
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
import { useDomainStore } from 'src/stores/useDomainStore';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
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>
|
||||
<style lang="scss">
|
||||
.q-btn.disabled.customized-disabled-btn {
|
||||
opacity: 1 !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>
|
||||
|
||||
@@ -144,10 +144,6 @@ onMounted(async () => {
|
||||
await getApps();
|
||||
});
|
||||
|
||||
watch(() => authStore.currentDomain.id, async () => {
|
||||
await getApps();
|
||||
});
|
||||
|
||||
const filterInitRows = (row: {id: string}) => {
|
||||
return !rowIds.has(row.id);
|
||||
}
|
||||
|
||||
@@ -142,13 +142,11 @@
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { api } from 'boot/axios';
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
import { useDomainStore } from 'stores/useDomainStore';
|
||||
import ShareDomainDialog from 'components/ShareDomain/ShareDomainDialog.vue';
|
||||
import TableActionMenu from 'components/TableActionMenu.vue';
|
||||
import { IDomain, IDomainDisplay, IDomainOwnerDisplay, IDomainSubmit } from '../types/DomainTypes';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const domainStore = useDomainStore();
|
||||
const inactiveRowClass = (row: IDomainOwnerDisplay) => row.domainActive ? '' : 'inactive-row';
|
||||
|
||||
const columns = [
|
||||
@@ -329,7 +327,6 @@ const onSubmit = () => {
|
||||
await authStore.setCurrentDomain();
|
||||
}
|
||||
getDomain();
|
||||
domainStore.loadUserDomains();
|
||||
closeDg();
|
||||
onReset();
|
||||
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