v3.30.1: the batch status modal cosmetics
The v3.30.0 review follow-up, both items cosmetic: - The modal's title follows the run's kind, but a cleared report carries kind: null, so Clear flipped a delete/reinstall run to the install title. The last seen kind is remembered (_ramBatchLastKind, set in ramBatchRender) and the title falls back to it through the new ramBatchModalTitle() helper. - The two batch-state RU strings stopped being install-specific: 'Batch stopped'/'Batch finished' are now «Пакетная операция остановлена/завершена» (the v3.29.0 kinds can delete or reinstall), matching the help's own «Пакетная операция» wording. Test: the cleared title keeps the kind and a fresh page keeps the install default. 930 frontend + 945 Python; sw cache simple-v451.
This commit is contained in:
+19
-7
@@ -1932,7 +1932,7 @@
|
|||||||
// ===== Version =====
|
// ===== Version =====
|
||||||
// Single source of truth for the PWA version: shown in the header and used
|
// Single source of truth for the PWA version: shown in the header and used
|
||||||
// by the server version check in pysimConnect().
|
// by the server version check in pysimConnect().
|
||||||
const SIMPLE_VERSION = '3.30.0';
|
const SIMPLE_VERSION = '3.30.1';
|
||||||
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
|
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
|
||||||
|
|
||||||
// ===== view history (the browser Back/Forward buttons) =====
|
// ===== view history (the browser Back/Forward buttons) =====
|
||||||
@@ -10191,6 +10191,9 @@ let _ramBatchFetchAt = 0; // when the in-flight fetch started (the watchd
|
|||||||
let _ramBatchSummary = null; // /api/status.ram_batch
|
let _ramBatchSummary = null; // /api/status.ram_batch
|
||||||
let _ramBatchProgress = null; // /api/status.ram_progress
|
let _ramBatchProgress = null; // /api/status.ram_progress
|
||||||
let _ramBatchModalShown = false; // the batch status modal is open (v3.30.0)
|
let _ramBatchModalShown = false; // the batch status modal is open (v3.30.0)
|
||||||
|
let _ramBatchLastKind = null; // the last seen run kind: a cleared report
|
||||||
|
// (kind: null) keeps the modal's title right
|
||||||
|
// (v3.30.1)
|
||||||
// A fetch that never settled must not block the report forever (v3.28.7).
|
// A fetch that never settled must not block the report forever (v3.28.7).
|
||||||
const RAM_BATCH_FETCH_STALE_MS = 10000;
|
const RAM_BATCH_FETCH_STALE_MS = 10000;
|
||||||
|
|
||||||
@@ -10213,6 +10216,13 @@ function ramBatchTitle(kind) {
|
|||||||
: t('Batch install (.cap file, per card)'));
|
: t('Batch install (.cap file, per card)'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The modal's title: the run's kind, falling back to the last one seen - a
|
||||||
|
// cleared report carries kind: null, and a delete/reinstall run must not flip
|
||||||
|
// to the install title (v3.30.1).
|
||||||
|
function ramBatchModalTitle(kind) {
|
||||||
|
return ramBatchTitle(kind || _ramBatchLastKind || 'install-cap');
|
||||||
|
}
|
||||||
|
|
||||||
// ===== the batch status modal (v3.30.0) =====
|
// ===== the batch status modal (v3.30.0) =====
|
||||||
// The same chrome as the single-operation modal, owned by the batch: the live
|
// The same chrome as the single-operation modal, owned by the batch: the live
|
||||||
// status on top (the current step or the waiting prompt) and the processed
|
// status on top (the current step or the waiting prompt) and the processed
|
||||||
@@ -10224,7 +10234,7 @@ function ramBatchModalOpen() {
|
|||||||
if (!modal) return; // no modal in the document (tests)
|
if (!modal) return; // no modal in the document (tests)
|
||||||
_ramBatchModalShown = true;
|
_ramBatchModalShown = true;
|
||||||
document.getElementById('ram-op-title').textContent =
|
document.getElementById('ram-op-title').textContent =
|
||||||
ramBatchTitle(ramBatchMergedState().kind || 'install-cap');
|
ramBatchModalTitle(ramBatchMergedState().kind);
|
||||||
document.getElementById('ram-op-status').textContent = t('Working...');
|
document.getElementById('ram-op-status').textContent = t('Working...');
|
||||||
document.getElementById('ram-op-status').className = 'text-sm text-gray-600 dark:text-slate-400';
|
document.getElementById('ram-op-status').className = 'text-sm text-gray-600 dark:text-slate-400';
|
||||||
document.getElementById('ram-op-bar').style.width = '0%';
|
document.getElementById('ram-op-bar').style.width = '0%';
|
||||||
@@ -10245,7 +10255,7 @@ function ramBatchModalRender(st, okLabel, actLabel) {
|
|||||||
const statusEl = document.getElementById('ram-op-status');
|
const statusEl = document.getElementById('ram-op-status');
|
||||||
if (!statusEl) return;
|
if (!statusEl) return;
|
||||||
document.getElementById('ram-op-title').textContent =
|
document.getElementById('ram-op-title').textContent =
|
||||||
ramBatchTitle(st.kind || 'install-cap');
|
ramBatchModalTitle(st.kind);
|
||||||
const active = !!st.active;
|
const active = !!st.active;
|
||||||
const phase = st.phase || (active ? 'waiting_card' : 'idle');
|
const phase = st.phase || (active ? 'waiting_card' : 'idle');
|
||||||
let status;
|
let status;
|
||||||
@@ -10340,8 +10350,10 @@ function ramBatchRender() {
|
|||||||
const active = !!st.active;
|
const active = !!st.active;
|
||||||
const phase = st.phase || (active ? 'waiting_card' : 'idle');
|
const phase = st.phase || (active ? 'waiting_card' : 'idle');
|
||||||
// The success labels follow the operation (v3.29.0): the counts bucket is
|
// The success labels follow the operation (v3.29.0): the counts bucket is
|
||||||
// 'installed' for every kind - "the operation succeeded".
|
// 'installed' for every kind - "the operation succeeded". The last seen
|
||||||
const kind = st.kind || 'install-cap';
|
// kind is remembered for the modal's title (v3.30.1).
|
||||||
|
if (st.kind) _ramBatchLastKind = st.kind;
|
||||||
|
const kind = st.kind || _ramBatchLastKind || 'install-cap';
|
||||||
const okLabel = kind === 'delete' ? t('Deleted')
|
const okLabel = kind === 'delete' ? t('Deleted')
|
||||||
: (kind === 'reinstall-app' ? t('Reinstalled') : t('Installed'));
|
: (kind === 'reinstall-app' ? t('Reinstalled') : t('Installed'));
|
||||||
const actLabel = kind === 'delete' ? t('Deleting...')
|
const actLabel = kind === 'delete' ? t('Deleting...')
|
||||||
@@ -24671,8 +24683,8 @@ const LANG_RU = {
|
|||||||
'not found': 'не найдено',
|
'not found': 'не найдено',
|
||||||
'Start batch': 'Запустить пакетную установку',
|
'Start batch': 'Запустить пакетную установку',
|
||||||
'Stopping...': 'Остановка…',
|
'Stopping...': 'Остановка…',
|
||||||
'Batch stopped': 'Пакетная установка остановлена',
|
'Batch stopped': 'Пакетная операция остановлена',
|
||||||
'Batch finished': 'Пакетная установка завершена',
|
'Batch finished': 'Пакетная операция завершена',
|
||||||
'Installing...': 'Установка…',
|
'Installing...': 'Установка…',
|
||||||
'Deleting...': 'Удаление…',
|
'Deleting...': 'Удаление…',
|
||||||
'Reinstalling...': 'Переустановка…',
|
'Reinstalling...': 'Переустановка…',
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
const CACHE = 'simple-v450';
|
const CACHE = 'simple-v451';
|
||||||
const URLS = [
|
const URLS = [
|
||||||
'index.html',
|
'index.html',
|
||||||
'help.html',
|
'help.html',
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ function extractFunc(src, name, asyncFn) {
|
|||||||
const ASYNC_FNS = ['ramBatchFetch', 'ramBatchStart', 'ramBatchStop', 'ramBatchClear'];
|
const ASYNC_FNS = ['ramBatchFetch', 'ramBatchStart', 'ramBatchStop', 'ramBatchClear'];
|
||||||
let code = '';
|
let code = '';
|
||||||
for (const fn of ['ramIsBatchOp', 'ramBatchPanelVisible', 'ramBatchMergedState',
|
for (const fn of ['ramIsBatchOp', 'ramBatchPanelVisible', 'ramBatchMergedState',
|
||||||
'ramBatchTitle', 'ramBatchModalOpen', 'ramBatchModalRender', 'ramBatchStepsText',
|
'ramBatchTitle', 'ramBatchModalTitle', 'ramBatchModalOpen', 'ramBatchModalRender',
|
||||||
|
'ramBatchStepsText',
|
||||||
'ramBatchAttemptsHtml', 'ramBatchRender', 'ramBatchApplyStatus', 'ramBatchFetch',
|
'ramBatchAttemptsHtml', 'ramBatchRender', 'ramBatchApplyStatus', 'ramBatchFetch',
|
||||||
'ramBatchStart', 'ramBatchStop', 'ramBatchClear', 'ramOpProgressText',
|
'ramBatchStart', 'ramBatchStop', 'ramBatchClear', 'ramOpProgressText',
|
||||||
'ramOpModalClose', 'esc']) {
|
'ramOpModalClose', 'esc']) {
|
||||||
@@ -99,6 +100,7 @@ const app = new Function('els', `
|
|||||||
var pysimApplyAvailability = () => {};
|
var pysimApplyAvailability = () => {};
|
||||||
var _ramOpActive = false;
|
var _ramOpActive = false;
|
||||||
var _ramBatchModalShown = false;
|
var _ramBatchModalShown = false;
|
||||||
|
var _ramBatchLastKind = null;
|
||||||
var _ramBatchLast = null;
|
var _ramBatchLast = null;
|
||||||
var _ramBatchFetching = false;
|
var _ramBatchFetching = false;
|
||||||
var _ramBatchFetchAt = 0;
|
var _ramBatchFetchAt = 0;
|
||||||
@@ -121,6 +123,7 @@ const app = new Function('els', `
|
|||||||
sandbox.ramOpModalClose = ramOpModalClose;
|
sandbox.ramOpModalClose = ramOpModalClose;
|
||||||
sandbox.isBatchModalShown = () => _ramBatchModalShown;
|
sandbox.isBatchModalShown = () => _ramBatchModalShown;
|
||||||
sandbox.resetBatchModal = () => { _ramBatchModalShown = false; };
|
sandbox.resetBatchModal = () => { _ramBatchModalShown = false; };
|
||||||
|
sandbox.resetKind = () => { _ramBatchLastKind = null; };
|
||||||
sandbox.setProgress = v => { _ramBatchProgress = v; };
|
sandbox.setProgress = v => { _ramBatchProgress = v; };
|
||||||
sandbox.ramBatchRender = ramBatchRender;
|
sandbox.ramBatchRender = ramBatchRender;
|
||||||
sandbox.ramBatchApplyStatus = ramBatchApplyStatus;
|
sandbox.ramBatchApplyStatus = ramBatchApplyStatus;
|
||||||
@@ -570,6 +573,29 @@ test('the batch modal follows the run: the step, the bar, the cards (v3.30.0)',
|
|||||||
assert.ok(!els['ram-op-batch-clear'].disabled);
|
assert.ok(!els['ram-op-batch-clear'].disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('a cleared report keeps the run kind in the modal title (v3.30.1)', () => {
|
||||||
|
clearEls();
|
||||||
|
setModalEls();
|
||||||
|
setPanelEls();
|
||||||
|
app.setSummary(null);
|
||||||
|
app.ramBatchModalOpen();
|
||||||
|
app.setLast({ kind: 'delete', active: false, phase: 'finished', attempts: [],
|
||||||
|
counts: { installed: 2 }, attempts_total: 2 });
|
||||||
|
app.ramBatchRender();
|
||||||
|
assert.strictEqual(els['ram-op-title'].textContent, 'Batch delete (per card)');
|
||||||
|
// Clear empties the state (kind: null): the title must not flip to install
|
||||||
|
app.setLast({ kind: null, active: false, phase: 'idle', attempts: [],
|
||||||
|
counts: {}, attempts_total: 0 });
|
||||||
|
app.ramBatchRender();
|
||||||
|
assert.strictEqual(els['ram-op-title'].textContent, 'Batch delete (per card)');
|
||||||
|
// a fresh page (no kind ever seen) keeps the install default
|
||||||
|
app.resetBatchModal();
|
||||||
|
app.resetKind();
|
||||||
|
app.setLast({ kind: null, active: false, phase: 'idle', attempts: [], counts: {}, attempts_total: 0 });
|
||||||
|
app.ramBatchModalOpen();
|
||||||
|
assert.strictEqual(els['ram-op-title'].textContent, 'Batch install (.cap file, per card)');
|
||||||
|
});
|
||||||
|
|
||||||
test('the batch modal stays open while the run is active (v3.30.0)', () => {
|
test('the batch modal stays open while the run is active (v3.30.0)', () => {
|
||||||
clearEls();
|
clearEls();
|
||||||
setModalEls();
|
setModalEls();
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "pysim-simple-server"
|
name = "pysim-simple-server"
|
||||||
version = "3.30.0"
|
version = "3.30.1"
|
||||||
description = "HTTP REST server wrapping pysim for the SIMple PWA"
|
description = "HTTP REST server wrapping pysim for the SIMple PWA"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
# pysim is a git-only dependency installed explicitly by setup.bat/setup.sh.
|
# pysim is a git-only dependency installed explicitly by setup.bat/setup.sh.
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ from osmocom.tlv import BER_TLV_IE
|
|||||||
from osmocom.utils import rpad
|
from osmocom.utils import rpad
|
||||||
|
|
||||||
|
|
||||||
VERSION = '3.30.0'
|
VERSION = '3.30.1'
|
||||||
|
|
||||||
MAX_ENVELOPE_SEGMENTS = 5 # max SMS segments for outgoing C-APDU in ENVELOPE
|
MAX_ENVELOPE_SEGMENTS = 5 # max SMS segments for outgoing C-APDU in ENVELOPE
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user