Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

Commit 62cd7d5

Browse files
author
Lennart Koopmann
committed
dirty fixes for several parts of the input management
1 parent 5025e99 commit 62cd7d5

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

app/controllers/InputsController.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import lib.*;
2626
import models.*;
2727
import models.api.responses.system.InputTypeSummaryResponse;
28+
import play.Logger;
2829
import play.mvc.Result;
2930

3031
import javax.ws.rs.WebApplicationException;
@@ -193,7 +194,7 @@ protected Map<String, Object> extractConfiguration(Map<String, String[]> form, I
193194
return configuration;
194195
}
195196

196-
public Result launch(String nodeId) {
197+
public Result launch(String nodeIdParam) {
197198
final Map<String, String[]> form = request().body().asFormUrlEncoded();
198199

199200
final String inputType = form.get("type")[0];
@@ -206,11 +207,21 @@ public Result launch(String nodeId) {
206207
try {
207208
ClusterEntity node = null;
208209
InputTypeSummaryResponse inputInfo = null;
209-
if (form.get("node") != null && form.get("node").length > 0) {
210+
211+
String nodeId = null;
212+
if(nodeIdParam != null && !nodeIdParam.isEmpty()) {
213+
nodeId = nodeIdParam;
214+
} else {
215+
if(form.get("node") != null && form.get("node").length > 0) {
216+
nodeId = form.get("node")[0];
217+
}
218+
}
219+
220+
if (nodeId != null) {
210221
try {
211-
node = nodeService.loadNode(form.get("node")[0]);
222+
node = nodeService.loadNode(nodeId);
212223
} catch (NodeService.NodeNotFoundException e) {
213-
node = nodeService.loadRadio(form.get("node")[0]);
224+
node = nodeService.loadRadio(nodeId);
214225
}
215226
}
216227

conf/routes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ GET /system/threaddump/:node_id
5858
GET /system/threaddump/radio/:radio_id @controllers.RadiosController.threadDump(radio_id: String)
5959
GET /system/inputs @controllers.InputsController.index()
6060
POST /system/inputs @controllers.InputsController.launch(node_id ?= "")
61+
POST /system/inputs/:node_id @controllers.InputsController.launch(node_id: String)
6162
GET /system/inputs/:node_id @controllers.InputsController.manage(node_id: String)
6263
GET /system/inputs/radio/:radio_id @controllers.InputsController.manageRadio(radio_id: String)
6364
POST /system/inputs/radio/:radio_id @controllers.InputsController.launchRadio(radio_id: String)

0 commit comments

Comments
 (0)