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

Commit

Permalink
dirty fixes for several parts of the input management
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart Koopmann committed Jan 13, 2014
1 parent 5025e99 commit 62cd7d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
19 changes: 15 additions & 4 deletions app/controllers/InputsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import lib.*;
import models.*;
import models.api.responses.system.InputTypeSummaryResponse;
import play.Logger;
import play.mvc.Result;

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

public Result launch(String nodeId) {
public Result launch(String nodeIdParam) {
final Map<String, String[]> form = request().body().asFormUrlEncoded();

final String inputType = form.get("type")[0];
Expand All @@ -206,11 +207,21 @@ public Result launch(String nodeId) {
try {
ClusterEntity node = null;
InputTypeSummaryResponse inputInfo = null;
if (form.get("node") != null && form.get("node").length > 0) {

String nodeId = null;
if(nodeIdParam != null && !nodeIdParam.isEmpty()) {
nodeId = nodeIdParam;
} else {
if(form.get("node") != null && form.get("node").length > 0) {
nodeId = form.get("node")[0];
}
}

if (nodeId != null) {
try {
node = nodeService.loadNode(form.get("node")[0]);
node = nodeService.loadNode(nodeId);
} catch (NodeService.NodeNotFoundException e) {
node = nodeService.loadRadio(form.get("node")[0]);
node = nodeService.loadRadio(nodeId);
}
}

Expand Down
1 change: 1 addition & 0 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ GET /system/threaddump/:node_id
GET /system/threaddump/radio/:radio_id @controllers.RadiosController.threadDump(radio_id: String)
GET /system/inputs @controllers.InputsController.index()
POST /system/inputs @controllers.InputsController.launch(node_id ?= "")
POST /system/inputs/:node_id @controllers.InputsController.launch(node_id: String)
GET /system/inputs/:node_id @controllers.InputsController.manage(node_id: String)
GET /system/inputs/radio/:radio_id @controllers.InputsController.manageRadio(radio_id: String)
POST /system/inputs/radio/:radio_id @controllers.InputsController.launchRadio(radio_id: String)
Expand Down

0 comments on commit 62cd7d5

Please sign in to comment.