Skip to content

Commit

Permalink
fix #3011
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielXia committed Jul 27, 2017
1 parent aa446f7 commit fda4c8d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.terasology.rendering.nui.databinding.ReadOnlyBinding;
import org.terasology.rendering.nui.widgets.ActivateEventListener;
import org.terasology.rendering.nui.widgets.UIButton;
import org.terasology.rendering.nui.widgets.UILabel;
import org.terasology.rendering.nui.widgets.UIText;

import java.util.function.Consumer;
Expand All @@ -40,6 +41,7 @@ public class AddServerPopup extends CoreScreenLayer {
private UIButton okButton;
private UIButton cancelButton;
private ServerInfo serverInfo;
private UILabel tip;

private Consumer<ServerInfo> successFunc;

Expand All @@ -51,6 +53,7 @@ public void initialise() {
portText = find("port", UIText.class);
okButton = find("ok", UIButton.class);
cancelButton = find("cancel", UIButton.class);
tip = find("tip", UILabel.class);

okButton.subscribe(button -> {

Expand Down Expand Up @@ -159,4 +162,8 @@ public void onSuccess(Consumer<ServerInfo> success) {
public void onCancel(ActivateEventListener listener) {
cancelButton.subscribe(listener);
}

public void removeTip() {
tip.setVisible(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public class TelemetryEmitter extends BatchEmitter {

public static final String DEFAULT_COLLECTOR_HOST = "utility.terasology.org";

public static final int DEFAULT_COLLECTOR_PORT = 80;
public static final String DEFAULT_COLLECTOR_OWNER = "Terasology Community";

public static final int DEFAULT_COLLECTOR_PORT = 14654;

private static final Logger logger = LoggerFactory.getLogger(TelemetryEmitter.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ private void refreshContent() {

private void pushAddServerPopupAndStartEmitter() {
AddServerPopup addServerPopup = nuiManager.pushScreen(AddServerPopup.ASSET_URI, AddServerPopup.class);
addServerPopup.removeTip();
ServerInfo serverInfo = new ServerInfo("TelemetryCollector", TelemetryEmitter.DEFAULT_COLLECTOR_HOST, TelemetryEmitter.DEFAULT_COLLECTOR_PORT);
serverInfo.setOwner(TelemetryEmitter.DEFAULT_COLLECTOR_OWNER);
addServerPopup.setServerInfo(serverInfo);
addServerPopup.onSuccess((item) -> {
TelemetryEmitter telemetryEmitter = (TelemetryEmitter) emitter;
Expand All @@ -150,7 +152,9 @@ private void pushAddServerPopupAndStartEmitter() {
private void pushAddServerPopupAndStartLogBackAppender() {

AddServerPopup addServerPopup = nuiManager.pushScreen(AddServerPopup.ASSET_URI, AddServerPopup.class);
addServerPopup.removeTip();
ServerInfo serverInfo = new ServerInfo("TelemetryCollector", TelemetryLogstashAppender.DEFAULT_LOGSTASH_HOST, TelemetryLogstashAppender.DEFAULT_LOGSTASH_PORT);
serverInfo.setOwner(TelemetryLogstashAppender.DEFAULT_LOGSTASH_OWNER);
addServerPopup.setServerInfo(serverInfo);
addServerPopup.onSuccess((item) -> {
StringBuilder destinationLogstash = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class TelemetryLogstashAppender extends LogstashTcpSocketAppender {

public static final String DEFAULT_LOGSTASH_HOST = "utility.terasology.org";

public static final String DEFAULT_LOGSTASH_OWNER = "Terasology Community";

public static final int DEFAULT_LOGSTASH_PORT = 9600;

private Context gameContext;
Expand Down
1 change: 1 addition & 0 deletions engine/src/main/resources/assets/i18n/menu_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"telemetry-launch-popup-text": "Telemetry system will send metrics and errors to the server. We do our best to avoid sending anything identifiable from your PC, e.g. telemetry includes your OS name, Java version but it doesn't include the MAC address, the home path, etc. You can review in Metric Menu and let us know if we missed something. Telemetry is super useful to an all volunteer project like ours and we'd really appreciate it!",
"telemetry-launch-popup-title": "Telemetry In Terasology",
"telemetry-menu": "Metrics Menu",
"telemetry-description": "This screen shows the metrics and their values that will be sent to the server. You can enable/disable it here. Telemetry is super useful to an all volunteer project like ours and we'd really appreciate it!",
"telemetry-block-destroyed": "Block Destroyed",
"telemetry-block-placed": "Block Placed",
"telemetry-game-configuration": "Game Configuration",
Expand Down
3 changes: 2 additions & 1 deletion engine/src/main/resources/assets/ui/menu/addServerPopup.ui
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
},
{
"type": "UILabel",
"text": "${engine:menu#add-server-tip}"
"text": "${engine:menu#add-server-tip}",
"id": "tip"
},
{
"type": "UISpace",
Expand Down
16 changes: 15 additions & 1 deletion engine/src/main/resources/assets/ui/telemetryScreen.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
}
}
},
{
"type": "UILabel",
"text": "${engine:menu#telemetry-description}",
"id": "description",
"layoutInfo": {
"width": 800,
"height": 24,
"position-horizontal-center": {},
"position-top": {
"target": "BOTTOM",
"widget": "subtitle"
}
}
},
{
"type": "ScrollableArea",
"verticalScrollbar": true,
Expand All @@ -42,7 +56,7 @@
"position-top": {
"target": "BOTTOM",
"offset": 16,
"widget": "subtitle"
"widget": "description"
},
"position-bottom": {
"target": "TOP",
Expand Down

0 comments on commit fda4c8d

Please sign in to comment.