update index.html
This commit is contained in:
+33
-12
@@ -324,11 +324,12 @@
|
|||||||
promptOvr: "GLOBAL OVERRIDE", promptOvrConfirm: "Confirm sending to ENTIRE network?",
|
promptOvr: "GLOBAL OVERRIDE", promptOvrConfirm: "Confirm sending to ENTIRE network?",
|
||||||
modUpdateTitle: "🔄 GLOBAL UPDATE", confUpdate: "Do you want to request updated data and configuration files from all nodes in the fleet?", alertUpdateOk: "Request sent successfully!",
|
modUpdateTitle: "🔄 GLOBAL UPDATE", confUpdate: "Do you want to request updated data and configuration files from all nodes in the fleet?", alertUpdateOk: "Request sent successfully!",
|
||||||
btnConfReset: "⚠️ CONFIRM RESET", btnCancel: "CANCEL", promptPass: "Enter the new password:",
|
btnConfReset: "⚠️ CONFIRM RESET", btnCancel: "CANCEL", promptPass: "Enter the new password:",
|
||||||
titleError: "❌ ERROR", titleSuccess: "✅ SUCCESS", titleAction: "⚙️ CONFIRM REBOOT", titleDelete: "🗑️ DELETE USER", titleSave: "💾 SAVE", titleGlobal: "🚨 GLOBAL OVERRIDE",
|
titleError: "❌ ERROR", titleSuccess: "✅ SUCCESS", titleAction: "⚙️ CONFIRM ACTION", titleDelete: "🗑️ DELETE USER", titleSave: "💾 SAVE", titleGlobal: "🚨 GLOBAL OVERRIDE",
|
||||||
btnYes: "YES, PROCEED", msgDelUser: "Confirm user deletion?", msgPassOk: "Password updated successfully!", msgPassErr: "Failed to update password.", msgLoginFail: "Login Failed",
|
btnYes: "YES, PROCEED", msgDelUser: "Confirm user deletion?", msgPassOk: "Password updated successfully!", msgPassErr: "Failed to update password.", msgLoginFail: "Login Failed",
|
||||||
msgConfigSaved: "Configuration saved!", msgConfigErr: "Error saving configuration", msgNetErr: "Network Error", msgOvrSel: "Select the profile to send to the ENTIRE network:",
|
msgConfigSaved: "Configuration saved!", msgConfigErr: "Error saving configuration", msgNetErr: "Network Error", msgOvrSel: "Select the profile to send to the ENTIRE network:",
|
||||||
msgOvrOk: "Command successfully sent to the network!", msgMissUser: "Missing Username", msgMissPass: "Password required for new user", btnSvcKo: "⚠️ DAEMON KO",
|
msgOvrOk: "Command successfully sent to the network!", msgMissUser: "Missing Username", msgMissPass: "Password required for new user", btnSvcKo: "⚠️ DAEMON KO",
|
||||||
phNewPass: "New pass (empty to keep)", phPass: "Password"
|
phNewPass: "New pass (empty to keep)", phPass: "Password",
|
||||||
|
titleSwitch: "SWITCH PROFILE", confSwitch: "Are you sure you want to switch to", titleBoot: "SYSTEM REBOOT", confBoot: "Are you sure you want to REBOOT node "
|
||||||
},
|
},
|
||||||
it: {
|
it: {
|
||||||
themeLight: "☀️ CHIARO", themeDark: "🌙 SCURO",
|
themeLight: "☀️ CHIARO", themeDark: "🌙 SCURO",
|
||||||
@@ -348,11 +349,12 @@
|
|||||||
promptOvr: "OVERRIDE GLOBALE", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?",
|
promptOvr: "OVERRIDE GLOBALE", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?",
|
||||||
modUpdateTitle: "🔄 AGGIORNAMENTO GLOBALE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "Richiesta inviata con successo!",
|
modUpdateTitle: "🔄 AGGIORNAMENTO GLOBALE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "Richiesta inviata con successo!",
|
||||||
btnConfReset: "⚠️ CONFERMA RESET", btnCancel: "ANNULLA", promptPass: "Inserisci la nuova password:",
|
btnConfReset: "⚠️ CONFERMA RESET", btnCancel: "ANNULLA", promptPass: "Inserisci la nuova password:",
|
||||||
titleError: "❌ ERRORE", titleSuccess: "✅ OK", titleAction: "⚙️ CONFERMA REBOOT", titleDelete: "🗑️ ELIMINA UTENTE", titleSave: "💾 SALVATAGGIO", titleGlobal: "🚨 OVERRIDE GLOBALE",
|
titleError: "❌ ERRORE", titleSuccess: "✅ OK", titleAction: "⚙️ CONFERMA AZIONE", titleDelete: "🗑️ ELIMINA UTENTE", titleSave: "💾 SALVATAGGIO", titleGlobal: "🚨 OVERRIDE GLOBALE",
|
||||||
btnYes: "SI, PROCEDI", msgDelUser: "Confermi l'eliminazione dell'utente?", msgPassOk: "Password aggiornata con successo!", msgPassErr: "Errore durante l'aggiornamento della password.", msgLoginFail: "Login Fallito",
|
btnYes: "SI, PROCEDI", msgDelUser: "Confermi l'eliminazione dell'utente?", msgPassOk: "Password aggiornata con successo!", msgPassErr: "Errore durante l'aggiornamento della password.", msgLoginFail: "Login Fallito",
|
||||||
msgConfigSaved: "Configurazione salvata!", msgConfigErr: "Errore durante il salvataggio", msgNetErr: "Errore di rete", msgOvrSel: "Seleziona il profilo da inviare a TUTTA la rete:",
|
msgConfigSaved: "Configurazione salvata!", msgConfigErr: "Errore durante il salvataggio", msgNetErr: "Errore di rete", msgOvrSel: "Seleziona il profilo da inviare a TUTTA la rete:",
|
||||||
msgOvrOk: "Comando inviato con successo a tutta la rete!", msgMissUser: "Username mancante", msgMissPass: "Password obbligatoria per il nuovo utente", btnSvcKo: "⚠️ DEMONE KO",
|
msgOvrOk: "Comando inviato con successo a tutta la rete!", msgMissUser: "Username mancante", msgMissPass: "Password obbligatoria per il nuovo utente", btnSvcKo: "⚠️ DEMONE KO",
|
||||||
phNewPass: "Nuova pass (vuota per non cambiare)", phPass: "Password"
|
phNewPass: "Nuova pass (vuota per non cambiare)", phPass: "Password",
|
||||||
|
titleSwitch: "CAMBIO PROFILO", confSwitch: "Sei sicuro di voler passare al", titleBoot: "RIAVVIO SISTEMA", confBoot: "Sei sicuro di voler RIAVVIARE il nodo "
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -415,8 +417,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- API & COMMAND FUNCTIONS ---
|
// --- API & COMMAND FUNCTIONS ---
|
||||||
function sendCommand(clientId, type) {
|
function sendCommand(clientId, type, customTitle, customMsg, customColor) {
|
||||||
customConfirm(t('titleAction'), `${t('confOp')}${clientId.toUpperCase()}?`, "var(--primary)", async () => {
|
const title = customTitle || t('titleAction');
|
||||||
|
const msg = customMsg || `${t('confOp')}<b>${clientId.toUpperCase()}</b>?`;
|
||||||
|
const color = customColor || "var(--primary)";
|
||||||
|
|
||||||
|
customConfirm(title, msg, color, async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/command', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clientId, type }) });
|
const res = await fetch('/api/command', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clientId, type }) });
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
@@ -426,8 +432,23 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmSwitch(id, mode) { sendCommand(id, mode); }
|
function confirmSwitch(id, mode) {
|
||||||
function confirmReboot(id) { sendCommand(id, 'REBOOT'); }
|
const data = globalHealthData[id.toLowerCase()];
|
||||||
|
let profileName = mode === 'A' ? "PROFILE A" : "PROFILE B";
|
||||||
|
if (data && data.profiles && data.profiles[mode]) {
|
||||||
|
profileName = data.profiles[mode];
|
||||||
|
}
|
||||||
|
const title = `🔄 ${t('titleSwitch')}`;
|
||||||
|
const msg = `${t('confSwitch')} <b>${profileName}</b> -> <b>${id.toUpperCase()}</b>?`;
|
||||||
|
const color = mode === 'A' ? "var(--accent)" : "#eab308";
|
||||||
|
sendCommand(id, mode, title, msg, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmReboot(id) {
|
||||||
|
const title = `🔄 ${t('titleBoot')}`;
|
||||||
|
const msg = `${t('confBoot')}<b>${id.toUpperCase()}</b>?`;
|
||||||
|
sendCommand(id, 'REBOOT', title, msg, "var(--danger)");
|
||||||
|
}
|
||||||
|
|
||||||
function confirmHatReset(id) {
|
function confirmHatReset(id) {
|
||||||
currentResetHatId = id;
|
currentResetHatId = id;
|
||||||
@@ -465,7 +486,7 @@
|
|||||||
|
|
||||||
function sendTgCommand(clientId, comando) {
|
function sendTgCommand(clientId, comando) {
|
||||||
const msg = (comando === 'TG:ON') ? t('confTgOn') : t('confTgOff');
|
const msg = (comando === 'TG:ON') ? t('confTgOn') : t('confTgOff');
|
||||||
customConfirm("💬 TELEGRAM", `${msg}${clientId.toUpperCase()}?`, "var(--primary)", async () => {
|
customConfirm("💬 TELEGRAM", `${msg}<b>${clientId.toUpperCase()}</b>?`, "var(--primary)", async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/command', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clientId: clientId, type: comando }) });
|
const res = await fetch('/api/command', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clientId: clientId, type: comando }) });
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
@@ -914,11 +935,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function controlService(clientId, service, action) {
|
function controlService(clientId, service, action) {
|
||||||
customConfirm(t('titleAction'), `${t('confOp')}${service}?`, "var(--accent)", async () => {
|
customConfirm(t('titleAction'), `${t('confOp')}<b>${service}</b>?`, "var(--accent)", async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/service_control', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId, service, action }) });
|
const res = await fetch('/api/service_control', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId, service, action }) });
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if(!data.success) customAlert(t('titleError'), data.error, true);
|
if(!data.success) customAlert(t('titleError'), "Error: " + data.error, true);
|
||||||
} catch(e) { console.error(e); }
|
} catch(e) { console.error(e); }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -935,7 +956,7 @@
|
|||||||
|
|
||||||
function saveConfig() {
|
function saveConfig() {
|
||||||
const textValue = document.getElementById('config-textarea').value; const statusSpan = document.getElementById('editor-status');
|
const textValue = document.getElementById('config-textarea').value; const statusSpan = document.getElementById('editor-status');
|
||||||
customConfirm(t('titleSave'), `${t('confOvr')}${currentEditClient.toUpperCase()}?`, "var(--danger)", async () => {
|
customConfirm(t('titleSave'), `${t('confOvr')}<b>${currentEditClient.toUpperCase()}</b>?`, "var(--danger)", async () => {
|
||||||
statusSpan.innerText = "Sending..."; statusSpan.style.color = "var(--success)";
|
statusSpan.innerText = "Sending..."; statusSpan.style.color = "var(--success)";
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/config_file', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId: currentEditClient, service: currentEditService, config_data: { "raw_text": textValue } }) });
|
const res = await fetch('/api/config_file', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId: currentEditClient, service: currentEditService, config_data: { "raw_text": textValue } }) });
|
||||||
|
|||||||
Reference in New Issue
Block a user