Skip to content

Commit

Permalink
Solved issue #25
Browse files Browse the repository at this point in the history
Solved issue #25
  • Loading branch information
Zaina-ram authored Feb 14, 2024
2 parents e8b253a + ea9e61e commit 2fdddf4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Binary file modified build_history.db
Binary file not shown.
32 changes: 30 additions & 2 deletions src/main/java/se/kth/ci/CIServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
// Recursive directory deletion
import org.apache.commons.io.FileUtils;



// JSON parsing utilities
import org.json.JSONObject;

Expand Down Expand Up @@ -62,6 +60,7 @@ public CIServer(int port, String endpoint, String buildDirectory) {
<!DOCTYPE html>
<html>
<head>
<title>Build details</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%%; border-collapse: collapse; }
Expand Down Expand Up @@ -141,6 +140,35 @@ public CIServer(int port, String endpoint, String buildDirectory) {
return html.toString();
});

get(endpoint, (req, res) -> {
String html = """
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; } /* Adjusted */
th, td { padding: 8px; text-align: left; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; } /* Adjusted */
th { background-color: #4CAF50; color: white; border-right: 1px solid #ddd; } /* Adjusted */
tr:nth-child(even) { background-color: #f2f2f2; }
tr:hover { background-color: #ddd; }
pre { white-space: pre-wrap; word-wrap: break-word; }
th, tr:first-child th, tr:first-child td { border-top: 1px solid #ddd; } /* New */
td, th { border-left: 1px solid #ddd; } /* New */
td:first-child, th:first-child { border-left: none; } /* New */
</style>
</head>
<body>
<h1>CI Server</h1>
<a href="/builds">Build History</a>
</body>
</html>
""";
res.type("text/html");
return html;
});

// Route for receiving webhooks
post(endpoint, (req, res) -> {
System.out.println("POST request received.");
Expand Down
Binary file modified src/test/resources/insert_test.db
Binary file not shown.

0 comments on commit 2fdddf4

Please sign in to comment.