Skip to content

Commit c5cb853

Browse files
author
Julien
committed
fix(sdk): Removed empty error console in the view intro replay popup
1 parent 4de7f8a commit c5cb853

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

runner/src/main/resources/view/app.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as config from '../config.js'
2-
import {ErrorLog} from '../core/ErrorLog.js'
3-
import {demo as defaultDemo} from '../demo.js'
2+
import { ErrorLog } from '../core/ErrorLog.js'
3+
import { demo as defaultDemo } from '../demo.js'
44
import Parser from './lib/Parser.js'
55
import './player.js'
66

@@ -38,6 +38,10 @@ function PlayerCtrl ($scope, $timeout, $interval, $filter, $element) {
3838

3939
$interval(checkSize, 1000)
4040

41+
$scope.isEmptyObject = function (obj) {
42+
return angular.equals(obj, {})
43+
}
44+
4145
$scope.errors = {}
4246
ErrorLog.listen(function (error) {
4347
addError(error)
@@ -49,7 +53,7 @@ function PlayerCtrl ($scope, $timeout, $interval, $filter, $element) {
4953
errorText += error.cause + '\n'
5054
}
5155
if (!$scope.errors[errorText]) {
52-
$scope.errors[errorText] = {quantity: 1}
56+
$scope.errors[errorText] = { quantity: 1 }
5357
} else {
5458
$scope.errors[errorText].quantity += 1
5559
}
@@ -101,7 +105,7 @@ function PlayerCtrl ($scope, $timeout, $interval, $filter, $element) {
101105
$scope.gameLoaded = true
102106
$scope.uinput = ctrl.data.uinput
103107
ctrl.gameInfo = convertFrameFormat(ctrl.data)
104-
$scope.agents = {...ctrl.data.agents}
108+
$scope.agents = { ...ctrl.data.agents }
105109

106110
cgPlayer.sendFrames(ctrl.gameInfo)
107111
cgPlayer.subscribe(onUpdate)
@@ -151,7 +155,7 @@ function PlayerCtrl ($scope, $timeout, $interval, $filter, $element) {
151155
let f = v.split('\n')
152156
let header = f[0].split(' ')
153157

154-
return {view: v.replace(/^(KEY_FRAME)|(INTERMEDIATE_FRAME)/, ''), keyframe: header[0] === 'KEY_FRAME'}
158+
return { view: v.replace(/^(KEY_FRAME)|(INTERMEDIATE_FRAME)/, ''), keyframe: header[0] === 'KEY_FRAME' }
155159
})
156160
for (let i = 0; i < frames.length; i++) {
157161
frames[i].gameSummary = data.summaries[i]
@@ -161,9 +165,9 @@ function PlayerCtrl ($scope, $timeout, $interval, $filter, $element) {
161165
}
162166
frames[i].agentId = -1
163167
}
164-
const agents = data.agents.map(a => Object.assign(a, {avatarUrl: a.avatar}))
168+
const agents = data.agents.map(a => Object.assign(a, { avatarUrl: a.avatar }))
165169
const tooltips = data.tooltips.map(JSON.stringify)
166-
return {agents: agents, frames: frames, tooltips: tooltips}
170+
return { agents: agents, frames: frames, tooltips: tooltips }
167171
}
168172

169173
function checkSize () {

runner/src/main/resources/view/test.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
<div ng-show="showViewReplayPopup" class="report-popup-wrapper">
4646
<div class="viewer-popup">
4747
<div class="cg-player-sandbox-replay"></div>
48-
<div id="console" class="outputs-demo">
49-
<div class="output-log" ng-repeat="(key,value) in errors" ng-if="errors">
48+
<div id="console" class="outputs-demo" ng-if="!isEmptyObject(errors)">
49+
<div class="output-log" ng-repeat="(key,value) in errors">
5050
<span class="collapsed-bubble" ng-if="value.quantity > 1">
5151
<span class="collapsed-count"
5252
ng-bind="value.quantity"

0 commit comments

Comments
 (0)