refactor: remove rules endpoint and related logic

- Deleted the rules routes and associated logic from the API.
- Removed rules-related functionality from params.sensor.js.
- Updated dashboard and rulesets HTML to remove references to rulesets.
- Removed force update button and related functionality from rulesets page.
- Cleaned up styles related to the force update button.
- Removed unused WebSocket client example.
- Updated realtime server to eliminate rules pushing logic.
- Refactored WebSocket handler to streamline data processing.
This commit is contained in:
Giuseppe Raffa
2026-04-16 14:27:27 +02:00
parent edd7226966
commit 5912c00a82
11 changed files with 32 additions and 1097 deletions

View File

@@ -31,12 +31,12 @@
</div>
</a>
<a class="card" href="/rulesets" title="Rulesets">
<!-- <a class="card" href="/rulesets" title="Rulesets">
<div>
<h3>Rulesets</h3>
<p>Gestisci i template di configurazione per weather, data e logs.</p>
</div>
</a>
</a> -->
<a class="card" href="/forecasts" title="Previsioni">
<div>

View File

@@ -40,7 +40,6 @@
</select>
</div>
<div class="rs-toolbar-right">
<button class="rs-force-btn" id="forceUpdateBtn">Forza Update Sensori</button>
<button class="rs-new-btn" id="newRuleBtn">+ Nuova Rule</button>
</div>
</div>
@@ -591,30 +590,6 @@ function flash(text, elId = 'savingIndicator') {
setTimeout(() => el.classList.remove('visible'), 1500);
}
// ========== Force Update ==========
document.getElementById('forceUpdateBtn').onclick = async () => {
const btn = document.getElementById('forceUpdateBtn');
btn.disabled = true;
btn.textContent = 'Invio in corso...';
try {
const res = await api('POST', '/rules/force-update');
btn.textContent = `Inviato a ${res.sensors || 0} sensori`;
flash('Update inviato');
setTimeout(() => {
btn.textContent = 'Forza Update Sensori';
btn.disabled = false;
}, 3000);
} catch (err) {
console.error('Error force-updating:', err);
btn.textContent = 'Errore!';
setTimeout(() => {
btn.textContent = 'Forza Update Sensori';
btn.disabled = false;
}, 3000);
}
};
// ========== Init ==========
document.addEventListener('DOMContentLoaded', () => loadRules());

View File

@@ -135,33 +135,6 @@
background-position: right 10px center;
}
/* Force Update button */
.rs-force-btn {
padding: 8px 20px;
border: 1px solid #f59e0b;
border-radius: 10px;
background: #fffbeb;
color: #b45309;
font-size: 0.85rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
font-family: inherit;
}
.rs-force-btn:hover:not(:disabled) {
background: #fef3c7;
border-color: #d97706;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}
.rs-force-btn:disabled {
opacity: 0.7;
cursor: not-allowed;
transform: none;
}
.rs-new-btn {
padding: 8px 20px;
border: none;