Skip to content

Commit ffa608d

Browse files
committed
feat(studio): the field designer writes Field Change Values, not Track History (#36290 part 1)
The FieldDesigner drawer's Track History switch wrote trackHistory: false on every save. It becomes Field Change Values (Default / On / Off over the field's fieldHistory), drawn as two rows shown by visibleWhen for the types whose Default resolves on or off (resolveFieldHistory), so Default names the right state after a type change; the save reads the row shown for the saved type. A stored trackHistory rides the edit spread and is never written. DesignerFieldDefinition and its zod mirror gain fieldHistory; MetadataFieldsPage and MetadataService.toFieldPayload carry it. The eleven language packs swap appDesigner.fieldDesigner.trackHistory for the four fieldHistory keys. Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
1 parent d0556eb commit ffa608d

24 files changed

Lines changed: 489 additions & 28 deletions
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
---
22
'@object-ui/app-shell': patch
33
'@object-ui/i18n': patch
4+
'@object-ui/types': patch
5+
'@object-ui/plugin-designer': patch
46
---
57

6-
feat(studio): the field inspector and the object's settings write Field change values instead of Track history
8+
feat(studio): the field inspector, the field designer and the object's settings write Field change values instead of Track history
79

810
Clause-②: yes (widening)
911
Metadata-protocol: none
1012

1113
Old → new values show on the record activity by default, and an object or a single field can turn them off. The Studio now writes that setting where an author looks for it:
1214

1315
- **Field inspector.** The "Track history" box is gone. In its place, "Field change values" offers Default, On and Off. Default leaves the field's `fieldHistory` unset and names what it means for this field on this object: "Default (On)" for most types, "Default (Off)" for a media, JSON or credential field, and "Default (Off)" for every field when the object turns values off, with a note saying so. On and Off write `fieldHistory: true` and `false`; choosing Default after Off removes the key. A stored `trackHistory` is kept as it is and never written.
16+
- **Field designer** (`@object-ui/plugin-designer`). The drawer's "Track History" switch, which wrote `trackHistory: false` on every save, is replaced by "Field Change Values" with the same three choices: Default (named "Default (On)" or "Default (Off)" for the type in the drawer, and it follows a type change), On, Off. A stored `trackHistory` is carried through an edit and never written. `DesignerFieldDefinition` (`@object-ui/types`, with its zod mirror) gains an optional `fieldHistory`, and both designer save paths (`MetadataFieldsPage`, `MetadataService.saveFields`) carry it; Default sends no key, which removes a stored one.
1417
- **Object settings.** The Features card gains "Field change values" (`enable.fieldHistory`). Unticking it writes `false`; ticking it again removes the key rather than writing `true`, since unset already means on. Sibling `enable` keys are kept.
1518

16-
The three choices, what each writes and their wording are shared with the metadata form's Field History control, so the two surfaces cannot drift. New Studio strings `designer.field.fieldHistory`, `designer.field.fieldHistoryObjectOff`, `engine.studio.settings.capFieldHistory` and `engine.studio.settings.capFieldHistoryDesc` (en, zh); `designer.field.trackHistory` is removed with the box it labelled.
19+
The inspector and the metadata form's Field History control share one module for the three choices, what each writes and their wording; the field designer cannot import it (the app shell depends on the designer) and shares the rule itself, `resolveFieldHistory` from `@objectstack/spec/data`. New Studio strings `designer.field.fieldHistory`, `designer.field.fieldHistoryObjectOff`, `engine.studio.settings.capFieldHistory` and `engine.studio.settings.capFieldHistoryDesc` (en, zh); `designer.field.trackHistory` is removed with the box it labelled. In the language packs, `appDesigner.fieldDesigner.trackHistory` is replaced by `appDesigner.fieldDesigner.fieldHistory`, `fieldHistoryDefault`, `fieldHistoryOn` and `fieldHistoryOff`, in all eleven locales.

‎ui/packages/app-shell/src/services/MetadataService.fieldKeyCarryOver.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ describe('objectui#6488 · the mirror — carry-over must NOT resurrect what the
314314
options: [{ label: 'One', value: '1' }],
315315
externalId: true,
316316
trackHistory: true,
317+
fieldHistory: false,
317318
reference: 'opportunity',
318319
// …and one key the designer does not model, as the positive control.
319320
expression: 'price * quantity',
@@ -334,6 +335,7 @@ describe('objectui#6488 · the mirror — carry-over must NOT resurrect what the
334335
'options',
335336
'externalId',
336337
'trackHistory',
338+
'fieldHistory',
337339
'reference',
338340
] as const;
339341

‎ui/packages/app-shell/src/services/MetadataService.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ export interface FieldMetadataPayload {
119119
options?: Array<{ label: string; value: string; color?: string }>;
120120
externalId?: boolean;
121121
trackHistory?: boolean;
122+
/** objectstack#36290 — the field's own old → new values switch; absent follows the platform. */
123+
fieldHistory?: boolean;
122124
// No `indexed` (objectui#4644): the spec has no field-level index flag —
123125
// `FieldSchema.safeParse` rejects the key by name, so writing it made
124126
// `PUT /api/v1/meta/object/:name` fail with 422 `INVALID_METADATA`.
@@ -628,6 +630,7 @@ function toFieldPayload(
628630
options: field.options,
629631
externalId: field.externalId,
630632
trackHistory: field.trackHistory,
633+
fieldHistory: field.fieldHistory,
631634
reference: field.referenceTo,
632635
};
633636
}

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,10 @@ const ar = {
22952295
unique: "فريد",
22962296
readOnly: "للقراءة فقط",
22972297
hidden: "مخفي",
2298-
trackHistory: "تتبع السجل",
2298+
fieldHistory: "قيم تغيير الحقل",
2299+
fieldHistoryDefault: "افتراضي ({{state}})",
2300+
fieldHistoryOn: "تشغيل",
2301+
fieldHistoryOff: "إيقاف",
22992302
defaultValue: "القيمة الافتراضية",
23002303
placeholder: "نص تلميحي",
23012304
referenceTo: "مرجع إلى",

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,10 @@ const de = {
20632063
unique: "Eindeutig",
20642064
readOnly: "Nur lesen",
20652065
hidden: "Ausgeblendet",
2066-
trackHistory: "Verlauf verfolgen",
2066+
fieldHistory: "Feldänderungswerte",
2067+
fieldHistoryDefault: "Standard ({{state}})",
2068+
fieldHistoryOn: "Ein",
2069+
fieldHistoryOff: "Aus",
20672070
defaultValue: "Standardwert",
20682071
placeholder: "Platzhalter",
20692072
referenceTo: "Verweis auf",

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2495,7 +2495,10 @@ const en = {
24952495
unique: 'Unique',
24962496
readOnly: 'Read Only',
24972497
hidden: 'Hidden',
2498-
trackHistory: 'Track History',
2498+
fieldHistory: 'Field Change Values',
2499+
fieldHistoryDefault: 'Default ({{state}})',
2500+
fieldHistoryOn: 'On',
2501+
fieldHistoryOff: 'Off',
24992502
defaultValue: 'Default Value',
25002503
placeholder: 'Placeholder',
25012504
referenceTo: 'Reference To',

‎ui/packages/i18n/src/locales/es.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,10 @@ const es = {
21232123
unique: "Único",
21242124
readOnly: "Solo lectura",
21252125
hidden: "Oculto",
2126-
trackHistory: "Rastrear historial",
2126+
fieldHistory: "Valores de cambio del campo",
2127+
fieldHistoryDefault: "Predeterminado ({{state}})",
2128+
fieldHistoryOn: "Activado",
2129+
fieldHistoryOff: "Desactivado",
21272130
defaultValue: "Valor predeterminado",
21282131
placeholder: "Marcador de posición",
21292132
referenceTo: "Referencia a",

‎ui/packages/i18n/src/locales/fr.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,10 @@ const fr = {
21192119
unique: "Unique",
21202120
readOnly: "Lecture seule",
21212121
hidden: "Masqué",
2122-
trackHistory: "Suivre l'historique",
2122+
fieldHistory: "Valeurs de modification du champ",
2123+
fieldHistoryDefault: "Par défaut ({{state}})",
2124+
fieldHistoryOn: "Activé",
2125+
fieldHistoryOff: "Désactivé",
21232126
defaultValue: "Valeur par défaut",
21242127
placeholder: "Espace réservé",
21252128
referenceTo: "Référence à",

‎ui/packages/i18n/src/locales/ja.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,10 @@ const ja = {
20632063
unique: "ユニーク",
20642064
readOnly: "読み取り専用",
20652065
hidden: "非表示",
2066-
trackHistory: "履歴追跡",
2066+
fieldHistory: "項目の変更値",
2067+
fieldHistoryDefault: "デフォルト({{state}})",
2068+
fieldHistoryOn: "オン",
2069+
fieldHistoryOff: "オフ",
20672070
defaultValue: "デフォルト値",
20682071
placeholder: "プレースホルダー",
20692072
referenceTo: "参照先",

‎ui/packages/i18n/src/locales/ko.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,10 @@ const ko = {
20632063
unique: "고유",
20642064
readOnly: "읽기 전용",
20652065
hidden: "숨김",
2066-
trackHistory: "기록 추적",
2066+
fieldHistory: "필드 변경 값",
2067+
fieldHistoryDefault: "기본값({{state}})",
2068+
fieldHistoryOn: "켜기",
2069+
fieldHistoryOff: "끄기",
20672070
defaultValue: "기본값",
20682071
placeholder: "자리 표시자",
20692072
referenceTo: "참조 대상",

0 commit comments

Comments
 (0)