mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* POST /devstate/container
* Implement POST /devstate/container
* Generate DELETE /devstate/container/{containerName}
* Implement DELETE /devstate/container/{containerName}
* Serve /devstate/image
* Implement /devstate/image
* Serve /devstate/resource
* Implement /devstate/resource
* Move Components specific code to components.go
* Serve /devstate/*command
* Implement /devstate/*command
* Serve /devstate/metadata
* Implement /devstate/metadata
* Serve devstate/chart
* Implement /devstate/chart
* Create a DevfileContent schema reference
* Use `DELETE /command/{name}` instead of `DELETE /*Command/{name}`
* Serve /devstate/command/move
* Implement /devstate/command/move
* Serve /devstate/command/{name}/[un]setDefault
* Implement /devstate/command/{name}/[un]setDefault
* serve /devstate/events
* Implement /devstate/events
* Serve /devstate/quantityValid
* Implement /devstate/quantityValid
* Add json tag to API result value
* Sets a proxy for the API
* Move calls from wasm to api (first part)
* Implement PUT /devsatte/devfile
* Move calls from wasm to api (end)
* Implement GET /devstate/devfile
* Implement DELETE /devstate/devfile
* At startup, get devfile from api, not from localStorage
* Rename service wasmGo -> devstate
* Remove wasm module
* Update to latest devfile-lifecycle version, license compatible
* Apply suggestions from code review
Co-authored-by: Armel Soro <armel@rm3l.org>
* Remove wasm from ui/{Makefile/devfile.yaml}
* Define DevfileContent into apispec
* Define required fields
* Generate API models from front
* Regenerate API server after spec changes
* Fix examples case
* Fix github action e2e tests not running
* Make target for all generated api code
---------
Co-authored-by: Armel Soro <armel@rm3l.org>
83 lines
1.5 KiB
Go
Generated
83 lines
1.5 KiB
Go
Generated
package graph
|
|
|
|
import (
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
)
|
|
|
|
type Graph struct {
|
|
EntryNodeID string
|
|
nodes map[string]*Node
|
|
edges []*Edge
|
|
}
|
|
|
|
func NewGraph() *Graph {
|
|
return &Graph{
|
|
nodes: make(map[string]*Node),
|
|
}
|
|
}
|
|
|
|
func (o *Graph) AddNode(id string, text ...string) *Node {
|
|
node := Node{
|
|
ID: id,
|
|
Text: text,
|
|
}
|
|
o.nodes[id] = &node
|
|
return &node
|
|
}
|
|
|
|
func (o *Graph) AddEdge(from *Node, to *Node, text ...string) *Edge {
|
|
edge := Edge{
|
|
From: from,
|
|
To: to,
|
|
Text: text,
|
|
}
|
|
o.edges = append(o.edges, &edge)
|
|
return &edge
|
|
}
|
|
|
|
func (o *Graph) ToFlowchart() string {
|
|
var str strings.Builder
|
|
str.WriteString("graph TB\n")
|
|
texts := o.nodes[o.EntryNodeID].Text
|
|
if len(texts) == 0 {
|
|
texts = []string{o.EntryNodeID}
|
|
}
|
|
str.WriteString(fmt.Sprintf("%s[\"%s\"]\n", o.EntryNodeID, strings.Join(texts, "<br/>")))
|
|
|
|
keys := make([]string, 0, len(o.nodes))
|
|
for k := range o.nodes {
|
|
keys = append(keys, k)
|
|
|
|
}
|
|
sort.Strings(keys)
|
|
for _, key := range keys {
|
|
node := o.nodes[key]
|
|
if node.ID == o.EntryNodeID {
|
|
continue
|
|
}
|
|
if len(node.Text) == 0 {
|
|
node.Text = []string{node.ID}
|
|
}
|
|
str.WriteString(fmt.Sprintf("%s[\"%s\"]\n", node.ID, strings.Join(node.Text, "<br/>")))
|
|
}
|
|
|
|
for _, edge := range o.edges {
|
|
str.WriteString(fmt.Sprintf("%s -->|\"%s\"| %s\n", edge.From.ID, strings.Join(edge.Text, "<br/>"), edge.To.ID))
|
|
}
|
|
|
|
return str.String()
|
|
}
|
|
|
|
type Node struct {
|
|
ID string
|
|
Text []string
|
|
}
|
|
|
|
type Edge struct {
|
|
From *Node
|
|
To *Node
|
|
Text []string
|
|
}
|