feat(webui): display task count by type in activity bar tooltip

This commit is contained in:
Gauthier Roebroeck 2021-07-06 09:39:24 +08:00
parent eda767aeb5
commit 6b690bcdfb
4 changed files with 14 additions and 4 deletions

View file

@ -5,10 +5,12 @@ import {Module} from "vuex";
const vuexModule: Module<any, any> = {
state: {
taskCount: 0,
taskCountByType: {} as { [key: string]: number },
},
mutations: {
setTaskCount (state, val) {
state.taskCount = val
setTaskCount (state, event) {
state.taskCount = event.count
state.taskCountByType = event.countByType
},
},
}

View file

@ -98,6 +98,6 @@ export default class KomgaSseService {
private updateTaskCount(event: any) {
const data = JSON.parse(event.data) as TaskQueueSseDto
this.store.commit('setTaskCount', data.count)
this.store.commit('setTaskCount', data)
}
}

View file

@ -44,6 +44,7 @@ export interface ThumbnailSeriesSseDto {
export interface TaskQueueSseDto {
count: number,
countByType: { [key: string]: number }
}
export interface BookImportSseDto {

View file

@ -42,7 +42,11 @@
v-on="on"
/>
</template>
<span>{{ $tc('common.pending_tasks', taskCount) }}</span>
<div class="mb-2">{{ $tc('common.pending_tasks', taskCount) }}</div>
<div v-for="taskType in Object.keys(taskCountByType)"
:key="taskType"
>{{ taskType }}: {{ taskCountByType[taskType] }}
</div>
</v-tooltip>
</v-list-item>
@ -213,6 +217,9 @@ export default Vue.extend({
taskCount(): number {
return this.$store.state.komgaSse.taskCount
},
taskCountByType(): { [key: string]: number } {
return this.$store.state.komgaSse.taskCountByType
},
libraries(): LibraryDto[] {
return this.$store.state.komgaLibraries.libraries
},