Skip to content

Commit

Permalink
Prod Build test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmaz93 committed Oct 19, 2018
1 parent a65ded5 commit 26c052d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
8 changes: 6 additions & 2 deletions gates/webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const ChaosControl = require("../chaos-control");
const bodyParser = require('body-parser')
const util = require('util');
var cors = require('cors');

const path = require('path');
const publicPath = path.join('ui','build');



Expand All @@ -18,7 +19,10 @@ expressApp.use(
);
expressApp.use(cors());
expressApp.options(cors());
expressApp.use(express.static('ui'));
expressApp.use(express.static(publicPath));
expressApp.get('*',(req,res) => {
res.sendFile(path.join(publicPath, 'index.html'))
});

expressApp.use(bodyParser.json());

Expand Down
19 changes: 17 additions & 2 deletions ui/src/components/PranksLog/PranksLog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PrankScore from './PrankScore';
// Styles
import Col from 'react-bootstrap/lib/Col';
import Row from 'react-bootstrap/lib/Row';
import Button from 'react-bootstrap/lib/Button';

const socket = io('http://localhost:8081');

Expand All @@ -19,6 +20,7 @@ class PranksLog extends Component {

componentDidMount() {
socket.connect();
console.log('Socket Connected', 'Will auto DC in 30sec');
socket.on('new-prank-activity', data => {
if (data) {
this.setState({items: [...this.state.items, data]});
Expand All @@ -28,13 +30,18 @@ class PranksLog extends Component {
});
setTimeout(() => {
socket.disconnect();
}, 4000);
console.log('Socket AUTO Disconnected');
}, 30000);
}
dc = () => {
socket.disconnect();
console.log('Socket Disconnected !');
};

render() {
const {items} = this.state;
return (
<Col lg='10' md="9">
<Col lg="10" md="9">
<Row>
<Col md="8">
<Row className="px-3">
Expand All @@ -44,6 +51,14 @@ class PranksLog extends Component {
</Col>
<PrankScore score={items.length} />
</Row>
<Row>
<Col sm="6">
<h5>after loading too much items press the RED button</h5>
<Button variant="danger" onClick={this.dc}>
Disconnect Socket
</Button>
</Col>
</Row>
</Col>
);
}
Expand Down

0 comments on commit 26c052d

Please sign in to comment.