-
File:
@@ -6125,6 +6124,8 @@ async function pysimFsToggleDir(name) {
if (node.expanded) pysimRefresh();
}
+let pysimFsSelected = null;
+
function pysimFsInfoHtml(sel) {
if (!sel) return '';
const num = v => (v === null || v === undefined) ? null : String(v);
@@ -6153,10 +6154,7 @@ async function pysimFsClickFile(name) {
if (!exists) node.children = [];
pysimFsRenderTree();
}
- const ft = exists ? sel.file_type : null;
- const label = ({ transparent: 'TR', linear_fixed: 'LF', cyclic: 'CY', ber_tlv: 'BT', df: 'DF' })[ft] || '';
- const prefix = exists ? '' : '✗ ';
- document.getElementById('pysim-fs-filename').textContent = prefix + name + (label ? ' [' + label + ']' : '');
+ pysimFsSelected = name;
document.getElementById('pysim-fs-info').innerHTML = exists ? pysimFsInfoHtml(sel) : '';
document.getElementById('pysim-fs-content').innerHTML = '';
document.getElementById('pysim-fs-status').textContent = exists ? '' : '✗ File not found on card';
@@ -6169,7 +6167,7 @@ async function pysimFsClickFile(name) {
}
async function pysimFsRead() {
- const rawName = document.getElementById('pysim-fs-filename').textContent.replace(/ \[.*?\]$/, '').replace(/^✗ /, '');
+ const rawName = pysimFsSelected;
const out = document.getElementById('pysim-fs-content');
const statusEl = document.getElementById('pysim-fs-status');
out.innerHTML = '';
@@ -6204,18 +6202,6 @@ async function pysimFsRead() {
}
}
-async function pysimFsSelect() {
- const name = document.getElementById('pysim-fs-filename').textContent;
- const node = pysimFsFindNode(name, pysimFsTreeRoot);
- if (node && node.fid) {
- await pysimFetch('/api/command', { cmd: 'select ' + node.fid });
- } else {
- await pysimFetch('/api/command', { cmd: 'select ' + name });
- }
- pysimFsRefresh();
- pysimRefresh();
-}
-
let pysimFsEditMode = false;
let pysimFsEditData = null;
@@ -6249,7 +6235,7 @@ function pysimFsCancel() {
}
async function pysimFsSave() {
- const rawName = document.getElementById('pysim-fs-filename').textContent.replace(/ \[.*?\]$/, '').replace(/^✗ /, '');
+ const rawName = pysimFsSelected;
const statusEl = document.getElementById('pysim-fs-status');
const out = document.getElementById('pysim-fs-content');
const node = pysimFsFindNode(rawName, pysimFsTreeRoot);
@@ -9220,7 +9206,6 @@ const LANG_RU = {
'Execute': 'Выполнить',
'Send': 'Отправить',
'Custom files are added in file manager tree and included in card scan.': 'Пользовательские файлы добавляются в менеджер файлов и учитываются при чтении карт.',
- 'File:': 'Файл:',
'Cancel': 'Отмена',
'Timeout': 'Таймаут',
'OK': 'OK',
diff --git a/frontend/sw.js b/frontend/sw.js
index 281686d..82cc430 100644
--- a/frontend/sw.js
+++ b/frontend/sw.js
@@ -1,4 +1,4 @@
-const CACHE = 'otaman-v121';
+const CACHE = 'otaman-v122';
const URLS = [
'index.html',
'help.html',
diff --git a/frontend/tests/html.test.js b/frontend/tests/html.test.js
index 0b75f81..2b0e17c 100644
--- a/frontend/tests/html.test.js
+++ b/frontend/tests/html.test.js
@@ -69,11 +69,15 @@ test('file manager has a probe-all-files button and status line', () => {
assert.ok(html.includes('id="pysim-fs-probe-status"'));
});
-test('file manager shows decoded FCI info under the file name', () => {
- const name = html.indexOf('id="pysim-fs-filename"');
+test('file manager shows FCI info and keeps the selection in state, not the DOM', () => {
+ const detail = html.indexOf('id="pysim-fs-detail"');
const info = html.indexOf('id="pysim-fs-info"');
const content = html.indexOf('id="pysim-fs-content"');
- assert.ok(name !== -1 && info > name && info < content, 'pysim-fs-info must sit between filename and content');
+ assert.ok(detail !== -1 && info > detail && info < content, 'pysim-fs-info must sit above the content');
assert.ok(html.includes('function pysimFsInfoHtml'));
assert.ok(html.includes("pysimFsInfoHtml(sel)"));
+ assert.ok(!html.includes('pysim-fs-filename'));
+ assert.ok(html.includes('let pysimFsSelected = null;'));
+ assert.ok(html.includes('pysimFsSelected = name;'));
+ assert.ok(!html.includes('pysimFsSelect()'));
});