Skip to content

Commit

Permalink
feat: Remove successful model downloads (#1710)
Browse files Browse the repository at this point in the history
* feat: Remove successful model downloads

* PR comments

---------

Co-authored-by: Oto Ciulis <[email protected]>
  • Loading branch information
oto-ciulis-tt and otociulis authored Nov 27, 2024
1 parent 1ac6d65 commit 2d022e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div class="mx-6 mb-4" v-if="downloads.length > 0">
<div class="mx-6 mb-4" v-if="inProgressDownloads.length > 0">
<div class="text-lg my-4">
{{ $t('electronFileDownload.inProgress') }}
</div>

<template v-for="download in downloads" :key="download.url">
<template v-for="download in inProgressDownloads" :key="download.url">
<DownloadItem :download="download" />
</template>
</div>
Expand All @@ -16,5 +16,5 @@ import { useElectronDownloadStore } from '@/stores/electronDownloadStore'
import { storeToRefs } from 'pinia'
const electronDownloadStore = useElectronDownloadStore()
const { downloads } = storeToRefs(electronDownloadStore)
const { inProgressDownloads } = storeToRefs(electronDownloadStore)
</script>
4 changes: 2 additions & 2 deletions src/hooks/sidebarTabs/modelLibrarySidebarTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export const useModelLibrarySidebarTab = (): SidebarTabExtension => {
iconBadge: () => {
if (isElectron()) {
const electronDownloadStore = useElectronDownloadStore()
if (electronDownloadStore.downloads.length > 0) {
return electronDownloadStore.downloads.length.toString()
if (electronDownloadStore.inProgressDownloads.length > 0) {
return electronDownloadStore.inProgressDownloads.length.toString()
}
}

Expand Down
13 changes: 9 additions & 4 deletions src/stores/electronDownloadStore.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ref } from 'vue'
import { computed, ref } from 'vue'
import { defineStore } from 'pinia'
import { isElectron, electronAPI } from '@/utils/envUtil'
import type {
DownloadState,
import {
type DownloadState,
DownloadStatus
} from '@comfyorg/comfyui-electron-types'

Expand Down Expand Up @@ -69,6 +69,11 @@ export const useElectronDownloadStore = defineStore('downloads', () => {
resume,
cancel,
findByUrl,
initialize
initialize,
inProgressDownloads: computed(() =>
downloads.value.filter(
({ status }) => status !== DownloadStatus.COMPLETED
)
)
}
})

0 comments on commit 2d022e4

Please sign in to comment.