Skip to content
Snippets Groups Projects
Commit 248d7ffe authored by IsolatedSushi's avatar IsolatedSushi
Browse files

Cleanup

parent d70893b3
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,8 @@ function sendPoint(call, callback) { ...@@ -26,6 +26,8 @@ function sendPoint(call, callback) {
}) })
} }
//Route the grpc function to the microservice
function sendPointStream(call) { function sendPointStream(call) {
http.get("http://localhost:8090/generatePointStream", res =>{ http.get("http://localhost:8090/generatePointStream", res =>{
......
...@@ -30,10 +30,11 @@ export default { ...@@ -30,10 +30,11 @@ export default {
ScatterPlot, ScatterPlot,
Counter }, Counter },
created(){ created(){
//To handle to insane amount of points being send over
const interValsource = interval(1000); const interValsource = interval(1000);
interValsource.subscribe(val => this.distributeStreams(val)); interValsource.subscribe(val => this.distributeStreams(val));
}, },
data(){ data(){
return { return {
pointList: [], pointList: [],
...@@ -41,11 +42,14 @@ export default { ...@@ -41,11 +42,14 @@ export default {
pointCount: 0 pointCount: 0
} }
}, },
methods: { methods: {
addPoint: function(point){ addPoint: function(point){
this.streamStarted = true; this.streamStarted = true;
this.pointList.push(point); this.pointList.push(point);
}, },
//Update all the components which rely on the data
//Is this the best way to do this?
distributeStreams: function(val){ distributeStreams: function(val){
//REMOVE THIS LATER //REMOVE THIS LATER
if(val == -1){ if(val == -1){
......
/*THIS IS FOR THE OLD PROTO, REMOVE LATER*/
/*eslint-disable*/ /*eslint-disable*/
<template> <template>
<div> <div>
......
/*eslint-disable*/ /*eslint-disable*/
<template> <template>
<div> <div>
<v-alert
v-if="launched"
:value="!succesAlert"
type="error"
transition="scale-transition"
dismissible
close-icon="mdi-delete"
>Cannot connect to server</v-alert>
<v-alert
v-if="launched"
:value="succesAlert"
type="success"
transition="scale-transition"
dismissible
close-icon="mdi-delete"
>Connected to the server!</v-alert>
<h1>Dapr grpc</h1> <h1>Dapr grpc</h1>
<h1 class="my-10">Check the developer console for the messages</h1> <h1 class="my-10">Check the developer console for the messages</h1>
...@@ -14,30 +31,40 @@ ...@@ -14,30 +31,40 @@
</template> </template>
<script> <script>
const { TrainingSet } = require("../generated/projector_pb"); const { TrainingSet } = require("../generated/projector_pb");
const { ProjectorClient } = require("../generated/projector_grpc_web_pb"); const { ProjectorClient } = require("../generated/projector_grpc_web_pb");
export default { export default {
name: "gRPCProjectorClient", name: "gRPCProjectorClient",
data() { data() {
return {}; return {
succesAlert: false,
launched: false
};
}, },
created: function () { created: function () {
//Setup the server
const connectURL = "http://" + window.location.hostname + ":8080"; const connectURL = "http://" + window.location.hostname + ":8080";
console.log(connectURL);
var client = new ProjectorClient(connectURL, null, null); var client = new ProjectorClient(connectURL, null, null);
console.log(client);
var param = new TrainingSet(); var param = new TrainingSet();
//Call the stream
var stream = client.getProjectionPoints(param); var stream = client.getProjectionPoints(param);
stream.on("data", (response) => { stream.on("data", (response) => {
this.succesAlert = true;
this.launched = true;
this.$emit("newPoint", response); this.$emit("newPoint", response);
}); });
stream.on("error", (err) => { stream.on("error", (err) => {
this.errorAlert = true; this.succesAlert = false
this.succesAlert = false; this.launched = true;
console.log( console.log(
`Unexpected stream error: code = ${err.code}` + `Unexpected stream error: code = ${err.code}` +
`, message = "${err.message}"` `, message = "${err.message}"`
...@@ -45,7 +72,6 @@ export default { ...@@ -45,7 +72,6 @@ export default {
}); });
}, },
methods: { methods: {
}, },
}; };
</script> </script>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment