Package su.onno.ui
Class DivKitController
java.lang.Object
su.onno.ui.DivKitController
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean
@RestController
@RequestMapping("/api/divkit")
public class DivKitController
extends Object
implements org.springframework.beans.factory.DisposableBean
Emits the server-rendered DivKit app, split so the client can render instantly
and load data lazily:
/shell returns the chrome (top bar + nav, no data
— fast), and each content endpoint returns just that surface's card. The client
paints the shell immediately and streams content in beneath it behind a
skeleton. Everything is resolved for the caller's persona, intersected with
RBAC, in the requested theme/viewport — the same hooks a Flutter client uses.-
Constructor Summary
ConstructorsConstructorDescriptionDivKitController(LayoutSet layoutSet, UiLayoutResolver layoutResolver, UiProfileResolver profileResolver, UiAccessService access, CurrentUserResolver currentUserResolver, ResolvedMetadataService resolvedMetadata, UiViewResolver viewResolver, PageResolver pageResolver, CatalogQueryService catalogQuery, DocumentQueryService documentQuery, RegisterQueryService registerQuery, UiActionResolver actionResolver, RelatedListReader relatedLists, UiProperties uiProperties, UiMessages messages, org.springframework.beans.factory.ObjectProvider<CommentProperties> commentProperties, org.springframework.beans.factory.ObjectProvider<NotificationProperties> notificationProperties) -
Method Summary
Modifier and TypeMethodDescriptioncatalogDetail(String name, UUID id, String profile, Principal principal) catalogDuplicate(String name, UUID id, String profile, Principal principal) voiddestroy()documentDetail(String name, UUID id, String profile, Principal principal) documentDuplicate(String name, UUID id, String profile, Principal principal) The mobile "More" hub: the full navigation (grouped by section) plus the account block.Any other route — settings (`/settings`), a custom dashboard, a report, a bespoke page — resolves to its authoredPagehere.pageAction(String route, String key, String profile, String viewport, Map<String, Object> body, Principal principal) Run a page action button's server handler — the обработка-style logic declared viaPageBuilder.actions(java.lang.String, java.util.function.Consumer<su.onno.ui.ActionSpec>).
-
Constructor Details
-
DivKitController
public DivKitController(LayoutSet layoutSet, UiLayoutResolver layoutResolver, UiProfileResolver profileResolver, UiAccessService access, CurrentUserResolver currentUserResolver, ResolvedMetadataService resolvedMetadata, UiViewResolver viewResolver, PageResolver pageResolver, CatalogQueryService catalogQuery, DocumentQueryService documentQuery, RegisterQueryService registerQuery, UiActionResolver actionResolver, RelatedListReader relatedLists, UiProperties uiProperties, UiMessages messages, org.springframework.beans.factory.ObjectProvider<CommentProperties> commentProperties, org.springframework.beans.factory.ObjectProvider<NotificationProperties> notificationProperties)
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
shell
-
account
-
home
-
page
@GetMapping("/{*route}") public Map<String,Object> page(@PathVariable String route, @RequestParam(required=false) String profile, @RequestParam(required=false) String viewport, @RequestParam(required=false) String theme, Principal principal) Any other route — settings (`/settings`), a custom dashboard, a report, a bespoke page — resolves to its authoredPagehere. This is the general page endpoint: the SPA fetches/api/divkit{route}for whatever path the user navigates to, and the more-specific mappings above (shell, home, the entity surfaces) win by pattern precedence; everything else lands here. Settings is not special — it is just a page you author at"/settings"and link in the nav withsection(...).page("/settings", …). No page registered for the route → a real404(this is an/apipath, so the SPA does not swallow it as an index.html fallthrough). -
pageAction
@PostMapping("/page-action") public ActionResult pageAction(@RequestParam String route, @RequestParam String key, @RequestParam(required=false) String profile, @RequestParam(required=false) String viewport, @RequestBody(required=false) Map<String, Object> body, Principal principal) Run a page action button's server handler — the обработка-style logic declared viaPageBuilder.actions(java.lang.String, java.util.function.Consumer<su.onno.ui.ActionSpec>). The button posts the pagerouteand actionkey; we re-resolve and re-compose the page (compose is a pure spec build, like the GET render), find the handler by key, and return itsActionResult. Page actions have no entity to gate on, so we require an authenticated user, honour the action's declared.roles(...)(#227), and leave finer authorization to the handler. Server handlers are writes by definition, soonno.ui.read-onlyblocks them the same way it blocks the generic mutation endpoints. -
catalogList
-
catalogDetail
-
catalogNew
-
catalogDuplicate
-
documentList
-
documentDetail
-
documentNew
-
documentDuplicate
-
registerReport
-