Show parent > child location on detail pages, add location move
Deploy to LXC / deploy (push) Successful in 18s
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:
@@ -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 };
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user