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

Commit 642d3bf

Browse files
committed
Fixes for issue #777
- Dynamically added width to link from dashboard replaying query
1 parent 630474f commit 642d3bf

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

app/assets/javascripts/universalsearch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ $(document).ready(function() {
4444
$("input[name='width']", $(this)).val(width);
4545
});
4646

47-
$(".stream-query-link").on("click", function() {
47+
$(".added-width-search-link").on("click", function() {
4848
var width = $(document).width();
4949
var href = $(this).attr("href");
50-
href += "&width=" + width;
50+
href = URI(href).addSearch("width", width).toString();
5151
$(this).attr("href", href);
5252
});
5353

app/controllers/SearchController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ protected String formatHistogramResults(Map<String, Long> histogramResults, int
148148

149149
int index = 0;
150150
for (Map.Entry<String, Long> result : histogramResults.entrySet()) {
151+
// TODO: instead of sampling we might consider interpolation (compare DashboardsApiController)
151152
if (index % factor == 0) {
152153
Map<String, Long> point = Maps.newHashMap();
153154
point.put("x", Long.parseLong(result.getKey()));

app/controllers/api/DashboardsApiController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ private Object filterValuesByResolution(final int resolution, final Object resul
165165
final Map<Object, Object> filteredResults = new LinkedHashMap<>(resolution);
166166
int index = 0;
167167
for (Map.Entry entry : resultMap.entrySet()) {
168+
// TODO: instead of sampling we might consider interpolation (compare SearchController)
168169
if (index % factor == 0) {
169170
filteredResults.put(entry.getKey(), entry.getValue());
170171
}

app/views/dashboards/show.scala.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ <h2>Widget config</h2>
200200
<a class="btn" href="@routes.MetricsController.ofMasterNode("org.graylog2.dashboards.widgets.*." + widget.getId)">
201201
Show widget metrics
202202
</a>
203-
<a class="btn btn-success" href="@DashboardWidgetRouteHelper.replayRoute(widget)">
203+
<a class="btn btn-success added-width-search-link" href="@DashboardWidgetRouteHelper.replayRoute(widget)">
204204
Replay search
205205
</a>
206206
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>

app/views/helpers/DashboardWidgetRouteHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected static Call prepareNonStreamBoundReplayRoute(String query, TimeRange t
3333
"",
3434
"",
3535
"", // TODO fields
36-
-1 // TODO displayWidth
36+
-1
3737
);
3838
}
3939

@@ -52,7 +52,7 @@ protected static Call prepareStreamBoundReplayRoute(String streamId, String quer
5252
"",
5353
"",
5454
"", // TODO fields
55-
-1 // TODO displayWidth
55+
-1
5656
);
5757
}
5858
}

app/views/streams/index.scala.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ <h1><i class="icon icon-barcode"></i> Streams</h1>
4141

4242
<h3>
4343
<i class="icon icon-ellipsis-vertical"></i>
44-
<a class="stream-query-link" href="@routes.StreamSearchController.index(stream.getId, "*", "relative", 300)">
44+
<a class="added-width-search-link" href="@routes.StreamSearchController.index(stream.getId, "*", "relative", 300)">
4545
@stream.getTitle
4646
</a>
4747

0 commit comments

Comments
 (0)