forked from nyaruka/goflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.go
40 lines (36 loc) · 1.51 KB
/
ui.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package legacy
import (
"github.com/nyaruka/goflow/flows"
"github.com/shopspring/decimal"
)
// the different node types supported by the editor
const (
UINodeTypeActionSet flows.UINodeType = "execute_actions"
UINodeTypeWaitForResponse flows.UINodeType = "wait_for_response"
UINodeTypeSplitByAirtime flows.UINodeType = "split_by_airtime"
UINodeTypeSplitBySubflow flows.UINodeType = "split_by_subflow"
UINodeTypeSplitByWebhook flows.UINodeType = "split_by_webhook"
UINodeTypeSplitByResthook flows.UINodeType = "split_by_resthook"
UINodeTypeSplitByGroups flows.UINodeType = "split_by_groups"
UINodeTypeSplitByExpression flows.UINodeType = "split_by_expression"
UINodeTypeSplitByContactField flows.UINodeType = "split_by_contact_field"
UINodeTypeSplitByRunResult flows.UINodeType = "split_by_run_result"
UINodeTypeSplitByRunResultDelimited flows.UINodeType = "split_by_run_result_delimited"
UINodeTypeSplitByRandom flows.UINodeType = "split_by_random"
)
// Note is a legacy sticky note
type Note struct {
X decimal.Decimal `json:"x"`
Y decimal.Decimal `json:"y"`
Title string `json:"title"`
Body string `json:"body"`
}
// Migrate migrates this note to a new sticky note
func (n *Note) Migrate() flows.Sticky {
return flows.Sticky{
"position": map[string]interface{}{"left": n.X.IntPart(), "top": n.Y.IntPart()},
"title": n.Title,
"body": n.Body,
"color": "yellow",
}
}