Skip to content

Commit 54703ad

Browse files
os-zhuangclaude
andcommitted
feat(app-showcase): master-detail showcase page (New Project + Tasks)
Adds showcase_project_workspace page rendering object-master-detail-form for showcase_project + showcase_task (master_detail), plus a nav entry. Verifies ObjectUI ADR-0001 master-detail subform end-to-end in the showcase. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 55ac75d commit 54703ad

4 files changed

Lines changed: 94 additions & 2 deletions

File tree

examples/app-showcase/objectstack.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ShowcaseApp } from './src/apps/index.js';
1010
import { ChartGalleryDashboard } from './src/dashboards/index.js';
1111
import { allReports } from './src/reports/index.js';
1212
import { allActions } from './src/actions/index.js';
13-
import { ComponentGalleryPage } from './src/pages/index.js';
13+
import { ComponentGalleryPage, ProjectWorkspacePage } from './src/pages/index.js';
1414
import { allFlows } from './src/flows/index.js';
1515
import { allWebhooks } from './src/webhooks/index.js';
1616
import { allJobs } from './src/jobs/index.js';
@@ -113,7 +113,7 @@ export default defineStack({
113113
apps: [ShowcaseApp],
114114
portals: allPortals,
115115
views: [TaskViews, ProjectViews],
116-
pages: [ComponentGalleryPage],
116+
pages: [ComponentGalleryPage, ProjectWorkspacePage],
117117
dashboards: [ChartGalleryDashboard],
118118
reports: allReports,
119119
actions: allActions,

examples/app-showcase/src/apps/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const ShowcaseApp = App.create({
4848
icon: 'layout',
4949
children: [
5050
{ id: 'nav_gallery', type: 'page', pageName: 'showcase_component_gallery', label: 'Component Gallery', icon: 'layout-template' },
51+
{ id: 'nav_project_workspace', type: 'page', pageName: 'showcase_project_workspace', label: 'New Project + Tasks', icon: 'folder-plus' },
5152
],
5253
},
5354
],

examples/app-showcase/src/pages/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import type { Page } from '@objectstack/spec/ui';
44

5+
export { ProjectWorkspacePage } from './project-workspace.page.js';
6+
57
/**
68
* Component Gallery — a custom page that places a spread of standard page
79
* components (header, card, tabs, text/number/image/divider/button elements,
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import type { Page } from '@objectstack/spec/ui';
4+
5+
/**
6+
* Project Workspace — a master-detail (header + line items) entry scenario.
7+
*
8+
* Demonstrates the `object-master-detail-form` renderer (ObjectUI ADR-0001):
9+
* create a Project (parent) together with its Tasks (children) in one screen.
10+
* `showcase_task.project` is a `master_detail` field, so the children are
11+
* created with the parent FK set in a single client-orchestrated transaction.
12+
*/
13+
export const ProjectWorkspacePage: Page = {
14+
name: 'showcase_project_workspace',
15+
label: 'New Project + Tasks',
16+
type: 'app',
17+
template: 'default',
18+
kind: 'full',
19+
regions: [
20+
{
21+
name: 'header',
22+
width: 'full',
23+
components: [
24+
{
25+
type: 'page:header',
26+
properties: {
27+
title: 'New Project + Tasks',
28+
subtitle:
29+
'Master-detail entry — fill the project, add its tasks inline, and save them together.',
30+
icon: 'folder-plus',
31+
},
32+
},
33+
],
34+
},
35+
{
36+
name: 'main',
37+
width: 'large',
38+
components: [
39+
{
40+
type: 'object-master-detail-form',
41+
properties: {
42+
objectName: 'showcase_project',
43+
mode: 'create',
44+
formType: 'simple',
45+
submitText: 'Create Project + Tasks',
46+
fields: ['name', 'account', 'status', 'health', 'budget', 'end_date'],
47+
details: [
48+
{
49+
title: 'Tasks',
50+
childObject: 'showcase_task',
51+
relationshipField: 'project',
52+
amountField: 'estimate_hours',
53+
addLabel: 'Add task',
54+
columns: [
55+
{ field: 'title', label: 'Title', type: 'text', required: true },
56+
{
57+
field: 'status',
58+
label: 'Status',
59+
type: 'select',
60+
options: [
61+
{ label: 'Backlog', value: 'backlog' },
62+
{ label: 'To Do', value: 'todo' },
63+
{ label: 'In Progress', value: 'in_progress' },
64+
{ label: 'In Review', value: 'in_review' },
65+
{ label: 'Done', value: 'done' },
66+
],
67+
},
68+
{
69+
field: 'priority',
70+
label: 'Priority',
71+
type: 'select',
72+
options: [
73+
{ label: 'Low', value: 'low' },
74+
{ label: 'Medium', value: 'medium' },
75+
{ label: 'High', value: 'high' },
76+
{ label: 'Urgent', value: 'urgent' },
77+
],
78+
},
79+
{ field: 'estimate_hours', label: 'Estimate (h)', type: 'number' },
80+
{ field: 'due_date', label: 'Due Date', type: 'date' },
81+
],
82+
},
83+
],
84+
},
85+
},
86+
],
87+
},
88+
],
89+
};

0 commit comments

Comments
 (0)