fix: dynamic menu numbering via ops dict
This commit is contained in:
parent
30c24da698
commit
0171438505
1 changed files with 16 additions and 8 deletions
|
|
@ -150,10 +150,10 @@ def main():
|
|||
n += 1
|
||||
|
||||
if deployed:
|
||||
print(f" [{n}] Edit nodes"); n += 1
|
||||
print(f" [{n}] Delete a node"); n += 1
|
||||
print(f" [{n}] Status"); n += 1
|
||||
print(f" [{n}] Remote tunnel"); n += 1
|
||||
print(f" [{n}] Edit nodes"); ops['edit'] = str(n); n += 1
|
||||
print(f" [{n}] Delete a node"); ops['del'] = str(n); n += 1
|
||||
print(f" [{n}] Status"); ops['status'] = str(n); n += 1
|
||||
print(f" [{n}] Remote tunnel"); ops['tunnel'] = str(n); n += 1
|
||||
print(" [q] Quit")
|
||||
|
||||
c = input("\nChoice: ").strip()
|
||||
|
|
@ -170,13 +170,21 @@ def main():
|
|||
str(nc.get("upstream_port","80")), "",
|
||||
nc.get("mode","monitoring"))
|
||||
deployed.add(name)
|
||||
elif c == str(n-4) and deployed:
|
||||
# Track what number each action got
|
||||
ops = {}
|
||||
if deployed:
|
||||
ops['edit'] = str(n); n += 1
|
||||
ops['del'] = str(n); n += 1
|
||||
ops['status'] = str(n); n += 1
|
||||
ops['tunnel'] = str(n); n += 1
|
||||
|
||||
if c == ops.get('edit') and deployed:
|
||||
edit_nodes()
|
||||
elif c == str(n-3) and deployed:
|
||||
elif c == ops.get('del') and deployed:
|
||||
remove_menu()
|
||||
elif c == str(n-2):
|
||||
elif c == ops.get('status'):
|
||||
container_status()
|
||||
elif c == str(n-1):
|
||||
elif c == ops.get('tunnel'):
|
||||
start_tunnel()
|
||||
elif c.lower() == "q":
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in a new issue