UI config
This commit is contained in:
@@ -367,7 +367,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="title">
|
||||
<h1>📊 PPR Reports</h1>
|
||||
<h1 id="tower-title">📊 PPR Reports</h1>
|
||||
</div>
|
||||
<div class="user-info">
|
||||
Logged in as: <span id="current-user">Loading...</span> |
|
||||
@@ -591,8 +591,49 @@
|
||||
let currentPPRs = []; // Store current results for export
|
||||
let currentOtherFlights = []; // Store other flights for export
|
||||
|
||||
// Load UI configuration from API
|
||||
async function loadUIConfig() {
|
||||
try {
|
||||
const response = await fetch('/api/v1/public/config');
|
||||
if (response.ok) {
|
||||
const config = await response.json();
|
||||
|
||||
// Update tower title
|
||||
const titleElement = document.getElementById('tower-title');
|
||||
if (titleElement && config.tag) {
|
||||
titleElement.innerHTML = `📊 Reports ${config.tag}`;
|
||||
}
|
||||
|
||||
// Update top bar gradient
|
||||
const topBar = document.querySelector('.top-bar');
|
||||
if (topBar && config.top_bar_gradient_start && config.top_bar_gradient_end) {
|
||||
topBar.style.background = `linear-gradient(135deg, ${config.top_bar_gradient_start}, ${config.top_bar_gradient_end})`;
|
||||
}
|
||||
|
||||
// Update page title
|
||||
if (config.tag) {
|
||||
document.title = `PPR Reports - ${config.tag}`;
|
||||
}
|
||||
|
||||
// Optionally indicate environment (e.g., add to title if not production)
|
||||
if (config.environment && config.environment !== 'production') {
|
||||
const envIndicator = ` (${config.environment.toUpperCase()})`;
|
||||
if (titleElement) {
|
||||
titleElement.innerHTML += envIndicator;
|
||||
}
|
||||
if (document.title) {
|
||||
document.title += envIndicator;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load UI config:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize the page
|
||||
async function initializePage() {
|
||||
loadUIConfig(); // Load UI configuration first
|
||||
await initializeAuth();
|
||||
setupDefaultDateRange();
|
||||
await loadReports();
|
||||
|
||||
Reference in New Issue
Block a user