Update redirection behavior when disabling an agent or flow
Problem
The agent enable/disable flow has inconsistent redirect and state update behavior depending on the context:
Scenario 1: Managed Agent Detail View
Current behavior: When disabling an agent from Automate > Agents > Managed > Detail View, the user is redirected away from the page.
Expected behavior: Since the agent is managed (not just enabled), the user should remain on the detail view page. The page should reload its state to show the 'Enable' button instead of redirecting.
Scenario 2: Enabled Agent Detail View
Current behavior: When disabling an agent from Automate > Agents > Enabled > Detail View, the user is redirected away. The page requires manual reload to reflect the new state.
Expected behavior: The redirect makes sense here since the agent is no longer "enabled". However, the page should automatically fetch and display the updated state without requiring manual reload.
Proposed Solution
- Managed agents: Keep user on detail view after disable action, update UI state to show 'Enable' button
- Enabled agents: After redirect, automatically reload page data to reflect current state