aboutsummaryrefslogtreecommitdiff
path: root/frontend/src
diff options
context:
space:
mode:
authortherealbobo2020-09-17 12:17:11 +0000
committertherealbobo2020-09-17 12:17:11 +0000
commit54f55f9ad4af4d50f0fca371b9a14308b1d80c6b (patch)
treef7203f39150663d4af70c527c99db7c530504435 /frontend/src
parent9063c5d4d5b04e4c7f4e689c9246c4b37b72ec68 (diff)
intial local processing support
Diffstat (limited to 'frontend/src')
-rw-r--r--frontend/src/views/Upload.js38
1 files changed, 37 insertions, 1 deletions
diff --git a/frontend/src/views/Upload.js b/frontend/src/views/Upload.js
index 522afe8..d3f6bf3 100644
--- a/frontend/src/views/Upload.js
+++ b/frontend/src/views/Upload.js
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import './Upload.scss';
-import {Button, ButtonGroup, Col, Container, Form, FormControl, InputGroup, Modal, Row, Table} from "react-bootstrap";
+import {Button, ButtonGroup, Col, Container, Form, FormFile, InputGroup, Modal, Row, Table} from "react-bootstrap";
import bsCustomFileInput from 'bs-custom-file-input'
import {createCurlCommand} from '../utils';
@@ -25,6 +25,30 @@ class Upload extends Component {
bsCustomFileInput.init()
}
+ onFileProcess = () => {
+ const formData = new FormData();
+ formData.append(
+ "file",
+ this.state.selectedFile.name
+ );
+ fetch('/api/pcap/file', {
+ method: 'POST',
+ body: formData
+ })
+ .then(response => {
+ if (response.status === 202 ){
+ this.props.onHide();
+ } else {
+ response.json().then(data => {
+ this.setState(
+ {errors : data.error.toString()}
+ );
+ });
+ }
+ }
+ );
+ }
+
onFileUpload = () => {
const formData = new FormData();
formData.append(
@@ -80,6 +104,17 @@ class Upload extends Component {
custom
/>
</Row>
+ <hr/>
+ <Row>
+ <Form.Control
+ type="text"
+ id="pcap-upload"
+ onChange={this.onLocalFileChange}
+ placeholder="local .pcap/.pcapng"
+ custom
+ />
+ </Row>
+ <hr/>
<Row>
<div class="error">
<b>
@@ -95,6 +130,7 @@ class Upload extends Component {
</Modal.Body>
<Modal.Footer className="dialog-footer">
+ <Button variant="blue" onClick={this.onFileProcess}>process_local</Button>
<Button variant="green" onClick={this.onFileUpload}>upload</Button>
<Button variant="red" onClick={this.props.onHide}>close</Button>
</Modal.Footer>