ui: show SELECT picker paths from the root instead of "fid — parent"
The picker option label read backwards, e.g. "EF.IMSI — 6F07 — 7F20". It now shows the path within the optgroup's root with the FIDs in order, matching the path-field convention: "EF.IMSI — 7F20/6F07", "EF.ICCID — 2FE2", "EF.PSC — 5F3A/4F22" (ADF session). Switch markers and the filter (which also matches the symbolic path) are unchanged. sw cache -> simple-v243; version stays 3.4.0.
This commit is contained in:
+4
-2
@@ -3462,9 +3462,11 @@ function rfmFileOptionsHtml(chainId, idx, list) {
|
||||
for (const [root, items] of groups) {
|
||||
html += '<optgroup label="' + escHtml(root) + '">';
|
||||
for (const it of items) {
|
||||
const parent = rfmParentPath(it.e.sym || it.e.path).replace(/^[^/]+\//, '');
|
||||
// Path within the root, FIDs in order (the optgroup carries the
|
||||
// root) - the same convention as the path field, with slashes.
|
||||
const inRoot = it.e.path.slice(it.e.root.length + 1);
|
||||
html += '<option value="' + escHtml(it.e.path) + '">' +
|
||||
escHtml(it.e.name + ' — ' + (it.e.fid || it.e.aid || '') + (parent ? ' — ' + parent : '') +
|
||||
escHtml(it.e.name + ' — ' + inRoot +
|
||||
(it.fill && it.fill.switched ? ' → ' + it.fill.method : '')) +
|
||||
'</option>';
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const CACHE = 'simple-v242';
|
||||
const CACHE = 'simple-v243';
|
||||
const URLS = [
|
||||
'index.html',
|
||||
'help.html',
|
||||
|
||||
@@ -194,6 +194,23 @@ test('rfmFileEntries merges card tree, custom files and the standard list', () =
|
||||
pysimCustomFiles = [];
|
||||
});
|
||||
|
||||
test('rfmFileOptionsHtml labels files with their path within the root', () => {
|
||||
const list = rfmFileEntries();
|
||||
setChain('chain-usim', [row('select', { method: 'fid' })]);
|
||||
const opts = rfmFileOptionsHtml('chain-usim', 0, list);
|
||||
// ADF.USIM session: EF.IMSI is a direct child of the root.
|
||||
assert.ok(opts.includes('>EF.IMSI — 6F07<'), opts.match(/>EF\.IMSI[^<]*</)[0]);
|
||||
// The root is the optgroup, the path is relative to it (FIDs in order).
|
||||
assert.ok(opts.includes('<optgroup label="ADF.USIM">'));
|
||||
assert.ok(!opts.includes('6F07 — '), 'no reversed "fid — parent" label');
|
||||
// Deep file under a DF: the label reads like the path field.
|
||||
rfmSetStartDf('chain-usim', 'MF');
|
||||
setChain('chain-sim', [row('select', { method: 'path', path: '7F10' })]);
|
||||
const deep = rfmFileOptionsHtml('chain-sim', 1, list);
|
||||
assert.ok(deep.includes('>EF.MSISDN — 7F10/6F40<'), deep.match(/>EF\.MSISDN[^<]*</)[0]);
|
||||
rfmSetStartDf('chain-usim', 'ADF.USIM');
|
||||
});
|
||||
|
||||
test('rfmFileOptionsHtml groups by root and marks method switches', () => {
|
||||
const list = rfmFileEntries();
|
||||
setChain('chain-sim', [row('select', { method: 'fid' })]);
|
||||
|
||||
Reference in New Issue
Block a user