feat: add Scheduler provider + multi-provider UX fixes

Scheduler provider:
- Virtual provider (no external service) that emits SCHEDULED_MESSAGE
  events on user-defined intervals or cron expressions
- Custom variables stored in tracker filters, flattened into template context
- fire_count persists across triggers via tracker state
- APScheduler CronTrigger support for cron-mode schedules
- Default templates (EN+RU), seeded on startup

Multi-provider UX fixes:
- Tracking config hides Immich-specific sections (periodic, scheduled,
  memory, asset display) for non-Immich providers
- Command config driven by provider capabilities — hides commands/settings
  for providers without bot commands
- Template config hides empty "Scheduled Messages" group
- Test menu on tracker targets is provider-aware (Immich shows all 4 test
  types, others show only basic)
- Removed redundant Test button from tracker card
- System-owned tracking configs (user_id=0) seeded for Gitea + Scheduler
- Fixed ownership checks to allow system configs in tracker-target links
- Capabilities cache shared across template-configs and command-configs
- Command tracker bot selector uses EntitySelect instead of raw select
- Sample context includes Gitea + Scheduler variables for template preview
This commit is contained in:
2026-03-22 15:50:51 +03:00
parent 6d28cfb8d8
commit 0562f78b35
30 changed files with 688 additions and 56 deletions
@@ -91,4 +91,50 @@ _SAMPLE_CONTEXT = {
"photo_count": 30,
"video_count": 5,
"owner": "Alice",
# Gitea variables (for gitea provider templates)
"sender": "alexei",
"sender_name": "Alexei",
"sender_avatar": "",
"repo_name": "my-project",
"repo_full_name": "alexei/my-project",
"repo_url": "https://gitea.example.com/alexei/my-project",
"repo_description": "Example project",
"branch": "main",
"commits": [{"id": "abc1234567", "short_id": "abc1234", "message": "fix: example commit", "url": "", "author": "Alexei"}],
"commit_count": 1,
"compare_url": "https://gitea.example.com/alexei/my-project/compare/abc...def",
"issue_number": 42,
"issue_title": "Example issue",
"issue_url": "https://gitea.example.com/alexei/my-project/issues/42",
"issue_state": "open",
"issue_body": "",
"issue_labels": ["bug"],
"pr_number": 17,
"pr_title": "Add feature",
"pr_url": "https://gitea.example.com/alexei/my-project/pulls/17",
"pr_state": "open",
"pr_body": "",
"pr_merged": False,
"pr_base": "main",
"pr_head": "feature/example",
"pr_labels": [],
"comment_body": "Looks good!",
"comment_url": "",
"comment_author": "alexei",
"release_tag": "v1.0.0",
"release_name": "Version 1.0.0",
"release_url": "https://gitea.example.com/alexei/my-project/releases/tag/v1.0.0",
"release_body": "Initial release",
"release_draft": False,
"release_prerelease": False,
# Scheduler variables (for scheduler provider templates)
"schedule_name": "Daily Reminder",
"fire_count": 42,
"current_date": "22.03.2026",
"current_time": "09:00",
"current_datetime": "22.03.2026, 09:00 UTC",
"weekday": "Monday",
"custom_vars": {"team": "Engineering", "message": "Time for standup!"},
"team": "Engineering",
"message": "Time for standup!",
}