Skip to content

Commit

Permalink
frontend dir made
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansurf committed May 24, 2024
1 parent c675d89 commit 1fee9a4
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 2 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/server.py → src/backend/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Flask Server Module
HTTP Server Module
"""

import os
Expand Down
58 changes: 58 additions & 0 deletions src/frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Itim&family=Poppins:wght@400;500&display=swap"
rel="stylesheet"
/>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css"
rel="stylesheet"
/>
<script src="https://cdn.tailwindcss.com"></script>
<title>cli-surf</title>
<style>
* {
font-family: "Poppins", sans-serif;
}
</style>
</head>


<body class="h-screen">
<div class="flex items-center justify-center h-screen bg-blue-900">
<!-- FORM START -->
<form id="reportForm" class="w-full max-w-xl">
<div class="flex items-center border-b border-teal-500 py-2">
<input
id="curlInput"
class="appearance-none bg-transparent border-none w-full text-white mr-3 py-1 px-2 leading-tight focus:outline-none"
type="text"
placeholder="Enter curl command"
aria-label="curl command"
/>
<button
id="getReportBtn"
class="flex-shrink-0 bg-teal-500 hover:bg-teal-700 border-teal-500 hover:border-teal-700 text-sm border-4 text-white py-1 px-2 rounded"
type="submit"
>
Get Report
</button>
<button
class="flex-shrink-0 border-transparent border-4 text-teal-500 hover:text-teal-800 text-sm py-1 px-2 rounded"
type="button"
>
Cancel
</button>
</div>
</form>
<!-- FORM END -->
</div>
<script src="script.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions src/frontend/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

document.getElementById("reportForm").addEventListener("submit", function(event) {
event.preventDefault(); // Prevent default form submission

const curlCommand = document.getElementById("curlInput").value;

// Make an asynchronous HTTP request to the server
fetch(`http://localhost:8000`, {
mode: 'no-cors'
})
.then(response => response.text())
.then(data => {
// Display the response in an alert or any other way you prefer
alert(data);
})
.catch(error => {
console.error('Error:', error);
// Handle errors
});
});
2 changes: 1 addition & 1 deletion src/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import sys

sys.path.append("..")
sys.path.append("../backend")

import unittest
from unittest.mock import patch
Expand Down

0 comments on commit 1fee9a4

Please sign in to comment.