From 5020b74cc5f6e6a1f2968c56568c7fb2661fdc19 Mon Sep 17 00:00:00 2001 From: deads2k Date: Fri, 5 Jun 2015 15:04:07 -0400 Subject: [PATCH] have osc status highlight disabled deployment configs --- pkg/cmd/cli/describe/projectstatus.go | 20 ++++++++++++-------- pkg/cmd/cli/describe/projectstatus_test.go | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/cli/describe/projectstatus.go b/pkg/cmd/cli/describe/projectstatus.go index 8a7e77419eca..54025a90eacb 100644 --- a/pkg/cmd/cli/describe/projectstatus.go +++ b/pkg/cmd/cli/describe/projectstatus.go @@ -76,12 +76,7 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error return tabbedString(func(out *tabwriter.Writer) error { indent := " " - if len(project.Annotations[projectapi.ProjectDisplayName]) > 0 && - project.Annotations[projectapi.ProjectDisplayName] != namespace { - fmt.Fprintf(out, "In project %s (%s)\n", project.Annotations[projectapi.ProjectDisplayName], namespace) - } else { - fmt.Fprintf(out, "In project %s\n", namespace) - } + fmt.Fprintf(out, "In project %s\n", projectapi.DisplayNameAndNameForProject(project)) for _, group := range groups { if len(group.Builds) != 0 { @@ -132,7 +127,7 @@ func printLines(out io.Writer, indent string, depth int, lines ...string) { func describeDeploymentInServiceGroup(deploy graph.DeploymentFlow) []string { includeLastPass := deploy.Deployment.ActiveDeployment == nil if len(deploy.Images) == 1 { - lines := []string{fmt.Sprintf("%s deploys %s", deploy.Deployment.Name, describeImageInPipeline(deploy.Images[0], deploy.Deployment.Namespace))} + lines := []string{fmt.Sprintf("%s deploys %s %s", deploy.Deployment.Name, describeImageInPipeline(deploy.Images[0], deploy.Deployment.Namespace), describeDeploymentConfigTrigger(deploy.Deployment.DeploymentConfig))} if len(lines[0]) > 120 && strings.Contains(lines[0], " <- ") { segments := strings.SplitN(lines[0], " <- ", 2) lines[0] = segments[0] + " <-" @@ -142,7 +137,8 @@ func describeDeploymentInServiceGroup(deploy graph.DeploymentFlow) []string { lines = append(lines, describeDeployments(deploy.Deployment, 3)...) return lines } - lines := []string{fmt.Sprintf("%s deploys:", deploy.Deployment.Name)} + + lines := []string{fmt.Sprintf("%s deploys: %s", deploy.Deployment.Name, describeDeploymentConfigTrigger(deploy.Deployment.DeploymentConfig))} for _, image := range deploy.Images { lines = append(lines, describeImageInPipeline(image, deploy.Deployment.Namespace)) lines = append(lines, describeAdditionalBuildDetail(image.Build, includeLastPass)...) @@ -151,6 +147,14 @@ func describeDeploymentInServiceGroup(deploy graph.DeploymentFlow) []string { return lines } +func describeDeploymentConfigTrigger(dc *deployapi.DeploymentConfig) string { + if len(dc.Triggers) == 0 { + return "(manual)" + } + + return "" +} + func describeStandaloneBuildGroup(pipeline graph.ImagePipeline, namespace string) []string { switch { case pipeline.Build != nil: diff --git a/pkg/cmd/cli/describe/projectstatus_test.go b/pkg/cmd/cli/describe/projectstatus_test.go index 379e7f27a325..23b9642504e2 100644 --- a/pkg/cmd/cli/describe/projectstatus_test.go +++ b/pkg/cmd/cli/describe/projectstatus_test.go @@ -40,7 +40,7 @@ func TestProjectStatus(t *testing.T) { Name: "example", Namespace: "", Annotations: map[string]string{ - "openshift.io/display-name": "Test", + projectapi.ProjectDisplayName: "Test", }, }, },