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:
2026-11-08 02:04:23 +00:00
parent fcfb298077
commit 05a7c114f5
10 changed files with 158 additions and 78 deletions
@@ -45,3 +45,13 @@ describe('useTargetPicker', () => {
expect(picker.snippetLabel.value).toBe('Merge into alice’s users.json line')
})
})
describe('useTargetPicker kind switch', () => {
it('clears targetName when targetKind changes so a stale name cannot leak across kinds', () => {
const picker = useTargetPicker(() => ['admins'], () => ['alice'])
picker.targetName.value = 'admins'
picker.targetKind.value = 'user'
expect(picker.targetName.value).toBe('')
expect(picker.nameValid.value).toBe(false)
})
})
+3 -1
View File
@@ -1,4 +1,4 @@
import { computed, ref, type ComputedRef, type Ref } from 'vue'
import { computed, ref, watch, type ComputedRef, type Ref } from 'vue'
import { isValidName, isValidUserName } from '@/lib/snippets'
@@ -30,6 +30,8 @@ export function useTargetPicker(groupNames: () => string[], userNames: () => str
const targetKind = ref<GrantTargetKind>('group')
const targetName = ref('')
watch(targetKind, () => (targetName.value = ''), { flush: 'sync' })
const targetNames = computed(() => (targetKind.value === 'group' ? groupNames() : userNames()))
const nameValid = computed(() => (targetKind.value === 'group' ? isValidName(targetName.value.trim()) : isValidUserName(targetName.value)))