davsclaus commented on code in PR #27515:
URL: https://github.com/apache/camel/pull/27515#discussion_r4211712490


##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java:
##########
@@ -1474,13 +1531,36 @@ JsonObject updateRow(String table, String datasource, 
String pkValuesJson, Strin
     }
 
     String controlIntegration(String action) {
+        return controlIntegration(action, null);
+    }
+
+    /**
+     * Controls the integration with the given name or pid, which becomes the 
selected one, so the screen shows what the
+     * agent acts on (CAMEL-25424). Without a name: the selected integration, 
or the only one running.
+     */
+    String controlIntegration(String action, String nameOrPid) {
         if (action == null || action.isBlank()) {
             return "Error: action is required";
         }
         if ("stop-all".equals(action)) {
             bridge.stopAll();
             return "Stopping all processes";
         }
+        if (nameOrPid != null && !nameOrPid.isBlank()) {
+            String pid = findPidByNameOrPid(nameOrPid.trim());
+            if (pid == null) {
+                String names = data.get().stream().filter(i -> !i.vanishing)
+                        .map(i -> i.name + " (pid " + i.pid + 
")").collect(Collectors.joining(", "));
+                return "Error: no integration with name or pid " + nameOrPid
+                       + (names.isEmpty() ? "; none is running" : ". Known: " 
+ names);

Review Comment:
   Right. This PR merged before I got to it, so the fix is in the follow-up PR 
for CAMEL-25426: the list now includes the infra services ("kafka (infra, pid 
300)"), with a test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to