version v2

This commit is contained in:
2025-06-23 14:11:11 +02:00
parent 1a6741ec10
commit 1370bef1f1
11 changed files with 315 additions and 115 deletions

View File

@@ -8,6 +8,38 @@
.table td {
vertical-align: middle;
}
/* Version column styling */
.version-badge {
font-family: monospace;
font-size: 0.85em;
}
.branch-badge {
font-size: 0.85em;
}
/* Make table responsive */
.table-responsive {
overflow-x: auto;
}
/* Tooltip styling for version info */
.tooltip-inner {
max-width: 300px;
text-align: left;
}
/* Version comparison styling */
.version-outdated {
background-color: #fff3cd !important;
border-color: #ffeaa7 !important;
}
.version-current {
background-color: #d1ecf1 !important;
border-color: #bee5eb !important;
}
</style>
{% endblock %}
@@ -51,6 +83,8 @@
<th>Payment Plan</th>
<th>Main URL</th>
<th>Status</th>
<th>Version</th>
<th>Branch</th>
<th>Connection Token</th>
<th>Actions</th>
</tr>
@@ -82,6 +116,26 @@
{{ instance.status|title }}
</span>
</td>
<td>
{% if instance.deployed_version %}
<span class="badge bg-info version-badge" data-bs-toggle="tooltip"
title="Deployed: {{ instance.deployed_version }}{% if instance.version_checked_at %}<br>Checked: {{ instance.version_checked_at.strftime('%Y-%m-%d %H:%M') }}{% endif %}">
{{ instance.deployed_version[:8] if instance.deployed_version != 'unknown' else 'unknown' }}
</span>
{% else %}
<span class="badge bg-secondary version-badge">unknown</span>
{% endif %}
</td>
<td>
{% if instance.deployed_branch %}
<span class="badge bg-light text-dark branch-badge" data-bs-toggle="tooltip"
title="Deployed branch: {{ instance.deployed_branch }}">
{{ instance.deployed_branch }}
</span>
{% else %}
<span class="badge bg-secondary branch-badge">unknown</span>
{% endif %}
</td>
<td>
{% if instance.connection_token %}
<span class="badge bg-success" data-bs-toggle="tooltip" title="Instance is authenticated">
@@ -809,19 +863,19 @@ async function fetchInstanceStats(instanceUrl, instanceId, jwtToken) {
const row = document.querySelector(`[data-instance-id="${instanceId}"]`).closest('tr');
// Update rooms count
// Update rooms count (3rd column)
const roomsCell = row.querySelector('td:nth-child(3)');
if (roomsCell) {
roomsCell.textContent = data.rooms || '0';
}
// Update conversations count
// Update conversations count (4th column)
const conversationsCell = row.querySelector('td:nth-child(4)');
if (conversationsCell) {
conversationsCell.textContent = data.conversations || '0';
}
// Update data usage
// Update data usage (5th column)
const dataCell = row.querySelector('td:nth-child(5)');
if (dataCell) {
const dataSize = data.total_storage || 0;
@@ -940,8 +994,8 @@ async function fetchCompanyNames() {
}))
});
// Changed from nth-child(8) to nth-child(7) since Main URL is the 7th column
const urlCell = row.querySelector('td:nth-child(7)');
// Main URL is now the 9th column (after adding Version and Branch columns)
const urlCell = row.querySelector('td:nth-child(9)');
if (!urlCell) {
console.error(`Could not find URL cell for instance ${instanceId}`);
@@ -1056,8 +1110,8 @@ async function editInstance(id) {
// Get the name from the first cell
const name = row.querySelector('td:first-child').textContent.trim();
// Get the main URL from the link in the URL cell (7th column)
const urlCell = row.querySelector('td:nth-child(7)');
// Get the main URL from the link in the URL cell (9th column after adding Version and Branch)
const urlCell = row.querySelector('td:nth-child(9)');
const urlLink = urlCell.querySelector('a');
const mainUrl = urlLink ? urlLink.getAttribute('href') : urlCell.textContent.trim();

View File

@@ -297,6 +297,67 @@
</div>
</div>
</div>
<!-- Version Management -->
<div class="mb-5">
<h5 style="color: var(--primary-color);" class="mb-4">Version Management</h5>
<!-- Version Tracking -->
<div class="card border-0 shadow-sm mb-4">
<div class="card-header bg-white">
<h6 class="mb-0" style="color: var(--primary-color);">
<i class="fas fa-tags me-2"></i>Version Tracking
</h6>
</div>
<div class="card-body">
<div class="row g-3">
<div class="col-md-6">
<h6 class="text-muted mb-2">Environment Variables</h6>
<ul class="list-unstyled small">
<li class="mb-1"><code>APP_VERSION</code> - Application version/tag</li>
<li class="mb-1"><code>GIT_COMMIT</code> - Git commit hash</li>
<li class="mb-1"><code>GIT_BRANCH</code> - Git branch name</li>
<li class="mb-1"><code>DEPLOYED_AT</code> - Deployment timestamp</li>
</ul>
</div>
<div class="col-md-6">
<h6 class="text-muted mb-2">Database Storage</h6>
<ul class="list-unstyled small">
<li class="mb-1">• Instance version tracking</li>
<li class="mb-1">• Version comparison</li>
<li class="mb-1">• Update notifications</li>
<li class="mb-1">• Deployment history</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Version API -->
<div class="card border-0 shadow-sm mb-4">
<div class="card-header bg-white">
<h6 class="mb-0" style="color: var(--primary-color);">
<i class="fas fa-code me-2"></i>Version API
</h6>
</div>
<div class="card-body">
<div class="mb-3">
<h6 class="text-muted mb-2">Endpoint</h6>
<code class="bg-light p-2 rounded d-block">GET /api/version</code>
</div>
<div class="mb-3">
<h6 class="text-muted mb-2">Response</h6>
<pre class="bg-light p-2 rounded small"><code>{
"version": "v1.2.3",
"tag": "v1.2.3",
"commit": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
"branch": "main",
"deployed_at": "2024-01-15T10:30:00.000000"
}</code></pre>
</div>
</div>
</div>
</div>
</div>
<!-- Sidebar -->