feat: table-align the explorer action buttons, Install green (v3.6.29)
The explorer buttons sat inline after each AID/detail line, so their columns moved with the text length. Now every entry (app / ELF) and every module line is a row with a fixed-width action column (w-28): - left cell: the text (module rows are siblings of their ELF entry, indented pl-6, so their buttons share the same column as the entry buttons); - right cell: the buttons, full width of the column, so Delete / Delete All / Make selectable / Install line up vertically across rows. All buttons go through ramActionBtn(label, action, tone): Danger (red) for Delete / Delete All, Ok (emerald) for Make selectable and the **Install** buttons, which were blue. Test pins the column width and the Install tone. 660 frontend / 504 Python green; version 3.6.29; sw simple-v302.
This commit is contained in:
@@ -25,7 +25,7 @@ function extractFunc(src, name) {
|
||||
const FNS = ['berLenStr', 'buildApdu', 'escHtml', 'esc', 'chainInit', 'chainRamBuildRowHex', 'ramFmtLifecycle', 'ramFmtPrivileges', 'ramRenderExploreHtml', 'ramStepLine', 'ramGetStatusApdu', 'ramDeleteApdu',
|
||||
'stkParamsBuild', 'ramRemoteSwOk', 'spPorAccepted', 'ramIncrementCntr', 'ramDeleteFromExplorer', 'ramListingSpi2', 'ramRemoveFromExplorer', 'ramHasInstance', 'ramExpandedQueryApdu',
|
||||
'_parseRawElfEntry', '_parseRawAppEntry', 'ramParseElfStatus', 'ramParseAppStatus', 'parseTLV', '_parseE3Entry',
|
||||
'ramCardIdxAfterRemove', 'ramClearResults', 'ramHideProgress', 'ramOpChanged', 'ramRender', 'ramApplyCard', 'ramExecute', 'decodePrivileges',
|
||||
'ramCardIdxAfterRemove', 'ramClearResults', 'ramHideProgress', 'ramOpChanged', 'ramRender', 'ramApplyCard', 'ramExecute', 'decodePrivileges', 'ramActionBtn',
|
||||
'jcAidNorm', 'jcAidName', 'jcAidSuffix', 'jcAidHtml'];
|
||||
let code = '';
|
||||
for (const f of FNS) {
|
||||
@@ -192,6 +192,27 @@ test('ramRenderExploreHtml puts the command format after the resource lines', ()
|
||||
assert.ok(iNv >= 0 && iV >= 0 && iFmt > iV, out);
|
||||
});
|
||||
|
||||
test('explorer action buttons share a fixed-width column, Install is green', () => {
|
||||
global.t = s => s;
|
||||
const out = ramRenderExploreHtml(
|
||||
{ appCount: 1, freeNV: 10, freeV: 5 },
|
||||
[],
|
||||
[{ aid: 'A000000151000000', lifecycle: '03', privileges: '' }],
|
||||
[{ aid: 'ELF1', lifecycle: '01', version: '1.0', moduleAids: ['M1'] }]
|
||||
);
|
||||
delete global.t;
|
||||
// every action cell is the same fixed-width column
|
||||
assert.ok(out.includes('w-28 shrink-0'), out);
|
||||
// the Install button (module without an instance) is green, not blue
|
||||
const inst = /<button onclick="ramInstallFromExplorer[^>]*class="([^"]*)"/.exec(out);
|
||||
assert.ok(inst, out);
|
||||
assert.ok(inst[1].includes('bg-emerald-100'), inst[1]);
|
||||
assert.ok(!inst[1].includes('bg-blue-'), inst[1]);
|
||||
// the delete buttons keep the danger tone
|
||||
const del = /<button onclick="ramDeleteFromExplorer[^>]*class="([^"]*)"/.exec(out);
|
||||
assert.ok(del && del[1].includes('bg-red-100'), del && del[1]);
|
||||
});
|
||||
|
||||
test('ramRenderExploreHtml localizes every label and button', () => {
|
||||
const seen = [];
|
||||
global.t = s => { seen.push(s); return 'XX' + s; };
|
||||
|
||||
Reference in New Issue
Block a user