199 lines
8.6 KiB
PHP
199 lines
8.6 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Project Details</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--primary-color: #2a3f54;
|
|
--secondary-color: #73879C;
|
|
--background-color: #F7F7F7;
|
|
--surface-color: #FFFFFF;
|
|
--accent-color: #1ABB9C;
|
|
}
|
|
body {
|
|
display: flex;
|
|
background-color: var(--background-color);
|
|
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
|
|
}
|
|
.sidebar {
|
|
width: 250px;
|
|
height: 100vh;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
background-color: var(--primary-color);
|
|
color: #ECF0F1;
|
|
padding-top: 20px;
|
|
}
|
|
.sidebar h3 {
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
font-weight: bold;
|
|
}
|
|
.sidebar .nav-link {
|
|
color: #ECF0F1;
|
|
padding: 10px 20px;
|
|
transition: background-color 0.3s;
|
|
}
|
|
.sidebar .nav-link:hover, .sidebar .nav-link.active {
|
|
background-color: var(--accent-color);
|
|
color: var(--surface-color);
|
|
}
|
|
.sidebar .nav-link .fa {
|
|
margin-right: 10px;
|
|
}
|
|
.main-content {
|
|
margin-left: 250px;
|
|
padding: 20px;
|
|
width: calc(100% - 250px);
|
|
}
|
|
.header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
.header h1 {
|
|
font-weight: bold;
|
|
color: var(--primary-color);
|
|
}
|
|
.card {
|
|
border: none;
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
margin-bottom: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="sidebar">
|
|
<h3><i class="fa fa-flask"></i> LWM</h3>
|
|
<ul class="nav flex-column">
|
|
<li class="nav-item">
|
|
<hr>
|
|
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
|
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="main-content">
|
|
<?php
|
|
require_once 'db/config.php';
|
|
$project = null;
|
|
if (isset($_GET['id'])) {
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("SELECT * FROM Project WHERE project_id = ?");
|
|
$stmt->execute([$_GET['id']]);
|
|
$project = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
} catch (PDOException $e) {
|
|
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
|
|
}
|
|
}
|
|
|
|
if ($project):
|
|
?>
|
|
<div class="header">
|
|
<h1>Project: <?php echo htmlspecialchars($project['name']); ?></h1>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Project Details</h5>
|
|
<p><strong>ID:</strong> <?php echo htmlspecialchars($project['project_id']); ?></p>
|
|
<p><strong>Description:</strong> <?php echo htmlspecialchars($project['description']); ?></p>
|
|
<p><strong>Start Date:</strong> <?php echo htmlspecialchars($project['Start Date']); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Generation Runs</h5>
|
|
<?php
|
|
try {
|
|
$stmt_runs = $pdo->prepare("
|
|
SELECT
|
|
gr.run_id,
|
|
gr.repository,
|
|
gr.rounds,
|
|
gr.status,
|
|
gr.run_start,
|
|
gr.run_end,
|
|
COUNT(c.candidate_id) AS candidate_count
|
|
FROM
|
|
Generation_Run gr
|
|
LEFT JOIN
|
|
Candidate c ON gr.run_id = c.run_id
|
|
WHERE
|
|
gr.project_id = ?
|
|
GROUP BY
|
|
gr.run_id
|
|
ORDER BY
|
|
gr.run_start DESC
|
|
");
|
|
$stmt_runs->execute([$_GET['id']]);
|
|
$runs = $stmt_runs->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if (count($runs) > 0) {
|
|
echo '<div class="table-responsive"><table class="table table-hover"><thead><tr><th>Run ID</th><th>Repository</th><th>Rounds</th><th>Status</th><th>Start Time</th><th>End Time</th><th>Candidates</th><th></th></tr></thead><tbody>';
|
|
foreach ($runs as $run) {
|
|
echo "<tr>";
|
|
echo "<td>" . htmlspecialchars($run['run_id']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($run['repository']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($run['rounds']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($run['status']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($run['run_start']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($run['run_end']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($run['candidate_count']) . "</td>";
|
|
echo "<td><button class='btn btn-sm btn-info' data-bs-toggle='collapse' data-bs-target='#candidates-" . $run['run_id'] . "'>View Candidates</button></td>";
|
|
echo "</tr>";
|
|
echo "<tr class='collapse' id='candidates-" . $run['run_id'] . "'><td colspan='8'>";
|
|
// Candidate table will go here
|
|
try {
|
|
$stmt_candidates = $pdo->prepare("SELECT candidate_id, smiles_id, estimated_cost, status FROM Candidate WHERE run_id = ?");
|
|
$stmt_candidates->execute([$run['run_id']]);
|
|
$candidates = $stmt_candidates->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if (count($candidates) > 0) {
|
|
echo '<table class="table table-sm table-bordered"><thead><tr><th>Candidate ID</th><th>SMILES ID</th><th>Est. Cost</th><th>Status</th></tr></thead><tbody>';
|
|
foreach ($candidates as $candidate) {
|
|
echo "<tr>";
|
|
echo "<td><a href='candidate.php?id=" . htmlspecialchars($candidate['candidate_id']) . "'>" . htmlspecialchars($candidate['candidate_id']) . "</a></td>";
|
|
echo "<td>" . htmlspecialchars($candidate['smiles_id']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($candidate['estimated_cost']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($candidate['status']) . "</td>";
|
|
echo "</tr>";
|
|
}
|
|
echo '</tbody></table>';
|
|
} else {
|
|
echo '<p class="text-muted">No candidates found for this run.</p>';
|
|
}
|
|
} catch (PDOException $e) {
|
|
echo '<div class="alert alert-danger">Database error fetching candidates: ' . $e->getMessage() . '</div>';
|
|
}
|
|
echo "</td></tr>";
|
|
}
|
|
echo '</tbody></table></div>';
|
|
} else {
|
|
echo '<p>No generation runs found for this project.</p>';
|
|
}
|
|
} catch (PDOException $e) {
|
|
echo '<div class="alert alert-danger">Database error fetching generation runs: ' . $e->getMessage() . '</div>';
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="alert alert-warning">Project not found or ID not provided.</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|