diff --git a/server/common/types.go b/server/common/types.go index 5e4f5327..2f3c93bd 100644 --- a/server/common/types.go +++ b/server/common/types.go @@ -94,12 +94,12 @@ type ITriggerEvent interface { } type WorkflowSpecs struct { - Name string `json:"name"` - Title string `json:"title"` - Subtitle string `json:"subtitle"` - Icon string `json:"icon"` - Specs map[string]FormElement `json:"specs"` - Order int `json:"-"` + Name string `json:"name"` + Title string `json:"title"` + Subtitle string `json:"subtitle"` + Icon string `json:"icon"` + Specs Form `json:"specs"` + Order int `json:"-"` } type File struct { diff --git a/server/workflow/actions/notify_email.go b/server/workflow/actions/notify_email.go index 64d6ab06..f68c9854 100644 --- a/server/workflow/actions/notify_email.go +++ b/server/workflow/actions/notify_email.go @@ -17,15 +17,20 @@ func (this *ActionNotifyEmail) Manifest() WorkflowSpecs { Name: "notify/email", Title: "Notify", Icon: ``, - Specs: map[string]FormElement{ - "email": { - Type: "text", - }, - "subject": { - Type: "text", - }, - "message": { - Type: "long_text", + Specs: Form{ + Elmnts: []FormElement{ + { + Name: "email", + Type: "text", + }, + { + Name: "subject", + Type: "text", + }, + { + Name: "message", + Type: "long_text", + }, }, }, } diff --git a/server/workflow/actions/run_api.go b/server/workflow/actions/run_api.go index ec2caa9a..0637afda 100644 --- a/server/workflow/actions/run_api.go +++ b/server/workflow/actions/run_api.go @@ -22,19 +22,25 @@ func (this *RunApi) Manifest() WorkflowSpecs { Name: "run/api", Title: "Make API Call", Icon: ``, - Specs: map[string]FormElement{ - "url": { - Type: "text", - }, - "method": { - Type: "select", - Opts: []string{"POST", "PUT", "GET", "PATCH"}, - }, - "headers": { - Type: "long_text", - }, - "body": { - Type: "long_text", + Specs: Form{ + Elmnts: []FormElement{ + { + Name: "url", + Type: "text", + }, + { + Name: "method", + Type: "select", + Opts: []string{"POST", "PUT", "GET", "PATCH"}, + }, + { + Name: "headers", + Type: "long_text", + }, + { + Name: "body", + Type: "long_text", + }, }, }, } diff --git a/server/workflow/actions/tools_debug.go b/server/workflow/actions/tools_debug.go index 2e730b57..9ba68a8c 100644 --- a/server/workflow/actions/tools_debug.go +++ b/server/workflow/actions/tools_debug.go @@ -15,7 +15,7 @@ func (this *ToolsDebug) Manifest() WorkflowSpecs { Name: "tools/debug", Title: "Debug", Icon: ``, - Specs: map[string]FormElement{}, + Specs: Form{}, } } diff --git a/server/workflow/trigger/fileaction.go b/server/workflow/trigger/fileaction.go index 51b65710..3d98fb4b 100644 --- a/server/workflow/trigger/fileaction.go +++ b/server/workflow/trigger/fileaction.go @@ -60,14 +60,18 @@ func (this *FileEventTrigger) Manifest() WorkflowSpecs { Name: fileaction_name, Title: "When Something Happen", Icon: ``, - Specs: map[string]FormElement{ - "event": { - Type: "text", - Datalist: []string{"ls", "cat", "mkdir", "mv", "rm", "touch"}, - MultiValue: true, - }, - "path": { - Type: "text", + Specs: Form{ + Elmnts: []FormElement{ + { + Name: "event", + Type: "text", + Datalist: []string{"ls", "cat", "mkdir", "mv", "rm", "touch"}, + MultiValue: true, + }, + { + Name: "path", + Type: "text", + }, }, }, Order: 3, diff --git a/server/workflow/trigger/filewatch.go b/server/workflow/trigger/filewatch.go index f9450421..80fb40ba 100644 --- a/server/workflow/trigger/filewatch.go +++ b/server/workflow/trigger/filewatch.go @@ -28,12 +28,16 @@ func (this *WatchTrigger) Manifest() WorkflowSpecs { Name: "watch", Title: "When the Filesystem Changes", Icon: ``, - Specs: map[string]FormElement{ - "token": { - Type: "text", - }, - "path": { - Type: "text", + Specs: Form{ + Elmnts: []FormElement{ + { + Name: "token", + Type: "text", + }, + { + Name: "path", + Type: "text", + }, }, }, Order: 4, diff --git a/server/workflow/trigger/schedule.go b/server/workflow/trigger/schedule.go index e364fb43..ae20a873 100644 --- a/server/workflow/trigger/schedule.go +++ b/server/workflow/trigger/schedule.go @@ -23,11 +23,14 @@ func (this *ScheduleTrigger) Manifest() WorkflowSpecs { Title: "On a Schedule", Subtitle: "frequency", Icon: ``, - Specs: map[string]FormElement{ - "frequency": { - Type: "select", - Opts: []string{"per-minute", "hourly", "daily", "weekly", "monthly"}, - Value: "daily", + Specs: Form{ + Elmnts: []FormElement{ + { + Name: "frequency", + Type: "select", + Opts: []string{"per-minute", "hourly", "daily", "weekly", "monthly"}, + Value: "daily", + }, }, }, Order: 1, diff --git a/server/workflow/trigger/webhook.go b/server/workflow/trigger/webhook.go index 29816fbd..e5f78e74 100644 --- a/server/workflow/trigger/webhook.go +++ b/server/workflow/trigger/webhook.go @@ -53,11 +53,14 @@ func (this *WebhookTrigger) Manifest() WorkflowSpecs { Name: webhook_name, Title: "From a WebHook", Icon: ``, - Specs: map[string]FormElement{ - "url": { - Type: "text", - ReadOnly: true, - Value: "/api/workflow/webhook", + Specs: Form{ + Elmnts: []FormElement{ + { + Name: "url", + Type: "text", + ReadOnly: true, + Value: "/api/workflow/webhook", + }, }, }, Order: 5,