Skip to content

Commit 64e6ba5

Browse files
committed
demo(app-showcase): bulk multi-select edit on the Project grid (#2185)
Exercises the objectui BulkActionDialog multi-select fix (objectstack-ai/objectui#2186) end-to-end in a real running app: - project.object.ts: add `labels` (multiselect, fixed options) and `team_members` (multi-user) — the two shapes the bulk dialog could not set before #2185 (its picker collapsed to a single value / overwrote the array). - project.view.ts: add the two columns and three `bulkActionDefs`: • set_labels → multi-select on a `select` param (array patch) • assign_team → multi-select on a `lookup` param (sys_user) • reschedule → the new `date` control + a single-select Verified in objectstack dev: select rows → each action writes an array (or date) patch to all selected records; labels/team_members/end_date persist server-side.
1 parent 996c548 commit 64e6ba5

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

examples/app-showcase/src/objects/project.object.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ export const Project = ObjectSchema.create({
5656
start_date: Field.date({ label: 'Start Date' }),
5757
end_date: Field.date({ label: 'Target End Date' }),
5858
owner: Field.text({ label: 'Owner', maxLength: 200 }),
59+
// Multi-value fields — the payload for the grid's *bulk-edit* showcase. A
60+
// multiselect (fixed options) and a multi-user field are exactly the two
61+
// shapes that, before #2185, the bulk dialog could not set: its people /
62+
// select picker collapsed to a single value and overwrote the array. The
63+
// list view's `bulkActionDefs` below now sets both with real multi-select
64+
// controls, writing an array patch.
65+
labels: {
66+
type: 'multiselect',
67+
label: 'Labels',
68+
options: [
69+
{ label: 'Frontend', value: 'frontend', color: '#3B82F6' },
70+
{ label: 'Backend', value: 'backend', color: '#8B5CF6' },
71+
{ label: 'Design', value: 'design', color: '#EC4899' },
72+
{ label: 'QA', value: 'qa', color: '#F59E0B' },
73+
{ label: 'DevOps', value: 'devops', color: '#10B981' },
74+
],
75+
},
76+
team_members: Field.user({ label: 'Team Members', multiple: true }),
5977
// Roll-up summaries — recomputed server-side whenever a child task is
6078
// inserted / updated / deleted (FK auto-detected: showcase_task.project).
6179
task_count: Field.summary({

examples/app-showcase/src/views/project.view.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,81 @@ export const ProjectViews = defineView({
1515
{ field: 'account' },
1616
{ field: 'status' },
1717
{ field: 'health' },
18+
{ field: 'labels' },
19+
{ field: 'team_members' },
1820
{ field: 'budget' },
1921
{ field: 'budget_remaining' },
2022
{ field: 'end_date' },
2123
],
24+
// Rich bulk-edit definitions (#2185) — select rows, then "set the same
25+
// value on all of them" through the BulkActionDialog. Each def exercises a
26+
// control the dialog gained in #2185:
27+
// • set_labels → multi-select on a `select` param (fixed options)
28+
// • assign_team → multi-select on a `lookup` param (users; array patch)
29+
// • reschedule → the new `date` control + a single-select together
30+
// A def with no `multiple` still renders a single-select, unchanged.
31+
bulkActionDefs: [
32+
{
33+
name: 'set_labels',
34+
label: 'Set Labels',
35+
operation: 'update',
36+
confirmText: 'Set these labels on every selected project?',
37+
params: [
38+
{
39+
name: 'labels',
40+
label: 'Labels',
41+
type: 'select',
42+
multiple: true,
43+
required: true,
44+
options: [
45+
{ label: 'Frontend', value: 'frontend' },
46+
{ label: 'Backend', value: 'backend' },
47+
{ label: 'Design', value: 'design' },
48+
{ label: 'QA', value: 'qa' },
49+
{ label: 'DevOps', value: 'devops' },
50+
],
51+
},
52+
],
53+
},
54+
{
55+
name: 'assign_team',
56+
label: 'Assign Team',
57+
operation: 'update',
58+
confirmText: 'Assign these team members to every selected project?',
59+
params: [
60+
{
61+
name: 'team_members',
62+
label: 'Team Members',
63+
type: 'lookup',
64+
object: 'sys_user',
65+
multiple: true,
66+
labelField: 'name',
67+
required: true,
68+
},
69+
],
70+
},
71+
{
72+
name: 'reschedule',
73+
label: 'Reschedule',
74+
operation: 'update',
75+
confirmText: 'Apply this schedule/status to every selected project?',
76+
params: [
77+
{ name: 'end_date', label: 'Target End Date', type: 'date' },
78+
{
79+
name: 'status',
80+
label: 'Status',
81+
type: 'select',
82+
options: [
83+
{ label: 'Planned', value: 'planned' },
84+
{ label: 'Active', value: 'active' },
85+
{ label: 'On Hold', value: 'on_hold' },
86+
{ label: 'Completed', value: 'completed' },
87+
{ label: 'Cancelled', value: 'cancelled' },
88+
],
89+
},
90+
],
91+
},
92+
],
2293
},
2394
listViews: {
2495
by_status: {

0 commit comments

Comments
 (0)