v1.2.1-fix

This commit is contained in:
Yuri
2025-11-13 13:38:15 +01:00
parent 378b3a0ba3
commit feb2c7c805
5 changed files with 102 additions and 60 deletions
@@ -211,7 +211,7 @@
</tr>
<tr>
<td class="text-muted">{$ADDONLANG.Overview.ServerType}:</td>
<td><strong>{$serverInfo['server_type']['description']|default:$ADDONLANG.ServerTypes.Standard}</strong></td>
<td><strong>{$productName}</strong></td>
</tr>
</table>
</div>
@@ -521,8 +521,10 @@ function updateBackupTable(data) {
backupDate = backupDate.split('T')[0];
}
// Determine backup type
var backupType = backup.type === 'backup' ? lang.backups.automatic : lang.backups.manual;
// Determine backup type based on description
// Manual backups have descriptions starting with "Manual backup -"
var backupName = backup.name || '';
var backupType = backupName.indexOf('Manual backup -') === 0 ? lang.backups.manual : lang.backups.automatic;
// Format size (already in GB from API)
var sizeStr = 'N/A';
@@ -530,22 +532,40 @@ function updateBackupTable(data) {
sizeStr = backup.size + ' ' + lang.general.gb;
}
// Status is always available for Hetzner backups
var statusBadge = '<span class="badge badge-success">' + lang.backups.available + '</span>';
// Determine status badge based on size first (more reliable than API status)
var statusBadge;
if (!backup.size || backup.size === 0 || backup.size === '0') {
// Backup is still being created (size not available yet)
statusBadge = '<span class="badge badge-warning">' + lang.backups.creating + '</span>';
} else if (backup.status === 'available' || backup.size > 0) {
// Backup is ready (has a size)
statusBadge = '<span class="badge badge-success">' + lang.backups.available + '</span>';
} else if (backup.status === 'creating') {
// Status says creating but has size (unlikely but possible)
statusBadge = '<span class="badge badge-warning">' + lang.backups.creating + '</span>';
} else {
// Other statuses (error, etc)
statusBadge = '<span class="badge badge-danger">' + (backup.status || lang.backups.error) + '</span>';
}
// Use backup ID for Hetzner
var backupId = backup.id || backup.file;
row.innerHTML =
// Disable buttons if backup is still being created (size not available)
var isCreating = (!backup.size || backup.size === 0 || backup.size === '0');
var disabledAttr = isCreating ? ' disabled' : '';
var disabledClass = isCreating ? ' disabled' : '';
row.innerHTML =
'<td>' + backupDate + '</td>' +
'<td>' + sizeStr + '</td>' +
'<td>' + backupType + '</td>' +
'<td>' + statusBadge + '</td>' +
'<td style="white-space: nowrap;">' +
'<button class="btn btn-xs btn-primary mr-1" style="padding: 4px 8px; font-size: 12px;" onclick="restoreBackup(\'' + backupId + '\'); return false;" title="' + lang.restore + '">' +
'<button class="btn btn-xs btn-primary mr-1' + disabledClass + '" style="padding: 4px 8px; font-size: 12px;" onclick="restoreBackup(\'' + backupId + '\'); return false;" title="' + lang.restore + '"' + disabledAttr + '>' +
'<i class="fa fa-undo"></i>' +
'</button>' +
'<button class="btn btn-xs btn-danger" style="padding: 4px 8px; font-size: 12px;" onclick="deleteBackup(\'' + backupId + '\'); return false;" title="' + lang.delete + '">' +
'<button class="btn btn-xs btn-danger' + disabledClass + '" style="padding: 4px 8px; font-size: 12px;" onclick="deleteBackup(\'' + backupId + '\'); return false;" title="' + lang.delete + '"' + disabledAttr + '>' +
'<i class="fa fa-trash"></i>' +
'</button>' +
'</td>';
@@ -68,6 +68,21 @@
font-weight: 600;
transition: all 0.3s ease;
}
.arkhost-vps-container .btn-danger {
background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
color: white !important;
border: none !important;
padding: 10px 20px;
border-radius: 12px;
font-weight: 600;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}
.arkhost-vps-container .btn-danger:hover {
background: linear-gradient(135deg, #c82333 0%, #bd2130 100%) !important;
box-shadow: 0 4px 12px rgba(220, 53, 69, 0.5) !important;
transform: translateY(-1px);
}
.arkhost-vps-container .head {
border-bottom: 2px solid #3c7fb4;
margin-bottom: 20px;