From 1a3041354d60c963415bd5829a20e395f58b1405 Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Mon, 22 Jun 2026 16:31:34 +0800 Subject: [PATCH] feat(identity): Org Chart tree view for sys_business_unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sys_business_unit is already a self-referencing hierarchy (parent_business_unit_id, ADR-0057 D2) with BFS graph traversal, but Setup only exposed flat grids. Adds an `org_chart` list view (type: 'tree') that renders the hierarchy as an indented, expand/collapse tree-grid, listed first so it's the default tab. No schema change — only surfaces the existing parent pointer. The active/inactive/by_kind/all grids stay for search, filter, and bulk edit. Uses the 'tree' view type added in #2184; renderer is objectui plugin-tree. Co-Authored-By: Claude Opus 4.8 --- .changeset/bu-org-chart-tree-view.md | 13 +++++++++++++ .../src/identity/sys-business-unit.object.ts | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .changeset/bu-org-chart-tree-view.md diff --git a/.changeset/bu-org-chart-tree-view.md b/.changeset/bu-org-chart-tree-view.md new file mode 100644 index 0000000000..1725604362 --- /dev/null +++ b/.changeset/bu-org-chart-tree-view.md @@ -0,0 +1,13 @@ +--- +"@objectstack/platform-objects": minor +--- + +feat(identity): add an Org Chart tree view to `sys_business_unit` + +`sys_business_unit` is already a self-referencing hierarchy +(`parent_business_unit_id`, ADR-0057 D2) but Setup only exposed flat grids. Adds +an `org_chart` list view (`type: 'tree'`) that renders the hierarchy as an +indented, expand/collapse tree-grid, listed first so it's the default tab. No +schema change — the parent pointer and graph traversal already existed; this only +surfaces them. The `active` / `inactive` / `by_kind` / `all` grids stay for +search, filter, and bulk edit. diff --git a/packages/platform-objects/src/identity/sys-business-unit.object.ts b/packages/platform-objects/src/identity/sys-business-unit.object.ts index 68b5be7ede..849c7589eb 100644 --- a/packages/platform-objects/src/identity/sys-business-unit.object.ts +++ b/packages/platform-objects/src/identity/sys-business-unit.object.ts @@ -33,6 +33,24 @@ export const SysBusinessUnit = ObjectSchema.create({ compactLayout: ['name', 'kind', 'parent_business_unit_id', 'manager_user_id'], listViews: { + // Org chart — the hierarchy view. Surfaces the self-referencing + // `parent_business_unit_id` tree (ADR-0057 D2) as an indented, expand/ + // collapse tree-grid. Listed first so it's the default tab; the grids + // below stay for search / filter / bulk edit. + org_chart: { + type: 'tree', + name: 'org_chart', + label: 'Org Chart', + data: { provider: 'object', object: 'sys_business_unit' }, + columns: ['name', 'kind', 'manager_user_id', 'active'], + tree: { + parentField: 'parent_business_unit_id', + labelField: 'name', + fields: ['kind', 'manager_user_id', 'active'], + defaultExpandedDepth: 1, + }, + sort: [{ field: 'name', order: 'asc' }], + }, active: { type: 'grid', name: 'active',