polish for failed retry mechanic and consistent sub naming

This commit is contained in:
2026-02-04 15:02:50 -05:00
parent 2190a9c16b
commit 055808ea6d
6 changed files with 82 additions and 21 deletions
+44 -13
View File
@@ -173,7 +173,7 @@
</v-icon>
</template>
<v-list-item-title class="text-body-2">
{{ truncate(dl.url, 30) }}
{{ getDownloadLabel(dl) }}
</v-list-item-title>
<v-list-item-subtitle>
<v-chip size="x-small" :color="dl.status === 'running' ? 'info' : 'warning'" variant="tonal">
@@ -211,7 +211,7 @@
</v-icon>
</template>
<v-list-item-title>
{{ truncate(download.url, 40) }}
{{ getDownloadLabel(download) }}
</v-list-item-title>
<v-list-item-subtitle>
{{ formatRelativeTime(download.created_at) }}
@@ -255,20 +255,18 @@
<v-table v-if="sourcesWithErrors.length">
<thead>
<tr>
<th>Name</th>
<th>Platform</th>
<th>Error Count</th>
<th>Source</th>
<th>Last Error</th>
<th>Last Check</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="source in sourcesWithErrors" :key="source.id">
<td>{{ source.subscription_name || source.subscription?.name || 'Unknown' }}</td>
<td class="text-capitalize">{{ source.platform }}</td>
<td>{{ getSourceLabel(source) }}</td>
<td>
<v-chip color="error" size="small">
{{ source.error_count }} errors
{{ source.last_error_type || 'failed' }}
</v-chip>
</td>
<td>{{ formatDate(source.last_check) }}</td>
@@ -318,7 +316,7 @@ const credentialsStore = useCredentialsStore()
const notifications = useNotificationStore()
// Supported platforms for credential status
const supportedPlatforms = ['patreon', 'subscribestar', 'hentaifoundry', 'discord']
const supportedPlatforms = ['patreon', 'subscribestar', 'hentaifoundry', 'discord', 'pixiv', 'deviantart']
// State
const checkingAll = ref(false)
@@ -335,9 +333,27 @@ let refreshInterval = null
// Computed
const stats = computed(() => downloadsStore.stats)
const recentActivity = computed(() => downloadsStore.recentActivity)
const sourcesWithErrors = computed(() =>
sourcesStore.sources.filter(s => s.error_count > 0).slice(0, 5)
)
// Sources with recent failures - derived from recent activity
// Only shows sources where a recent download failed (not cumulative error_count)
const sourcesWithErrors = computed(() => {
const failedDownloads = recentActivity.value.filter(d => d.status === 'failed')
// Group by source_id and keep unique sources with their most recent failure
const sourceMap = new Map()
for (const dl of failedDownloads) {
if (dl.source_id && !sourceMap.has(dl.source_id)) {
sourceMap.set(dl.source_id, {
id: dl.source_id,
subscription_name: dl.subscription_name,
platform: dl.platform,
last_error_type: dl.error_type,
last_check: dl.created_at,
})
}
}
return Array.from(sourceMap.values()).slice(0, 5)
})
const failedCount = computed(() => stats.value?.failed || 0)
const activeDownloadsCount = computed(() =>
(stats.value?.queued || 0) + (stats.value?.running || 0)
@@ -565,10 +581,25 @@ function truncate(str, length) {
return str.substring(0, length) + '...'
}
function getDownloadLabel(download) {
if (download.subscription_name && download.platform) {
return `${download.subscription_name}:${download.platform}`
}
// Fallback to truncated URL if source info not available
return truncate(download.url, 35)
}
function getSourceLabel(source) {
const name = source.subscription_name || source.subscription?.name || 'Unknown'
return `${name}:${source.platform}`
}
async function retrySource(source) {
try {
await sourcesStore.triggerCheck(source.id)
notifications.success(`Queued check for ${source.subscription_name || source.platform}`)
notifications.success(`Queued check for ${getSourceLabel(source)}`)
// Refresh recent activity after retrying
await downloadsStore.fetchRecentActivity({ limit: 10 })
} catch (error) {
notifications.error(`Failed to queue check: ${error.message}`)
}