diff --git a/docker-compose.yml b/docker-compose.yml
index 3d01b32..7276bba 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -25,6 +25,13 @@ services:
- GIT_COMMIT=${GIT_COMMIT:-unknown}
- GIT_BRANCH=${GIT_BRANCH:-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:
- docupulse_uploads:/app/uploads
depends_on:
diff --git a/templates/main/instances.html b/templates/main/instances.html
index 2b0f8ea..4301ec1 100644
--- a/templates/main/instances.html
+++ b/templates/main/instances.html
@@ -1088,12 +1088,15 @@ function compareSemanticVersions(currentVersion, latestVersion) {
async function fetchVersionInfo(instanceUrl, instanceId) {
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 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
if (versionCell) {
versionCell.innerHTML = ' Loading...';
}
+ if (paymentPlanCell) {
+ paymentPlanCell.innerHTML = ' Loading...';
+ }
try {
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
if (paymentPlanCell) {
const pricingTierName = data.pricing_tier_name || 'unknown';
+ console.log(`Instance ${instanceId}: API returned pricing_tier_name: "${pricingTierName}"`);
+
if (pricingTierName !== 'unknown') {
+ console.log(`Instance ${instanceId}: Setting payment plan to "${pricingTierName}" with badge styling`);
paymentPlanCell.innerHTML = `
${pricingTierName}
@@ -1139,8 +1145,11 @@ async function fetchVersionInfo(instanceUrl, instanceId) {
new bootstrap.Tooltip(paymentPlanBadge);
}
} else {
+ console.log(`Instance ${instanceId}: API returned "unknown", setting badge to unknown`);
paymentPlanCell.innerHTML = 'unknown';
}
+ } else {
+ console.log(`Instance ${instanceId}: paymentPlanCell not found`);
}
// Update version cell
@@ -1360,8 +1369,8 @@ async function fetchCompanyNames() {
if (instanceUrl && apiKey) {
console.log(`Fetching data for instance ${instanceId}`);
loadingPromises.push(
- fetchCompanyName(instanceUrl, instanceId),
- fetchVersionInfo(instanceUrl, instanceId) // Add version info fetching
+ fetchCompanyName(instanceUrl, instanceId)
+ // Removed fetchVersionInfo call to prevent race conditions - checkAllInstanceStatuses handles this
);
} else {
const row = badge.closest('tr');
@@ -1390,7 +1399,7 @@ async function fetchCompanyNames() {
try {
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) {
console.error('Error in fetchCompanyNames:', error);
}
@@ -2492,48 +2501,8 @@ function validateStep6() {
}
document.addEventListener('DOMContentLoaded', function() {
- // For each instance row, fetch the payment plan from the instance API
- document.querySelectorAll('[data-instance-id]').forEach(function(badge) {
- 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';
- });
- });
+ // Remove the payment plan fetching from here since fetchVersionInfo handles it
+ // The periodic refresh (every 30 seconds) will handle payment plan updates properly
});
{% endblock %}