From 829cae4c47997d6f179e62e01dc7be34c803ad63 Mon Sep 17 00:00:00 2001 From: Krupa Jariwala Date: Wed, 16 Nov 2022 22:56:37 +0530 Subject: [PATCH] Changes to stack_graph.go file and envrc file --- ...e-name-instead-of-the-full-urn-in-the-stack-graph.yaml | 4 ++++ pkg/cmd/pulumi/stack_graph.go | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 changelog/pending/20221116--cli--adds-a-flag-that-allows-user-to-set-the-node-label-as-the-resource-name-instead-of-the-full-urn-in-the-stack-graph.yaml diff --git a/changelog/pending/20221116--cli--adds-a-flag-that-allows-user-to-set-the-node-label-as-the-resource-name-instead-of-the-full-urn-in-the-stack-graph.yaml b/changelog/pending/20221116--cli--adds-a-flag-that-allows-user-to-set-the-node-label-as-the-resource-name-instead-of-the-full-urn-in-the-stack-graph.yaml new file mode 100644 index 000000000000..7a1dfef82a9c --- /dev/null +++ b/changelog/pending/20221116--cli--adds-a-flag-that-allows-user-to-set-the-node-label-as-the-resource-name-instead-of-the-full-urn-in-the-stack-graph.yaml @@ -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 diff --git a/pkg/cmd/pulumi/stack_graph.go b/pkg/cmd/pulumi/stack_graph.go index 90afd0fef5f8..d564dd88e549 100644 --- a/pkg/cmd/pulumi/stack_graph.go +++ b/pkg/cmd/pulumi/stack_graph.go @@ -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 @@ -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 } @@ -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) }