mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Merge branch 'master' into lite
This commit is contained in:
@@ -44,25 +44,29 @@ body {
|
||||
width: 42%;
|
||||
height: 100%;
|
||||
background-color: #333;
|
||||
font-size: 13vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.team-id {
|
||||
width: 100%;
|
||||
height: 80%;
|
||||
font-size: 13vw;
|
||||
}
|
||||
.team-id[data-status=no-link] {
|
||||
.team-id[data-fta="true"] {
|
||||
height: 40%;
|
||||
font-size: 6vw;
|
||||
}
|
||||
.team-id[data-status=no-link], .team-notes[data-status=no-link] {
|
||||
background-color: #963;
|
||||
}
|
||||
.team-id[data-status=ds-linked] {
|
||||
.team-id[data-status=ds-linked], .team-notes[data-status=ds-linked] {
|
||||
background-color: #ff0;
|
||||
color: #333;
|
||||
}
|
||||
.team-id[data-status=robot-linked] {
|
||||
.team-id[data-status=robot-linked], .team-notes[data-status=robot-linked] {
|
||||
background-color: #0a3;
|
||||
}
|
||||
.team-id[data-status=radio-linked] {
|
||||
.team-id[data-status=radio-linked], .team-notes[data-status=radio-linked] {
|
||||
background-color: #ff00ff;
|
||||
}
|
||||
.team-box-row {
|
||||
@@ -85,3 +89,24 @@ body {
|
||||
.team-box i {
|
||||
margin-right: 0.5vw;
|
||||
}
|
||||
.team-notes[data-fta="true"] {
|
||||
height: 40%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0.5vw;
|
||||
font-size: 1vw;
|
||||
}
|
||||
.team-notes[data-fta="false"] {
|
||||
display: none;
|
||||
}
|
||||
.team-notes div {
|
||||
width: 96%;
|
||||
height: 96%;
|
||||
white-space: pre;
|
||||
}
|
||||
textarea {
|
||||
width: 96%;
|
||||
height: 96%;
|
||||
background-color: #ccc;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ var handleArenaStatus = function(data) {
|
||||
teamElementPrefix = "#" + blueSide + "Team" + station[1];
|
||||
}
|
||||
var teamIdElement = $(teamElementPrefix + "Id");
|
||||
var teamNotesElement = $(teamElementPrefix + "Notes");
|
||||
var teamNotesTextElement = $(teamElementPrefix + "Notes div");
|
||||
var teamEthernetElement = $(teamElementPrefix + "Ethernet");
|
||||
var teamDsElement = $(teamElementPrefix + "Ds");
|
||||
var teamRadioElement = $(teamElementPrefix + "Radio");
|
||||
@@ -26,6 +28,8 @@ var handleArenaStatus = function(data) {
|
||||
var teamRobotElement = $(teamElementPrefix + "Robot");
|
||||
var teamBypassElement = $(teamElementPrefix + "Bypass");
|
||||
|
||||
teamNotesTextElement.attr("data-station", station);
|
||||
|
||||
if (stationStatus.Team) {
|
||||
// Set the team number and status.
|
||||
teamIdElement.text(stationStatus.Team.Id);
|
||||
@@ -42,10 +46,13 @@ var handleArenaStatus = function(data) {
|
||||
}
|
||||
}
|
||||
teamIdElement.attr("data-status", status);
|
||||
teamNotesTextElement.text(stationStatus.Team.FtaNotes);
|
||||
teamNotesElement.attr("data-status", status);
|
||||
} else {
|
||||
// No team is present in this position for this match; blank out the status.
|
||||
teamIdElement.text("");
|
||||
teamIdElement.attr("data-status", "");
|
||||
teamNotesTextElement.text("");
|
||||
teamNotesElement.attr("data-status", "");
|
||||
}
|
||||
|
||||
// Format the Ethernet status box.
|
||||
@@ -119,6 +126,21 @@ var handleEventStatus = function(data) {
|
||||
$("#earlyLateMessage").text(data.EarlyLateMessage);
|
||||
};
|
||||
|
||||
// Makes the team notes section editable and handles saving edits to the server.
|
||||
var editFtaNotes = function(element) {
|
||||
var teamNotesTextElement = $(element);
|
||||
var textArea = $("<textarea />");
|
||||
textArea.val(teamNotesTextElement.text());
|
||||
teamNotesTextElement.replaceWith(textArea);
|
||||
textArea.focus();
|
||||
textArea.blur(function() {
|
||||
textArea.replaceWith(teamNotesTextElement);
|
||||
if (textArea.val() !== teamNotesTextElement.text()) {
|
||||
websocket.send("updateTeamNotes", { station: teamNotesTextElement.attr("data-station"), notes: textArea.val()});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$(function() {
|
||||
// Read the configuration for this display from the URL query string.
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
@@ -132,6 +154,7 @@ $(function() {
|
||||
}
|
||||
$(".reversible-left").attr("data-reversed", reversed);
|
||||
$(".reversible-right").attr("data-reversed", reversed);
|
||||
$(".fta-dependent").attr("data-fta", urlParams.get("fta"));
|
||||
|
||||
// Set up the websocket back to the server.
|
||||
websocket = new CheesyWebsocket("/displays/field_monitor/websocket", {
|
||||
|
||||
@@ -187,6 +187,9 @@ var handleArenaStatus = function(data) {
|
||||
$("#plcStatus").attr("data-ready", false);
|
||||
}
|
||||
$("#fieldEstop").attr("data-ready", !data.FieldEstop);
|
||||
$.each(data.PlcArmorBlockStatuses, function(name, status) {
|
||||
$("#plc" + name + "Status").attr("data-ready", status);
|
||||
});
|
||||
};
|
||||
|
||||
// Handles a websocket message to update the match time countdown.
|
||||
|
||||
@@ -85,22 +85,11 @@ var handleRealtimeScore = function(data) {
|
||||
}
|
||||
$("#rungIsLevel>.value").text(score.RungIsLevel ? "Yes" : "No");
|
||||
$("#rungIsLevel").attr("data-value", score.RungIsLevel);
|
||||
$("#controlPanelColor>.value").text(getControlPanelColorText(realtimeScore.ControlPanel.CurrentColor));
|
||||
$("#controlPanelColor").attr("data-value", realtimeScore.ControlPanel.CurrentColor);
|
||||
$("#controlPanelColor").attr("data-control-panel-status", score.ControlPanelStatus)
|
||||
};
|
||||
|
||||
// Handles a websocket message to update the Control Panel color.
|
||||
var handleControlPanelColor = function(data) {
|
||||
var color;
|
||||
if (alliance === "red") {
|
||||
color = data.RedControlPanelColor;
|
||||
} else {
|
||||
color = data.BlueControlPanelColor;
|
||||
}
|
||||
|
||||
$("#controlPanelColor>.value").text(getControlPanelColorText(color));
|
||||
$("#controlPanelColor").attr("data-value", color);
|
||||
};
|
||||
|
||||
// Handles a keyboard event and sends the appropriate websocket message.
|
||||
var handleKeyPress = function(event) {
|
||||
websocket.send(String.fromCharCode(event.keyCode));
|
||||
@@ -164,7 +153,6 @@ $(function() {
|
||||
matchLoad: function(event) { handleMatchLoad(event.data); },
|
||||
matchTime: function(event) { handleMatchTime(event.data); },
|
||||
realtimeScore: function(event) { handleRealtimeScore(event.data); },
|
||||
controlPanelColor: function(event) { handleControlPanelColor(event.data); }
|
||||
});
|
||||
|
||||
$(document).keypress(handleKeyPress);
|
||||
|
||||
Reference in New Issue
Block a user