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

Commit 74241a5

Browse files
committed
Merge branch '0.20' of github.com:Graylog2/graylog2-web-interface into 0.20
2 parents 2d54fe7 + c8fca62 commit 74241a5

File tree

14 files changed

+63
-21
lines changed

14 files changed

+63
-21
lines changed

app/controllers/AlertsController.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@
2222
import com.google.inject.Inject;
2323
import lib.APIException;
2424
import lib.ApiClient;
25-
import models.User;
26-
import models.UserService;
25+
import models.*;
2726
import models.alerts.Alert;
2827
import models.alerts.AlertCondition;
2928
import models.alerts.AlertConditionService;
30-
import models.Stream;
31-
import models.StreamService;
3229
import models.api.requests.alerts.CreateAlertConditionRequest;
33-
import play.Logger;
3430
import play.mvc.Result;
3531

3632
import java.io.IOException;
@@ -51,6 +47,9 @@ public class AlertsController extends AuthenticatedController {
5147
@Inject
5248
private AlertConditionService alertConditionService;
5349

50+
@Inject
51+
private NodeService nodeService;
52+
5453
public Result index(String streamId) {
5554
try {
5655
Stream stream = streamService.get(streamId);
@@ -78,7 +77,8 @@ public Result index(String streamId) {
7877
alertConditions,
7978
totalAlerts,
8079
alerts,
81-
users.toString()
80+
users.toString(),
81+
nodeService.loadMasterNode()
8282
));
8383
} catch (IOException e) {
8484
return status(504, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));

app/lib/DateTools.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,22 @@ public static String inUserTimeZoneShortFormat(DateTime esDate) {
8585
public static DateTime nowInUTC() {
8686
return DateTime.now(DateTimeZone.UTC);
8787
}
88+
89+
public static int getUserTimeZoneOffset() {
90+
DateTimeZone tz = globalTimezone;
91+
92+
final User currentUser = UserService.current();
93+
94+
if (currentUser != null && currentUser.getTimeZone() != null) {
95+
tz = currentUser.getTimeZone();
96+
}
97+
98+
int offsetMillis = tz.toTimeZone().getRawOffset() / 1000;
99+
100+
if (tz.toTimeZone().useDaylightTime()) {
101+
offsetMillis += 3600;
102+
}
103+
104+
return (offsetMillis / 60) * -1;
105+
}
88106
}

app/lib/Version.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ public class Version {
4848
public static final Version v0_20_2_SNAPSHOT = new Version(0, 20, 2, "snapshot");
4949
public static final Version v0_20_2_RC_1 = new Version(0, 20, 2, "rc.1");
5050
public static final Version v0_20_2 = new Version(0, 20, 2);
51+
public static final Version v0_20_3 = new Version(0, 20, 3);
5152

52-
public static final Version VERSION = v0_20_2;
53+
public static final Version VERSION = v0_20_3;
5354

5455
public final int major;
5556
public final int minor;

app/views/alerts/manage.scala.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
alertConditions: List[models.alerts.AlertCondition],
33
totalAlerts: Long,
44
alerts: List[models.alerts.Alert],
5-
users: String)
5+
users: String,
6+
node: Node)
67

78
@import lib.security.RestPermissions._
89
@import views.helpers.Permissions._
@@ -228,8 +229,9 @@ <h2><i class="icon icon-group"></i> Alert receivers</h2>
228229
<hr />
229230

230231
<h2><i class="icon icon-bell"></i> Triggered alerts</h2>
231-
Showing the most recent alerts. This stream triggered a total of @totalAlerts alerts.
232-
232+
Showing the most recent alerts. This stream triggered a total of <b>@totalAlerts alerts</b>.<br>
233+
Alerts can be retrieved from the server's <a href="@node.getTransportAddress/api-browser#!/Alerts/checkConditions_get_1" target="_blank">API Browser <i class="icon icon-external-link" style="font-size: 11px;"></i></a>,
234+
for example to hook them into an existing monitoring system. Learn more in the knowledgebase. @views.html.partials.support.bubble("graylog2-server/polling-for-stream-alerts")
233235
@if(stream.getAlerts.isEmpty) {
234236
<div style="margin-top: 10px;" class="alert alert-info">
235237
This stream has never triggered an alert.

app/views/partials/support/head_bubble.scala.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
@(link: String)
1+
@(link: String, top: Int = 10, left: Int = 0)
22

33
<a href="http://support.torch.sh/help/kb/@link"
44
class="pull-right"
5-
style="position: relative; top: 10px;"
5+
style="position: relative; top: @{top}px; left: @{left}px;"
66
target="_blank">
77

88
<i class="icon icon-lightbulb"></i>

app/views/partials/top.scala.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
@import lib.security.RestPermissions._
22
@import views.helpers.Permissions._
33
@import lib.Configuration
4+
@import lib.DateTools
45

56
<script type="text/javascript">
67
// needs to be global!
78
gl2AppPathPrefix = "@Configuration.getApplicationContext";
9+
gl2UserTimeZoneOffset = @DateTools.getUserTimeZoneOffset;
810
</script>
911

1012
<div id="top" class="navbar navbar-fixed-top">

app/views/search/results.scala.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,15 @@ <h3>
163163
new Rickshaw.Graph.Axis.Time({
164164
graph: resultGraph,
165165
ticksTreatment: "glow",
166-
timeFixture: new Rickshaw.Fixtures.Graylog2Time() // Cares about correct TZ handling.
166+
timeFixture: new Rickshaw.Fixtures.Graylog2Time(gl2UserTimeZoneOffset) // Cares about correct TZ handling.
167167
});
168168
}
169169

170170
new Rickshaw.Graph.HoverDetail({
171171
graph: resultGraph,
172172
formatter: function(series, x, y) {
173-
var date = '<span class="date">' + new Date(x * 1000 ).toString() + '</span>';
173+
var dateMoment = moment(new Date(x * 1000 )).zone(gl2UserTimeZoneOffset);
174+
var date = '<span class="date">' + dateMoment.format('ddd MMM DD YYYY HH:mm:ss ZZ') + '</span>';
174175
var swatch = '<span class="detail_swatch"></span>';
175176
var content = parseInt(y) + ' messages<br>' + date;
176177
return content;

app/views/system/nodes/index.scala.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,13 @@ <h3>
141141
<span class="label label-success node-state" data-toggle="tooltip" title="Marked as ALIVE for load balancers">
142142
lb:ALIVE
143143
</span>
144+
<span style="margin-left: 4px">@partials.support.bubble("graylog2-server/load-balancer-status")</span>
145+
144146
} else {
145147
<span class="label label-important node-state" data-toggle="tooltip" title="Marked as DEAD for load balancers">
146148
lb:DEAD
147149
</span>
150+
<span style="margin-left: 4px">@partials.support.bubble("graylog2-server/load-balancer-status")</span>
148151
}
149152
</h3>
150153

app/views/system/nodes/show.scala.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ <h1><i class="icon icon-sitemap"></i> Node @node.getHostname / @node.getShortNod
3838
<div class="alert alert-info">
3939
<i class="icon icon-retweet"></i> &nbsp; Lifecycle state:
4040
<strong>@node.getLifecycle</strong>
41+
<span class="pull-right">@partials.support.head_bubble("graylog2-server/load-balancer-status", 0, 19)</span>
4142
</div>
4243
</div>
4344

@@ -46,12 +47,14 @@ <h1><i class="icon icon-sitemap"></i> Node @node.getHostname / @node.getShortNod
4647
<div class="row-fluid">
4748
<div class="alert alert-success">
4849
<i class="icon icon-heart"></i> &nbsp; Marked as <strong>ALIVE</strong> for load balancers.
50+
<span class="pull-right">@partials.support.head_bubble("graylog2-server/load-balancer-status", 0, 19)</span>
4951
</div>
5052
</div>
5153
} else {
5254
<div class="row-fluid">
5355
<div class="alert alert-error">
5456
<i class="icon icon-heart"></i> &nbsp; Marked as <strong>DEAD</strong> for load balancers.
57+
<span class="pull-right">@partials.support.head_bubble("graylog2-server/load-balancer-status", 0, 19)</span>
5558
</div>
5659
</div>
5760
}

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import play.Project._
55
object ApplicationBuild extends Build {
66

77
val appName = "graylog2-web-interface"
8-
val appVersion = "0.20.2"
8+
val appVersion = "0.20.3"
99

1010
val appDependencies = Seq(
1111
cache,

0 commit comments

Comments
 (0)