Skip to content

Commit 957a1e7

Browse files
committed
refactor: add typed consts for ContainerKind, InsertPosition, PluggablePropertyOp; add TODO comments in panic stubs
1 parent c22227c commit 957a1e7

2 files changed

Lines changed: 45 additions & 15 deletions

File tree

mdl/backend/mpr/backend.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -729,31 +729,31 @@ func (b *MprBackend) DeleteAgentEditorAgent(id string) error {
729729
// PageMutationBackend
730730

731731
func (b *MprBackend) OpenPageForMutation(unitID model.ID) (backend.PageMutator, error) {
732-
panic("MprBackend.OpenPageForMutation not yet implemented")
732+
panic("MprBackend.OpenPageForMutation not yet implemented") // TODO: implement in PR #237
733733
}
734734

735735
// ---------------------------------------------------------------------------
736736
// WorkflowMutationBackend
737737

738738
func (b *MprBackend) OpenWorkflowForMutation(unitID model.ID) (backend.WorkflowMutator, error) {
739-
panic("MprBackend.OpenWorkflowForMutation not yet implemented")
739+
panic("MprBackend.OpenWorkflowForMutation not yet implemented") // TODO: implement in PR #237
740740
}
741741

742742
// ---------------------------------------------------------------------------
743743
// WidgetSerializationBackend
744744

745745
func (b *MprBackend) SerializeWidget(w pages.Widget) (any, error) {
746-
panic("MprBackend.SerializeWidget not yet implemented")
746+
panic("MprBackend.SerializeWidget not yet implemented") // TODO: implement in PR #237
747747
}
748748

749749
func (b *MprBackend) SerializeClientAction(a pages.ClientAction) (any, error) {
750-
panic("MprBackend.SerializeClientAction not yet implemented")
750+
panic("MprBackend.SerializeClientAction not yet implemented") // TODO: implement in PR #237
751751
}
752752

753753
func (b *MprBackend) SerializeDataSource(ds pages.DataSource) (any, error) {
754-
panic("MprBackend.SerializeDataSource not yet implemented")
754+
panic("MprBackend.SerializeDataSource not yet implemented") // TODO: implement in PR #237
755755
}
756756

757757
func (b *MprBackend) SerializeWorkflowActivity(a workflows.WorkflowActivity) (any, error) {
758-
panic("MprBackend.SerializeWorkflowActivity not yet implemented")
758+
panic("MprBackend.SerializeWorkflowActivity not yet implemented") // TODO: implement in PR #237
759759
}

mdl/backend/mutation.go

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,44 @@ import (
88
"github.com/mendixlabs/mxcli/sdk/workflows"
99
)
1010

11+
// ContainerKind represents the type of page container (page, layout, or snippet).
12+
type ContainerKind string
13+
14+
const (
15+
ContainerPage ContainerKind = "page"
16+
ContainerLayout ContainerKind = "layout"
17+
ContainerSnippet ContainerKind = "snippet"
18+
)
19+
20+
// InsertPosition represents where a widget is inserted relative to a target.
21+
type InsertPosition string
22+
23+
const (
24+
InsertBefore InsertPosition = "before"
25+
InsertAfter InsertPosition = "after"
26+
)
27+
28+
// PluggablePropertyOp represents the operation type for SetPluggableProperty.
29+
type PluggablePropertyOp string
30+
31+
const (
32+
PluggableOpAttribute PluggablePropertyOp = "attribute"
33+
PluggableOpAssociation PluggablePropertyOp = "association"
34+
PluggableOpPrimitive PluggablePropertyOp = "primitive"
35+
PluggableOpSelection PluggablePropertyOp = "selection"
36+
PluggableOpDataSource PluggablePropertyOp = "datasource"
37+
PluggableOpWidgets PluggablePropertyOp = "widgets"
38+
PluggableOpTextTemplate PluggablePropertyOp = "texttemplate"
39+
PluggableOpAction PluggablePropertyOp = "action"
40+
PluggableOpAttributeObjects PluggablePropertyOp = "attributeObjects"
41+
)
42+
1143
// PageMutator provides fine-grained mutation operations on a single
1244
// page, layout, or snippet unit. Obtain one via PageMutationBackend.OpenPageForMutation.
1345
// All methods operate on the in-memory representation; call Save to persist.
1446
type PageMutator interface {
15-
// ContainerType returns "page", "layout", or "snippet".
16-
ContainerType() string
47+
// ContainerType returns the kind of container (page, layout, or snippet).
48+
ContainerType() ContainerKind
1749

1850
// --- Widget property operations ---
1951

@@ -31,8 +63,8 @@ type PageMutator interface {
3163
// --- Widget tree operations ---
3264

3365
// InsertWidget inserts serialized widgets at the given position
34-
// relative to the target widget. Position is "before" or "after".
35-
InsertWidget(targetWidget string, position string, widgets []pages.Widget) error
66+
// relative to the target widget.
67+
InsertWidget(targetWidget string, position InsertPosition, widgets []pages.Widget) error
3668

3769
// DropWidget removes widgets by name from the tree.
3870
DropWidget(widgetRefs []string) error
@@ -56,11 +88,9 @@ type PageMutator interface {
5688
// --- Pluggable widget operations ---
5789

5890
// SetPluggableProperty sets a typed property on a pluggable widget's object.
59-
// propKey is the Mendix property key, opName is the operation type
60-
// ("attribute", "association", "primitive", "selection", "datasource",
61-
// "widgets", "texttemplate", "action", "attributeObjects").
62-
// ctx carries the operation-specific values.
63-
SetPluggableProperty(widgetRef string, propKey string, opName string, ctx PluggablePropertyContext) error
91+
// propKey is the Mendix property key, op identifies the operation type,
92+
// and ctx carries the operation-specific values.
93+
SetPluggableProperty(widgetRef string, propKey string, op PluggablePropertyOp, ctx PluggablePropertyContext) error
6494

6595
// --- Introspection ---
6696

0 commit comments

Comments
 (0)