Coverage for /usr/local/lib/python3.12/site-packages/prefect/server/schemas/ui.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 02:04 +0000

1"""Schemas for UI endpoints.""" 

2 

3from typing import Literal, Optional 

4 

5from pydantic import BaseModel, Field 

6 

7from prefect.server.schemas.core import TaskRun as CoreTaskRun 

8 

9 

10class UITaskRun(CoreTaskRun): 

11 """A task run with additional details for display in the UI.""" 

12 

13 flow_run_name: Optional[str] = None 

14 

15 

16class UISettings(BaseModel): 

17 """Runtime UI configuration returned by /ui-settings endpoint.""" 

18 

19 api_url: str = Field(description="The base URL for API requests.") 

20 csrf_enabled: bool = Field(description="Whether CSRF protection is enabled.") 

21 auth: Optional[str] = Field( 

22 description="Authentication method (e.g., 'BASIC') or null if disabled." 

23 ) 

24 flags: list[str] = Field( 

25 default_factory=list, description="List of enabled feature flags." 

26 ) 

27 default_ui: Literal["v1", "v2"] = Field( 

28 description="The default UI used for neutral entry points when the browser has no saved UI preference." 

29 ) 

30 available_uis: list[Literal["v1", "v2"]] = Field( 

31 default_factory=list, 

32 description="List of UI bundles currently available to this server.", 

33 ) 

34 v1_base_url: Optional[str] = Field( 

35 default=None, 

36 description="The base URL for the legacy V1 UI, or null when unavailable.", 

37 ) 

38 v2_base_url: Optional[str] = Field( 

39 default=None, 

40 description="The base URL for the V2 UI, or null when unavailable.", 

41 )