From 910c5abfadd0f66c6d562fc55fd473dd5b77374a 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: Tue, 22 Sep 2026 00:53:55 +0300 Subject: [PATCH] ui: show the provider in the eSIM profile card title The card title showed only the nickname or profile name ('0002'); with the provider in front it reads 'Alfa 0002' and still prefers a user nickname ('Alfa Work') when one is set. - esimProfileTitle(): provider + (nickname || name), falling back to the ICCID and finally '?'. - tests for the helper; help EN/RU and sw.js simple-v234. --- frontend/help-ru.html | 2 +- frontend/help.html | 2 +- frontend/index.html | 10 +++++++++- frontend/sw.js | 2 +- frontend/tests/esim.test.js | 14 +++++++++++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/frontend/help-ru.html b/frontend/help-ru.html index 5b14eeb..b9d3243 100644 --- a/frontend/help-ru.html +++ b/frontend/help-ru.html @@ -498,7 +498,7 @@

Для eUICC (SGP.22/SGP.32) подвкладка «eSIM» читает чип и управляет установленными профилями через локальный интерфейс ES10 (через pySim, без обращения к SM-DP+):

Никаких загрузок профилей, обработки уведомлений и взаимодействия с SM-DP+ — используются только локальные функции ES10a/b/c. Если карта не eUICC, подвкладка сообщает об этом.

diff --git a/frontend/help.html b/frontend/help.html index 4c67929..bceb846 100644 --- a/frontend/help.html +++ b/frontend/help.html @@ -498,7 +498,7 @@

For an eUICC (SGP.22/SGP.32) the eSIM pill reads the chip and manages the installed profiles through the local ES10 interface (via pySim, no SM-DP+ contact):

No profile downloads, no notification handling and no SM-DP+ interaction — only the local ES10a/b/c functions are used. The card must be an eUICC; otherwise the pill says so.

diff --git a/frontend/index.html b/frontend/index.html index 20287c2..d49b445 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1732,6 +1732,14 @@ function esimRenderChip() { el.innerHTML = html; } +// Profile card title: the provider first (when known), then the nickname or +// the profile name; falls back to the ICCID. +function esimProfileTitle(p) { + const label = p.nickname || p.name; + const title = [p.provider, label].filter(Boolean).join(' '); + return title || p.iccid || '?'; +} + function esimRenderProfiles() { const el = document.getElementById('esim-profiles'); if (!el) return; @@ -1742,7 +1750,7 @@ function esimRenderProfiles() { let html = ''; for (const p of _esimProfiles) { const enabled = p.state === 'enabled'; - const title = p.nickname || p.name || p.iccid || '?'; + const title = esimProfileTitle(p); html += '
'; html += '
' + '' + (enabled ? '●' : '○') + '' + diff --git a/frontend/sw.js b/frontend/sw.js index ae902e2..ba1eef0 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -1,4 +1,4 @@ -const CACHE = 'simple-v233'; +const CACHE = 'simple-v234'; const URLS = [ 'index.html', 'help.html', diff --git a/frontend/tests/esim.test.js b/frontend/tests/esim.test.js index fcfee77..af9ecba 100644 --- a/frontend/tests/esim.test.js +++ b/frontend/tests/esim.test.js @@ -24,7 +24,8 @@ function extractFunc(src, name) { let code = ''; for (const fn of ['esimLabel', 'esimGroupEid', 'esimFieldRows', 'esimResultText', 'esimStateLabel', 'esimOperationsText', 'esimProfileRows', 'esimIconDataUrl', - 'esimChipSectionRows', 'esimChipValueWide', 'esimChipBox', 'esimSwitchStatus']) { + 'esimChipSectionRows', 'esimChipValueWide', 'esimChipBox', 'esimSwitchStatus', + 'esimProfileTitle']) { code += extractFunc(html, fn) + '\n'; } for (const c of ['ESIM_CHIP_LABELS', 'ESIM_RESULT_KEYS']) { @@ -148,6 +149,17 @@ test('esimIconDataUrl builds a data URL for png and jpg icons', () => { assert.strictEqual(esimIconDataUrl(null), ''); }); +test('esimProfileTitle puts the provider in front of the profile label', () => { + assert.strictEqual(esimProfileTitle({ provider: 'Alfa', name: '0002' }), 'Alfa 0002'); + assert.strictEqual(esimProfileTitle({ provider: 'Alfa', nickname: 'Work', name: '0002' }), + 'Alfa Work'); + assert.strictEqual(esimProfileTitle({ name: '0002' }), '0002'); + assert.strictEqual(esimProfileTitle({ provider: 'Alfa' }), 'Alfa'); + assert.strictEqual(esimProfileTitle({ iccid: '8970119000004002667' }), + '8970119000004002667'); + assert.strictEqual(esimProfileTitle({}), '?'); +}); + test('the profile card renders the icon image next to the rows', () => { const fn = extractFunc(html, 'esimRenderProfiles'); assert.match(fn, /esimIconDataUrl\(p\)/);