Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
47fca9be
Commit
47fca9be
authored
5 years ago
by
Tomaž Jerman
Committed by
Denis Arh
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add value formatting to record create/update steps
parent
562b6164
2021.9.x
2020.12.x
2020.12.x-store-cache
2020.9.x
2021.3.x
2021.3.x-feature-invoker-runner
2021.3.x-sink
2021.3.x-wf-flaky-trace
2021.9.x-feature-discovery
2021.9.x-feature-idp-roles
2021.9.x-feature-ns-dup
2021.9.x-feature-report-scenarios
2021.9.x-feature-res-tr
2021.9.x-fix-wf-preprocessing-loop
2021.9.x-planetcrust
2021.9.x-wf-function-translations
2021.9.3
2021.9.3-planetcrust
2021.9.3-discovery
2021.9.2
2021.9.2-plugin-poc
2021.9.1
2021.9.0
2021.9.0-rc.4
2021.9.0-rc.3
2021.9.0-rc.2
2021.9.0-rc.1
2021.9.0-dev.5
2021.9.0-dev.4
2021.9.0-dev.3
2021.9.0-dev.2
2021.9.0-dev.1
2021.6.0-rc.3
2021.6.0-rc.2
2021.6.0-rc.1
2021.6.0-feature-relay
2021.3.13
2021.3.12
2021.3.11
2021.3.10
2021.3.9
2021.3.8
2021.3.7
2021.3.6
2021.3.5
2021.3.4
2021.3.3
2021.3.2
2021.3.1
2021.3.1-feature-fed-update
2021.3.0
2021.3.0-rc.4
2021.3.0-rc.3
2021.3.0-rc.2
2021.3.0-rc.1
2021.3.0-feature-workflow
2021.3.0-feature-fed-update
2020.12.3
2020.12.2
2020.12.1
2020.12.0
2020.12.0-rc.5
2020.12.0-rc.4
2020.12.0-rc.3
2020.12.0-rc.2
2020.12.0-rc.1
2020.12.0-feddatafix
2020.9.5
2020.9.4
2020.9.1
2020.9.0
2020.9.0-rc.1
2020.6.1
2020.6.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
compose/service/record.go
compose/service/record.go
+13
-2
No files found.
compose/service/record.go
View file @
47fca9be
...
...
@@ -374,6 +374,7 @@ func (svc record) Create(new *types.Record) (rec *types.Record, err error) {
return
rve
}
new
.
Values
=
svc
.
formatter
.
Run
(
m
,
new
.
Values
)
if
err
=
svc
.
eventbus
.
WaitFor
(
svc
.
ctx
,
event
.
RecordBeforeCreate
(
new
,
nil
,
m
,
ns
,
rve
));
err
!=
nil
{
return
}
else
if
!
rve
.
IsValid
()
{
...
...
@@ -399,7 +400,10 @@ func (svc record) Create(new *types.Record) (rec *types.Record, err error) {
// At this point we can return the value
rec
=
new
defer
svc
.
eventbus
.
Dispatch
(
svc
.
ctx
,
event
.
RecordAfterCreateImmutable
(
new
,
nil
,
m
,
ns
,
nil
))
defer
func
()
{
new
.
Values
=
svc
.
formatter
.
Run
(
m
,
new
.
Values
)
svc
.
eventbus
.
Dispatch
(
svc
.
ctx
,
event
.
RecordAfterCreateImmutable
(
new
,
nil
,
m
,
ns
,
nil
))
}()
return
})
}
...
...
@@ -487,6 +491,9 @@ func (svc record) Update(upd *types.Record) (rec *types.Record, err error) {
// to be sent to handler
upd
.
Values
=
upd
.
Values
.
GetClean
()
// Before we pass values to automation scripts, they should be formatted
upd
.
Values
=
svc
.
formatter
.
Run
(
m
,
upd
.
Values
)
// Scripts can (besides simple error value) return complex record value error set
// that is passed back to the UI or any other API consumer
//
...
...
@@ -518,7 +525,11 @@ func (svc record) Update(upd *types.Record) (rec *types.Record, err error) {
// At this point we can return the value
rec
=
upd
defer
svc
.
eventbus
.
Dispatch
(
svc
.
ctx
,
event
.
RecordAfterUpdateImmutable
(
upd
,
old
,
m
,
ns
,
nil
))
defer
func
()
{
// Before we pass values to automation scripts, they should be formatted
upd
.
Values
=
svc
.
formatter
.
Run
(
m
,
upd
.
Values
)
svc
.
eventbus
.
Dispatch
(
svc
.
ctx
,
event
.
RecordAfterUpdateImmutable
(
upd
,
old
,
m
,
ns
,
nil
))
}()
return
})
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help