remove versions for now
This commit is contained in:
Binary file not shown.
@@ -386,46 +386,10 @@ def init_routes(main_bp):
|
||||
gitea_repo = git_settings.get('repo') if git_settings else None
|
||||
|
||||
for instance in instances:
|
||||
# 1. Check status
|
||||
# Check status
|
||||
status_info = check_instance_status(instance)
|
||||
instance.status = status_info['status']
|
||||
instance.status_details = status_info['details']
|
||||
|
||||
# 2. Check deployed version
|
||||
deployed_version = None
|
||||
deployed_tag = None
|
||||
deployed_commit = None
|
||||
try:
|
||||
version_url = f"{instance.main_url.rstrip('/')}/api/version"
|
||||
resp = requests.get(version_url, timeout=30) # Increased timeout to 30 seconds
|
||||
if resp.status_code == 200:
|
||||
version_data = resp.json()
|
||||
deployed_version = version_data.get('version', 'unknown')
|
||||
deployed_tag = version_data.get('tag', 'unknown')
|
||||
deployed_commit = version_data.get('commit', 'unknown')
|
||||
except Exception as e:
|
||||
deployed_version = None
|
||||
deployed_tag = None
|
||||
deployed_commit = None
|
||||
|
||||
instance.deployed_version = deployed_tag or deployed_version or 'unknown'
|
||||
instance.deployed_branch = instance.deployed_branch or 'master'
|
||||
|
||||
# 3. Check latest version from Gitea (if settings available)
|
||||
latest_version = None
|
||||
deployed_branch = instance.deployed_branch or 'master'
|
||||
if gitea_url and gitea_token and gitea_repo:
|
||||
try:
|
||||
headers = {'Accept': 'application/json', 'Authorization': f'token {gitea_token}'}
|
||||
# Gitea API: /api/v1/repos/{owner}/{repo}/commits/{branch}
|
||||
commit_url = f"{gitea_url}/api/v1/repos/{gitea_repo}/commits/{deployed_branch}"
|
||||
commit_resp = requests.get(commit_url, headers=headers, timeout=30) # Increased timeout to 30 seconds
|
||||
if commit_resp.status_code == 200:
|
||||
latest_version = commit_resp.json().get('sha')
|
||||
except Exception as e:
|
||||
latest_version = None
|
||||
instance.latest_version = latest_version or 'unknown'
|
||||
instance.version_checked_at = datetime.utcnow()
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@@ -5,19 +5,6 @@
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
.version-info {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.version-info code {
|
||||
font-size: 0.8rem;
|
||||
background-color: #f8f9fa;
|
||||
padding: 2px 4px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.badge-sm {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
.table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -64,7 +51,6 @@
|
||||
<th>Payment Plan</th>
|
||||
<th>Main URL</th>
|
||||
<th>Status</th>
|
||||
<th>Version</th>
|
||||
<th>Connection Token</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
@@ -96,44 +82,6 @@
|
||||
{{ instance.status|title }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{% if instance.deployed_version and instance.deployed_version != 'unknown' %}
|
||||
<div class="version-info">
|
||||
<div class="small">
|
||||
<strong>Version:</strong>
|
||||
<code class="text-primary">{{ instance.deployed_version }}</code>
|
||||
</div>
|
||||
{% if instance.latest_version and instance.latest_version != 'unknown' %}
|
||||
<div class="small">
|
||||
<strong>Latest:</strong>
|
||||
<code class="text-secondary">{{ instance.latest_version }}</code>
|
||||
</div>
|
||||
{% if instance.deployed_version == instance.latest_version %}
|
||||
<span class="badge bg-success badge-sm" data-bs-toggle="tooltip" title="Instance is up to date">
|
||||
<i class="fas fa-check"></i> Up-to-date
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="badge bg-warning badge-sm" data-bs-toggle="tooltip" title="Instance is outdated">
|
||||
<i class="fas fa-exclamation-triangle"></i> Outdated
|
||||
</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="badge bg-secondary badge-sm" data-bs-toggle="tooltip" title="Latest version unknown">
|
||||
<i class="fas fa-question"></i> Unknown
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if instance.version_checked_at %}
|
||||
<div class="small text-muted">
|
||||
<i class="fas fa-clock"></i> {{ instance.version_checked_at.strftime('%H:%M') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary" data-bs-toggle="tooltip" title="Version information not available">
|
||||
<i class="fas fa-question"></i> Unknown
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if instance.connection_token %}
|
||||
<span class="badge bg-success" data-bs-toggle="tooltip" title="Instance is authenticated">
|
||||
|
||||
Reference in New Issue
Block a user