mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
## Summary This PR only refactors code and should not result in any behavioral changes. This PR follows #5206 and attempts to refactor dashboards in a similar way to how that PR refactors folders. This PR aims to divide our dashboard code into distinct "HTTP Layer" and "Service Layer"s - where the "HTTP Layer" contains only logic and models related to serializing/deserializing for the REST HTTP API, and the "Service Layer" contains only domain models/logic and is agnostic to the REST HTTP API. This PR only partially achieves the above goals. Specifically, it makes following changes... 1. Move all HTTP responses out of the `service` module and and into the `http/request` module. 2. Introduce a new `DashboardError` in the `service` module to model all types of "domain logic" errors that occur when interacting with folders. 3. Remove the `service/db/folders` module since, after the migration of folders from the `meta` table to the `folders` table, this module mostly just acted as a wrapper around the `infra/table/folders` module. This PR is still missing the following changes. These changes will be saved for a subsequent PR in order to keep the scope of this PR limited: - Introduce new `...Response` and `...Request` types in the `http/request/models` module whose role is specifically to define serialization/deserialization definitions for the REST HTTP API. ⚠️ Notably, at this point the "HTTP Layer", "Service Layer", and "DB Layer" models for dashboards are still tightly coupled together since all still use the shared JSON serialization/deserialization logic defined on the shared `Dashboard` struct in `config::meta`. Decoupling the models and de/serialization logic at each layer will take more effort than folders since the `Dashboard` struct is large and complicated. I plan to start on this decoupling in the follow-up PR, though that PR likely won't complete the process. ## Overall design goals The design goals here are the same as in #5206 . Please see that PR's description for a detailed explanation. ## Immediate motivation and next steps Motivations and next steps are generally the same as in #5206 . Please see that PR's description for a detailed explanation. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Enhanced dashboard creation and update processes with improved error handling and response management. - Added support for parsing dashboard data across multiple versions. - **Bug Fixes** - Streamlined error handling for dashboard operations, ensuring more consistent and informative responses. - **Chores** - Refactored dashboard management logic to remove unnecessary complexity, improving maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->