-
- Upload
-
-
-
-
+
+ state = {
+ saml_file: null,
+ idp_name: "",
+ data: [],
+ // description: ""
+ }
+
+ handleInputChange = event => {
+ const { name, value } = event.target;
+ this.setState({
+ [name]: value
+ });
+ }
+
+ handleFile(e) {
+ let file = e.target.files[0];
+ this.setState({file: file})
+ }
+
+ handleUpload(e) {
+ let file = this.state.file;
+ let idp_name = this.state.idp_name;
+ let formdata = new FormData();
+ formdata.append('saml_file', file);
+ formdata.append('idp_name', idp_name);
+
+ axios({
+ url: "/upload",
+ method: "POST",
+ data: formdata
+ }).then((res)=> {
+ if (res.data) {
+ // res.data[0] =
+ this.setState({data: res.data})
+
+ // console.log("ARR BELOW")
+ // console.log(arr)
+ // Object.entries(this.state.data).map(([key, value]) =>{
+ // return(
+ //
{key} : {value}
+ // )
+ // })
+ }
+ }, (err)=> {
+ console.log(err)
+ })
+ }
+
+ render() {
+ let keyArr = [];
+ let errorArr = [];
+ let jsonData = this.state.data;
+
+ for (let key in jsonData) {
+ if (jsonData.hasOwnProperty(key) && key !== "assertion_attributes" && !("errors_found" in jsonData[key])) {
+ keyArr.push(key);
+ } else if (jsonData.hasOwnProperty(key) && key !== "assertion_attributes" && ("errors_found" in jsonData[key])) {
+ errorArr.push(key);
+ }
+ }
+ const mappedKeys = keyArr.map((key) =>
+
+
+
{key}
+
{jsonData[key].description}
+
{jsonData[key].value}
-
-
-
+ );
+ const errorKeys = errorArr.map((key) =>
+
+
+
{key}
+
{jsonData[key].description}
+
{jsonData[key].value}
+
{jsonData[key].errors_found.description}
+
{jsonData[key].errors_found.hint}
+
{jsonData[key].errors_found.link}
+
-
-
+ );
+
+
+ return (
+
-
-
-
- );
- }
+ )
+ }
}
export default Form;
\ No newline at end of file
diff --git a/react_app/src/components/MappedCard.js b/react_app/src/components/MappedCard.js
new file mode 100644
index 0000000..793d7c5
--- /dev/null
+++ b/react_app/src/components/MappedCard.js
@@ -0,0 +1,39 @@
+// import React from "react";
+// import "../index.css";
+//
+// function MappedCard(props) {
+// if(props.res) {
+//
+// let description = ""
+// let keyArr = [];
+// let jsonData = props.res
+//
+// for (let key in jsonData) {
+// console.log(key);
+// if (jsonData.hasOwnProperty(key) && key !== "assertion_attributes") {
+// console.log("KEY BELOW");
+// console.log(key);
+// keyArr.push(key);
+// }
+// }
+// const mappedKeys = keyArr.map((key) =>
+//
{key} : {jsonData[key].description} &&& {jsonData[key].value}
+// );
+//
+// return (
+//
+//
+//
Assertion Attributes
+//
{description}
+//
{mappedKeys}
+//
+//
+// )
+// }
+// }
+//
+//
+//
+//
+//
+// export default MappedCard;
\ No newline at end of file
diff --git a/react_app/src/components/Table.js b/react_app/src/components/Table.js
index b07b660..2c82813 100644
--- a/react_app/src/components/Table.js
+++ b/react_app/src/components/Table.js
@@ -1,12 +1,12 @@
import React from "react";
import "../index.css";
-class Table extends React.Component {
- render() {
+function Table(props) {
return (
-
+ {props.description + " === " + props.value}
+
| Attribute |
@@ -16,41 +16,14 @@ class Table extends React.Component {
- | FirstName |
- Samwell |
- |
-
-
- | LastName |
- Tarly |
- |
-
-
- | Email |
- bigsammyt@hotmail.biz |
- Email 'bigsammyt@hotmail.biz' does not match user |
-
-
- | Larry |
- the Bird |
- @twitter |
-
-
- | Larry |
- the Bird |
- @twitter |
-
-
- | Larry |
- the Bird |
- @twitter |
+ {props.description} |
+ {props.value} |
-
);
- }
+
}
export default Table;
\ No newline at end of file
diff --git a/react_app/src/index.css b/react_app/src/index.css
index 40cda8d..22128cb 100644
--- a/react_app/src/index.css
+++ b/react_app/src/index.css
@@ -1,9 +1,10 @@
body {
- background-color: rgb(32, 32, 32);
+ /*background-color: rgb(32, 32, 32);*/
+ background-color: white;
+
}
h1 {
- color: white;
text-align: center;
margin-top: 50px;
}
@@ -39,7 +40,8 @@ table {
margin-top: 50px;
}
thead {
- background-color: #ffc107;
+ /*background-color: #ffc107;*/
+ background-color: white;
border: none;
}
@@ -58,4 +60,19 @@ thead {
.small-form {
width: 400px;
+}
+
+.error-title {
+ color: red;
+}
+.card {
+ width: 18rem;
+}
+
+.error-card {
+ border: red 1px solid;
+}
+
+li {
+ list-style-type: none;
}
\ No newline at end of file
diff --git a/react_app/src/pages/Home.js b/react_app/src/pages/Home.js
index 0d5c10c..57233bd 100644
--- a/react_app/src/pages/Home.js
+++ b/react_app/src/pages/Home.js
@@ -2,14 +2,15 @@ import React, { Component } from "react";
import Form from "../components/Form"
import Title from "../components/Title";
import PracticeForm from "../components/PracticeForm";
+import Table from "../components/Table"
+import MappedCard from "../components/MappedCard";
class Home extends Component {
render() {
return (
)
}
diff --git a/react_app/src/pages/NoMatch.js b/react_app/src/pages/NoMatch.js
index 6b6dddb..b0ccc7d 100644
--- a/react_app/src/pages/NoMatch.js
+++ b/react_app/src/pages/NoMatch.js
@@ -5,7 +5,7 @@ class NoMatch extends Component {
render() {
return (
-
No Match Found
+ Page Not Found
);
}
diff --git a/react_app/src/utils/API.js b/react_app/src/utils/API.js
index 57df48f..e69de29 100644
--- a/react_app/src/utils/API.js
+++ b/react_app/src/utils/API.js
@@ -1,11 +0,0 @@
-import axios from "axios";
-require("dotenv").config();
-
-export default {
- addStuff: function (data) {
- console.log('data is');
- console.log(data);
- return axios.post("/api/data", data);
- }
-
-}
\ No newline at end of file