Qualify firewall layouts and keep device names compatible with JS target

This commit is contained in:
archipelago
2026-10-08 07:06:30 -04:00
parent ccfa91aa57
commit 8a70232f18
3 changed files with 28 additions and 8 deletions
@@ -62,7 +62,7 @@ describe('Private device management', () => {
const w = view(); await flushPromises(); await w.get('[aria-label="Remove Phone"]').trigger('click')
expect(vi.mocked(rpcClient.call).mock.calls.filter(([a]) => a.method === 'vpn.remove-peer')).toHaveLength(0)
await button(w, 'Remove device').trigger('click'); await flushPromises()
expect(w.text()).toContain('Could not confirm removal'); expect(w.get('[aria-label="Remove Phone"]').exists()).toBe(true); w.unmount()
expect(w.text()).toContain('Could not confirm removal'); expect(w.find('[aria-label="Remove Phone"]').exists()).toBe(true); w.unmount()
})
it('keeps a failed list distinct from no devices and disables creation', async () => {
vi.mocked(rpcClient.call).mockRejectedValue(new Error('offline'))
@@ -18,7 +18,7 @@ const removeName = ref('')
const copied = ref(false)
const needsRefresh = ref(false)
const safeName = (value: string) => /^[A-Za-z0-9][A-Za-z0-9 _-]{0,63}$/.test(value)
const filename = (value: string) => value.toLowerCase().replaceAll(' ', '-')
const filename = (value: string) => value.toLowerCase().replace(/ /g, '-')
const canCreate = computed(() => props.statusKnown && props.configured && props.managementVerified && devices.value !== null && !needsRefresh.value && safeName(name.value.trim()) && !devices.value.some(d => filename(d.name) === filename(name.value.trim())))
let active = true
let request = 0