feat(fc3c): /subscriptions Check Now button — wires SourceRow → store.checkNow

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 20:47:36 -04:00
parent d35605ab73
commit f309a1e79e
3 changed files with 42 additions and 5 deletions
@@ -13,9 +13,11 @@
<div v-if="open" class="fc-artist-section__body">
<SourceRow
v-for="s in sources" :key="s.id" :source="s"
:checking="checkingIds.has(s.id)"
@edit="$emit('edit', $event)"
@remove="$emit('remove', $event)"
@toggle="$emit('toggle-source', $event)"
@check="$emit('check', $event)"
/>
<v-btn
size="small" variant="text" prepend-icon="mdi-plus"
@@ -34,8 +36,9 @@ const props = defineProps({
artist: { type: Object, required: true },
sources: { type: Array, required: true },
open: { type: Boolean, default: false },
checkingIds: { type: Set, default: () => new Set() },
})
defineEmits(['toggle', 'edit', 'remove', 'toggle-source', 'add-source'])
defineEmits(['toggle', 'edit', 'remove', 'toggle-source', 'add-source', 'check'])
const latestChecked = computed(() => {
const dates = props.sources.map(s => s.last_checked_at).filter(Boolean)
@@ -11,14 +11,22 @@
density="compact" hide-details color="accent"
@update:model-value="onToggleEnabled"
/>
<v-btn
icon="mdi-play" size="x-small" variant="text"
:loading="checking"
@click="$emit('check', source)"
/>
<v-btn icon="mdi-pencil" size="x-small" variant="text" @click="$emit('edit', source)" />
<v-btn icon="mdi-close" size="x-small" variant="text" @click="$emit('remove', source)" />
</div>
</template>
<script setup>
const props = defineProps({ source: { type: Object, required: true } })
const emit = defineEmits(['edit', 'remove', 'toggle'])
const props = defineProps({
source: { type: Object, required: true },
checking: { type: Boolean, default: false },
})
const emit = defineEmits(['edit', 'remove', 'toggle', 'check'])
function onToggleEnabled(value) {
emit('toggle', { source: props.source, enabled: value })
}
@@ -27,7 +35,7 @@ function onToggleEnabled(value) {
<style scoped>
.fc-source-row {
display: grid;
grid-template-columns: 96px 1fr auto auto auto;
grid-template-columns: 96px 1fr auto auto auto auto;
gap: 0.75rem;
align-items: center;
padding: 0.4rem 0;
+27 -1
View File
@@ -30,11 +30,13 @@
v-for="g in groups" :key="g.artist.id"
:artist="g.artist" :sources="g.sources"
:open="isOpen(g.artist.id)"
:checking-ids="store.checkingIds"
@toggle="toggleSection(g.artist.id)"
@edit="openEditSource"
@remove="removeSource"
@toggle-source="toggleSourceEnabled"
@add-source="openAddSource"
@check="onCheck"
/>
</div>
@@ -50,7 +52,7 @@
<script setup>
import { computed, onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import { useSourcesStore } from '../stores/sources.js'
import { usePlatformsStore } from '../stores/platforms.js'
import ArtistSection from '../components/subscriptions/ArtistSection.vue'
@@ -58,6 +60,7 @@ import SourceFormDialog from '../components/subscriptions/SourceFormDialog.vue'
import ArtistCreateDialog from '../components/subscriptions/ArtistCreateDialog.vue'
const route = useRoute()
const router = useRouter()
const store = useSourcesStore()
const platformsStore = usePlatformsStore()
@@ -132,6 +135,29 @@ function onArtistCreated(artist) {
// Move into Add Source for the new artist immediately.
openAddSource(artist)
}
async function onCheck(source) {
try {
const body = await store.checkNow(source.id)
globalThis.window?.__fcToast?.({
text: `Check enqueued (event #${body.download_event_id})`,
type: 'success',
})
} catch (e) {
if (e?.body?.download_event_id) {
globalThis.window?.__fcToast?.({
text: 'Already running — see Downloads',
type: 'info',
})
router.push({ path: '/downloads', query: { source_id: source.id } })
} else {
globalThis.window?.__fcToast?.({
text: `Check failed: ${e?.detail || e?.message || e}`,
type: 'error',
})
}
}
}
</script>
<style scoped>