From 4598a70db2bfd7fd68bb8762f90a00405cd6b737 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A2=D1=80=D0=BE=D1=88?=
=?UTF-8?q?=D0=B8=D0=BD?=
Date: Sat, 12 Sep 2026 20:14:24 +0300
Subject: [PATCH] ui: edit/delete buttons for custom files
- each row now shows Edit and Delete buttons (same styling as the
profiler list buttons) instead of the red X glyph
- Edit reloads the entry into the top form: the Add button becomes
Save (data-l10n updated too) and a Cancel button appears; submit
updates the entry in place, recomputing fid/parentFid and excluding
the edited row from the duplicate-path check
- Delete removes without confirmation; deleting the row being edited
cancels the edit and an earlier deletion shifts the edit index
- pysimCustomAdd renamed to pysimCustomSubmit; tests for the whole
flow; SW cache v114 -> v115.
---
README.md | 3 +-
README_RUS.md | 3 +-
frontend/help-ru.html | 2 +-
frontend/help.html | 2 +-
frontend/index.html | 55 ++++++++--
frontend/sw.js | 2 +-
frontend/tests/custom_files.test.js | 165 ++++++++++++++++++++++++++++
frontend/tests/html.test.js | 7 ++
8 files changed, 225 insertions(+), 14 deletions(-)
create mode 100644 frontend/tests/custom_files.test.js
diff --git a/README.md b/README.md
index 61b6694..be133e0 100644
--- a/README.md
+++ b/README.md
@@ -538,7 +538,8 @@ Files not in pysim's model can be added manually:
1. Switch to the **Custom files** tab in the Profiler list
2. Enter the file path (e.g., `3F00/6F46`) and an alias (e.g., `EF.SPN`)
3. Click **Add** — the file appears in the tree in italics (unverified)
-4. Click the file to verify existence — on success, it behaves like a model file
+4. Use **Edit** on a row to reload it into the form (the button becomes **Save** and a **Cancel** button appears) or **Delete** to remove it
+5. Click the file to verify existence — on success, it behaves like a model file
Custom files persist in `localStorage` across sessions. Export/import as JSON for sharing.
diff --git a/README_RUS.md b/README_RUS.md
index c2f2447..7dcf4f0 100644
--- a/README_RUS.md
+++ b/README_RUS.md
@@ -512,7 +512,8 @@ Delivery PoR (SPI2 `01`) проще — карта возвращает PoR на
1. Перейдите на вкладку **Custom files** в списке профайлера
2. Введите путь (например, `3F00/6F46`) и псевдоним (например, `EF.SPN`)
3. Нажмите **Add** — файл появится в дереве курсивом (непроверенный)
-4. Кликните для проверки существования — при успехе работает как обычный файл
+4. Кнопка **Edit** загружает запись в форму (кнопка становится **Save**, появляется **Cancel**), **Delete** удаляет запись без подтверждения
+5. Кликните для проверки существования — при успехе работает как обычный файл
Пользовательские файлы сохраняются в `localStorage`. Экспорт/импорт в JSON для обмена.
diff --git a/frontend/help-ru.html b/frontend/help-ru.html
index 09997f9..d2ca5b9 100644
--- a/frontend/help-ru.html
+++ b/frontend/help-ru.html
@@ -405,7 +405,7 @@
Пользовательские файлы
-
Добавление файлов, не покрытых моделью pySim: введите полный путь (например, 3F00/7F20/6F46) и псевдоним (например, EF.SPN), затем нажмите Добавить; добавленные файлы появляются в дереве «Файловый менеджер». Список сохраняется в localStorage; обмен — Экспорт в JSON / Экспорт в файл и Импорт из файла / Вставить и импортировать / Импорт JSON из буфера.
+
Добавление файлов, не покрытых моделью pySim: введите полный путь (например, 3F00/7F20/6F46) и псевдоним (например, EF.SPN), затем нажмите Добавить; добавленные файлы появляются в дереве «Файловый менеджер». В каждой строке есть кнопки «Редактировать» (загружает запись в форму — кнопка становится «Сохранить», появляется «Отмена») и «Удалить» (без подтверждения). Список сохраняется в localStorage; обмен — Экспорт в JSON / Экспорт в файл и Импорт из файла / Вставить и импортировать / Импорт JSON из буфера.
Add files that pySim’s model does not cover: enter the full path (e.g. 3F00/7F20/6F46) and an alias (e.g. EF.SPN), then press Add; added files appear in the File manager tree. The list persists in localStorage and can be shared with Export as JSON / Export to file and restored with Import from file / Paste & import / Import JSON from clipboard.
+
Add files that pySim’s model does not cover: enter the full path (e.g. 3F00/7F20/6F46) and an alias (e.g. EF.SPN), then press Add; added files appear in the File manager tree. Each row has Edit (reloads the entry into the form — the button becomes Save and a Cancel button appears) and Delete (no confirmation) buttons. The list persists in localStorage and can be shared with Export as JSON / Export to file and restored with Import from file / Paste & import / Import JSON from clipboard.