From 637ae5ce87f27493c0d76725bb4d1d017374e619 Mon Sep 17 00:00:00 2001 From: AlexsandrSnytkin Date: Fri, 18 Sep 2026 15:35:18 +0700 Subject: [PATCH] fix(ui): separate permanent and recoverable deletion --- tests/test_ui_server.py | 1 + ui_server.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/test_ui_server.py b/tests/test_ui_server.py index 8158d67..488d64d 100644 --- a/tests/test_ui_server.py +++ b/tests/test_ui_server.py @@ -82,6 +82,7 @@ class UIServerTests(unittest.TestCase): self.assertIn('focusConfigBlock', HTML) self.assertIn('startConfigBlockDrag', HTML) self.assertIn('configDragBlocked', HTML) + self.assertIn('removeConfigBlockForever', HTML) self.assertIn('positionNewConfigBlock', HTML) self.assertIn('finishConfigDrag', HTML) self.assertIn('fpv-config-layout-v1', HTML) diff --git a/ui_server.py b/ui_server.py index 36e6f5e..23e7d08 100644 --- a/ui_server.py +++ b/ui_server.py @@ -2081,10 +2081,11 @@ HTML = """ if (block.dataset.custom === 'true' && !state && !deleted) { const remove = document.createElement('button'); remove.type = 'button'; - remove.textContent = 'удалить'; + remove.textContent = 'удалить навсегда'; + remove.title = 'Удалить блок без возможности восстановления'; remove.addEventListener('click', event => { event.stopPropagation(); - setConfigBlockState(block, 'deleted'); + removeConfigBlockForever(block); }); actions.appendChild(remove); } @@ -2123,6 +2124,17 @@ HTML = """ setText('configLayoutState', `${visible} блоков · ${hidden.length} скрыто · ${deleted.length} в корзине`); if (configCanvas) applyStoredConfigLayout(); } + function removeConfigBlockForever(block) { + if (!block || block.dataset.custom !== 'true') return; + if (block.contains(document.activeElement)) document.activeElement.blur(); + const key = block.dataset.section; + block.remove(); + configBlocks = configBlocks.filter(item => item !== block); + if (key) delete configLayout[key]; + saveConfigLayout(); + renderConfigRestorePanel(); + setText('configLayoutState', 'блок удалён навсегда'); + } function nextCustomConfigKey() { let index = 1; while (configBlocks.some(block => block.dataset.section === `custom-${index}`)) index += 1;