Add updated-at to scripts, fix prefix-filtering
This commit is contained in:
@@ -64,6 +64,10 @@ func (f *Filter) procRTPrefixes(service string) {
|
||||
hasService, hasUi bool
|
||||
)
|
||||
|
||||
if service == "" {
|
||||
return
|
||||
}
|
||||
|
||||
for i, rtp := range f.ResourceTypePrefixes {
|
||||
if rtp == service {
|
||||
hasService = true
|
||||
|
||||
@@ -470,6 +470,7 @@ func (svc *service) registerServerScripts(ctx context.Context, ss ...*ServerScri
|
||||
Errors: script.Errors,
|
||||
Triggers: script.Triggers,
|
||||
Iterator: script.Iterator,
|
||||
UpdatedAt: script.UpdatedAt,
|
||||
}
|
||||
|
||||
if len(s.Errors) == 0 {
|
||||
@@ -871,6 +872,7 @@ func (svc *service) registerClientScripts(ss ...*ClientScript) {
|
||||
Triggers: script.Triggers,
|
||||
Bundle: script.Bundle,
|
||||
Type: script.Type,
|
||||
UpdatedAt: script.UpdatedAt,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ type (
|
||||
Triggers []*Trigger `json:"triggers"`
|
||||
Iterator *Iterator `json:"iterator"`
|
||||
Security *ScriptSecurity `json:"security"`
|
||||
UpdatedAt string `json:"updatedAt,omitempty"`
|
||||
|
||||
// If bundle or type is set, consider
|
||||
// this a frontend script
|
||||
|
||||
@@ -97,7 +97,13 @@ func encodeArguments(args map[string]string, key string, val interface{}) (err e
|
||||
|
||||
// GenericListHandler returns filtered list of scripts
|
||||
func GenericListHandler(ctx context.Context, svc *service, f Filter, resourcePrefix string) (p *automationListSetPayload, err error) {
|
||||
f.procRTPrefixes(resourcePrefix)
|
||||
if f.ExcludeInvalid {
|
||||
// resource prefix filtering is only applicable when we want to
|
||||
// exclude invalid scripts, because invalid scripts do not have
|
||||
// (usually, depends at what level error occurred) information
|
||||
// about triggers and resources
|
||||
f.procRTPrefixes(resourcePrefix)
|
||||
}
|
||||
|
||||
p = &automationListSetPayload{}
|
||||
p.Set, p.Filter, err = svc.Find(ctx, f)
|
||||
|
||||
Reference in New Issue
Block a user