Pick and show schedules as plain time instead of cron

Schedules were entered and displayed as six field cron expressions. A
picker now offers a frequency, a weekday or day of the month and a time,
and turns that into the expression the backend stores; tables and the
dashboard show wording like "Every day at 03:00". An expression the
picker cannot express stays editable as cron.

This also fixes a broken preset: the backend's cron dialect counts Sunday
as 1 and rejects 0, so the "every Sunday" choice in the application
backup form produced an invalid expression. The picker emits weekday
names, and a test pins the dialect down.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Dennis Nemec
2026-09-03 21:47:56 +02:00
parent 1339ae864e
commit 6796634906
15 changed files with 513 additions and 62 deletions

View File

@ -28,12 +28,14 @@ test('an admin backs up Gitea data and database in one flow', async ({ page }) =
// Gitea → select → schedule → target → save
await gitea.getByRole('button', { name: 'Back up' }).click()
await expect(page.getByRole('dialog')).toContainText('gitea-shared-storage')
// the schedule reads as time, not as cron
await expect(page.getByRole('dialog')).toContainText('Every day at 03:00')
await page.getByLabel('Target', { exact: true }).selectOption({ label: name })
await page.getByRole('button', { name: 'Create backup plan' }).click()
await expect(page.getByText(/2 backup strategies created/)).toBeVisible()
await expect(page.getByRole('row', { name: /Gitea – Gitea volume/ })).toBeVisible()
await expect(page.getByRole('row', { name: /Gitea – PostgreSQL dump/ })).toContainText(
'0 0 3 * * *',
'Every day at 03:00',
)
})

View File

@ -26,7 +26,7 @@ test('admin creates a target and a strategy, runs it and sees the backup', async
await page.getByLabel('Source type', { exact: true }).selectOption('postgres_dump')
await page.getByLabel('Namespace', { exact: true }).fill('gitea')
await page.getByLabel('Pod', { exact: true }).fill('gitea-postgresql-0')
await page.getByLabel('Schedule', { exact: true }).fill('0 0 2 * * *')
await page.getByLabel('At', { exact: true }).fill('02:00')
await page.getByLabel('Target', { exact: true }).selectOption({ label: name })
await page.getByLabel('Keep last', { exact: true }).fill('3')
await page.getByRole('button', { name: 'Save strategy' }).click()
@ -36,4 +36,5 @@ test('admin creates a target and a strategy, runs it and sees the backup', async
await expect(row).toContainText(/gitea-database_.*\.sql\.gz/, { timeout: 20_000 })
await row.getByRole('button', { name: 'History' }).click()
await expect(page.getByTestId('backup-records')).toContainText('sql.gz')
await expect(row).toContainText('Every day at 02:00')
})

View File

@ -23,10 +23,14 @@ test('admin saves SMTP settings and a schedule', async ({ page }) => {
await expect(page.getByLabel('SMTP host')).toHaveValue('mail.example.com')
await expect(page.getByText('leave empty to keep')).toBeVisible()
const cron = page.getByLabel('Package refresh schedule')
await cron.fill('0 */30 * * * *')
await expect(page.getByTestId('schedule-summary').first()).toHaveText('Every hour')
await page.getByLabel('Repeat').first().selectOption('daily')
await expect(page.getByTestId('schedule-summary').first()).toContainText('Every day at')
await page.getByLabel('At', { exact: true }).first().fill('04:30')
await page.getByRole('button', { name: 'Save schedules' }).click()
await expect(page.getByRole('status')).toContainText('Schedules saved')
await expect(page.getByText(/Schedules saved/)).toBeVisible()
await page.reload()
await expect(page.getByLabel('At', { exact: true }).first()).toHaveValue('04:30')
})
test('admin runs a job manually and sees the log', async ({ page }) => {