Skip to content

Commit

Permalink
nics: initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: matthias.gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Sep 29, 2023
1 parent 62cda15 commit 4ed9dad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion osc_tui/mainForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
19 changes: 19 additions & 0 deletions osc_tui/nicsGrid.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 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

0 comments on commit 4ed9dad

Please sign in to comment.