mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(admin-ui): page-level loading, stale and form fixes
Fetch the consumers list on the user detail page so admin and grant data show on a deep link. Gate Recent errors, the Spend total and the forecast card on load state instead of showing zeros. Show a stale notice on top lists when a refresh fails. Clear the target name when the target kind changes. Ignore out-of-order config responses. Wrap long group names and event messages, and announce projected budget overruns to screen readers. Regenerate admin_assets_gen.go.
This commit is contained in:
@@ -19,20 +19,26 @@ export const useConfigStore = defineStore('config', {
|
||||
data: null as AdminConfigResponse | null,
|
||||
loading: false,
|
||||
error: '',
|
||||
/** Latest-request-wins guard: only the newest fetch may write state. */
|
||||
reqId: 0,
|
||||
}),
|
||||
actions: {
|
||||
async fetchConfig(): Promise<void> {
|
||||
const auth = useAuthStore()
|
||||
if (!auth.isAuthenticated) return
|
||||
const requestId = ++this.reqId
|
||||
this.loading = true
|
||||
try {
|
||||
this.data = await adminFetch<AdminConfigResponse>('/admin/api/config')
|
||||
const res = await adminFetch<AdminConfigResponse>('/admin/api/config')
|
||||
if (requestId !== this.reqId) return
|
||||
this.data = res
|
||||
this.error = ''
|
||||
} catch (err) {
|
||||
if (requestId !== this.reqId) return
|
||||
if (isAuthRejection(err)) return
|
||||
this.error = messageOf(err)
|
||||
} finally {
|
||||
this.loading = false
|
||||
if (requestId === this.reqId) this.loading = false
|
||||
}
|
||||
},
|
||||
/** ensureConfig fetches only when there is no data yet — ConfigPage.vue's own onMounted call. */
|
||||
|
||||
Reference in New Issue
Block a user