oc-lib/models/resources/workflow/graph/graph.go

45 lines
2.0 KiB
Go
Raw Normal View History

2024-07-18 11:51:12 +02:00
package graph
2024-07-30 12:08:13 +02:00
import "cloud.o-forge.io/core/oc-lib/models/resources"
2024-07-18 11:51:12 +02:00
type Graph struct {
2024-08-02 15:06:40 +02:00
Zoom float64 `bson:"zoom" json:"zoom" validate:"required"`
2024-07-22 09:03:57 +02:00
Items map[string]GraphItem `bson:"items" json:"items" default:"{}" validate:"required"`
Links []GraphLink `bson:"links" json:"links" default:"{}" validate:"required"`
2024-07-18 11:51:12 +02:00
}
type GraphItem struct {
2024-07-30 12:08:13 +02:00
ID string `bson:"id" json:"id" validate:"required"`
Width float64 `bson:"width" json:"width" validate:"required"`
Height float64 `bson:"height" json:"height" validate:"required"`
Position Position `bson:"position" json:"position" validate:"required"`
resources.ItemResource
2024-07-18 11:51:12 +02:00
}
type GraphLink struct {
2024-07-22 09:03:57 +02:00
Source Position `bson:"source" json:"source" validate:"required"`
Destination Position `bson:"destination" json:"destination" validate:"required"`
Style GraphLinkStyle `bson:"style" json:"style" validate:"required"`
2024-07-18 11:51:12 +02:00
}
type GraphLinkStyle struct {
2024-07-23 11:49:11 +02:00
Color int64 `bson:"color" json:"color" validate:"required"`
2024-07-22 09:03:57 +02:00
Stroke float64 `bson:"stroke" json:"stroke" validate:"required"`
2024-07-18 11:51:12 +02:00
Tension float64 `bson:"tension" json:"tension"`
HeadRadius float64 `bson:"head_radius" json:"head_radius"`
DashWidth float64 `bson:"dash_width" json:"dash_width"`
DashSpace float64 `bson:"dash_space" json:"dash_space"`
EndArrow Position `bson:"end_arrow" json:"end_arrow"`
StartArrow Position `bson:"start_arrow" json:"start_arrow"`
2024-07-22 09:03:57 +02:00
ArrowStyle int64 `bson:"arrow_style" json:"arrow_style" validate:"required"`
ArrowDirection int64 `bson:"arrow_direction" json:"arrow_direction" validate:"required"`
2024-07-23 09:46:27 +02:00
StartArrowWidth float64 `bson:"start_arrow_width" json:"start_arrow_width"`
EndArrowWidth float64 `bson:"end_arrow_width" json:"end_arrow_width"`
2024-07-18 11:51:12 +02:00
}
type Position struct {
2024-07-23 09:15:42 +02:00
ID string `json:"id" bson:"id" validate:"required"`
X float64 `json:"x" bson:"x" validate:"required"`
Y float64 `json:"y" bson:"y" validate:"required"`
2024-07-18 11:51:12 +02:00
}