fix: handling invoice pagination

This commit is contained in:
2026-05-05 19:16:41 +08:00
parent 4ca78fda50
commit eb6df01c06
2 changed files with 105 additions and 90 deletions

View File

@@ -152,7 +152,7 @@ function main(profiles, args) {
switch (Status) {
case 'READY':
let name = $('#name').value;
let options = new Map();
let options = { profile: name };
for (let element of $$("input[type='checkbox']:not(.local-only)")) {
options[element.id] = element.checked;
@@ -166,7 +166,6 @@ function main(profiles, args) {
args[element.id] = element.valueAsNumber;
}
options['profile'] = name;
await Rpc2.invoke('begin', options, args);
break;
case 'RUNNING':
@@ -225,10 +224,12 @@ function main(profiles, args) {
$('#dateto').valueAsNumber = date.setHours(24 * 7) + date.getTimezoneOffset() * 60 * 1000;
$('#all').dispatchEvent(new Event('change'));
let account = new String(args['account']);
let name = account.split('@', 1).pop() ?? 'unknown';
name = name.charAt(0).toLocaleUpperCase() + name.slice(1);
document.title += ` (${name})`;
if (Object.hasOwn(args, 'account')) {
let account = new String(args['account']);
let name = account.split('@', 1).pop();
name = name.charAt(0).toLocaleUpperCase() + name.slice(1);
document.title += ` (${name})`;
}
setInterval(async () => {
let history = await Rpc2.invoke('history');
@@ -263,11 +264,11 @@ function main(profiles, args) {
$('#numberLabel').innerText = number ?? '';
$('#progressLabel').innerText = limit ? `${task}, ${parseFloat((index / limit * 100).toFixed(2))}% (${index}/${limit})` : task;
let uptime = await Rpc2.invoke('uptime');
$('#uptimeLabel').innerText = Temporal.Duration.from({ seconds: uptime }).round({ largestUnit: 'hours' }).toLocaleString('en', { style: 'digital' });
let [t1, t2] = await Rpc2.invoke('uptime').catch(() => []);
$('#uptimeLabel').innerText = Temporal.Duration.from({ seconds: t1 ?? 0 }).round({ largestUnit: 'hours' }).toLocaleString('en', { style: 'digital' });
if (index && limit && uptime) {
let rate = index / uptime;
if (index && limit && t2) {
let rate = index / t2;
let remaining = Math.floor((limit - index) / rate);
$('#remainingLabel').innerHTML = Temporal.Duration.from({ seconds: remaining }).round({ largestUnit: 'hours' }).toLocaleString('en');
}