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

Commit ca3e229

Browse files
committed
Adding correct source field for radios when showing messages from input.
Fixes #856
1 parent 5e3cff5 commit ca3e229

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

app/views/helpers/InputHelper.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package views.helpers;
2+
3+
import org.graylog2.restclient.models.ClusterEntity;
4+
import org.graylog2.restclient.models.Radio;
5+
6+
/**
7+
* @author Dennis Oelkers <[email protected]>
8+
*/
9+
public class InputHelper {
10+
public static String sourceFieldForNode(ClusterEntity clusterEntity) {
11+
if (clusterEntity instanceof Radio)
12+
return "gl2_source_radio_input";
13+
else
14+
return "gl2_source_input";
15+
}
16+
}

app/views/system/inputs/partials/input_action_menu.scala.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@import views.helpers.Permissions._
55
@import lib.security.RestPermissions._
66
@import org.graylog2.restclient.models.Radio
7+
@import views.helpers.InputHelper.sourceFieldForNode
78

89
<div class="btn-group">
910
<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
@@ -24,7 +25,7 @@
2425
}
2526

2627
@if(isPermitted(SEARCHES_RELATIVE)) {
27-
<li><a href="@routes.SearchController.index("gl2_source_input:" + input.getId, "relative", 28800)">Messages from this input</a></li>
28+
<li><a href="@routes.SearchController.index(sourceFieldForNode(targetNode) + ":" + input.getId, "relative", 28800)">Messages from this input</a></li>
2829
}
2930
</ul>
3031
</div>

0 commit comments

Comments
 (0)