ui(platform-orders): add run_id badge quick governance links

This commit is contained in:
萝卜
2026-03-17 13:37:15 +08:00
parent 96c1a1562d
commit 9e40e73481
2 changed files with 68 additions and 1 deletions

View File

@@ -503,7 +503,25 @@
$batchActivationRunId = trim((string) ($filters['batch_activation_run_id'] ?? ''));
@endphp
@if($batchActivationRunId !== '')
<div class="card mb-20 governance-block">
@php
$runGoFailedUrl = $buildQuickFilterUrl([
'batch_activation_run_id' => $batchActivationRunId,
'sync_status' => 'failed',
'page' => null,
]);
$runGoUnsyncedUrl = $buildQuickFilterUrl([
'batch_activation_run_id' => $batchActivationRunId,
'sync_status' => 'unsynced',
'page' => null,
]);
$runGoSyncableUrl = $buildQuickFilterUrl([
'batch_activation_run_id' => $batchActivationRunId,
'sync_status' => 'unsynced',
'syncable_only' => '1',
'page' => null,
]);
@endphp
<div class="card mb-20 governance-block" data-role="batch-activation-run-id-badge">
<div class="muted governance-block-title"><strong>当前批次筛选</strong></div>
<div class="muted governance-block-body">
<div>
@@ -511,6 +529,14 @@
<span class="muted"></span>
<a class="btn btn-secondary btn-sm" href="{!! $safeFullUrlWithQuery(['batch_activation_run_id' => null, 'page' => null]) !!}">清除批次筛选</a>
</div>
<div class="mt-6">
<span class="muted">快速查看:</span>
<a class="link" href="{!! $runGoFailedUrl !!}">本批次失败</a>
<span class="muted"></span>
<a class="link" href="{!! $runGoUnsyncedUrl !!}">本批次未同步</a>
<span class="muted"></span>
<a class="link" href="{!! $runGoSyncableUrl !!}">本批次可同步重试</a>
</div>
</div>
</div>
@endif

View File

@@ -0,0 +1,41 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexBatchActivationRunIdBadgeQuickLinksShouldRenderTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_platform_orders_page_should_render_run_id_badge_quick_links(): void
{
$this->loginAsPlatformAdmin();
$runId = 'BAS_TEST_BADGE_0001';
$html = $this->get('/admin/platform-orders?batch_activation_run_id=' . $runId)
->assertOk()
->getContent();
$this->assertStringContainsString('当前 run_id<strong>' . $runId . '</strong>', $html);
// 本批次失败
$this->assertStringContainsString('batch_activation_run_id=' . $runId, $html);
$this->assertStringContainsString('sync_status=failed', $html);
// 本批次可同步重试unsynced + syncable_only=1
$this->assertStringContainsString('syncable_only=1', $html);
$this->assertStringContainsString('sync_status=unsynced', $html);
}
}