Skip to content

Commit

Permalink
route tables infos
Browse files Browse the repository at this point in the history
Signed-off-by: matthias.gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Feb 1, 2024
1 parent 82f46a1 commit f56edab
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
38 changes: 38 additions & 0 deletions osc_tui/popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,44 @@ def add_to_lbu():
F.edit()


def selectRouteTable(form, rt, form_color='STANDOUT'):
id = rt[0]
F = displayPopup(id, color=form_color)
F.preserve_selected_widget = True

def exit():
F.editing = False

F.on_ok = exit
info = F.add_widget(
oscscreen.ButtonPress,
name="INFO",
)

def info_rt():
exit()
F = displayPopupWide(name = "Route Table Info id: " + id)
F.preserve_selected_widget = True

ft = F.add_widget(
oscscreen.Pager,
)
sg = main.GATEWAY.ReadRouteTables(form=form, Filters={"RouteTableIds": [id]})
sg = sg["RouteTables"][0]

ft.values = json.dumps(sg, indent=2).split("\n")

def ok():
exit()

F.on_ok = ok
F.edit()

info.whenPressed = info_rt
F.edit()
form.current_grid.display()


def editSecurityGroup(form, sg, form_color='STANDOUT'):
name = sg[1]
id = sg[0]
Expand Down
11 changes: 8 additions & 3 deletions osc_tui/routeTables.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
class routeTablesGrid(selectableGrid.SelectableGrid):
def __init__(self, screen, *args, **keywords):
super().__init__(screen, *args, **keywords)
self.col_titles = ["Id"]
self.col_titles = ["Id", "NetId"]

def on_selection(line):
popup.selectRouteTable(self.form, line)

self.on_selection = on_selection

def refresh_call(self, name_filter=None):
groups = main.GATEWAY.ReadRouteTables(form=self.form)['RouteTables']
return groups

def refresh(self):
groups = main.do_search(self.data.copy(), ["RouteTableId"])
groups = main.do_search(self.data.copy(), ["RouteTableId", "NetId"])
values = list()
for g in groups:
values.append([g['RouteTableId']])
values.append([g['RouteTableId'], g["NetId"] if "NetId" in g else "No Net"])
self.values = values

0 comments on commit f56edab

Please sign in to comment.