feat(admin): always-on dashboard widget + default retro days = 0
- Dashboard widget is now registered unconditionally. Header + content adapt: shows '⚠️ ошибки доставки' only when failed > 0, otherwise plain title with queue state (pending / sent-24h / failed). Pilot feedback: the conditional widget felt like the plugin was missing — users expect a persistent status readout. - Retro default window changed from 7 days to 0 (no limit). Most pilot uses were 'dump everything since install', so 0 is the more useful default. User can still narrow to N days in the form. - Spec §10 + §14 updated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,35 @@
|
||||
<?php
|
||||
/** @var array<int,object> $failed */
|
||||
/** @var int $count */
|
||||
/** @var int $failed_count */
|
||||
/** @var int $pending */
|
||||
/** @var int $sent_24h */
|
||||
/** @var bool $configured */
|
||||
/** @var string $settings_url */
|
||||
?>
|
||||
<p>Есть <b><?php echo (int)$count; ?></b> неотправленных сообщений (TG-API отвечает ошибкой):</p>
|
||||
<ul style="margin:0 0 8px 18px;list-style:disc">
|
||||
<?php foreach ($failed as $row): ?>
|
||||
<li>
|
||||
<?php echo esc_html((string)$row->created_at); ?> —
|
||||
<?php echo esc_html((string)$row->last_error); ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php if (!$configured): ?>
|
||||
<p>⚙️ Плагин не настроен — укажите <b>Bot Token</b> и <b>Chat ID</b> в настройках.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p>
|
||||
<span title="Ожидают отправки">⏳ В очереди: <b><?php echo (int)$pending; ?></b></span>
|
||||
·
|
||||
<span title="Успешно отправлено за последние сутки">✅ За сутки: <b><?php echo (int)$sent_24h; ?></b></span>
|
||||
·
|
||||
<span title="Не удалось доставить после ретраев">
|
||||
<?php echo $failed_count > 0 ? '⚠️' : '✖'; ?> Ошибки: <b><?php echo (int)$failed_count; ?></b>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<?php if ($failed_count > 0): ?>
|
||||
<p style="margin-top:10px">Последние ошибки доставки (TG-API):</p>
|
||||
<ul style="margin:0 0 8px 18px;list-style:disc">
|
||||
<?php foreach ($failed as $row): ?>
|
||||
<li>
|
||||
<?php echo esc_html((string)$row->created_at); ?> —
|
||||
<?php echo esc_html((string)$row->last_error); ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><a href="<?php echo esc_url($settings_url); ?>" class="button">Открыть настройки →</a></p>
|
||||
|
||||
@@ -83,7 +83,7 @@ if (isset($_GET['purged'])) $notice = '<div class="notice notice-success"
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Только за последние</th>
|
||||
<td><input type="number" name="retro_days" value="7" min="0"> дней <span class="description">(0 = без ограничения)</span></td>
|
||||
<td><input type="number" name="retro_days" value="0" min="0"> дней <span class="description">(0 = без ограничения)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
|
||||
Reference in New Issue
Block a user