APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
096529ee90
commit
05524ae5a2
5 files changed
+310
-6
No files matched your search
+47
-2
@@ -10922,23 +10922,57 @@ ${vpnBadgeTopo}
|
||||
const isRemoteEn = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
|
||||
const curProv = $('backupRemoteProvider')?.value || 'ftp';
|
||||
const provIconHtml = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(curProv) : '☁️ ';
|
||||
const provNames = {
|
||||
gdrive: 'Google Drive',
|
||||
dropbox: 'Dropbox',
|
||||
sftp: 'SFTP',
|
||||
ftp: 'FTP',
|
||||
webdav: 'WebDAV',
|
||||
s3: 'S3',
|
||||
webhook: 'Webhook'
|
||||
};
|
||||
const curProvName = provNames[curProv] || curProv.toUpperCase();
|
||||
|
||||
tbody.innerHTML = serverBackupsCache.map(bk => {
|
||||
const fname = bk.filename || '';
|
||||
const safeArg = escapeHtml(fname).replace(/'/g, ''');
|
||||
const isUploaded = !!bk.remote_uploaded;
|
||||
const upProv = bk.remote_provider || curProv;
|
||||
const upIconHtml = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(upProv) : provIconHtml;
|
||||
const upProvName = provNames[upProv] || upProv.toUpperCase();
|
||||
|
||||
const typePill = bk.trigger === 'auto'
|
||||
? `<span class="pill pill-green pill-no-dot" style="font-size:11px;padding:2px 8px">🤖 ${escapeHtml(t('backup_type_auto', 'Auto (Cron)'))}</span>`
|
||||
: (bk.trigger === 'manual'
|
||||
? `<span class="pill pill-blue pill-no-dot" style="font-size:11px;padding:2px 8px">👤 ${escapeHtml(t('backup_type_manual', 'Manuel'))}</span>`
|
||||
: `<span class="pill pill-no-dot" style="font-size:11px;padding:2px 8px">📄 ${escapeHtml(t('backup_type_external', 'Externe'))}</span>`);
|
||||
|
||||
// Badge statut distant à côté du nom de fichier : coche verte et logo du service
|
||||
const remoteBadge = (isRemoteEn && isUploaded)
|
||||
? `<span class="pill pill-green pill-no-dot" style="font-size:10px;padding:2px 6px;margin-left:6px;display:inline-flex;align-items:center;gap:3px;vertical-align:middle" title="${escapeHtml(t('backup_remote_already_uploaded', 'Présent sur {prov}').replace('{prov}', upProvName))}${bk.remote_uploaded_at ? ' (' + escapeHtml(bk.remote_uploaded_at) + ')' : ''}"><span style="color:var(--green);font-weight:bold">✓</span> ${upIconHtml}<span>${escapeHtml(upProvName)}</span></span>`
|
||||
: '';
|
||||
|
||||
// Bouton d'action Distant :
|
||||
// - Si pas encore téléversé : affiche le logo du service distant (ex: GDrive, Dropbox, SFTP, FTP...)
|
||||
// - Si déjà présent dessus : affiche une coche verte avec le logo du service distant !
|
||||
let remoteBtnHtml = '';
|
||||
if (isRemoteEn) {
|
||||
if (isUploaded) {
|
||||
remoteBtnHtml = `<button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--green);color:var(--green);background:rgba(50,213,131,0.14);font-weight:600" onclick="uploadServerBackupToRemote('${safeArg}')" title="${escapeHtml(t('backup_btn_remote_synced_title', 'Déjà présent sur {prov} (cliquer pour renvoyer)').replace('{prov}', upProvName))}"><span style="color:var(--green);font-weight:bold;margin-right:4px">✓</span>${upIconHtml}${escapeHtml(t('backup_btn_remote_short', 'Distant'))}</button>`;
|
||||
} else {
|
||||
remoteBtnHtml = `<button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--line);color:var(--text)" onclick="uploadServerBackupToRemote('${safeArg}')" title="${escapeHtml(t('backup_btn_remote_push_title', 'Envoyer vers {prov}').replace('{prov}', curProvName))}">${provIconHtml}${escapeHtml(t('backup_btn_remote_short', 'Distant'))}</button>`;
|
||||
}
|
||||
}
|
||||
|
||||
return `<tr>
|
||||
<td style="font-family:monospace;font-size:12px;word-break:break-all"><strong>${escapeHtml(fname)}</strong></td>
|
||||
<td style="font-family:monospace;font-size:12px;word-break:break-all"><strong>${escapeHtml(fname)}</strong>${remoteBadge}</td>
|
||||
<td>${typePill}</td>
|
||||
<td style="white-space:nowrap;font-size:12px" class="muted">${escapeHtml(bk.created_at || '—')}</td>
|
||||
<td style="white-space:nowrap;font-size:12px">${escapeHtml(bk.size_str || '—')}</td>
|
||||
<td style="text-align:right;white-space:nowrap">
|
||||
<div style="display:inline-flex;gap:6px;flex-wrap:wrap;justify-content:flex-end">
|
||||
<button type="button" class="secondary" style="padding:5px 10px;font-size:12px" onclick="downloadServerBackup('${safeArg}')" title="${escapeHtml(t('backup_btn_export', 'Exporter'))}">⬇️ ${escapeHtml(t('backup_btn_export', 'Exporter'))}</button>
|
||||
${isRemoteEn ? `<button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--green);color:var(--green)" onclick="uploadServerBackupToRemote('${safeArg}')" title="${escapeHtml(t('backup_btn_remote_push', 'Envoyer vers le stockage distant'))}">${provIconHtml}${escapeHtml(t('backup_btn_remote_short', 'Distant'))}</button>` : ''}
|
||||
${remoteBtnHtml}
|
||||
<button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--blue);color:var(--blue)" onclick="restoreServerBackup('${safeArg}')" title="${escapeHtml(t('backup_btn_restore', 'Restaurer'))}">♻️ ${escapeHtml(t('backup_btn_restore', 'Restaurer'))}</button>
|
||||
<button type="button" class="secondary danger" style="padding:5px 10px;font-size:12px;border-color:rgba(239,68,68,0.45);color:var(--red)" onclick="deleteServerBackup('${safeArg}')" title="${escapeHtml(t('btn_delete', 'Supprimer'))}">🗑️</button>
|
||||
</div>
|
||||
@@ -11428,6 +11462,17 @@ ${vpnBadgeTopo}
|
||||
const d = await res.json();
|
||||
if (!res.ok) throw new Error(d.error || 'Échec du transfert distant');
|
||||
if (d.remote) applyBackupRemoteToUI(d.remote);
|
||||
const bk = serverBackupsCache.find(b => b.filename === filename);
|
||||
if (bk) {
|
||||
bk.remote_uploaded = true;
|
||||
bk.remote_provider = prov;
|
||||
bk.remote_uploaded_at = new Date().toISOString().replace('T', ' ').substring(0, 19);
|
||||
}
|
||||
if (Array.isArray(d.backups)) {
|
||||
renderServerBackupsTable(d.backups, serverBackupsTotalSize);
|
||||
} else {
|
||||
renderServerBackupsTable(serverBackupsCache, serverBackupsTotalSize);
|
||||
}
|
||||
if (msg) {
|
||||
msg.style.background = 'rgba(50,213,131,0.12)';
|
||||
msg.style.color = 'var(--green)';
|
||||
|
||||
Reference in new issue
Block a user