Skip to content

Commit

Permalink
add internet services, 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 0007001 commit dec5b86
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
19 changes: 19 additions & 0 deletions osc_tui/internetServices.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 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
8 changes: 6 additions & 2 deletions osc_tui/mainForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit dec5b86

Please sign in to comment.