diff --git a/static/css/cheesy-arena.css b/static/css/cheesy-arena.css index 918d452..546f378 100644 --- a/static/css/cheesy-arena.css +++ b/static/css/cheesy-arena.css @@ -112,4 +112,11 @@ input[data-changed="true"], select[data-changed="true"] { padding: 5px; border-radius: 3px; border: 1px solid #ddd; -} \ No newline at end of file +} +.status-well { + margin-bottom: 10px; +} +#buttonBottomRow { + margin-top: 5px; + margin-bottom: 10px; +} diff --git a/static/js/match_play.js b/static/js/match_play.js index 9a85ab8..3f019b5 100755 --- a/static/js/match_play.js +++ b/static/js/match_play.js @@ -28,6 +28,16 @@ var abortMatch = function() { websocket.send("abortMatch"); }; +// Sends a websocket message to signal to the volunteers that they may enter the field. +var signalVolunteers = function() { + websocket.send("signalVolunteers"); +}; + +// Sends a websocket message to signal to the teams that they may enter the field. +var signalReset = function() { + websocket.send("signalReset"); +}; + // Sends a websocket message to commit the match score and load the next match. var commitResults = function() { websocket.send("commitResults"); @@ -153,6 +163,8 @@ var handleArenaStatus = function(data) { case "PRE_MATCH": $("#startMatch").prop("disabled", !data.CanStartMatch); $("#abortMatch").prop("disabled", true); + $("#signalVolunteers").prop("disabled", true); + $("#signalReset").prop("disabled", true); $("#commitResults").prop("disabled", true); $("#discardResults").prop("disabled", true); $("#editResults").prop("disabled", true); @@ -177,6 +189,8 @@ var handleArenaStatus = function(data) { case "TELEOP_PERIOD": $("#startMatch").prop("disabled", true); $("#abortMatch").prop("disabled", false); + $("#signalVolunteers").prop("disabled", true); + $("#signalReset").prop("disabled", true); $("#commitResults").prop("disabled", true); $("#discardResults").prop("disabled", true); $("#editResults").prop("disabled", true); @@ -191,6 +205,8 @@ var handleArenaStatus = function(data) { case "POST_MATCH": $("#startMatch").prop("disabled", true); $("#abortMatch").prop("disabled", true); + $("#signalVolunteers").prop("disabled", false); + $("#signalReset").prop("disabled", false); $("#commitResults").prop("disabled", false); $("#discardResults").prop("disabled", false); $("#editResults").prop("disabled", false); @@ -205,6 +221,8 @@ var handleArenaStatus = function(data) { case "TIMEOUT_ACTIVE": $("#startMatch").prop("disabled", true); $("#abortMatch").prop("disabled", false); + $("#signalVolunteers").prop("disabled", true); + $("#signalReset").prop("disabled", true); $("#commitResults").prop("disabled", true); $("#discardResults").prop("disabled", true); $("#editResults").prop("disabled", true); @@ -219,6 +237,8 @@ var handleArenaStatus = function(data) { case "POST_TIMEOUT": $("#startMatch").prop("disabled", true); $("#abortMatch").prop("disabled", true); + $("#signalVolunteers").prop("disabled", true); + $("#signalReset").prop("disabled", true); $("#commitResults").prop("disabled", true); $("#discardResults").prop("disabled", true); $("#editResults").prop("disabled", true); diff --git a/templates/match_play.html b/templates/match_play.html index 80cb6eb..fc2dded 100755 --- a/templates/match_play.html +++ b/templates/match_play.html @@ -62,7 +62,7 @@
 
-
+
Blue Teams
DS
@@ -74,7 +74,7 @@ {{template "matchPlayTeam" dict "team" .Match.Blue2 "color" "B" "position" 2 "data" .}} {{template "matchPlayTeam" dict "team" .Match.Blue3 "color" "B" "position" 3 "data" .}}
-
+
Red Teams
DS
@@ -96,6 +96,16 @@ onclick="abortMatch();" disabled> Abort Match + + +
+
-
diff --git a/web/match_play.go b/web/match_play.go index d92b668..c7aa356 100755 --- a/web/match_play.go +++ b/web/match_play.go @@ -7,6 +7,7 @@ package web import ( "fmt" + "github.com/Team254/cheesy-arena-lite/field" "github.com/Team254/cheesy-arena-lite/game" "github.com/Team254/cheesy-arena-lite/model" "github.com/Team254/cheesy-arena-lite/tournament" @@ -243,6 +244,22 @@ func (web *Web) matchPlayWebsocketHandler(w http.ResponseWriter, r *http.Request ws.WriteError(err.Error()) continue } + case "signalVolunteers": + if web.arena.MatchState != field.PostMatch { + // Don't allow clearing the field until the match is over. + continue + } + web.arena.FieldVolunteers = true + continue // Don't reload. + case "signalReset": + if web.arena.MatchState != field.PostMatch { + // Don't allow clearing the field until the match is over. + continue + } + web.arena.FieldReset = true + web.arena.AllianceStationDisplayMode = "fieldReset" + web.arena.AllianceStationDisplayModeNotifier.Notify() + continue // Don't reload. case "commitResults": err = web.commitCurrentMatchScore() if err != nil {