update docker file for version
This commit is contained in:
@@ -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 = '<i class="fas fa-spinner fa-spin"></i> Loading...';
|
||||
}
|
||||
if (paymentPlanCell) {
|
||||
paymentPlanCell.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 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 = `
|
||||
<span class="badge bg-info" data-bs-toggle="tooltip" title="Pricing Tier: ${pricingTierName}">
|
||||
<i class="fas fa-tag me-1"></i>${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 = '<span class="badge bg-secondary">unknown</span>';
|
||||
}
|
||||
} 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
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user