Show parent > child location on detail pages, add location move
Deploy to LXC / deploy (push) Successful in 18s

- Device/component detail pages show "Parent › Child" for locations
- Device list cards show full location path
- Location edit form now includes a Parent selector to move locations
  between parents or make them top-level
- Prevents setting a location as its own parent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 17:07:08 +07:00
parent 948617a285
commit 9102ffd8b4
8 changed files with 65 additions and 8 deletions
+5 -1
View File
@@ -73,11 +73,15 @@ export const actions: Actions = {
const id = formData.get('id') as string;
const name = (formData.get('name') as string)?.trim();
const description = (formData.get('description') as string)?.trim();
const parentId = (formData.get('parentId') as string) || null;
if (!name) return fail(400, { error: 'Name is required' });
// Prevent setting self as parent
if (parentId === id) return fail(400, { error: 'Cannot set location as its own parent' });
await db
.update(locations)
.set({ name, description: description || null, updatedAt: new Date() })
.set({ name, description: description || null, parentId, updatedAt: new Date() })
.where(eq(locations.id, id));
return { renamed: true };
},