From 4b1095f74268cb4667424d18f9ddc796a0ad161a Mon Sep 17 00:00:00 2001 From: Kyle Flynn Date: Wed, 9 Oct 2019 14:19:29 -0400 Subject: [PATCH] Small updates and fixed match-test view. --- .../fgc_2019/match-play/MatchPlayScreen.tsx | 25 +++++++++++-------- ems-core/package.electron.json | 2 +- ems-core/package.json | 2 +- ems-core/src/App.tsx | 4 +-- .../OceanOpportunitiesTeamStatus.tsx | 2 +- ems-core/src/managers/UploadManager.ts | 16 +++++++++++- .../src/views/match-test/MatchTestView.tsx | 5 ++-- package.json | 5 ++-- 8 files changed, 40 insertions(+), 21 deletions(-) diff --git a/audience-display/src/displays/fgc_2019/match-play/MatchPlayScreen.tsx b/audience-display/src/displays/fgc_2019/match-play/MatchPlayScreen.tsx index ffb0a37..6fbaa6c 100644 --- a/audience-display/src/displays/fgc_2019/match-play/MatchPlayScreen.tsx +++ b/audience-display/src/displays/fgc_2019/match-play/MatchPlayScreen.tsx @@ -38,11 +38,13 @@ interface IState { class MatchPlayScreen extends React.Component { private _timer: MatchTimer; + private _matchEnded: boolean; constructor(props: IProps) { super(props); this._timer = new MatchTimer(); + this._matchEnded = false; this.state = { match: this.props.match, @@ -68,6 +70,7 @@ class MatchPlayScreen extends React.Component { this._timer.removeAllListeners("match-tele"); this._timer.removeAllListeners("match-endgame"); this._timer.removeAllListeners("match-abort"); + this._matchEnded = true; }); this._timer.start(); this.updateTimer(); @@ -92,18 +95,20 @@ class MatchPlayScreen extends React.Component { this._timer.removeAllListeners("match-end"); }); SocketProvider.on("score-update", (matchJSON: any) => { - const oldMatch = this.props.match; - const match: Match = new Match().fromJSON(matchJSON); - const seasonKey: string = match.matchKey.split("-")[0]; - match.matchDetails = Match.getDetailsFromSeasonKey(seasonKey).fromJSON(matchJSON.details); - match.participants = matchJSON.participants.map((pJSON: any) => new MatchParticipant().fromJSON(pJSON)); - match.participants.sort((a: MatchParticipant, b: MatchParticipant) => a.station - b.station); - for (let i = 0; i < match.participants.length; i++) { - if (typeof oldMatch.participants !== "undefined" && typeof oldMatch.participants[i].team !== "undefined") { - match.participants[i].team = oldMatch.participants[i].team; // Both are sorted by station, so we can safely assume/do this. + if (!this._matchEnded) { + const oldMatch = this.props.match; + const match: Match = new Match().fromJSON(matchJSON); + const seasonKey: string = match.matchKey.split("-")[0]; + match.matchDetails = Match.getDetailsFromSeasonKey(seasonKey).fromJSON(matchJSON.details); + match.participants = matchJSON.participants.map((pJSON: any) => new MatchParticipant().fromJSON(pJSON)); + match.participants.sort((a: MatchParticipant, b: MatchParticipant) => a.station - b.station); + for (let i = 0; i < match.participants.length; i++) { + if (typeof oldMatch.participants !== "undefined" && typeof oldMatch.participants[i].team !== "undefined") { + match.participants[i].team = oldMatch.participants[i].team; // Both are sorted by station, so we can safely assume/do this. + } } + this.setState({match: match}); } - this.setState({match: match}); }); } diff --git a/ems-core/package.electron.json b/ems-core/package.electron.json index 79bc462..8b42684 100644 --- a/ems-core/package.electron.json +++ b/ems-core/package.electron.json @@ -2,7 +2,7 @@ "name": "ems-core", "author": "The Orange Alliance", "description": "An improved event experience.", - "version": "2.15.0", + "version": "2.16.0", "private": true, "main": "public/desktop/electron.js", "homepage": "./public/desktop/", diff --git a/ems-core/package.json b/ems-core/package.json index c961e1c..372b695 100644 --- a/ems-core/package.json +++ b/ems-core/package.json @@ -1,6 +1,6 @@ { "name": "ems-core", - "version": "2.15.0", + "version": "2.16.0", "private": true, "main": "build/electron.js", "dependencies": { diff --git a/ems-core/src/App.tsx b/ems-core/src/App.tsx index 4c9c963..cfecf40 100644 --- a/ems-core/src/App.tsx +++ b/ems-core/src/App.tsx @@ -28,9 +28,7 @@ class App extends React.Component { } public componentDidMount() { - if (this.props.toaConfig.enabled) { - UploadManager.initialize(1, this.props.toaConfig); - } + UploadManager.initialize(1, this.props.toaConfig); this.initializeSocket(this.props.networkHost); WebProvider.initialize(this.props.networkHost); diff --git a/ems-core/src/components/game-specifics/ocean-opportunities/OceanOpportunitiesTeamStatus.tsx b/ems-core/src/components/game-specifics/ocean-opportunities/OceanOpportunitiesTeamStatus.tsx index 507c142..882bc04 100644 --- a/ems-core/src/components/game-specifics/ocean-opportunities/OceanOpportunitiesTeamStatus.tsx +++ b/ems-core/src/components/game-specifics/ocean-opportunities/OceanOpportunitiesTeamStatus.tsx @@ -37,7 +37,7 @@ class OceanOpportunitiesTeamStatus extends React.Component { const teamsView = participants.map((p: MatchParticipant) => { return ( - + ); diff --git a/ems-core/src/managers/UploadManager.ts b/ems-core/src/managers/UploadManager.ts index ed8781d..91fd52e 100644 --- a/ems-core/src/managers/UploadManager.ts +++ b/ems-core/src/managers/UploadManager.ts @@ -25,7 +25,7 @@ class UploadManager { TOAProvider.initialize(toaConfig); } if (this._type === UploadManager.FGC) { - FGCProvider.initialize("127.0.0.1", 8088); // DEBUG + FGCProvider.initialize("173.231.247.208", 8088); // DEBUG } } @@ -79,6 +79,20 @@ class UploadManager { } } + public testConnection(): Promise { + if (this._type === UploadManager.TOA) { + return TOAProvider.ping(); + } else if (this._type === UploadManager.FGC) { + return FGCProvider.ping(); + } else { + return new Promise((resolve, reject) => reject()); + } + } + + public get type(): number { + return this._type; + } + } export const TOA = UploadManager.TOA; diff --git a/ems-core/src/views/match-test/MatchTestView.tsx b/ems-core/src/views/match-test/MatchTestView.tsx index e72ea9d..1309def 100644 --- a/ems-core/src/views/match-test/MatchTestView.tsx +++ b/ems-core/src/views/match-test/MatchTestView.tsx @@ -16,6 +16,7 @@ import { } from "@the-orange-alliance/lib-ems"; import ExplanationIcon from "../../components/ExplanationIcon"; import NumericInput from "../../components/NumericInput"; +import UploadManager from "../../managers/UploadManager"; interface IProps { slaveModeEnabled?: boolean, @@ -128,7 +129,7 @@ class MatchTestView extends React.Component {

REST API {slaveModeEnabled ? "(MASTER)" : ""}

SocketIO Server

Web Server

-

TheOrangeAlliance

+

{UploadManager.type === 0 ? "TheOrangeAlliance" : "TheGlobalAlliance"}

Audience Display

@@ -305,7 +306,7 @@ class MatchTestView extends React.Component { private testTOA() { this.setState({toaTesting: true}); - TOAProvider.ping().then(() => { + UploadManager.testConnection().then(() => { this.setState({toaConnected: true, toaTested: true, toaTesting: false}); }).catch((error: HttpError) => { DialogManager.showErrorBox(error); diff --git a/package.json b/package.json index a9e9736..b5484f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "event-management-system", "description": "Hub for all programs in the EMS suite.", - "version": "2.15.0", + "version": "2.16.0", "private": true, "scripts": { "api": "cd ems-api/ && npm start", @@ -15,10 +15,11 @@ "build-ref": "cd ref-tablet/ && npm run build && cd ../", "build-pit": "cd pit-display/ && npm run build && cd ../", "build-core": "cd ems-core/ && npm run build && cd ../", + "build-home": "cd ems-home/ && npm run build && cd ../", "build-api": "cd ems-api/ && npm run build && cd ../", "build-sck": "cd ems-socket/ && npm run build && cd ../", "build-web": "cd ems-web/ && npm run build && cd ../", - "build-webapps": "npm run build-audience && npm run build-ref && npm run build-core", + "build-webapps": "npm run build-audience && npm run build-ref && npm run build-core && npm run build-home", "build-services": "npm run build-api && npm run build-sck && npm run build-web", "prebuild": "gulp prebuild:prod", "build": "npm run build-services && npm run build-webapps",