Skip to content

Commit f21f137

Browse files
committed
[feature] Show a message if vision-client not found
1 parent 6adbff4 commit f21f137

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

src/App.vue

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
</div>
1313
<div class="main-middle-container">
1414
<Events/>
15-
<iframe src="http://localhost:8082/" frameborder="none"></iframe>
15+
<iframe :src="visionClientAddress" frameborder="none" v-if="showVisionClient"
16+
class="vision-client"></iframe>
17+
<div class="vision-client" v-show="!showVisionClient">
18+
<p>The vision-client is shown here, if it is running.</p>
19+
<p>It is expected to run at <a :href="visionClientAddress">{{visionClientAddress}}</a></p>
20+
<b-button variant="primary" @click="checkVisionClientAvailability">Reload</b-button>
21+
</div>
1622
</div>
1723
<div class="team-container">
1824
<h2>Blue Team</h2>
@@ -41,6 +47,34 @@
4147
ControlGeneral,
4248
TeamOverview,
4349
GameState
50+
},
51+
props: {
52+
visionClientAddress: {
53+
type: String,
54+
default: "http://localhost:8082"
55+
}
56+
},
57+
data() {
58+
return {
59+
showVisionClient: false
60+
}
61+
},
62+
methods: {
63+
checkVisionClientAvailability() {
64+
let rq = new XMLHttpRequest();
65+
66+
rq.onreadystatechange = function (vm) {
67+
if (this.readyState === XMLHttpRequest.DONE) {
68+
vm.showVisionClient = this.status === 200;
69+
}
70+
}.bind(rq, this);
71+
72+
rq.open("GET", this.visionClientAddress);
73+
rq.send();
74+
}
75+
},
76+
mounted() {
77+
this.checkVisionClientAvailability();
4478
}
4579
}
4680
</script>
@@ -95,7 +129,7 @@
95129
flex-grow: 1;
96130
}
97131
98-
.main-middle-container iframe {
132+
.vision-client {
99133
flex-grow: 1;
100134
width: 100%;
101135
height: 100%;

0 commit comments

Comments
 (0)