feat(ui): redesign /subscriptions as v-data-table with expandable source rows (GS-style)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,25 +1,63 @@
|
||||
<template>
|
||||
<div class="fc-source-row">
|
||||
<SourceHealthDot :source="source" :warning-threshold="warningThreshold" />
|
||||
<v-chip size="x-small" variant="tonal" class="fc-source-row__platform">
|
||||
{{ source.platform }}
|
||||
</v-chip>
|
||||
<a :href="source.url" target="_blank" rel="noopener" class="fc-source-row__url">
|
||||
{{ source.url }}
|
||||
</a>
|
||||
<v-switch
|
||||
:model-value="source.enabled"
|
||||
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>
|
||||
<tr class="fc-source-row">
|
||||
<td class="fc-source-row__health">
|
||||
<SourceHealthDot :source="source" :warning-threshold="warningThreshold" />
|
||||
</td>
|
||||
<td>
|
||||
<v-chip size="x-small" variant="tonal" label>{{ source.platform }}</v-chip>
|
||||
</td>
|
||||
<td class="fc-source-row__url-cell">
|
||||
<a :href="source.url" target="_blank" rel="noopener" class="fc-source-row__url"
|
||||
@click.stop>
|
||||
{{ source.url }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<v-switch
|
||||
:model-value="source.enabled"
|
||||
density="compact" hide-details color="accent"
|
||||
@click.stop
|
||||
@update:model-value="onToggleEnabled"
|
||||
/>
|
||||
</td>
|
||||
<td class="fc-source-row__when">
|
||||
{{ formatRelative(source.last_checked_at) }}
|
||||
</td>
|
||||
<td class="fc-source-row__when">
|
||||
{{ formatRelative(source.next_check_at, { future: true }) }}
|
||||
</td>
|
||||
<td>
|
||||
<v-chip
|
||||
v-if="(source.consecutive_failures || 0) > 0"
|
||||
size="x-small" color="error" variant="tonal" label
|
||||
>{{ source.consecutive_failures }}</v-chip>
|
||||
<span v-else class="fc-source-row__zero">0</span>
|
||||
</td>
|
||||
<td class="fc-source-row__actions">
|
||||
<v-btn
|
||||
icon="mdi-play" size="x-small" variant="text"
|
||||
:loading="checking"
|
||||
@click.stop="$emit('check', source)"
|
||||
>
|
||||
<v-icon>mdi-play</v-icon>
|
||||
<v-tooltip activator="parent" location="top">Check now</v-tooltip>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
icon="mdi-pencil" size="x-small" variant="text"
|
||||
@click.stop="$emit('edit', source)"
|
||||
>
|
||||
<v-icon>mdi-pencil</v-icon>
|
||||
<v-tooltip activator="parent" location="top">Edit</v-tooltip>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
icon="mdi-close" size="x-small" variant="text" color="error"
|
||||
@click.stop="$emit('remove', source)"
|
||||
>
|
||||
<v-icon>mdi-close</v-icon>
|
||||
<v-tooltip activator="parent" location="top">Remove</v-tooltip>
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -31,25 +69,59 @@ const props = defineProps({
|
||||
warningThreshold: { type: Number, default: 5 },
|
||||
})
|
||||
const emit = defineEmits(['edit', 'remove', 'toggle', 'check'])
|
||||
|
||||
function onToggleEnabled(value) {
|
||||
emit('toggle', { source: props.source, enabled: value })
|
||||
}
|
||||
|
||||
function formatRelative(iso, opts = {}) {
|
||||
if (!iso) return opts.future ? '—' : 'Never'
|
||||
const then = new Date(iso).getTime()
|
||||
const now = Date.now()
|
||||
const diff = (then - now) / 1000 // seconds; positive = future, negative = past
|
||||
const abs = Math.abs(diff)
|
||||
|
||||
let body
|
||||
if (abs < 60) body = `${Math.floor(abs)}s`
|
||||
else if (abs < 3600) body = `${Math.floor(abs / 60)}m`
|
||||
else if (abs < 86400) body = `${Math.floor(abs / 3600)}h`
|
||||
else body = `${Math.floor(abs / 86400)}d`
|
||||
|
||||
if (opts.future) return diff <= 0 ? 'imminent' : `in ${body}`
|
||||
return `${body} ago`
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fc-source-row {
|
||||
display: grid;
|
||||
grid-template-columns: auto 96px 1fr auto auto auto auto;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
padding: 0.4rem 0;
|
||||
.fc-source-row__health {
|
||||
width: 24px;
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
.fc-source-row__url-cell {
|
||||
max-width: 400px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fc-source-row__url {
|
||||
color: rgb(var(--v-theme-on-surface-variant));
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.fc-source-row__url:hover { color: rgb(var(--v-theme-accent)); }
|
||||
.fc-source-row__when {
|
||||
color: rgb(var(--v-theme-on-surface-variant));
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.fc-source-row__zero {
|
||||
color: rgb(var(--v-theme-on-surface-variant));
|
||||
opacity: 0.6;
|
||||
}
|
||||
.fc-source-row__actions {
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user