Skip to content

Commit 215900d

Browse files
committed
new
1 parent 6d6a81f commit 215900d

5 files changed

Lines changed: 18 additions & 21 deletions

File tree

cmd/gateways.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cmd
22

33
import (
4-
"encoding/json"
54
"fmt"
65

76
"github.com/drycc/controller-sdk-go/gateways"
@@ -28,11 +27,10 @@ func (d *DryccCmd) GatewaysList(appID string, results int) error {
2827
d.Println("Could not find any gateway")
2928
} else {
3029
table := tablewriter.NewWriter(d.WOut)
31-
table.SetHeader([]string{"Name", "Lisenter", "Port", "Protocol", "allowedRoutes"})
30+
table.SetHeader([]string{"Name", "Lisenter", "Port", "Protocol"})
3231
for _, gateway := range gateways {
3332
for _, listener := range gateway.Listeners {
34-
allowedRoutes, _ := json.Marshal(listener.AllowedRoutes)
35-
table.Append([]string{gateway.Name, listener.Name, fmt.Sprint(listener.Port), listener.Protocol, string(allowedRoutes)})
33+
table.Append([]string{gateway.Name, listener.Name, fmt.Sprint(listener.Port), listener.Protocol})
3634
}
3735
}
3836
table.SetAutoMergeCellsByColumnIndex([]int{0})

cmd/gateways_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ func TestGatewaysList(t *testing.T) {
5757
assert.NoError(t, err)
5858

5959
assert.Equal(t, b.String(), `=== foo Gateways
60-
+------+---------------+------+----------+-------------------------------+
61-
| NAME | LISENTER | PORT | PROTOCOL | ALLOWEDROUTES |
62-
+------+---------------+------+----------+-------------------------------+
63-
| foo | foo-80-http | 80 | HTTP | {"namespaces":{"from":"All"}} |
64-
+ +---------------+------+----------+-------------------------------+
65-
| | foo-443-https | 443 | HTTPS | {"namespaces":{"from":"All"}} |
66-
+------+---------------+------+----------+-------------------------------+
60+
+------+---------------+------+----------+
61+
| NAME | LISENTER | PORT | PROTOCOL |
62+
+------+---------------+------+----------+
63+
| foo | foo-80-http | 80 | HTTP |
64+
+ +---------------+------+----------+
65+
| | foo-443-https | 443 | HTTPS |
66+
+------+---------------+------+----------+
6767
`, "output")
6868
}
6969

cmd/routes.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,15 @@ func (d *DryccCmd) RoutesList(appID string, results int) error {
5151
d.Println("Could not find any route")
5252
} else {
5353
table := tablewriter.NewWriter(d.WOut)
54-
table.SetHeader([]string{"Name", "Type", "Kind", "Gateway", "Section"})
54+
table.SetHeader([]string{"Name", "Type", "Kind", "Gateway"})
5555
for _, route := range routes {
5656
if len(route.ParentRefs) > 0 {
5757
for _, gateway := range route.ParentRefs {
58-
table.Append([]string{route.Name, route.Type, route.Kind, gateway.Name, gateway.Section})
58+
table.Append([]string{route.Name, route.Type, route.Kind, gateway.Name})
5959
}
6060
} else {
61-
table.Append([]string{route.Name, route.Type, route.Kind, "", ""})
61+
table.Append([]string{route.Name, route.Type, route.Kind, ""})
6262
}
63-
6463
}
6564
table.SetAutoMergeCellsByColumnIndex([]int{0})
6665
table.SetRowLine(true)

cmd/routes_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ func TestRoutesList(t *testing.T) {
7575
assert.NoError(t, err)
7676

7777
assert.Equal(t, b.String(), `=== foo Routes
78-
+------------+------+-----------+------------+--------------------+
79-
| NAME | TYPE | KIND | GATEWAY | SECTION |
80-
+------------+------+-----------+------------+--------------------+
81-
| example-go | web | HTTPRoute | example-go | example-go-80-http |
82-
+------------+------+-----------+------------+--------------------+
78+
+------------+------+-----------+------------+
79+
| NAME | TYPE | KIND | GATEWAY |
80+
+------------+------+-----------+------------+
81+
| example-go | web | HTTPRoute | example-go |
82+
+------------+------+-----------+------------+
8383
`, "output")
8484
}
8585

cmd/services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (d *DryccCmd) ServicesList(appID string) error {
3232
table.Append([]string{service.ProcfileType, port.Name, fmt.Sprint(port.Port), port.Protocol, fmt.Sprint(port.TargetPort)})
3333
}
3434
}
35-
table.SetAutoMergeCellsByColumnIndex([]int{0, 1})
35+
table.SetAutoMergeCellsByColumnIndex([]int{0})
3636
table.SetRowLine(true)
3737
table.Render()
3838
}

0 commit comments

Comments
 (0)