@@ -13,7 +13,7 @@ import (
1313 "github.com/jr-k/d4s/internal/ui/styles"
1414)
1515
16- var Headers = []string {"ID" , "NAME" , "DRIVER" , "SCOPE" , "CREATED" , "INTERNAL" , "SUBNET" }
16+ var Headers = []string {"ID" , "NAME" , "DRIVER" , "SCOPE" , "CONTAINERS" , " CREATED" , "INTERNAL" , "SUBNET" }
1717
1818func Fetch (app common.AppController , v * view.ResourceView ) ([]dao.Resource , error ) {
1919 scope := app .GetActiveScope ()
@@ -56,6 +56,7 @@ func Inspect(app common.AppController, id string) {
5656func GetShortcuts () []string {
5757 return []string {
5858 common .FormatSCHeader ("d" , "Describe" ),
59+ common .FormatSCHeader ("c" , "Containers" ),
5960 common .FormatSCHeader ("a" , "Add" ),
6061 common .FormatSCHeader ("p" , "Prune" ),
6162 common .FormatSCHeader ("ctrl-d" , "Delete" ),
@@ -69,6 +70,26 @@ func InputHandler(v *view.ResourceView, event *tcell.EventKey) *tcell.EventKey {
6970 return nil
7071 }
7172 switch event .Rune () {
73+ case 'c' :
74+ row , _ := v .Table .GetSelection ()
75+ if row < 1 || row >= v .Table .GetRowCount () {
76+ return nil
77+ }
78+ dataIndex := row - 1
79+ if dataIndex < 0 || dataIndex >= len (v .Data ) {
80+ return nil
81+ }
82+ if net , ok := v .Data [dataIndex ].(dao.Network ); ok {
83+ scope := & common.Scope {
84+ Type : "network" ,
85+ Value : net .ID ,
86+ Label : net .Name ,
87+ OriginView : styles .TitleNetworks ,
88+ }
89+ app .SetActiveScope (scope )
90+ app .SwitchTo (styles .TitleContainers )
91+ }
92+ return nil
7293 case 'd' :
7394 app .InspectCurrentSelection ()
7495 return nil
0 commit comments