Continuing work removing legacy functions and implementing UI changes
Build Library / Build Library (push) Failing after 3m58s
Build Library / Build Library (push) Failing after 3m58s
This commit is contained in:
+14
-37
@@ -20,18 +20,17 @@ from textual.widgets import (
|
||||
|
||||
from flows.otp import otp_activities_by_agent, otp_revoke
|
||||
from flows.prepPolicy import menu_policy_enforce
|
||||
from flows.quietAgent import findQuietAgents
|
||||
from models.agent import Agent
|
||||
from models.policy import Policy
|
||||
from screens.moveagentworkflowscreen import MoveAgentWorkflowScreen
|
||||
from screens.otpworkflowscreen import OTPWorkflowScreen
|
||||
from services.agenthandler import findAgents, moveAgents, toggleEnforcement
|
||||
from services.API import AirlockAPIWrapper
|
||||
from services.policyhandler import confirmUpdateAfromE
|
||||
from utils.configmanager import load_env
|
||||
from utils.setup import get_base_directory, load_user_config
|
||||
from utils.utils import open_directory
|
||||
from widgets.agentmoveoperations import AgentMoveOperations
|
||||
from widgets.amber_terminal_theme import get_amber_terminal_theme
|
||||
from widgets.multiagentselector import MultiAgentSelector
|
||||
from widgets.OTP_generate import OTPGenerator
|
||||
from widgets.policytreewidget import PolicyTreeWidget
|
||||
@@ -105,24 +104,18 @@ class MainMenuScreen(Screen):
|
||||
current_tab = reactive("")
|
||||
|
||||
BUTTON_DEFS = {
|
||||
"find": [
|
||||
("🔍 - Device Search", "find_device_button"),
|
||||
"agent_actions": [
|
||||
(
|
||||
"🖥️ - Find, Move, or Generate OTP for Agents",
|
||||
"move_agent_workflow_button",
|
||||
),
|
||||
("🔇 - Find Quiet Hosts", "find_quiet_button"),
|
||||
],
|
||||
"move": [
|
||||
("🔄 - Move Agent Workflow", "move_agent_workflow_button"),
|
||||
("✅ - Move to local approval", "move_local_button"),
|
||||
("🔄 - Move to Audit/Enforcement", "move_audit_button"),
|
||||
("🔀 - Move - Other", "move_other_button"),
|
||||
],
|
||||
"otp": [
|
||||
("🎫 - Generate OTPs", "otp_generate_button"),
|
||||
("📊 - OTP Activities By Agent", "otp_activities_button"),
|
||||
("❌ - Revoke OTPs", "otp_revoke_button"),
|
||||
],
|
||||
"policy": [
|
||||
("🔒 - Prepare Policy For Enforcement", "policy_prep_button"),
|
||||
("🔄 - Update Audit Policies", "policy_audit_update_button"),
|
||||
("📊 - OTP Activities By Agent", "otp_activities_button"),
|
||||
("❌ - Revoke OTPs", "otp_revoke_button"),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -148,23 +141,21 @@ class MainMenuScreen(Screen):
|
||||
yield Header(show_clock=True, icon="⚙")
|
||||
|
||||
tabs = [
|
||||
Tab("Policy Tree", id="p_tree"),
|
||||
Tab("Device Search", id="find"),
|
||||
Tab("Move Agent", id="move"),
|
||||
Tab("OTP", id="otp"),
|
||||
Tab("Tree View", id="p_tree"),
|
||||
Tab("Agents", id="agent_actions"),
|
||||
Tab("Directory", id="dir"),
|
||||
Tab("Settings", id="settings"),
|
||||
]
|
||||
|
||||
if self.extras == "POLICYPREP":
|
||||
tabs.insert(3, Tab("Policy Prep", id="policy"))
|
||||
tabs.insert(2, Tab("Policy Prep", id="policy"))
|
||||
|
||||
yield Tabs(*tabs, id="tabs")
|
||||
yield Vertical(id="content")
|
||||
yield Footer()
|
||||
|
||||
def on_mount(self) -> None:
|
||||
self.switch_tab("find")
|
||||
self.switch_tab("agent_actions")
|
||||
|
||||
# focus helpers
|
||||
def _get_content_buttons(self) -> list[Button]:
|
||||
@@ -225,7 +216,7 @@ class MainMenuScreen(Screen):
|
||||
def on_multi_agent_selector_agents_selected(
|
||||
self, message: MultiAgentSelector.AgentsSelected
|
||||
) -> None:
|
||||
"""Handle selected agents from MultiAgentSelector."""
|
||||
"""Handle selected agents from AgentSelector."""
|
||||
global _PENDING_JOB
|
||||
selected_agents = message.selected_agents
|
||||
logger.info("Selected agents: %s", selected_agents)
|
||||
@@ -324,26 +315,11 @@ class MainMenuScreen(Screen):
|
||||
logger.debug("Button pressed: %s", button_id)
|
||||
|
||||
match button_id:
|
||||
case "find_device_button":
|
||||
_PENDING_JOB = ("legacy", findAgents, (self.app.api, False), {})
|
||||
case "find_quiet_button":
|
||||
_PENDING_JOB = ("legacy", findQuietAgents, (self.app.api,), {})
|
||||
case "move_agent_workflow_button":
|
||||
# Push Move Agent workflow screen
|
||||
self.app.push_screen(MoveAgentWorkflowScreen(self.app.devices))
|
||||
event.stop()
|
||||
return # Don't exit the app
|
||||
case "move_local_button":
|
||||
_PENDING_JOB = (
|
||||
"legacy",
|
||||
print,
|
||||
("Move to local approval (placeholder)",),
|
||||
{},
|
||||
)
|
||||
case "move_audit_button":
|
||||
_PENDING_JOB = ("legacy", toggleEnforcement, (self.app.api,), {})
|
||||
case "move_other_button":
|
||||
_PENDING_JOB = ("legacy", moveAgents, (self.app.api,), {})
|
||||
case "otp_generate_button":
|
||||
# NEW: Push OTP workflow screen instead of legacy function
|
||||
self.app.push_screen(OTPWorkflowScreen(self.app.devices))
|
||||
@@ -415,6 +391,7 @@ class Loxide(App):
|
||||
|
||||
def on_mount(self, api: AirlockAPIWrapper) -> None:
|
||||
self.register_theme(get_retro_terminal_theme())
|
||||
self.register_theme(get_amber_terminal_theme())
|
||||
self.theme = self._textual_theme
|
||||
self.push_screen(MainMenuScreen(api))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user