feat: plans migration
Summary by CodeRabbit
-
New Features
- Full plan migration management: create/edit/delete migrations, view details, history, and subscriptions; new public API endpoints and migration schemas; new error codes.
-
UI
- Migration status chips, detailed migration panels/tooltips, record list, plan selectors with migration filtering, full‑width tooltips, header custom buttons, optional table headers, dedicated create/edit admin pages.
-
Validation
- Form validation for monthly/yearly offset fields.
-
i18n / Email
- Email templates and translation keys for plan migration notifications; new error translation strings.
-
Tests
- Email send-count verifier and new data‑cy identifiers for migration flows.
-
Background / Date
- Improved date handling (system local date) and cron-based task scheduling.
Walkthrough
Adds backend plan-migration APIs, scheduling/date helpers, an internal properties setter, i18n/email keys and test helpers; and extensive frontend EE billing UI for plan migrations including selectors, forms, chips, lists, pages, routes, validation, generated API schemas, Cypress typings, and small UI utilities.
Changes
| Cohort / File(s) | Summary |
|---|---|
Backend date & schedulingbackend/data/src/main/kotlin/io/tolgee/component/CurrentDateProvider.kt, backend/data/src/main/kotlin/io/tolgee/component/SchedulingManager.kt |
Adds val localDate: LocalDate computed from date using system default zone; adds scheduleWithCron(runnable: Runnable, cron: String): String that schedules via CronTrigger, stores future by UUID and returns id. |
Backend messages, i18n & email testsbackend/data/src/main/kotlin/io/tolgee/constants/Message.kt, backend/data/src/main/resources/I18n_en.properties, backend/testing/src/main/kotlin/io/tolgee/fixtures/EmailTestUtil.kt |
Adds enum values PLAN_MIGRATION_NOT_FOUND, PLAN_HAS_MIGRATIONS; adds plan-migration email subject/body i18n keys; adds verifyTimesEmailSent(num: Int) test helper. |
Backend internal properties facade & controllerbackend/development/src/main/kotlin/io/tolgee/facade/InternalPropertiesSetterFacade.kt, backend/development/src/main/kotlin/io/tolgee/controllers/internal/PropertiesController.kt |
New InternalPropertiesSetterFacade.setProperty(...) that traverses dot-paths via reflection and enforces mutability; PropertiesController delegates to the facade and makes tolgeeProperties private. |
Billing API schemas (generated)webapp/src/service/billingApiSchema.generated.ts, webapp/src/service/apiSchema.generated.ts |
Adds plan-migration endpoints (POST/GET/PUT/DELETE, subscriptions), new migration schemas (CloudPlanMigrationModel, PlanMigrationRecordModel, history/request/paged models), adds activeMigration/migrationId fields, filterHasMigration param; expands ErrorResponseTyped.code with plan_migration_not_found/plan_has_migrations. |
Webapp migration UI (components / forms / pages / routing)webapp/src/ee/billing/**/migration/**, webapp/src/eeSetup/eeModule.ee.tsx, webapp/src/ee/billing/component/Plan/migration/** |
Adds generic create/edit bases, PlanMigrationForm (generic), Create/Edit wrappers, Cloud/Self‑hosted edit forms, chips, detail/price components, paginated record list, status chip, create/edit admin pages, lazy-loading chips, and registers routes in EE module. |
Plan selectors & related changeswebapp/src/ee/billing/administration/subscriptionPlans/components/planForm/genericFields/GenericPlanSelector.tsx, .../cloud/fields/CloudPlanSelector.tsx, .../selfHostedEe/fields/SelfHostedEePlanSelector.tsx, .../migration/fields/PlanSelectorField.tsx, .../migration/types.ts |
GenericPlanType now includes free; GenericPlanSelector gains planProps (hiddenIds, free), dataCy, and returns full plan in handler; cloud/self-hosted selectors accept filterHasMigration; new PlanSelectorField binds to Formik; new PlanType alias added. |
Forms wrappers & validationwebapp/src/ee/billing/administration/subscriptionPlans/components/migration/PlanMigrationForm.tsx, .../CreatePlanMigrationForm.tsx, .../EditPlanMigrationForm.tsx, webapp/src/constants/GlobalValidationSchema.tsx |
Adds generic PlanMigrationForm with validation, offsets, source/target selectors and delete confirmation; Create/Edit wrapper components; adds PLAN_MIGRATION_FORM Yup schema and localized min-number message. |
UI utilities & common propswebapp/src/component/common/FullWidthTooltip.tsx, webapp/src/component/common/table/PaginatedHateoasTable.tsx, webapp/src/component/layout/HeaderBar.tsx |
Adds FullWidthTooltip; PaginatedHateoasTable accepts optional tableHead?: ReactNode; HeaderBar adds optional customButtons?: ReactNode[]. |
Plans views & UI integrationwebapp/src/ee/billing/administration/subscriptionPlans/viewsCloud/AdministrationCloudPlansView.tsx, .../viewsSelfHostedEe/AdministrationEePlansView.tsx |
Injects migration-create custom button in plans list headers and renders migrating chips per plan row. |
Lists, records & status componentswebapp/src/ee/billing/administration/subscriptionPlans/migration/general/* |
Adds AdministrationPlanMigrationCreateBase, AdministrationPlanMigrationEditBase, PlanMigrationRecordList, PlanMigrationStatus and supporting components to display record lists, statuses and edit flows. |
Cypress typings & error translation & linkse2e/cypress/support/dataCyType.d.ts, webapp/src/translationTools/useErrorTranslation.ts, webapp/src/constants/links.tsx, webapp/src/service/apiSchema.generated.ts |
Adds several new data-cy keys; maps new error codes to translation keys; adds PLAN_MIGRATION_ID param and migration route constants; updates generated API error unions accordingly. |
Sequence Diagram(s)
sequenceDiagram
autonumber
actor Admin as Admin User
participant UI as Webapp UI
participant API as Billing API
participant DB as Storage
rect #f0f8ff
note over UI: Create migration flow
Admin->>UI: Open Create Migration UI
UI->>API: POST /v2/administration/billing/{cloud|self-hosted}-plans/migration
API->>DB: Persist migration
DB-->>API: id
API-->>UI: 201 Created
UI-->>Admin: Show success + navigate to list
end
rect #f5fff0
note over UI: Edit/Delete with subscriptions
Admin->>UI: Open Edit Migration
UI->>API: GET /.../migration/{id}
API-->>UI: migration detail
UI->>API: GET /.../migration/{id}/subscriptions?page=N
API-->>UI: paged records
Admin->>UI: Save
UI->>API: PUT /.../migration/{id}
API->>DB: Update
API-->>UI: 200 OK
Admin->>UI: Delete
UI->>API: DELETE /.../migration/{id}
API->>DB: Remove
API-->>UI: 204 No Content
end
sequenceDiagram
autonumber
participant List as Plans List
participant Chip as Migrating Chip
participant API as Billing API
List->>Chip: Render with migrationId
Chip-->>List: Return null if no id
Chip->>Chip: onOpen => opened=true
Chip->>API: GET /.../migration/{id} (enabled by opened)
API-->>Chip: migration detail
Chip-->>List: Tooltip shows PlanMigrationDetail with edit link
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~75 minutes
Possibly related PRs
- tolgee/tolgee-platform#3062 — modifies the same GenericPlanSelector UI file and likely overlaps on selector/plan props changes.
- tolgee/tolgee-platform#3152 — touches administration billing plans UI (cloud plans view), related to UI integration for plan features.
- tolgee/tolgee-platform#3092 — updates backend Message enum; related to added error constants in this change.
Suggested reviewers
- JanCizmar
- ZuzanaOdstrcilova
Poem
Hop-hop I bound through routes and forms,
Chips that glow where server warms.
I nudge cron ticks and dates align,
Migrations queued by paw and sign.
A rabbit cheers — migrations shine! 🐇✨
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title Check | ✅ Passed | The PR title "feat: plans migration" directly relates to the main changes in the changeset. The entire pull request is cohesively focused on implementing plan migration functionality across multiple layers: backend services (CurrentDateProvider, SchedulingManager), API schema definitions for migration endpoints and models, frontend form components (CreatePlanMigrationForm, EditPlanMigrationForm, PlanMigrationForm), UI components for displaying migration status and details, routing/linking for migration pages, and testing utilities. The title clearly communicates that this is a feature addition for plan migration, which is the unifying theme across all the changes. While the title doesn't enumerate every component involved, it appropriately summarizes the primary purpose without unnecessary verbosity. |
| Docstring Coverage | ✅ Passed | No functions found in the changes. Docstring coverage check skipped. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
danielkrizan/plan-migration
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 42559b89834e488f785dbca9dd85eb4cc1c047e9 and 9d162abf047138d610eddd80b68f03813c0d91fe.
📒 Files selected for processing (4)
webapp/src/ee/billing/administration/subscriptionPlans/migration/cloud/AdministrationCloudPlanMigrationEdit.tsx(1 hunks)webapp/src/ee/billing/administration/subscriptionPlans/migration/general/PlanMigrationStatus.tsx(1 hunks)webapp/src/ee/billing/administration/subscriptionPlans/migration/selfhosted/AdministrationSelfHostedEePlanMigrationEdit.tsx(1 hunks)webapp/src/ee/billing/component/Plan/migration/PlanMigrationChip.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- webapp/src/ee/billing/administration/subscriptionPlans/migration/selfhosted/AdministrationSelfHostedEePlanMigrationEdit.tsx
- webapp/src/ee/billing/administration/subscriptionPlans/migration/general/PlanMigrationStatus.tsx
- webapp/src/ee/billing/component/Plan/migration/PlanMigrationChip.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
webapp/src/ee/billing/administration/subscriptionPlans/migration/cloud/AdministrationCloudPlanMigrationEdit.tsx (4)
webapp/src/constants/links.tsx (1)
LINKS(69-455)webapp/src/service/http/useQueryApi.ts (1)
useBillingApiQuery(288-293)webapp/src/ee/billing/administration/subscriptionPlans/migration/general/AdministrationPlanMigrationEditBase.tsx (1)
AdministrationPlanMigrationEditBase(32-94)webapp/src/ee/billing/administration/subscriptionPlans/components/migration/CloudPlanEditPlanMigrationForm.tsx (1)
CloudPlanEditPlanMigrationForm(15-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build backend 🏗️
- GitHub Check: Frontend static check 🪲
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
This PR is stale because it has been open for 30 days with no activity.