From 3f3ae121ef082a430f4bdc84ab7970a5633d552a Mon Sep 17 00:00:00 2001
From: Emiliano Ciavatta
Date: Wed, 29 Apr 2020 15:13:20 +0200
Subject: Frontend checkpoint
---
frontend/src/views/App.js | 26 ++++++++++
frontend/src/views/App.scss | 2 +
frontend/src/views/Connections.js | 96 +++++++++++++++++++++++++++++++++++++
frontend/src/views/Connections.scss | 13 +++++
frontend/src/views/Footer.js | 19 ++++++++
frontend/src/views/Footer.scss | 14 ++++++
frontend/src/views/Header.js | 48 +++++++++++++++++++
frontend/src/views/Header.scss | 18 +++++++
frontend/src/views/MainPane.js | 49 +++++++++++++++++++
frontend/src/views/MainPane.scss | 9 ++++
10 files changed, 294 insertions(+)
create mode 100644 frontend/src/views/App.js
create mode 100644 frontend/src/views/App.scss
create mode 100644 frontend/src/views/Connections.js
create mode 100644 frontend/src/views/Connections.scss
create mode 100644 frontend/src/views/Footer.js
create mode 100644 frontend/src/views/Footer.scss
create mode 100644 frontend/src/views/Header.js
create mode 100644 frontend/src/views/Header.scss
create mode 100644 frontend/src/views/MainPane.js
create mode 100644 frontend/src/views/MainPane.scss
(limited to 'frontend/src/views')
diff --git a/frontend/src/views/App.js b/frontend/src/views/App.js
new file mode 100644
index 0000000..4d80da5
--- /dev/null
+++ b/frontend/src/views/App.js
@@ -0,0 +1,26 @@
+import React, {Component} from 'react';
+import Header from "./Header";
+import './App.scss';
+import MainPane from "./MainPane";
+import Footer from "./Footer";
+import {Route, BrowserRouter as Router, Switch} from "react-router-dom";
+
+class App extends Component {
+
+ render() {
+ return (
+
+
+
+
+ } />
+ } />
+
+
+
+
+ );
+ }
+}
+
+export default App;
diff --git a/frontend/src/views/App.scss b/frontend/src/views/App.scss
new file mode 100644
index 0000000..2ee17ac
--- /dev/null
+++ b/frontend/src/views/App.scss
@@ -0,0 +1,2 @@
+.app {
+}
\ No newline at end of file
diff --git a/frontend/src/views/Connections.js b/frontend/src/views/Connections.js
new file mode 100644
index 0000000..5876a40
--- /dev/null
+++ b/frontend/src/views/Connections.js
@@ -0,0 +1,96 @@
+import React, {Component} from 'react';
+import './Connections.scss';
+import axios from 'axios'
+import Connection from "../components/Connection";
+import {Link} from "react-router-dom";
+import Table from 'react-bootstrap/Table';
+
+class Connections extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ connections: [],
+ };
+ }
+
+
+ componentDidMount() {
+ axios.get("/api/connections").then(res => this.setState({connections: res.data}))
+ }
+
+ render() {
+ let connection = {
+ "id": "5dd95ff0fe7ae01ae7f419c2",
+ "ip_src": "10.62.82.1",
+ "ip_dst": "10.62.82.2",
+ "port_src": 59113,
+ "port_dst": 23179,
+ "started_at": "2019-11-23T16:36:00.1Z",
+ "closed_at": "2019-11-23T16:36:00.971Z",
+ "client_bytes": 331,
+ "server_bytes": 85,
+ "client_documents": 1,
+ "server_documents": 1,
+ "processed_at": "2020-04-21T17:10:29.532Z",
+ "matched_rules": [],
+ "hidden": false,
+ "marked": true,
+ "comment": "",
+ "service": {
+ "port": 23179,
+ "name": "kaboom",
+ "color": "#3C6D3C",
+ "notes": "wdddoddddddw"
+ }
+ }
+
+ return (
+
+
+
+
+ service |
+ srcip |
+ dstip |
+ srcport |
+ dstport |
+ duration |
+ up |
+ down |
+ actions |
+
+
+
+
+ 1 |
+ Mark |
+ Otto |
+ @mdo |
+
+
+ 2 |
+ Jacob |
+ Thornton |
+ @fat |
+
+
+ 3 |
+ Larry the Bird |
+ @twitter |
+
+
+
+
+ {
+ this.state.connections.map(c =>
+
+ )
+ }
+
+ );
+ }
+
+}
+
+
+export default Connections;
diff --git a/frontend/src/views/Connections.scss b/frontend/src/views/Connections.scss
new file mode 100644
index 0000000..da74e11
--- /dev/null
+++ b/frontend/src/views/Connections.scss
@@ -0,0 +1,13 @@
+@import '../colors.scss';
+
+.connections {
+ background-color: $color-primary-3;
+ padding: 10px 10px 10px 10px;
+
+ height: 100%;
+ overflow: auto;
+
+ .table {
+ color: $color-primary-4;
+ }
+}
\ No newline at end of file
diff --git a/frontend/src/views/Footer.js b/frontend/src/views/Footer.js
new file mode 100644
index 0000000..b6ffd9d
--- /dev/null
+++ b/frontend/src/views/Footer.js
@@ -0,0 +1,19 @@
+import React, {Component} from 'react';
+import './Footer.scss';
+
+class Footer extends Component {
+
+ render() {
+ return (
+
+ )
+ }
+}
+
+export default Footer;
diff --git a/frontend/src/views/Footer.scss b/frontend/src/views/Footer.scss
new file mode 100644
index 0000000..9a8cacb
--- /dev/null
+++ b/frontend/src/views/Footer.scss
@@ -0,0 +1,14 @@
+@import '../colors.scss';
+
+.footer {
+ padding: 15px 30px;
+
+ >.row {
+ background-color: $color-primary-0;
+ }
+
+ .footer-timeline {
+ height: 100px;
+ }
+
+}
\ No newline at end of file
diff --git a/frontend/src/views/Header.js b/frontend/src/views/Header.js
new file mode 100644
index 0000000..b3f919b
--- /dev/null
+++ b/frontend/src/views/Header.js
@@ -0,0 +1,48 @@
+import React, {Component} from 'react';
+import Typed from 'typed.js';
+import './Header.scss';
+
+class Header extends Component {
+
+ componentDidMount() {
+ const options = {
+ strings: ["caronte$ "],
+ typeSpeed: 50,
+ cursorChar: "❚"
+ };
+ this.typed = new Typed(this.el, options);
+ }
+
+ componentWillUnmount() {
+ this.typed.destroy();
+ }
+
+ render() {
+ return (
+
+ )
+ }
+}
+
+export default Header;
diff --git a/frontend/src/views/Header.scss b/frontend/src/views/Header.scss
new file mode 100644
index 0000000..16c2dbd
--- /dev/null
+++ b/frontend/src/views/Header.scss
@@ -0,0 +1,18 @@
+@import '../colors.scss';
+
+.header {
+ padding: 15px 30px;
+
+ >.row {
+ background-color: $color-primary-0;
+ }
+
+ .header-title {
+ margin: 5px 0 5px -5px;
+ }
+
+ .header-buttons {
+ margin: 5px 0;
+ text-align: right;
+ }
+}
\ No newline at end of file
diff --git a/frontend/src/views/MainPane.js b/frontend/src/views/MainPane.js
new file mode 100644
index 0000000..88b5376
--- /dev/null
+++ b/frontend/src/views/MainPane.js
@@ -0,0 +1,49 @@
+import React, {Component} from 'react';
+import './MainPane.scss';
+import Connections from "./Connections";
+import ConnectionContent from "../components/ConnectionContent";
+import {withRouter} from "react-router-dom";
+import axios from 'axios'
+
+class MainPane extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ id: null,
+ };
+ }
+
+ componentDidUpdate() {
+ if (this.props.match.params.id !== this.state.id) {
+ const id = this.props.match.params.id;
+ this.setState({id: id});
+
+ axios.get(`/api/streams/${id}`).then(res => this.setState({connectionContent: res.data}))
+
+
+ }
+ }
+
+ componentDidMount() {
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+export default withRouter(MainPane);
diff --git a/frontend/src/views/MainPane.scss b/frontend/src/views/MainPane.scss
new file mode 100644
index 0000000..c1a2f7f
--- /dev/null
+++ b/frontend/src/views/MainPane.scss
@@ -0,0 +1,9 @@
+.main-pane {
+
+ .pane {
+ height: calc(100vh - 210px);
+ position: relative;
+ }
+
+
+}
\ No newline at end of file
--
cgit v1.2.3-70-g09d2