Merge pull request #2 from phyroslam/codex/add-dynamic-related-lists-to-detail-views

Add dynamic tenant-level related lists and page layout selection
This commit is contained in:
phyroslam
2026-01-08 15:16:17 -08:00
committed by GitHub
12 changed files with 287 additions and 35 deletions

View File

@@ -155,6 +155,14 @@ const handleBack = () => {
router.push(`/${objectApiName.value.toLowerCase()}/`)
}
const handleNavigate = (relatedObjectApiName: string, relatedRecordId: string) => {
router.push(`/${relatedObjectApiName.toLowerCase()}/${relatedRecordId}/detail`)
}
const handleCreateRelated = (relatedObjectApiName: string, _parentId: string) => {
router.push(`/${relatedObjectApiName.toLowerCase()}/new`)
}
const handleDelete = async (rows: any[]) => {
if (confirm(`Delete ${rows.length} record(s)? This action cannot be undone.`)) {
try {
@@ -279,6 +287,8 @@ onMounted(async () => {
@edit="handleEdit"
@delete="() => handleDelete([currentRecord])"
@back="handleBack"
@navigate="handleNavigate"
@create-related="handleCreateRelated"
/>
<!-- Edit View -->

View File

@@ -95,6 +95,14 @@ const handleBack = () => {
router.push(`/app/objects/${objectApiName.value}/`)
}
const handleNavigate = (relatedObjectApiName: string, relatedRecordId: string) => {
router.push(`/app/objects/${relatedObjectApiName}/${relatedRecordId}/detail`)
}
const handleCreateRelated = (relatedObjectApiName: string, _parentId: string) => {
router.push(`/app/objects/${relatedObjectApiName}/new`)
}
const handleDelete = async (rows: any[]) => {
if (confirm(`Delete ${rows.length} record(s)? This action cannot be undone.`)) {
try {
@@ -212,6 +220,8 @@ onMounted(async () => {
@edit="handleEdit"
@delete="() => handleDelete([currentRecord])"
@back="handleBack"
@navigate="handleNavigate"
@create-related="handleCreateRelated"
/>
<!-- Edit View -->

View File

@@ -178,6 +178,8 @@
<PageLayoutEditor
:fields="object.fields"
:initial-layout="(selectedLayout.layoutConfig || selectedLayout.layout_config)?.fields || []"
:related-lists="object.relatedLists || []"
:initial-related-lists="(selectedLayout.layoutConfig || selectedLayout.layout_config)?.relatedLists || []"
:layout-name="selectedLayout.name"
@save="handleSaveLayout"
/>
@@ -683,7 +685,7 @@ const handleCreateLayout = async () => {
name,
objectId: object.value.id,
isDefault: layouts.value.length === 0,
layoutConfig: { fields: [] },
layoutConfig: { fields: [], relatedLists: [] },
})
layouts.value.push(newLayout)
@@ -699,12 +701,12 @@ const handleSelectLayout = (layout: PageLayout) => {
selectedLayout.value = layout
}
const handleSaveLayout = async (fields: FieldLayoutItem[]) => {
const handleSaveLayout = async (layoutConfig: { fields: FieldLayoutItem[]; relatedLists: string[] }) => {
if (!selectedLayout.value) return
try {
const updated = await updatePageLayout(selectedLayout.value.id, {
layoutConfig: { fields },
layoutConfig,
})
// Update the layout in the list