-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathreport.form.ts
More file actions
73 lines (71 loc) · 2.93 KB
/
Copy pathreport.form.ts
File metadata and controls
73 lines (71 loc) · 2.93 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
/**
* Form layout for the Report metadata editor.
*
* Bound to {@link ReportSchema} via `data.provider = 'schema'`. The
* `@object-ui/plugin-form` renderer resolves field metadata from the
* Zod-derived JSON Schema served by `/api/v1/meta` and applies the
* widget/visibility hints declared here.
*
* ADR-0021 single-form: a report is dataset-bound — it binds a semantic-layer
* `dataset` and selects its `values` (measure names) grouped by `rows`
* (dimension names). The legacy inline `objectName` + `columns` + `groupings`
* query form was removed from {@link ReportSchema} in the 9.0 cutover, so this
* form no longer declares those fields.
*/
import { defineForm } from './view.zod';
export const reportForm = defineForm({
schemaId: 'report',
type: 'simple',
sections: [
{
label: 'Basics',
description: 'Identity and report type.',
columns: 2,
fields: [
{ field: 'name', type: 'text', colSpan: 1, required: true, helpText: 'snake_case unique identifier' },
{ field: 'label', type: 'text', colSpan: 1, required: true },
{ field: 'description', type: 'textarea', colSpan: 2 },
{ field: 'type', colSpan: 2, helpText: 'Report type: tabular/summary/matrix/joined' },
],
},
{
label: 'Dataset binding',
description: 'The semantic-layer dataset this report renders. Values are the dataset’s measures; rows are its dimensions.',
// A `joined` report carries its data on `blocks` instead.
visibleOn: "data.type != 'joined'",
fields: [
{ field: 'dataset', widget: 'ref:dataset', helpText: 'Dataset to bind (measures/dimensions come from its semantic layer)' },
{ field: 'values', widget: 'string-tags', helpText: 'Measure names (from the dataset) to display' },
{ field: 'rows', widget: 'string-tags', helpText: 'Dimension names (from the dataset) to group rows by' },
],
},
{
label: 'Joined blocks',
description: 'Additional dataset-bound blocks stacked into a single report (joined reports only).',
visibleOn: "data.type == 'joined'",
fields: [
{ field: 'blocks', type: 'repeater', helpText: 'Dataset-bound sub-reports (joined report only)' },
],
},
{
label: 'Filter & chart',
description: 'Render-time scope filter and chart presentation.',
collapsible: true,
collapsed: true,
fields: [
{ field: 'runtimeFilter', widget: 'json', helpText: 'Render-time scope filter, ANDed at query time' },
{ field: 'chart', type: 'composite', helpText: 'Chart config (type, legend, colors)' },
],
},
{
label: 'Advanced',
description: 'Accessibility and performance tuning.',
collapsible: true,
collapsed: true,
fields: [
{ field: 'aria', type: 'composite', helpText: 'Accessibility labels' },
{ field: 'performance', type: 'composite', helpText: 'Caching and optimization' },
],
},
],
});