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 Details

  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • shell

      @GetMapping("/shell") public Map<String,Object> shell(@RequestParam(required=false) String profile, @RequestParam(required=false) String viewport, @RequestParam(required=false) String theme, Principal principal)
    • account

      @GetMapping("/account") public Map<String,Object> account(@RequestParam(required=false) String profile, @RequestParam(required=false) String theme, Principal principal)
    • home

      @GetMapping("/home") public Map<String,Object> home(@RequestParam(required=false) String profile, @RequestParam(required=false) String viewport, @RequestParam(required=false) String theme, Principal principal)
    • 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 authored Page here. 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 with section(...).page("/settings", …). No page registered for the route → a real 404 (this is an /api path, 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 via PageBuilder.actions(java.lang.String, java.util.function.Consumer<su.onno.ui.ActionSpec>). The button posts the page route and action key; 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 its ActionResult. 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, so onno.ui.read-only blocks them the same way it blocks the generic mutation endpoints.
    • catalogList

      @GetMapping("/catalogs/{name}") public Map<String,Object> catalogList(@PathVariable String name, @RequestParam(required=false) String profile, @RequestParam(required=false) String viewport, @RequestParam(required=false) String theme, Principal principal)
    • catalogDetail

      @GetMapping("/catalogs/{name}/{id}") public Map<String,Object> catalogDetail(@PathVariable String name, @PathVariable UUID id, @RequestParam(required=false) String profile, Principal principal)
    • catalogNew

      @GetMapping("/catalogs/{name}/new") public Map<String,Object> catalogNew(@PathVariable String name, @RequestParam Map<String,String> params, Principal principal)
    • catalogDuplicate

      @GetMapping("/catalogs/{name}/{id}/duplicate") public Map<String,Object> catalogDuplicate(@PathVariable String name, @PathVariable UUID id, @RequestParam(required=false) String profile, Principal principal)
    • documentList

      @GetMapping("/documents/{name}") public Map<String,Object> documentList(@PathVariable String name, @RequestParam(required=false) String profile, @RequestParam(required=false) String viewport, @RequestParam(required=false) String theme, Principal principal)
    • documentDetail

      @GetMapping("/documents/{name}/{id}") public Map<String,Object> documentDetail(@PathVariable String name, @PathVariable UUID id, @RequestParam(required=false) String profile, Principal principal)
    • documentNew

      @GetMapping("/documents/{name}/new") public Map<String,Object> documentNew(@PathVariable String name, @RequestParam Map<String,String> params, Principal principal)
    • documentDuplicate

      @GetMapping("/documents/{name}/{id}/duplicate") public Map<String,Object> documentDuplicate(@PathVariable String name, @PathVariable UUID id, @RequestParam(required=false) String profile, Principal principal)
    • registerReport

      @GetMapping("/registers/{name}") public Map<String,Object> registerReport(@PathVariable String name, @RequestParam(required=false) String profile, @RequestParam(required=false) String viewport, @RequestParam(required=false) String theme, Principal principal)