ef3ee5aceb
- Settings → Maintenance gains a "Database maintenance" card: a "Run VACUUM ANALYZE now" button (enqueues the maintenance task) plus a per-table bloat readout (live/dead/dead%/last vacuum) from /api/admin/maintenance/db-stats. - dbMaintenance store (loadStats / runVacuum) + test. - Fix ruff I001: combine the two _sync_engine imports onto one line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
642 B
JavaScript
26 lines
642 B
JavaScript
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
import { useApi } from '../composables/useApi.js'
|
|
|
|
export const useDbMaintenanceStore = defineStore('dbMaintenance', () => {
|
|
const api = useApi()
|
|
const tables = ref([])
|
|
const loading = ref(false)
|
|
|
|
async function loadStats() {
|
|
loading.value = true
|
|
try {
|
|
const body = await api.get('/api/admin/maintenance/db-stats')
|
|
tables.value = body.tables || []
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
async function runVacuum() {
|
|
return await api.post('/api/admin/maintenance/vacuum')
|
|
}
|
|
|
|
return { tables, loading, loadStats, runVacuum }
|
|
})
|