Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Short Node Label for Stack Graph #11383

Merged
merged 1 commit into from Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,4 @@
changes:
- type: feat
scope: cli
description: Adds a flag that allows user to set the node label as the resource name instead of full URN in the stack graph
8 changes: 8 additions & 0 deletions pkg/cmd/pulumi/stack_graph.go
Expand Up @@ -40,6 +40,9 @@ var dependencyEdgeColor string
// The color of parent edges in the graph. Defaults to #AA6639, an orange.
var parentEdgeColor string

// Whether or not to return resource name as the node label for each node of the graph.
var shortNodeName bool

func newStackGraphCmd() *cobra.Command {
var stackName string

Expand Down Expand Up @@ -98,6 +101,8 @@ func newStackGraphCmd() *cobra.Command {
"Sets the color of dependency edges in the graph")
cmd.PersistentFlags().StringVar(&parentEdgeColor, "parent-edge-color", "#AA6639",
"Sets the color of parent edges in the graph")
cmd.PersistentFlags().BoolVar(&shortNodeName, "short-node-name", false,
"Sets the resource name as the node label for each node of the graph")
return cmd
}

Expand Down Expand Up @@ -178,6 +183,9 @@ func (vertex *dependencyVertex) Data() interface{} {
}

func (vertex *dependencyVertex) Label() string {
if shortNodeName {
return string(vertex.resource.URN.Name())
}
return string(vertex.resource.URN)
}

Expand Down