diff --git a/osc_tui/internetServices.py b/osc_tui/internetServices.py new file mode 100644 index 0000000..f0d8068 --- /dev/null +++ b/osc_tui/internetServices.py @@ -0,0 +1,19 @@ +from osc_tui import main +from osc_tui import popup +from osc_tui import selectableGrid + +class internetServicesGrid(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.ReadInternetServices(form=self.form)['InternetServices'] + return groups + + def refresh(self): + groups = main.do_search(self.data.copy(), ["InternetServiceId"]) + values = list() + for g in groups: + values.append([g['InternetServiceId']]) + self.values = values diff --git a/osc_tui/mainForm.py b/osc_tui/mainForm.py index b72cf98..9bd704f 100644 --- a/osc_tui/mainForm.py +++ b/osc_tui/mainForm.py @@ -32,6 +32,7 @@ from osc_tui import guiRules from osc_tui import nicsGrid from osc_tui import publicIps +from osc_tui import internetServices from osc_diagram import osc_diagram @@ -58,8 +59,9 @@ def swicthToVolumeLink(self, id, volume): self.parentApp.switchForm("Volume-Link") +# update draw_line_at when adding a new resource class mainMenu(oscscreen.MultiLineAction): - def __init__(self, screen, form=None, draw_line_at=14, *args, **keywords): + def __init__(self, screen, form=None, draw_line_at=15, *args, **keywords): super().__init__(screen, *args, **keywords) self.form = form self.cursor_line = SELECTED_BUTTON @@ -254,7 +256,7 @@ def build_line(size): out = out + '‎' return out menu_desc = ( - "Vms Security Volumes Snapshots Keypairs Images LoadBalancers Nets Subnets PublicIps Nics NetAccessPoints NetPeering GPUs " + build_line(15) + " Refresh Quit").split() + "Vms Security Volumes Snapshots Keypairs Images LoadBalancers Nets Subnets PublicIps Nics NetAccessPoints NetPeering InternetServices GPUs " + build_line(15) + " Refresh Quit").split() global CURRENT_GRID_CLASS y, _ = self.useable_space() self.rowOffset = MENU_WIDTH @@ -308,6 +310,8 @@ def build_line(size): menu_desc.append('Create new') elif MODE == 'Nics': CURRENT_GRID_CLASS = nicsGrid.nicsGrid + elif MODE == 'InternetServices': + CURRENT_GRID_CLASS = internetServices.internetServicesGrid elif MODE == 'PublicIps': CURRENT_GRID_CLASS = publicIps.publicIpsGrid elif MODE == 'Keypairs':