update configuration docker setup for data platform

This commit is contained in:
jigoong
2026-05-07 17:57:42 +07:00
parent ce949dcc8f
commit 1dba772e62
53 changed files with 6732 additions and 24 deletions

View File

@@ -0,0 +1,360 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Management - Admin</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
border-radius: 20px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 2px solid #e0e0e0;
}
h1 { color: #333; font-size: 32px; }
.user-info {
display: flex;
align-items: center;
gap: 15px;
}
.role-badge {
padding: 5px 15px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
}
.role-admin {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
color: white;
}
.role-operation {
background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
color: white;
}
.back-link {
display: inline-block;
margin-bottom: 20px;
color: #667eea;
text-decoration: none;
font-weight: 600;
font-size: 16px;
}
.back-link:hover { text-decoration: underline; }
.alert {
padding: 15px 20px;
margin-bottom: 20px;
border-radius: 8px;
font-weight: 500;
}
.alert-success {
background: #51cf66;
color: white;
}
.alert-error {
background: #ff6b6b;
color: white;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.stat-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 12px;
text-align: center;
}
.stat-number {
font-size: 36px;
font-weight: bold;
margin-bottom: 5px;
}
.stat-label {
font-size: 14px;
opacity: 0.9;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
background: white;
}
th, td {
padding: 15px;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
th {
background: #f8f9fa;
font-weight: 600;
color: #495057;
position: sticky;
top: 0;
}
tr:hover { background: #f8f9fa; }
.status-active {
color: #51cf66;
font-weight: 600;
}
.status-inactive {
color: #ff6b6b;
font-weight: 600;
}
.btn {
padding: 8px 16px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: all 0.3s;
font-weight: 500;
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #5568d3;
transform: translateY(-2px);
}
.btn-danger {
background: #ff6b6b;
color: white;
}
.btn-danger:hover {
background: #ee5a52;
transform: translateY(-2px);
}
.loading {
text-align: center;
padding: 40px;
color: #666;
}
.empty-state {
text-align: center;
padding: 60px;
color: #999;
}
.empty-state-icon {
font-size: 64px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="container">
<a href="{{ root_path }}/" class="back-link">← Back to Dashboard</a>
<div class="header">
<h1>👥 User Management</h1>
{% if user %}
<div class="user-info">
<span>{{ user.name or user.username }}</span>
{% if user.roles %}
{% for role in user.roles %}
<span class="role-badge role-{{ role }}">{{ role }}</span>
{% endfor %}
{% endif %}
</div>
{% endif %}
</div>
<div id="alertContainer"></div>
<div class="stats" id="statsContainer">
<div class="stat-card">
<div class="stat-number" id="totalUsers">-</div>
<div class="stat-label">Total Users</div>
</div>
<div class="stat-card">
<div class="stat-number" id="activeUsers">-</div>
<div class="stat-label">Active Users</div>
</div>
<div class="stat-card">
<div class="stat-number" id="adminUsers">-</div>
<div class="stat-label">Admins</div>
</div>
<div class="stat-card">
<div class="stat-number" id="operationUsers">-</div>
<div class="stat-label">Operations</div>
</div>
</div>
<div id="tableContainer">
<div class="loading">Loading users...</div>
</div>
</div>
<script>
const rootPath = "{{ root_path }}";
async function loadUsers() {
try {
const response = await fetch(`${rootPath}/admin/users/`);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const users = await response.json();
// Update stats
document.getElementById('totalUsers').textContent = users.length;
document.getElementById('activeUsers').textContent = users.filter(u => u.is_active).length;
document.getElementById('adminUsers').textContent = users.filter(u =>
u.roles.some(r => r.name === 'admin')
).length;
document.getElementById('operationUsers').textContent = users.filter(u =>
u.roles.some(r => r.name === 'operation')
).length;
// Render table
const tableContainer = document.getElementById('tableContainer');
if (users.length === 0) {
tableContainer.innerHTML = `
<div class="empty-state">
<div class="empty-state-icon">📭</div>
<h3>No users found</h3>
<p>Users will appear here when they log in for the first time.</p>
</div>
`;
return;
}
tableContainer.innerHTML = `
<table>
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Full Name</th>
<th>Roles</th>
<th>Status</th>
<th>Last Login</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
${users.map(user => `
<tr>
<td><strong>${escapeHtml(user.username)}</strong></td>
<td>${user.email ? escapeHtml(user.email) : '-'}</td>
<td>${user.full_name ? escapeHtml(user.full_name) : '-'}</td>
<td>
${user.roles.map(role =>
`<span class="role-badge role-${role.name}">${role.name}</span>`
).join(' ') || '<span style="color: #999;">No roles</span>'}
</td>
<td class="${user.is_active ? 'status-active' : 'status-inactive'}">
${user.is_active ? '✅ Active' : '❌ Inactive'}
</td>
<td>${user.last_login ? formatDate(user.last_login) : 'Never'}</td>
<td>
<button class="btn btn-primary" onclick="editUser(${user.id})">Edit</button>
<button class="btn btn-danger" onclick="deleteUser(${user.id}, '${escapeHtml(user.username)}')">Delete</button>
</td>
</tr>
`).join('')}
</tbody>
</table>
`;
} catch (error) {
console.error('Error loading users:', error);
document.getElementById('tableContainer').innerHTML = `
<div class="empty-state">
<div class="empty-state-icon">⚠️</div>
<h3>Error loading users</h3>
<p>${escapeHtml(error.message)}</p>
</div>
`;
showAlert('Failed to load users: ' + error.message, 'error');
}
}
function showAlert(message, type) {
const alertContainer = document.getElementById('alertContainer');
alertContainer.innerHTML = `
<div class="alert alert-${type}">
${escapeHtml(message)}
</div>
`;
setTimeout(() => alertContainer.innerHTML = '', 5000);
}
function editUser(userId) {
// TODO: Implement edit modal
showAlert('Edit functionality coming soon!', 'success');
}
async function deleteUser(userId, username) {
if (!confirm(`Are you sure you want to delete user "${username}"?`)) return;
try {
const response = await fetch(`${rootPath}/admin/users/${userId}`, {
method: 'DELETE'
});
if (response.ok) {
showAlert(`User "${username}" deleted successfully`, 'success');
loadUsers();
} else {
const error = await response.json();
showAlert('Failed to delete user: ' + error.detail, 'error');
}
} catch (error) {
console.error('Error deleting user:', error);
showAlert('Failed to delete user: ' + error.message, 'error');
}
}
function formatDate(dateString) {
const date = new Date(dateString);
return date.toLocaleString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
});
}
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
// Load users on page load
loadUsers();
</script>
</body>
</html>

View File

@@ -0,0 +1,635 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Finance Excel Upload - Sriphat Data Platform</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1000px;
margin: 0 auto;
}
.header {
background: white;
border-radius: 12px;
padding: 25px;
margin-bottom: 20px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
position: relative;
}
.header h1 {
color: #333;
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 10px;
}
.header p {
color: #666;
}
.user-info {
position: absolute;
top: 25px;
right: 25px;
display: flex;
align-items: center;
gap: 15px;
background: #f8f9fa;
padding: 8px 16px;
border-radius: 20px;
border: 1px solid #dee2e6;
}
.user-info .username {
font-size: 0.9rem;
color: #495057;
font-weight: 500;
}
.logout-btn {
background: #667eea;
color: white;
padding: 5px 12px;
border-radius: 12px;
text-decoration: none;
font-size: 0.85rem;
transition: background 0.3s ease;
}
.logout-btn:hover {
background: #5568d3;
}
.role-badge {
padding: 4px 12px;
border-radius: 12px;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.role-admin {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
color: white;
box-shadow: 0 2px 4px rgba(255,107,107,0.3);
}
.role-operation {
background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
color: white;
box-shadow: 0 2px 4px rgba(78,205,196,0.3);
}
.back-link {
display: inline-block;
color: #667eea;
text-decoration: none;
margin-bottom: 15px;
font-size: 0.9rem;
}
.back-link:hover {
text-decoration: underline;
}
.upload-section {
background: white;
border-radius: 12px;
padding: 30px;
margin-bottom: 20px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.upload-section h2 {
color: #333;
margin-bottom: 20px;
font-size: 1.5rem;
}
.upload-form {
display: flex;
flex-direction: column;
gap: 20px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 8px;
}
.form-group label {
color: #333;
font-weight: 500;
}
.file-input-wrapper {
position: relative;
display: inline-block;
width: 100%;
}
.file-input {
display: none;
}
.file-input-label {
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
border: 2px dashed #667eea;
border-radius: 8px;
background: #f8f9fa;
cursor: pointer;
transition: all 0.3s ease;
}
.file-input-label:hover {
background: #e9ecef;
border-color: #764ba2;
}
.file-input-label.has-file {
border-color: #28a745;
background: #d4edda;
}
.file-info {
display: none;
margin-top: 10px;
padding: 10px;
background: #e9ecef;
border-radius: 6px;
font-size: 0.9rem;
}
.file-info.show {
display: block;
}
.btn {
padding: 12px 30px;
border: none;
border-radius: 6px;
font-size: 1rem;
cursor: pointer;
transition: all 0.3s ease;
font-weight: 500;
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #5568d3;
}
.btn-primary:disabled {
background: #ccc;
cursor: not-allowed;
}
.alert {
padding: 15px;
border-radius: 6px;
margin-bottom: 20px;
display: none;
}
.alert.show {
display: block;
}
.alert-success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.alert-error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.alert-info {
background: #d1ecf1;
color: #0c5460;
border: 1px solid #bee5eb;
}
.uploads-list {
background: white;
border-radius: 12px;
padding: 30px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.uploads-list h2 {
color: #333;
margin-bottom: 20px;
font-size: 1.5rem;
}
.upload-item {
border: 1px solid #dee2e6;
border-radius: 8px;
margin-bottom: 15px;
overflow: hidden;
}
.upload-header {
padding: 15px;
background: #f8f9fa;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
transition: background 0.2s ease;
}
.upload-header:hover {
background: #e9ecef;
}
.upload-info {
flex: 1;
}
.upload-filename {
font-weight: 500;
color: #333;
margin-bottom: 5px;
}
.upload-meta {
font-size: 0.85rem;
color: #666;
}
.upload-status {
display: flex;
align-items: center;
gap: 10px;
}
.status-badge {
padding: 5px 12px;
border-radius: 20px;
font-size: 0.85rem;
font-weight: 500;
}
.status-pending {
background: #fff3cd;
color: #856404;
}
.status-processing {
background: #d1ecf1;
color: #0c5460;
}
.status-success {
background: #d4edda;
color: #155724;
}
.status-error {
background: #f8d7da;
color: #721c24;
}
.expand-icon {
transition: transform 0.3s ease;
}
.expand-icon.expanded {
transform: rotate(180deg);
}
.upload-details {
padding: 15px;
background: white;
border-top: 1px solid #dee2e6;
display: none;
}
.upload-details.show {
display: block;
}
.log-container {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 6px;
padding: 15px;
font-family: 'Courier New', monospace;
font-size: 0.85rem;
max-height: 300px;
overflow-y: auto;
white-space: pre-wrap;
word-wrap: break-word;
}
.log-error {
color: #dc3545;
}
.log-info {
color: #17a2b8;
}
.empty-state {
text-align: center;
padding: 40px;
color: #666;
}
.empty-state .icon {
font-size: 3rem;
margin-bottom: 15px;
opacity: 0.5;
}
.spinner {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid rgba(0,0,0,0.1);
border-radius: 50%;
border-top-color: #667eea;
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@media (max-width: 768px) {
.container {
padding: 10px;
}
.upload-section, .uploads-list {
padding: 20px;
}
}
</style>
</head>
<body>
<div class="container">
<a href="{{ root_path }}/" class="back-link">← Back to Dashboard</a>
<div class="header">
<h1>💰 Finance Excel Upload</h1>
<p>Upload Excel files for financial data processing</p>
{% if user %}
<div class="user-info">
<span class="username">👤 {{ user.name or user.username }}</span>
{% if user.roles %}
{% for role in user.roles %}
<span class="role-badge role-{{ role }}">{{ role }}</span>
{% endfor %}
{% endif %}
<a href="{{ root_path }}/auth/logout" class="logout-btn">Logout</a>
</div>
{% endif %}
</div>
<div id="alertContainer"></div>
<div class="upload-section">
<h2>📤 Upload File</h2>
<form id="uploadForm" class="upload-form" enctype="multipart/form-data">
<div class="form-group">
<label for="file">Select Excel File (.xlsx, .xls)</label>
<div class="file-input-wrapper">
<input type="file" id="file" name="file" class="file-input" accept=".xlsx,.xls" required>
<label for="file" id="fileLabel" class="file-input-label">
<span>📁 Click to select file or drag and drop</span>
</label>
</div>
<div id="fileInfo" class="file-info"></div>
</div>
<div class="form-group">
<label for="description">Description (Optional)</label>
<textarea id="description" name="description" rows="3" style="padding: 10px; border: 1px solid #dee2e6; border-radius: 6px; font-family: inherit;"></textarea>
</div>
<button type="submit" class="btn btn-primary" id="submitBtn">
Upload and Process
</button>
</form>
</div>
<div class="uploads-list">
<h2>📋 Upload History</h2>
<div id="uploadsList">
<div class="empty-state">
<div class="icon">📭</div>
<p>No uploads yet</p>
</div>
</div>
</div>
</div>
<script>
const rootPath = '{{ root_path }}';
const fileInput = document.getElementById('file');
const fileLabel = document.getElementById('fileLabel');
const fileInfo = document.getElementById('fileInfo');
const uploadForm = document.getElementById('uploadForm');
const submitBtn = document.getElementById('submitBtn');
const uploadsList = document.getElementById('uploadsList');
const alertContainer = document.getElementById('alertContainer');
// File input handling
fileInput.addEventListener('change', function(e) {
const file = e.target.files[0];
if (file) {
fileLabel.classList.add('has-file');
fileLabel.innerHTML = `<span>✅ ${file.name}</span>`;
fileInfo.classList.add('show');
fileInfo.textContent = `File: ${file.name} (${formatFileSize(file.size)})`;
}
});
// Drag and drop
fileLabel.addEventListener('dragover', (e) => {
e.preventDefault();
fileLabel.style.borderColor = '#764ba2';
});
fileLabel.addEventListener('dragleave', () => {
fileLabel.style.borderColor = '#667eea';
});
fileLabel.addEventListener('drop', (e) => {
e.preventDefault();
fileLabel.style.borderColor = '#667eea';
const files = e.dataTransfer.files;
if (files.length > 0) {
fileInput.files = files;
fileInput.dispatchEvent(new Event('change'));
}
});
// Form submission
uploadForm.addEventListener('submit', async function(e) {
e.preventDefault();
const formData = new FormData(uploadForm);
submitBtn.disabled = true;
submitBtn.innerHTML = '<span class="spinner"></span> Uploading...';
try {
const response = await fetch(`${rootPath}/data-management/finance/upload`, {
method: 'POST',
body: formData
});
const result = await response.json();
if (response.ok) {
showAlert('success', result.message || 'File uploaded successfully!');
uploadForm.reset();
fileLabel.classList.remove('has-file');
fileLabel.innerHTML = '<span>📁 Click to select file or drag and drop</span>';
fileInfo.classList.remove('show');
// Refresh uploads list
loadUploads();
} else {
showAlert('error', result.detail || 'Upload failed');
}
} catch (error) {
showAlert('error', 'Network error: ' + error.message);
} finally {
submitBtn.disabled = false;
submitBtn.textContent = 'Upload and Process';
}
});
// Load uploads list
async function loadUploads() {
try {
const response = await fetch(`${rootPath}/data-management/finance/uploads`);
const uploads = await response.json();
if (uploads.length === 0) {
uploadsList.innerHTML = `
<div class="empty-state">
<div class="icon">📭</div>
<p>No uploads yet</p>
</div>
`;
return;
}
uploadsList.innerHTML = uploads.map(upload => `
<div class="upload-item">
<div class="upload-header" onclick="toggleDetails('${upload.id}')">
<div class="upload-info">
<div class="upload-filename">${upload.filename}</div>
<div class="upload-meta">
Uploaded: ${formatDate(upload.uploaded_at)}
${upload.description ? `${upload.description}` : ''}
</div>
</div>
<div class="upload-status">
<span class="status-badge status-${upload.status}">${upload.status.toUpperCase()}</span>
<span class="expand-icon" id="icon-${upload.id}">▼</span>
</div>
</div>
<div class="upload-details" id="details-${upload.id}">
${upload.job_id ? `<p><strong>Job ID:</strong> ${upload.job_id}</p>` : ''}
${upload.logs ? `
<h4>Logs:</h4>
<div class="log-container ${upload.status === 'error' ? 'log-error' : 'log-info'}">
${upload.logs}
</div>
` : '<p>No logs available</p>'}
</div>
</div>
`).join('');
} catch (error) {
console.error('Failed to load uploads:', error);
}
}
function toggleDetails(id) {
const details = document.getElementById(`details-${id}`);
const icon = document.getElementById(`icon-${id}`);
if (details.classList.contains('show')) {
details.classList.remove('show');
icon.classList.remove('expanded');
} else {
details.classList.add('show');
icon.classList.add('expanded');
}
}
function showAlert(type, message) {
const alertClass = type === 'success' ? 'alert-success' : type === 'error' ? 'alert-error' : 'alert-info';
const alert = document.createElement('div');
alert.className = `alert ${alertClass} show`;
alert.textContent = message;
alertContainer.innerHTML = '';
alertContainer.appendChild(alert);
setTimeout(() => {
alert.classList.remove('show');
}, 5000);
}
function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
}
function formatDate(dateString) {
const date = new Date(dateString);
return date.toLocaleString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
});
}
// Load uploads on page load
loadUploads();
// Refresh uploads every 10 seconds
setInterval(loadUploads, 10000);
</script>
</body>
</html>

View File

@@ -0,0 +1,296 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sriphat Data Platform</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
text-align: center;
color: white;
margin-bottom: 40px;
padding: 20px;
position: relative;
}
.header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.header p {
font-size: 1.1rem;
opacity: 0.9;
}
.user-info {
position: absolute;
top: 20px;
right: 20px;
display: flex;
align-items: center;
gap: 15px;
background: rgba(255,255,255,0.1);
padding: 10px 20px;
border-radius: 25px;
backdrop-filter: blur(10px);
}
.user-info .username {
font-size: 0.95rem;
font-weight: 500;
}
.logout-btn {
background: rgba(255,255,255,0.2);
color: white;
padding: 6px 15px;
border-radius: 15px;
text-decoration: none;
font-size: 0.9rem;
transition: background 0.3s ease;
}
.logout-btn:hover {
background: rgba(255,255,255,0.3);
}
.role-badge {
padding: 4px 12px;
border-radius: 12px;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.role-admin {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
color: white;
box-shadow: 0 2px 4px rgba(255,107,107,0.3);
}
.role-operation {
background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
color: white;
box-shadow: 0 2px 4px rgba(78,205,196,0.3);
}
.menu-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.menu-card {
background: white;
border-radius: 12px;
padding: 25px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
text-decoration: none;
color: inherit;
display: block;
}
.menu-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}
.menu-card.has-submenu {
cursor: default;
}
.menu-card .icon {
font-size: 2.5rem;
margin-bottom: 15px;
display: block;
}
.menu-card h3 {
color: #333;
margin-bottom: 10px;
font-size: 1.3rem;
}
.menu-card p {
color: #666;
font-size: 0.9rem;
line-height: 1.5;
}
.submenu {
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid #eee;
display: none;
}
.submenu.active {
display: block;
}
.submenu-item {
display: block;
padding: 10px 15px;
margin: 5px 0;
background: #f8f9fa;
border-radius: 6px;
color: #495057;
text-decoration: none;
transition: background 0.2s ease;
}
.submenu-item:hover {
background: #e9ecef;
}
.submenu-toggle {
display: inline-block;
margin-left: 10px;
font-size: 0.8rem;
color: #667eea;
cursor: pointer;
}
/* Color themes for different services */
.card-supabase { border-left: 4px solid #3ECF8E; }
.card-api { border-left: 4px solid #009688; }
.card-airflow { border-left: 4px solid #017CEE; }
.card-airbyte { border-left: 4px solid #615EFF; }
.card-data { border-left: 4px solid #FF6B6B; }
.card-dbt { border-left: 4px solid #FF694B; }
.card-superset { border-left: 4px solid #20A7C9; }
@media (max-width: 768px) {
.header h1 {
font-size: 2rem;
}
.menu-grid {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🏥 Sriphat Data Platform</h1>
<p>Integrated Data Management & Analytics Platform</p>
{% if user %}
<div class="user-info">
<span class="username">👤 {{ user.name or user.username }}</span>
{% if user.roles %}
{% for role in user.roles %}
<span class="role-badge role-{{ role }}">{{ role }}</span>
{% endfor %}
{% endif %}
<a href="{{ root_path }}/auth/logout" class="logout-btn">Logout</a>
</div>
{% endif %}
</div>
<div class="menu-grid">
<!-- Supabase -->
<a href="https://ai.sriphat.com/supabase" class="menu-card card-supabase" target="_blank">
<span class="icon">🗄️</span>
<h3>Supabase</h3>
<p>PostgreSQL database with real-time capabilities and REST API</p>
</a>
<!-- API Docs -->
<a href="{{ root_path }}/docs" class="menu-card card-api">
<span class="icon">📚</span>
<h3>API Documentation</h3>
<p>Interactive API documentation and testing interface</p>
</a>
<!-- Airflow -->
<a href="https://ai.sriphat.com/airflow" class="menu-card card-airflow" target="_blank">
<span class="icon">🔄</span>
<h3>Airflow</h3>
<p>Workflow orchestration and data pipeline management</p>
</a>
<!-- Airbyte -->
<a href="https://ai.sriphat.com/airbyte" class="menu-card card-airbyte" target="_blank">
<span class="icon">🔌</span>
<h3>Airbyte</h3>
<p>Data integration and ETL platform</p>
</a>
<!-- Data Management -->
<div class="menu-card card-data has-submenu" onclick="toggleSubmenu(this)">
<span class="icon">📊</span>
<h3>Data Management <span class="submenu-toggle"></span></h3>
<p>Upload and manage data files</p>
<div class="submenu">
<a href="{{ root_path }}/data-management/finance" class="submenu-item">
💰 Finance Excel Upload
</a>
</div>
</div>
<!-- DBT -->
<a href="https://ai.sriphat.com/dbt" class="menu-card card-dbt" target="_blank">
<span class="icon">🔧</span>
<h3>DBT</h3>
<p>Data transformation and modeling</p>
</a>
<!-- Superset -->
<a href="https://ai.sriphat.com/superset" class="menu-card card-superset" target="_blank">
<span class="icon">📈</span>
<h3>Superset</h3>
<p>Business intelligence and data visualization</p>
</a>
<!-- User Management (Admin only) -->
{% if user and user.roles and 'admin' in user.roles %}
<a href="{{ root_path }}/admin/users" class="menu-card card-admin">
<span class="icon">👥</span>
<h3>User Management</h3>
<p>Manage users and roles (Admin only)</p>
</a>
{% endif %}
</div>
</div>
<script>
function toggleSubmenu(card) {
const submenu = card.querySelector('.submenu');
const toggle = card.querySelector('.submenu-toggle');
if (submenu.classList.contains('active')) {
submenu.classList.remove('active');
toggle.textContent = '▼';
} else {
submenu.classList.add('active');
toggle.textContent = '▲';
}
}
</script>
</body>
</html>