Skip to content

Commit

Permalink
add route tables but only show id for now
Browse files Browse the repository at this point in the history
Signed-off-by: matthias.gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Nov 23, 2023
1 parent dec5b86 commit 91e916a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
7 changes: 5 additions & 2 deletions osc_tui/mainForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from osc_tui import nicsGrid
from osc_tui import publicIps
from osc_tui import internetServices
from osc_tui import routeTables

from osc_diagram import osc_diagram

Expand Down Expand Up @@ -61,7 +62,7 @@ def swicthToVolumeLink(self, id, volume):

# update draw_line_at when adding a new resource
class mainMenu(oscscreen.MultiLineAction):
def __init__(self, screen, form=None, draw_line_at=15, *args, **keywords):
def __init__(self, screen, form=None, draw_line_at=16, *args, **keywords):
super().__init__(screen, *args, **keywords)
self.form = form
self.cursor_line = SELECTED_BUTTON
Expand Down Expand Up @@ -256,7 +257,7 @@ def build_line(size):
out = out + '‎'
return out
menu_desc = (
"Vms Security Volumes Snapshots Keypairs Images LoadBalancers Nets Subnets PublicIps Nics NetAccessPoints NetPeering InternetServices GPUs " + build_line(15) + " Refresh Quit").split()
"Vms Security Volumes Snapshots Keypairs Images LoadBalancers Nets Subnets PublicIps Nics NetAccessPoints NetPeering InternetServices RouteTables GPUs " + build_line(15) + " Refresh Quit").split()
global CURRENT_GRID_CLASS
y, _ = self.useable_space()
self.rowOffset = MENU_WIDTH
Expand Down Expand Up @@ -312,6 +313,8 @@ def build_line(size):
CURRENT_GRID_CLASS = nicsGrid.nicsGrid
elif MODE == 'InternetServices':
CURRENT_GRID_CLASS = internetServices.internetServicesGrid
elif MODE == 'RouteTables':
CURRENT_GRID_CLASS = routeTables.routeTablesGrid
elif MODE == 'PublicIps':
CURRENT_GRID_CLASS = publicIps.publicIpsGrid
elif MODE == 'Keypairs':
Expand Down
19 changes: 19 additions & 0 deletions osc_tui/routeTables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from osc_tui import main
from osc_tui import popup
from osc_tui import selectableGrid

class routeTablesGrid(selectableGrid.SelectableGrid):
def __init__(self, screen, *args, **keywords):
super().__init__(screen, *args, **keywords)
self.col_titles = ["Id"]

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"])
values = list()
for g in groups:
values.append([g['RouteTableId']])
self.values = values

0 comments on commit 91e916a

Please sign in to comment.