diff --git a/osc_tui/mainForm.py b/osc_tui/mainForm.py index b1b8d09..9bb815b 100644 --- a/osc_tui/mainForm.py +++ b/osc_tui/mainForm.py @@ -30,6 +30,7 @@ from osc_tui import loadbalancerGrid from osc_tui import volumesGrid from osc_tui import guiRules +from osc_tui import nicsGrid from osc_diagram import osc_diagram @@ -252,7 +253,7 @@ def build_line(size): out = out + '‎' return out menu_desc = ( - "Vms Security Volumes Snapshots Keypairs Images LoadBalancers Nets NetAccessPoints NetPeering GPUs " + build_line(15) + " Refresh Quit").split() + "Vms Security Volumes Snapshots Keypairs Images LoadBalancers Nets Nics NetAccessPoints NetPeering GPUs " + build_line(15) + " Refresh Quit").split() global CURRENT_GRID_CLASS y, _ = self.useable_space() self.rowOffset = MENU_WIDTH @@ -304,6 +305,8 @@ def build_line(size): elif MODE == 'Subnets': CURRENT_GRID_CLASS = vpcsGrid.subnetGrid menu_desc.append('Create new') + elif MODE == 'Nics': + CURRENT_GRID_CLASS = nicsGrid.nicsGrid elif MODE == 'Keypairs': CURRENT_GRID_CLASS = keyPairsGrid.KeyPairsGrid menu_desc.append('Create new') diff --git a/osc_tui/nicsGrid.py b/osc_tui/nicsGrid.py new file mode 100644 index 0000000..c7c07f3 --- /dev/null +++ b/osc_tui/nicsGrid.py @@ -0,0 +1,19 @@ +from osc_tui import main +from osc_tui import popup +from osc_tui import selectableGrid + +class nicsGrid(selectableGrid.SelectableGrid): + def __init__(self, screen, *args, **keywords): + super().__init__(screen, *args, **keywords) + self.col_titles = ["Id", "State"] + + def refresh_call(self, name_filter=None): + groups = main.GATEWAY.ReadNics(form=self.form)['Nics'] + return groups + + def refresh(self): + groups = main.do_search(self.data.copy(), ["NicId", "State"]) + values = list() + for g in groups: + values.append([g['NicId'], g["State"]]) + self.values = values