fix(backup-scheduling): show next run in schedule timezone
This commit is contained in:
parent
c00b2d32ee
commit
a05835f87c
@ -278,7 +278,21 @@ public static function table(Table $table): Table
|
|||||||
|
|
||||||
TextColumn::make('next_run_at')
|
TextColumn::make('next_run_at')
|
||||||
->label('Next run')
|
->label('Next run')
|
||||||
->dateTime()
|
->getStateUsing(function (BackupSchedule $record): ?string {
|
||||||
|
$nextRun = $record->next_run_at;
|
||||||
|
|
||||||
|
if (! $nextRun) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$timezone = $record->timezone ?: 'UTC';
|
||||||
|
|
||||||
|
try {
|
||||||
|
return $nextRun->setTimezone($timezone)->format('M j, Y H:i:s');
|
||||||
|
} catch (\Throwable) {
|
||||||
|
return $nextRun->format('M j, Y H:i:s');
|
||||||
|
}
|
||||||
|
})
|
||||||
->sortable(),
|
->sortable(),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
|
|||||||
@ -88,6 +88,7 @@ ### Tests (Pest)
|
|||||||
- [X] T029 [P] [US3] Add feature test tests/Feature/BackupScheduling/ApplyRetentionJobTest.php (keeps last N backup_sets; soft-deletes older)
|
- [X] T029 [P] [US3] Add feature test tests/Feature/BackupScheduling/ApplyRetentionJobTest.php (keeps last N backup_sets; soft-deletes older)
|
||||||
- [X] T038 [P] [US1] Add feature test tests/Feature/BackupScheduling/BackupScheduleBulkDeleteTest.php (bulk delete action regression)
|
- [X] T038 [P] [US1] Add feature test tests/Feature/BackupScheduling/BackupScheduleBulkDeleteTest.php (bulk delete action regression)
|
||||||
- [X] T039 [P] [US1] Extend tests/Feature/BackupScheduling/BackupScheduleBulkDeleteTest.php (operator cannot bulk delete)
|
- [X] T039 [P] [US1] Extend tests/Feature/BackupScheduling/BackupScheduleBulkDeleteTest.php (operator cannot bulk delete)
|
||||||
|
- [X] T040 [P] [US1] Update app/Filament/Resources/BackupScheduleResource.php and tests/Feature/BackupScheduling/BackupScheduleCrudTest.php (display next_run in schedule timezone)
|
||||||
|
|
||||||
### Implementation
|
### Implementation
|
||||||
|
|
||||||
|
|||||||
@ -17,13 +17,15 @@
|
|||||||
'tenant_id' => $tenantA->id,
|
'tenant_id' => $tenantA->id,
|
||||||
'name' => 'Tenant A schedule',
|
'name' => 'Tenant A schedule',
|
||||||
'is_enabled' => true,
|
'is_enabled' => true,
|
||||||
'timezone' => 'UTC',
|
'timezone' => 'Europe/Berlin',
|
||||||
'frequency' => 'daily',
|
'frequency' => 'daily',
|
||||||
'time_of_day' => '01:00:00',
|
'time_of_day' => '01:00:00',
|
||||||
'days_of_week' => null,
|
'days_of_week' => null,
|
||||||
'policy_types' => ['deviceConfiguration'],
|
'policy_types' => ['deviceConfiguration'],
|
||||||
'include_foundations' => true,
|
'include_foundations' => true,
|
||||||
'retention_keep_last' => 30,
|
'retention_keep_last' => 30,
|
||||||
|
// Stored in UTC; should render as schedule-local time in list.
|
||||||
|
'next_run_at' => '2026-01-05 09:08:00',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
BackupSchedule::query()->create([
|
BackupSchedule::query()->create([
|
||||||
@ -45,6 +47,7 @@
|
|||||||
->assertOk()
|
->assertOk()
|
||||||
->assertSee('Tenant A schedule')
|
->assertSee('Tenant A schedule')
|
||||||
->assertSee('Device Configuration')
|
->assertSee('Device Configuration')
|
||||||
|
->assertSee('Jan 5, 2026 10:08:00')
|
||||||
->assertDontSee('Tenant B schedule');
|
->assertDontSee('Tenant B schedule');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user