-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from hovsep/export
Export
- Loading branch information
Showing
10 changed files
with
661 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
package dot | ||
|
||
import fmeshcomponent "github.com/hovsep/fmesh/component" | ||
|
||
type attributesMap map[string]string | ||
|
||
type ComponentConfig struct { | ||
Subgraph attributesMap | ||
SubgraphNodeBaseAttrs attributesMap | ||
Node attributesMap | ||
NodeDefaultLabel string | ||
ErrorNode attributesMap | ||
SubgraphAttributesByActivationResultCode map[fmeshcomponent.ActivationResultCode]attributesMap | ||
} | ||
|
||
type PortConfig struct { | ||
Node attributesMap | ||
} | ||
|
||
type LegendConfig struct { | ||
Subgraph attributesMap | ||
Node attributesMap | ||
} | ||
|
||
type PipeConfig struct { | ||
Edge attributesMap | ||
} | ||
|
||
type Config struct { | ||
MainGraph attributesMap | ||
Component ComponentConfig | ||
Port PortConfig | ||
Pipe PipeConfig | ||
Legend LegendConfig | ||
} | ||
|
||
var ( | ||
defaultConfig = &Config{ | ||
MainGraph: attributesMap{ | ||
"layout": "dot", | ||
"splines": "ortho", | ||
}, | ||
Component: ComponentConfig{ | ||
Subgraph: attributesMap{ | ||
"cluster": "true", | ||
"style": "rounded", | ||
"color": "black", | ||
"margin": "20", | ||
"penwidth": "5", | ||
}, | ||
SubgraphNodeBaseAttrs: attributesMap{ | ||
"fontname": "Courier New", | ||
"width": "1.0", | ||
"height": "1.0", | ||
"penwidth": "2.5", | ||
"style": "filled", | ||
}, | ||
Node: attributesMap{ | ||
"shape": "rect", | ||
"color": "#9dddea", | ||
"style": "filled", | ||
}, | ||
NodeDefaultLabel: "𝑓", | ||
ErrorNode: nil, | ||
SubgraphAttributesByActivationResultCode: map[fmeshcomponent.ActivationResultCode]attributesMap{ | ||
fmeshcomponent.ActivationCodeOK: { | ||
"color": "green", | ||
}, | ||
fmeshcomponent.ActivationCodeNoInput: { | ||
"color": "yellow", | ||
}, | ||
fmeshcomponent.ActivationCodeNoFunction: { | ||
"color": "gray", | ||
}, | ||
fmeshcomponent.ActivationCodeReturnedError: { | ||
"color": "red", | ||
}, | ||
fmeshcomponent.ActivationCodePanicked: { | ||
"color": "pink", | ||
}, | ||
fmeshcomponent.ActivationCodeWaitingForInputsClear: { | ||
"color": "blue", | ||
}, | ||
fmeshcomponent.ActivationCodeWaitingForInputsKeep: { | ||
"color": "purple", | ||
}, | ||
}, | ||
}, | ||
Port: PortConfig{ | ||
Node: attributesMap{ | ||
"shape": "circle", | ||
}, | ||
}, | ||
Pipe: PipeConfig{ | ||
Edge: attributesMap{ | ||
"minlen": "3", | ||
"penwidth": "2", | ||
"color": "#e437ea", | ||
}, | ||
}, | ||
Legend: LegendConfig{ | ||
Subgraph: attributesMap{ | ||
"style": "dashed,filled", | ||
"fillcolor": "#e2c6fc", | ||
}, | ||
Node: attributesMap{ | ||
"shape": "plaintext", | ||
"color": "green", | ||
"fontname": "Courier New", | ||
}, | ||
}, | ||
} | ||
|
||
legendTemplate = ` | ||
<table border="0" cellborder="0" cellspacing="10"> | ||
{{ if .meshDescription }} | ||
<tr> | ||
<td>Description:</td><td>{{ .meshDescription }}</td> | ||
</tr> | ||
{{ end }} | ||
{{ if .cycleNumber }} | ||
<tr> | ||
<td>Cycle:</td><td>{{ .cycleNumber }}</td> | ||
</tr> | ||
{{ end }} | ||
{{ if .stats }} | ||
{{ range .stats }} | ||
<tr> | ||
<td>{{ .Name }}:</td><td>{{ .Value }}</td> | ||
</tr> | ||
{{ end }} | ||
{{ end }} | ||
</table> | ||
` | ||
) |
Oops, something went wrong.