diff --git a/server/static/index.html b/server/static/index.html
index 42ddda8..62dcb22 100644
--- a/server/static/index.html
+++ b/server/static/index.html
@@ -220,6 +220,7 @@
—
+ Черновик — значения с устройства не подставляются
@@ -349,6 +350,9 @@
let mapInitialFitDone = false;
let userMovedMap = false;
let programmaticMove = false;
+ let cmdFormDirty = false;
+
+ const CMD_INPUT_IDS = ['cmdFq', 'cmdPw', 'cmdSf', 'cmdPl', 'cmdBw', 'cmdCr', 'cmdTm', 'cmdRole'];
let trackTxLayer = null;
let trackRxLayer = null;
@@ -531,15 +535,40 @@
);
}
- function fillCmdFormFromDevice(d) {
+ function setCmdFormDirty(dirty) {
+ cmdFormDirty = dirty;
+ const hint = document.getElementById('cmdDraftHint');
+ if (hint) hint.style.display = dirty ? 'block' : 'none';
+ }
+
+ function setupCmdFormDirtyTracking() {
+ const panel = document.getElementById('controlPanel');
+ if (!panel) return;
+ const markDirty = () => setCmdFormDirty(true);
+ CMD_INPUT_IDS.forEach(id => {
+ const el = document.getElementById(id);
+ if (!el) return;
+ el.addEventListener('input', markDirty);
+ el.addEventListener('change', markDirty);
+ });
+ }
+
+ function refreshCmdDeviceStatus(d) {
if (!d) return;
const snap = RadioUI.parseRadioSnapshot(d.meta, d.role, d.rssi);
- document.getElementById('cmdCurrentValues').innerHTML =
+ setPanelHtml(
+ document.getElementById('cmdCurrentValues'),
RadioUI.formatRadioPanel(
snap,
new Set(),
isRadioStaticOpen(document.getElementById('cmdCurrentValues'))
- );
+ )
+ );
+ }
+
+ function fillCmdInputsFromDevice(d) {
+ if (!d) return;
+ const snap = RadioUI.parseRadioSnapshot(d.meta, d.role, d.rssi);
if (snap.frequencyMhz != null) {
document.getElementById('cmdFq').value = snap.frequencyMhz.toFixed(3);
}
@@ -549,6 +578,14 @@
if (snap.role) document.getElementById('cmdRole').value = snap.role;
}
+ function fillCmdFormFromDevice(d, opts = {}) {
+ if (!d) return;
+ const force = opts.force === true;
+ refreshCmdDeviceStatus(d);
+ if (!force && cmdFormDirty) return;
+ fillCmdInputsFromDevice(d);
+ }
+
function buildMacroLines() {
const lines = ['S'];
const fq = document.getElementById('cmdFq').value.trim();
@@ -2065,6 +2102,7 @@
document.getElementById('btnCmdApply').onclick = () => {
const lines = buildMacroLines();
postCommand(document.getElementById('cmdTargetSelect').value, 'at', { lines });
+ setCmdFormDirty(false);
};
document.getElementById('btnMapTx').onclick = () => centerMapOnRole('TX');
document.getElementById('btnMapRx').onclick = () => centerMapOnRole('RX');
@@ -2281,12 +2319,14 @@
document.getElementById('cmdTargetSelect').onchange = () => {
const id = document.getElementById('cmdTargetSelect').value;
const d = lastDevices.find(x => x.device_id === id);
- if (d) fillCmdFormFromDevice(d);
+ setCmdFormDirty(false);
+ if (d) fillCmdFormFromDevice(d, { force: true });
};
function selectDevice(d) {
selectedId = d.device_id;
- fillCmdFormFromDevice(d);
+ setCmdFormDirty(false);
+ fillCmdFormFromDevice(d, { force: true });
document.querySelectorAll('#deviceList li').forEach(li => {
li.classList.toggle('active', li.textContent.startsWith(d.device_id));
});
@@ -2452,6 +2492,7 @@
});
schedulePoll();
+ setupCmdFormDirtyTracking();
loadAllTracks();
refreshPairedStatus();