Moved buttons to wifi.html
modified: data/www/index.html modified: data/www/wifi.html
This commit is contained in:
@@ -34,9 +34,7 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
.danger-zone {
|
.danger-zone {
|
||||||
margin-top: auto;
|
display: none; /* Hide the danger zone since it's no longer needed */
|
||||||
padding: 20px;
|
|
||||||
border-top: 1px solid #34495e;
|
|
||||||
}
|
}
|
||||||
.danger-btn {
|
.danger-btn {
|
||||||
background: #e74c3c;
|
background: #e74c3c;
|
||||||
@@ -59,11 +57,6 @@
|
|||||||
<div class="menu-item" data-page="wifi">WiFi Settings</div>
|
<div class="menu-item" data-page="wifi">WiFi Settings</div>
|
||||||
<div class="menu-item" data-page="midi">MIDI Config</div>
|
<div class="menu-item" data-page="midi">MIDI Config</div>
|
||||||
<div class="menu-item" data-page="system">System</div>
|
<div class="menu-item" data-page="system">System</div>
|
||||||
|
|
||||||
<div class="danger-zone">
|
|
||||||
<h4>Danger Zone</h4>
|
|
||||||
<button class="danger-btn" onclick="factoryReset()">Factory Reset</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="content" id="mainContent">
|
<div class="content" id="mainContent">
|
||||||
<iframe id="contentFrame" style="width:100%;height:100%;border:none;"></iframe>
|
<iframe id="contentFrame" style="width:100%;height:100%;border:none;"></iframe>
|
||||||
@@ -86,15 +79,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function factoryReset() {
|
|
||||||
if(confirm('Are you sure you want to perform a factory reset? This will erase all settings.')) {
|
|
||||||
fetch('/api/system/factory-reset', { method: 'POST' })
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => alert(data.message))
|
|
||||||
.catch(error => alert('Error: ' + error));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load dashboard by default
|
// Load dashboard by default
|
||||||
document.getElementById('contentFrame').src = pages.dashboard;
|
document.getElementById('contentFrame').src = pages.dashboard;
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -34,11 +34,17 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 5px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
.danger-btn:hover {
|
.danger-btn:hover {
|
||||||
background: #c0392b;
|
background: #c0392b;
|
||||||
}
|
}
|
||||||
|
.danger-section {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.danger-section h4 {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -50,9 +56,15 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="danger-zone">
|
<div class="danger-zone">
|
||||||
<h4>WiFi Controls</h4>
|
<div class="danger-section">
|
||||||
<button class="danger-btn" onclick="resetWiFi()">Reset WiFi Settings</button>
|
<h4>WiFi Controls</h4>
|
||||||
<button class="danger-btn" onclick="forgetNetwork()">Forget Current Network</button>
|
<button class="danger-btn" onclick="resetWiFi()">Reset WiFi Settings</button>
|
||||||
|
<button class="danger-btn" onclick="forgetNetwork()">Forget Current Network</button>
|
||||||
|
</div>
|
||||||
|
<div class="danger-section">
|
||||||
|
<h4>System Controls</h4>
|
||||||
|
<button class="danger-btn" onclick="factoryReset()">Factory Reset</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
@@ -102,6 +114,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function factoryReset() {
|
||||||
|
if(confirm('Are you sure you want to perform a factory reset? This will erase ALL settings and restart the device.')) {
|
||||||
|
// Using GET method to avoid HTTP method redefinition issues with WiFiManager
|
||||||
|
fetch('/api/system/factory-reset')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
alert(data.message || 'Factory reset initiated. Device will restart.');
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = '/';
|
||||||
|
}, 3000);
|
||||||
|
})
|
||||||
|
.catch(error => alert('Error: ' + error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update status every 5 seconds
|
// Update status every 5 seconds
|
||||||
updateWiFiStatus();
|
updateWiFiStatus();
|
||||||
setInterval(updateWiFiStatus, 5000);
|
setInterval(updateWiFiStatus, 5000);
|
||||||
|
|||||||
Reference in New Issue
Block a user