update docker file for version

This commit is contained in:
2025-06-24 15:42:54 +02:00
parent 84da2eb489
commit cc699506d3
2 changed files with 22 additions and 46 deletions

View File

@@ -25,6 +25,13 @@ services:
- GIT_COMMIT=${GIT_COMMIT:-unknown} - GIT_COMMIT=${GIT_COMMIT:-unknown}
- GIT_BRANCH=${GIT_BRANCH:-unknown} - GIT_BRANCH=${GIT_BRANCH:-unknown}
- DEPLOYED_AT=${DEPLOYED_AT:-unknown} - DEPLOYED_AT=${DEPLOYED_AT:-unknown}
- PRICING_TIER_ID=${PRICING_TIER_ID:-0}
- PRICING_TIER_NAME=${PRICING_TIER_NAME:-Unknown}
- ROOM_QUOTA=${ROOM_QUOTA:-0}
- CONVERSATION_QUOTA=${CONVERSATION_QUOTA:-0}
- STORAGE_QUOTA_GB=${STORAGE_QUOTA_GB:-0}
- MANAGER_QUOTA=${MANAGER_QUOTA:-0}
- ADMIN_QUOTA=${ADMIN_QUOTA:-0}
volumes: volumes:
- docupulse_uploads:/app/uploads - docupulse_uploads:/app/uploads
depends_on: depends_on:

View File

@@ -1088,12 +1088,15 @@ function compareSemanticVersions(currentVersion, latestVersion) {
async function fetchVersionInfo(instanceUrl, instanceId) { async function fetchVersionInfo(instanceUrl, instanceId) {
const row = document.querySelector(`[data-instance-id="${instanceId}"]`).closest('tr'); const row = document.querySelector(`[data-instance-id="${instanceId}"]`).closest('tr');
const versionCell = row.querySelector('td:nth-child(9)'); // Version column (adjusted after removing branch) const versionCell = row.querySelector('td:nth-child(9)'); // Version column (adjusted after removing branch)
const paymentPlanCell = row.querySelector('td:nth-child(6)'); // Payment Plan column const paymentPlanCell = document.getElementById('payment-plan-' + instanceId); // Payment Plan column - use ID selector like initial load
// Show loading state // Show loading state
if (versionCell) { if (versionCell) {
versionCell.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Loading...'; versionCell.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Loading...';
} }
if (paymentPlanCell) {
paymentPlanCell.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Loading...';
}
try { try {
const apiKey = document.querySelector(`[data-instance-id="${instanceId}"]`).dataset.token; const apiKey = document.querySelector(`[data-instance-id="${instanceId}"]`).dataset.token;
@@ -1127,7 +1130,10 @@ async function fetchVersionInfo(instanceUrl, instanceId) {
// Update payment plan cell with pricing tier name // Update payment plan cell with pricing tier name
if (paymentPlanCell) { if (paymentPlanCell) {
const pricingTierName = data.pricing_tier_name || 'unknown'; const pricingTierName = data.pricing_tier_name || 'unknown';
console.log(`Instance ${instanceId}: API returned pricing_tier_name: "${pricingTierName}"`);
if (pricingTierName !== 'unknown') { if (pricingTierName !== 'unknown') {
console.log(`Instance ${instanceId}: Setting payment plan to "${pricingTierName}" with badge styling`);
paymentPlanCell.innerHTML = ` paymentPlanCell.innerHTML = `
<span class="badge bg-info" data-bs-toggle="tooltip" title="Pricing Tier: ${pricingTierName}"> <span class="badge bg-info" data-bs-toggle="tooltip" title="Pricing Tier: ${pricingTierName}">
<i class="fas fa-tag me-1"></i>${pricingTierName} <i class="fas fa-tag me-1"></i>${pricingTierName}
@@ -1139,8 +1145,11 @@ async function fetchVersionInfo(instanceUrl, instanceId) {
new bootstrap.Tooltip(paymentPlanBadge); new bootstrap.Tooltip(paymentPlanBadge);
} }
} else { } else {
console.log(`Instance ${instanceId}: API returned "unknown", setting badge to unknown`);
paymentPlanCell.innerHTML = '<span class="badge bg-secondary">unknown</span>'; paymentPlanCell.innerHTML = '<span class="badge bg-secondary">unknown</span>';
} }
} else {
console.log(`Instance ${instanceId}: paymentPlanCell not found`);
} }
// Update version cell // Update version cell
@@ -1360,8 +1369,8 @@ async function fetchCompanyNames() {
if (instanceUrl && apiKey) { if (instanceUrl && apiKey) {
console.log(`Fetching data for instance ${instanceId}`); console.log(`Fetching data for instance ${instanceId}`);
loadingPromises.push( loadingPromises.push(
fetchCompanyName(instanceUrl, instanceId), fetchCompanyName(instanceUrl, instanceId)
fetchVersionInfo(instanceUrl, instanceId) // Add version info fetching // Removed fetchVersionInfo call to prevent race conditions - checkAllInstanceStatuses handles this
); );
} else { } else {
const row = badge.closest('tr'); const row = badge.closest('tr');
@@ -1390,7 +1399,7 @@ async function fetchCompanyNames() {
try { try {
await Promise.all(loadingPromises); await Promise.all(loadingPromises);
console.log('Finished fetching all company names, stats, and version info'); console.log('Finished fetching all company names and stats');
} catch (error) { } catch (error) {
console.error('Error in fetchCompanyNames:', error); console.error('Error in fetchCompanyNames:', error);
} }
@@ -2492,48 +2501,8 @@ function validateStep6() {
} }
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// For each instance row, fetch the payment plan from the instance API // Remove the payment plan fetching from here since fetchVersionInfo handles it
document.querySelectorAll('[data-instance-id]').forEach(function(badge) { // The periodic refresh (every 30 seconds) will handle payment plan updates properly
const instanceId = badge.getAttribute('data-instance-id');
const token = badge.getAttribute('data-token');
const row = badge.closest('tr');
const urlCell = row.querySelector('td:nth-child(7) a');
const paymentPlanCell = document.getElementById('payment-plan-' + instanceId);
if (!urlCell || !token || !paymentPlanCell) return;
const instanceUrl = urlCell.getAttribute('href');
// Get management token
fetch(instanceUrl.replace(/\/$/, '') + '/api/admin/management-token', {
method: 'POST',
headers: {
'X-API-Key': token,
'Accept': 'application/json'
}
})
.then(res => res.json())
.then(data => {
if (!data.token) throw new Error('No management token');
// Fetch version info (which includes pricing_tier_name)
return fetch(instanceUrl.replace(/\/$/, '') + '/api/admin/version-info', {
headers: {
'Authorization': 'Bearer ' + data.token,
'Accept': 'application/json'
}
});
})
.then(res => res.json())
.then(data => {
if (data.pricing_tier_name) {
paymentPlanCell.textContent = data.pricing_tier_name;
} else {
paymentPlanCell.textContent = 'Unknown';
}
})
.catch(err => {
paymentPlanCell.textContent = 'Unknown';
});
});
}); });
</script> </script>
{% endblock %} {% endblock %}