filter
This commit is contained in:
1 parent
3082794436
commit
67d30a6f32
4 files changed
+16
-7
No files matched your search
+6
-2
@@ -1,13 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useEventSource } from '@vueuse/core'
|
import { useEventSource } from '@vueuse/core'
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
import { computed, onMounted, watch } from 'vue'
|
import { computed, onMounted, watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { useStatusStore } from '@/stores/status.ts'
|
import { useStatusStore } from '@/stores/status.ts'
|
||||||
import { useIssueStore } from '@/stores/issue.ts'
|
import { useIssueStore } from '@/stores/issue.ts'
|
||||||
|
import { useProjectStore } from '@/stores/project.ts'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const issueStore = useIssueStore()
|
const issueStore = useIssueStore()
|
||||||
const statusStore = useStatusStore()
|
const statusStore = useStatusStore()
|
||||||
|
const projectStore = useProjectStore()
|
||||||
|
const { currentProjectId } = storeToRefs(projectStore)
|
||||||
|
|
||||||
interface IssueSseEvent {
|
interface IssueSseEvent {
|
||||||
type: string
|
type: string
|
||||||
@@ -35,7 +39,7 @@ watch(data, () => {
|
|||||||
data.value?.type === 'issue.updated' ||
|
data.value?.type === 'issue.updated' ||
|
||||||
data.value?.type === 'issue.deleted'
|
data.value?.type === 'issue.deleted'
|
||||||
) {
|
) {
|
||||||
issueStore.getStat()
|
issueStore.getStat(currentProjectId.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -46,7 +50,7 @@ const layout = computed(() => {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await statusStore.list()
|
await statusStore.list()
|
||||||
await issueStore.getStat()
|
await issueStore.getStat(currentProjectId.value)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ export async function itemDelete(id: number) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function itemStat() {
|
export async function itemStat(projectId?: string) {
|
||||||
return apiClient.get<IssueStat>('/api/issues/stats')
|
const query = toQuery({ projectId: projectId })
|
||||||
|
return apiClient.get<IssueStat>(`/api/issues/stats${query}`)
|
||||||
}
|
}
|
||||||
+2
-2
@@ -75,9 +75,9 @@ export const useIssueStore = defineStore('item', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getStat(): Promise<IssueStat | undefined> {
|
async function getStat(projectId?: string | null): Promise<IssueStat | undefined> {
|
||||||
try {
|
try {
|
||||||
stats.value = await itemStat()
|
stats.value = await itemStat(projectId ?? undefined)
|
||||||
|
|
||||||
return stats.value
|
return stats.value
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -83,9 +83,13 @@ watch(currentProjectId, async () => {
|
|||||||
clearBatch()
|
clearBatch()
|
||||||
close()
|
close()
|
||||||
await load()
|
await load()
|
||||||
|
await issueStore.getStat(currentProjectId.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => await load())
|
onMounted(async () => {
|
||||||
|
await load()
|
||||||
|
await issueStore.getStat(currentProjectId.value)
|
||||||
|
})
|
||||||
const gridTemplate = computed(() => (selected.value.length ? '1fr 1fr' : '1fr'))
|
const gridTemplate = computed(() => (selected.value.length ? '1fr 1fr' : '1fr'))
|
||||||
const goToIssue = (key: string[]) => router.push(`/issues/${key[0]}`)
|
const goToIssue = (key: string[]) => router.push(`/issues/${key[0]}`)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user