setup docker containers

This commit is contained in:
Lorenzo Iovino 2019-11-05 10:16:39 +01:00
parent 3274d47c94
commit 13d9a24d63
22 changed files with 1593 additions and 745 deletions

View file

@ -0,0 +1,40 @@
<html>
<head>
<script>
UPS_CONFIGS = {
gatherer_ws_url: 'localhost:8001',
predictor_ws_url: 'localhost:8002/predict'
}
</script>
<script src="bundle.js"></script>
<script>
/* const interval = setInterval(() => {
let i = 1;
for( i = 1; i <= 13; i++){
const el = document.getElementById(i.toString());
el.style.top = Math.floor(Math.random() * 1000) + 10 + 'px';
el.style.width = Math.floor(Math.random() * 200) + 10 + 'px';
el.style.height = Math.floor(Math.random() * 200) + 10 + 'px';
el.style.left = Math.floor(Math.random() * 1000) + 10 + 'px';
}
clearInterval(interval);
}, 200);*/
</script>
</head>
<body>
<button>ciao</button>
<div id="1" style="width: 50px; height: 70px; background-color:red; position: absolute; top: 20px; left: 100px;"></div>
<div id="2" style="width: 30px; height: 500px; background-color:blue; position: absolute; top: 465px; left: 33px;"></div>
<div id="3" style="width: 40px; height: 20px; background-color:pink; position: absolute; top: 765px; left: 46px;"></div>
<div id="4" style="width: 90px; height: 220px; background-color:black; position: absolute; top: 233px; left: 35px;"></div>
<div id="5" style="width: 30px; height: 30px; background-color:cyan; position: absolute; top: 40px; left: 234px;"></div>
<div id="6" style="width: 30px; height: 300px; background-color:yellow; position: absolute; top: 66px; left: 5px;"></div>
<div id="7" style="width: 120px; height: 20px; background-color:limegreen; position: absolute; top: 123px; left: 45px;"></div>
<div id="8" style="width: 30px; height: 10px; background-color:darkmagenta; position: absolute; top: 362px; left: 456px;"></div>
<div id="9" style="width: 220px; height: 30px; background-color:darkslategray; position: absolute; top: 43px; left: 222px;"></div>
<div id="10" style="width: 300px; height: 30px; background-color:fuchsia; position: absolute; top: 201px; left: 100px;"></div>
<div id="11" style="width: 230px; height: 120px; background-color:purple; position: absolute; top: 201px; left: 344px;"></div>
<div id="12" style="width: 80px; height: 230px; background-color:sienna; position: absolute; top: 324px; left: 23px;"></div>
<div id="13" style="width: 30px; height: 100px; background-color:darkturquoise; position: absolute; top: 130px; left: 320px;"></div>
</body>
</html>

View file

@ -4,6 +4,8 @@ import { Gatherer } from "./gatherer/Gatherer";
import { Keyboard } from "./source/keyboard/Keyboard";
import { Screen } from "./source/screen/Screen";
declare var UPS_CONFIGS;
function main() {
const humanGatherer: Gatherer = new Gatherer([
new Screen('screen'),
@ -28,7 +30,7 @@ function getAgentName() {
}
function startPrediction(gatherer: Gatherer) {
const sender: Sender = new Sender(() => gatherer.getData(), 'localhost:4000/predict',10000);
const sender: Sender = new Sender(() => gatherer.getData(), UPS_CONFIGS.gatherer_ws_url,10000);
sender.start('http')
.subscribe(
val => {
@ -42,7 +44,7 @@ function startGathering(gatherers: Array<Gatherer>) {
for(const gatherer of gatherers ) {
gatherer.start();
const sender: Sender = new Sender(() => gatherer.getData(), 'localhost:4100/' + '?agentName='+getAgentName()+'&flowName='+getFlowName(), 1000);
const sender: Sender = new Sender(() => gatherer.getData(), UPS_CONFIGS.gatherer_ws_url+ '?agentName='+getAgentName()+'&flowName='+getFlowName(), 1000);
sender.start('ws')
.subscribe(
val => {

View file

@ -1,7 +1,7 @@
import { interval, Observable, of } from 'rxjs';
import { filter, flatMap, delay } from 'rxjs/operators';
import { Rxios } from 'rxios';
import {Data} from "../shared/Data";
import {Data} from "../../../Shared/Data";
export class Sender {
private url: string;

View file

@ -1,17 +0,0 @@
export class Data {
public name: string;
public data: any;
public timestamp: number;
public size: {
width: number;
height: number;
};
constructor(name: string, data: any, size: any, timestamp?: number) {
this.name = name;
this.data = data;
this.timestamp = timestamp ? timestamp : Date.now();
this.size = size;
}
}

View file

@ -1,4 +1,4 @@
import { Data } from "../shared/Data";
import { Data } from "../../../Shared/Data";
export class Source {
private name: string;

View file

@ -1,5 +1,5 @@
import { Source } from '../Source';
import {Data} from "../../shared/Data";
import {Data} from "../../../../Shared/Data";
export class Mouse extends Source {

View file

@ -1,6 +1,6 @@
import { Source } from '../Source';
import Html2CanvasStatic from "html2canvas";
import {Data} from "../../shared/Data";
import {Data} from "../../../../Shared/Data";
export class Screen extends Source {