mermaid job partition refs fix
This commit is contained in:
parent
52e4d2e9d4
commit
aa08cdd8db
1 changed files with 42 additions and 10 deletions
|
|
@ -336,13 +336,30 @@ func generateMermaidDiagram(graph *JobGraph) string {
|
|||
|
||||
// Process each task in the graph
|
||||
for _, task := range graph.Nodes {
|
||||
// Create a unique ID for this job+outputs combination
|
||||
outputsKey := strings.Join(task.Config.Outputs, "_")
|
||||
jobNodeId := "job_" + strings.Replace(task.JobLabel, "//", "_", -1)
|
||||
jobNodeId = strings.Replace(jobNodeId, ":", "_", -1)
|
||||
jobNodeId = jobNodeId + "_" + strings.Replace(outputsKey, "/", "_", -1)
|
||||
|
||||
// Create a descriptive label that includes both job label and outputs
|
||||
jobLabel := task.JobLabel
|
||||
outputsLabel := ""
|
||||
if len(task.Config.Outputs) > 0 {
|
||||
if len(task.Config.Outputs) == 1 {
|
||||
outputsLabel = " [" + task.Config.Outputs[0] + "]"
|
||||
} else {
|
||||
outputsLabel = " [" + task.Config.Outputs[0] + ", ...]"
|
||||
}
|
||||
}
|
||||
|
||||
// Add the job node if not already added
|
||||
if !addedNodes[jobNodeId] {
|
||||
// Represent job as a process shape
|
||||
mermaid += fmt.Sprintf(" %s[\"%s\"]:::job\n", jobNodeId, task.JobLabel)
|
||||
// Represent job as a process shape with escaped label
|
||||
mermaid += fmt.Sprintf(" %s[\"`**%s** %s`\"]:::job\n",
|
||||
jobNodeId,
|
||||
jobLabel,
|
||||
outputsLabel)
|
||||
addedNodes[jobNodeId] = true
|
||||
}
|
||||
|
||||
|
|
@ -352,8 +369,19 @@ func generateMermaidDiagram(graph *JobGraph) string {
|
|||
|
||||
// Add the partition ref node if not already added
|
||||
if !addedRefs[refNodeId] {
|
||||
node_class := "partition"
|
||||
// Apply output styling immediately if this is an output ref
|
||||
if isOutputRef[input.Ref] {
|
||||
//mermaid += fmt.Sprintf(" class %s outputPartition;\n", refNodeId)
|
||||
node_class = "outputPartition"
|
||||
}
|
||||
|
||||
// Represent partition as a cylinder
|
||||
mermaid += fmt.Sprintf(" %s[(Partition: %s)]:::partition\n", refNodeId, input.Ref)
|
||||
mermaid += fmt.Sprintf(" %s[(\"%s\")]:::%s\n",
|
||||
refNodeId,
|
||||
input.Ref,
|
||||
node_class,
|
||||
)
|
||||
addedRefs[refNodeId] = true
|
||||
}
|
||||
|
||||
|
|
@ -373,8 +401,18 @@ func generateMermaidDiagram(graph *JobGraph) string {
|
|||
|
||||
// Add the partition ref node if not already added
|
||||
if !addedRefs[refNodeId] {
|
||||
node_class := "partition"
|
||||
// Apply output styling immediately if this is an output ref
|
||||
if isOutputRef[output] {
|
||||
//mermaid += fmt.Sprintf(" class %s outputPartition;\n", refNodeId)
|
||||
node_class = "outputPartition"
|
||||
}
|
||||
|
||||
// Represent partition as a cylinder
|
||||
mermaid += fmt.Sprintf(" %s[(Partition: %s)]:::partition\n", refNodeId, output)
|
||||
mermaid += fmt.Sprintf(" %s[(\"Partition: %s\")]:::%s\n",
|
||||
refNodeId,
|
||||
output,
|
||||
node_class)
|
||||
addedRefs[refNodeId] = true
|
||||
}
|
||||
|
||||
|
|
@ -389,12 +427,6 @@ func generateMermaidDiagram(graph *JobGraph) string {
|
|||
mermaid += " classDef partition fill:#bbf,stroke:#333,stroke-width:1px;\n"
|
||||
mermaid += " classDef outputPartition fill:#bfb,stroke:#333,stroke-width:2px;\n"
|
||||
|
||||
// Apply output styling to output refs
|
||||
for ref := range isOutputRef {
|
||||
refNodeId := "ref_" + strings.Replace(ref, "/", "_", -1)
|
||||
mermaid += fmt.Sprintf(" class %s outputPartition;\n", refNodeId)
|
||||
}
|
||||
|
||||
return mermaid
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue