feat(registry): кнопка/эндпоинт «Запустить пополнение сейчас» (SuperAdmin)
Some checks are pending
Auto-tag / Create date-tag (push) Waiting to run
CI / Backend (.NET 8) (push) Waiting to run
CI / Web (React + Vite) (push) Waiting to run
CI / POS (WPF, Windows) (push) Waiting to run
Docker API / Build + push API (push) Waiting to run
Docker API / Deploy API on stage (push) Blocked by required conditions
Docker Web / Build + push Web (push) Waiting to run
Docker Web / Deploy Web on stage (push) Blocked by required conditions

Разовый запуск фонового пополнения реестра помимо расписания
(POST /api/super-admin/product-registry/enrich/run-now). Джоб проверяет флаг.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nns 2026-10-12 19:43:49 +05:00
parent e39e4fe1d5
commit 81bf4c7b23
2 changed files with 18 additions and 3 deletions

View file

@ -121,6 +121,15 @@ public async Task<IActionResult> SetEnrich([FromBody] EnrichInput input, Cancell
return NoContent();
}
[HttpPost("enrich/run-now")]
public IActionResult RunEnrichNow()
{
// Разовый запуск фонового пополнения (помимо расписания). Джоб сам
// проверяет флаг ProductRegistryEnrichEnabled и при ВЫКЛ ничего не делает.
_jobs.Enqueue<ProductRegistryService>(s => s.EnrichFromParticipantsAsync(CancellationToken.None));
return Accepted(new { enqueued = true });
}
// ── Наполнение «из МойСклад заново» ──────────────────────────────────────
[HttpGet("fill-status")]
public async Task<ActionResult<object>> FillStatus(CancellationToken ct)

View file

@ -241,9 +241,15 @@ function EnrichSection({ enrich, onChange }: { enrich: EnrichDto | undefined; on
</div>
{err && <div className="text-sm text-red-600">{err}</div>}
<Field label="Причина (≥10, в журнал)"><TextInput value={reason} onChange={e => setReason(e.target.value)} /></Field>
<div className="flex items-center gap-3">
<Button onClick={save} disabled={busy || reason.trim().length < 10 || !enrich || pending === enrich.enabled}>
<Save className="w-4 h-4" /> {pending ? 'Включить пополнение' : 'Выключить пополнение'}
</Button>
<Button variant="secondary" disabled={busy || !enrich?.enabled}
onClick={async () => { await api.post('/api/super-admin/product-registry/enrich/run-now'); onChange() }}>
<RefreshCw className="w-4 h-4" /> Запустить сейчас
</Button>
</div>
</section>
)
}