Repository navigation
Expand file tree
/
Copy pathsys-approval-request.page.ts
More file actions
155 lines (148 loc) · 8.23 KB
/
Copy pathsys-approval-request.page.ts
File metadata and controls
155 lines (148 loc) · 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
import type { Page } from '@objectstack/spec/ui';
/**
* sys_approval_request — Record Detail Page (`kind: 'full'`, default for
* ALL sys_approval_request records).
*
* **Audience**: the people on a request — its submitter and its approvers —
* opening it from the approvals inbox or from Setup → Approvals → Requests.
*
* This is the page the console mounts `RecordDetailView` over for a request:
* the placement of every block on it is metadata served from here, through
* this plugin's manifest `pages` (the way plugin-auth ships `sys_user`'s), and
* the console only registers renderers. Every block is a declared spec type,
* so `os validate` checks the page whole, props included.
*
* Strategy
* --------
* - `kind: 'full'` + `isDefault: true`: the page owns its tab strip, so it is
* drawn as authored at every width. It was a `kind: 'slotted'` page until
* the `tabs` slot retired (#27053); the rebuild renders the same nodes in
* the same order. Its `page:header` is the one the synthesizer supplied:
* the request's title, and the object's placed header actions read live
* (`placedActions: true`, #29951). The object places none of its own (its
* decision actions are `record_section` ones, drawn by the panel below), so
* the header draws only what an installed package places on
* `sys_approval_request` at `record_header` / `record_more`.
* - After the header, ONE `record:approval_decision` node: the request's
* decision progress and its declared decision actions, the reply
* (`approval_comment`) included, in one panel. The type is declared with an
* empty strict props row, so the node carries no `properties` at all; the
* panel reads the bound request and the object's own actions.
* - The highlight strip is the object's `highlightFields` WITHOUT `record_id`. The
* details grid hides every field a mounted highlights strip shows, and
* `record_id` / `object_name` is a declared `referenceVia` pointer pair that
* the console draws as a card of the target record IN THE DETAILS GRID — a
* strip carrying `record_id` would take the card off the page. The object's
* own `highlightFields` keeps `record_id`: other surfaces read it, and only
* this page has a grid the pair must stay in.
* - The strip and the object's list change together, never the strip alone.
* The Details tab's `record:details` node authors neither `sections` nor
* `fields`, so it draws the object's `highlightFields` (the spec's declared
* fallback) minus the strip: a field the object lists and the strip drops
* moves into that tab.
* - The flow chip is `process_label` (the flow's label), not `process_name`
* (the machine source, `flow:NAME`). The console reads a request through
* the approvals get, which serves `process_label` by the one display-label
* chain (`display-labels.ts`): the stored label, else the node-config
* snapshot's, else the humanized machine name. Where the chain yields
* nothing, the field has no value, the strip draws no Flow chip, and the
* record title still names `process_name`.
* - The step chip is `current_step_label` (the "Approval Step" field), not
* `current_step` (the Approval node's machine id, such as `approve_step`).
* The approvals get serves it by the same chain: the stored label, else
* the snapshot's `__nodeLabel`, else the humanized node id. A request with
* no step at all serves neither field, and the strip draws no step chip.
* - There is no Object chip. `object_name` is the target object's API name
* as stored (`showcase_announcement`), and the object declares no field
* that holds that object's label. The page names the target object in the
* Details tab instead: the `record_id` / `object_name` pair's card heads the
* target record with its object's label, translated and read from the
* object's definition when the page draws, so a relabelled object reads its
* new label. Where the card cannot read the target (the reader may not
* read it, or the platform deleted it), the page names no object at all.
* `object_name` leaves the object's `highlightFields` too, by the rule
* above, so the Details tab does not draw it as a row.
* - The tab strip is authored: Details (`record:details`, a bare node: see
* the strip above) and Timeline — `sys_approval_action` as a
* related list keyed on `request_id`, newest first. Its step column is
* `step_label` (the step's label, stored on every row), not `step_name`
* (the node's machine id, such as `dual_signoff`), as the strip's step
* chip is `current_step_label`.
* - There is no `record:discussion` node: the generic discussion thread has
* no place here. A request's thread is its timeline, and its reply is the
* declared `approval_comment` action, which the service stores as a
* `sys_approval_action` row the Timeline tab lists.
* - There is no aside: the page places only its `main` region.
*
* Copy inside the components is authored as inline locale maps, the ruled route for
* page prose; the page-level `label` is the one key a translation bundle
* reaches (`pages.sys_approval_request_detail.label`, in
* `translations/pages.ts`).
*/
export const SysApprovalRequestDetailPage: Page = {
name: 'sys_approval_request_detail',
label: 'Approval Request',
type: 'record',
object: 'sys_approval_request',
template: 'default',
kind: 'full',
isDefault: true,
regions: [
{
name: 'main',
width: 'full',
components: [
// ── The record header: the request's title, and every action placed
// on the object at `record_header` / `record_more`, read live, as the
// synthesized header drew them. The object places none of its own, so
// only an action another package places there shows (a bare header
// dropped it, #29951); the host appends its system actions.
{ type: 'page:header', properties: { placedActions: true } },
// ── The decision panel ────────────────────────────────────────
{ type: 'record:approval_decision' },
// ── Highlight chips, `record_id` left to the details grid ─────
{
type: 'record:highlights',
properties: {
fields: ['process_label', 'status', 'current_step_label', 'submitter_id', 'updated_at'],
},
},
// ── Tabs: the request's fields, then its timeline ─────────────
{
type: 'page:tabs',
properties: {
tabStyle: 'line',
position: 'top',
items: [
{
label: { en: 'Details', 'zh-CN': '详情', 'ja-JP': '詳細', 'es-ES': 'Detalles', 'zh-Hant': '詳細資料', 'ar': 'التفاصيل', 'fr': 'Détails', 'pt-BR': 'Detalhes' },
icon: 'file-text',
children: [{ type: 'record:details' }],
},
{
label: { en: 'Timeline', 'zh-CN': '时间线', 'ja-JP': 'タイムライン', 'es-ES': 'Cronología', 'zh-Hant': '時間軸', 'ar': 'المخطط الزمني', 'fr': 'Chronologie', 'pt-BR': 'Linha do tempo' },
icon: 'history',
children: [
{
type: 'record:related_list',
properties: {
objectName: 'sys_approval_action',
relationshipField: 'request_id',
columns: ['created_at', 'action', 'actor_id', 'step_label', 'comment', 'attachments'],
sort: [{ field: 'created_at', order: 'desc' }],
limit: 50,
showViewAll: true,
title: { en: 'Timeline', 'zh-CN': '时间线', 'ja-JP': 'タイムライン', 'es-ES': 'Cronología', 'zh-Hant': '時間軸', 'ar': 'المخطط الزمني', 'fr': 'Chronologie', 'pt-BR': 'Linha do tempo' },
},
},
],
},
],
},
},
// No `record:discussion` node: the reply is `approval_comment`.
],
},
],
};