Initialisation depot
This commit is contained in:
210
arti-api/auth-service/templates/dashboard.html
Normal file
210
arti-api/auth-service/templates/dashboard.html
Normal file
@@ -0,0 +1,210 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dashboard - Artifactory</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 1rem 2rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 2rem auto;
|
||||
padding: 0 2rem;
|
||||
}
|
||||
|
||||
.cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 2rem;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
color: #333;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.card p {
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.api-link {
|
||||
display: inline-block;
|
||||
margin-top: 1rem;
|
||||
padding: 0.5rem 1rem;
|
||||
background: #667eea;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
.api-link:hover {
|
||||
background: #5a6fd8;
|
||||
}
|
||||
|
||||
.alert {
|
||||
padding: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 6px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
background-color: #d1ecf1;
|
||||
border: 1px solid #bee5eb;
|
||||
color: #0c5460;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1>🏗️ Artifactory Dashboard</h1>
|
||||
<div class="user-info">
|
||||
<span id="userInfo">Loading...</span>
|
||||
<button class="logout-btn" onclick="logout()">Logout</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="alert" class="alert alert-info">
|
||||
<strong>Welcome!</strong> You have successfully authenticated with Active Directory.
|
||||
</div>
|
||||
|
||||
<div class="cards">
|
||||
<div class="card">
|
||||
<h3>📦 Debian Repository</h3>
|
||||
<p>Manage and distribute Debian packages for arm64 and amd64 architectures.</p>
|
||||
<a href="/debian" class="api-link">Browse Packages</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>⛵ Helm Charts</h3>
|
||||
<p>Store and manage Helm charts for Kubernetes deployments.</p>
|
||||
<a href="/charts" class="api-link">Browse Charts</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>🐳 Docker Registry</h3>
|
||||
<p>Manage Docker images and container registries.</p>
|
||||
<a href="/docker" class="api-link">Browse Images</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>🔧 API Documentation</h3>
|
||||
<p>Explore the REST API endpoints and interactive documentation.</p>
|
||||
<a href="/docs" class="api-link">View API Docs</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>📊 Health Status</h3>
|
||||
<p>Monitor the health and status of all artifactory services.</p>
|
||||
<a href="/health" class="api-link">View Health</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>👥 User Management</h3>
|
||||
<p>Manage users and permissions for the artifactory services.</p>
|
||||
<a href="/users" class="api-link">Manage Users</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
async function loadUserInfo() {
|
||||
try {
|
||||
const response = await fetch('/auth/user', {
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const user = await response.json();
|
||||
document.getElementById('userInfo').textContent =
|
||||
`${user.display_name || user.username} (${user.email})`;
|
||||
document.getElementById('alert').style.display = 'block';
|
||||
} else {
|
||||
// Redirect to login if not authenticated
|
||||
window.location.href = '/';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load user info:', error);
|
||||
window.location.href = '/';
|
||||
}
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
try {
|
||||
await fetch('/auth/logout', {
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
// Clear local storage
|
||||
localStorage.removeItem('auth_token');
|
||||
localStorage.removeItem('auth_timestamp');
|
||||
|
||||
// Redirect to login
|
||||
window.location.href = '/';
|
||||
} catch (error) {
|
||||
console.error('Logout error:', error);
|
||||
// Still redirect to login
|
||||
window.location.href = '/';
|
||||
}
|
||||
}
|
||||
|
||||
// Load user info on page load
|
||||
document.addEventListener('DOMContentLoaded', loadUserInfo);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user