Skip to content

Commit

Permalink
add users tab
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 26, 2024
1 parent 9acdbb9 commit 4feb516
Show file tree
Hide file tree
Showing 2 changed files with 26 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 @@ -38,6 +38,7 @@
from osc_tui import routeTables
from osc_tui import dhcpOptions
from osc_tui import natServices
from osc_tui import userGrid

from osc_diagram import osc_diagram

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

# update draw_line_at when adding a new resource
class mainMenu(osc_npyscreen.MultiLineAction):
def __init__(self, screen, form=None, draw_line_at=18, *args, **keywords):
def __init__(self, screen, form=None, draw_line_at=19, *args, **keywords):
super().__init__(screen, *args, **keywords)
self.form = form
self.cursor_line = SELECTED_BUTTON
Expand Down Expand Up @@ -261,7 +262,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 NatServices RouteTables DhcpOptions GPUs " + build_line(15) + " Refresh Quit").split()
"Vms Security Volumes Snapshots Keypairs Images LoadBalancers Nets Subnets PublicIps Nics NetAccessPoints NetPeering InternetServices NatServices RouteTables DhcpOptions GPUs Users " + build_line(15) + " Refresh Quit").split()
global CURRENT_GRID_CLASS
y, _ = self.useable_space()
self.rowOffset = MENU_WIDTH
Expand Down Expand Up @@ -323,6 +324,8 @@ def build_line(size):
CURRENT_GRID_CLASS = dhcpOptions.dhcpOptionsGrid
elif MODE == 'NatServices':
CURRENT_GRID_CLASS = natServices.natServicesGrid
elif MODE == 'Users':
CURRENT_GRID_CLASS = userGrid.userGrid
elif MODE == 'PublicIps':
CURRENT_GRID_CLASS = publicIps.publicIpsGrid
elif MODE == 'Keypairs':
Expand Down
21 changes: 21 additions & 0 deletions osc_tui/userGrid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from osc_tui import main
from osc_tui import popup
from osc_tui import selectableGrid

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

def refresh_call(self, name_filter=None):
groups = main.GATEWAY.ReadUsers(form=self.form)['Users']
return groups

def refresh(self):
groups = main.do_search(self.data.copy(), ["UserId", "UserName",
"UserEmail", "CreationDate"])
values = list()
for g in groups:
values.append([g['UserId'], g['UserName'], g['UserEmail'],
g["CreationDate"]])
self.values = values

0 comments on commit 4feb516

Please sign in to comment.