Documentation
¶
Overview ¶
Package ui defines the declarative Astra Admin UI protocol.
Index ¶
- Constants
- func Validate(provider string, descriptor Descriptor, modules []resources.Module) error
- func ValidateOperationExtension(provider string, extension OperationExtension, base Descriptor, ...) error
- type Action
- type BodyBinding
- type Confirmation
- type Contribution
- type Customizable
- type Descriptor
- type EndpointRef
- type Form
- type FormField
- type Node
- type OperationAction
- type OperationCapability
- type OperationExtension
- type OperationInputBinding
- type OperationProvider
- type OperationRef
- type OperationRegistration
- type OperationRegistry
- type OperationResolver
- type OperationSnapshot
- type OperationVisibility
- type Option
- type ParameterBinding
- type Provider
- type Registration
- type Registry
- func (r *Registry) Discovery() (uint64, bool)
- func (r *Registry) Register(provider string, descriptor Descriptor, modules []resources.Module) error
- func (r *Registry) RegisterBatch(registrations []Registration, modules []resources.Module) error
- func (r *Registry) Snapshot(visibleModules []resources.Module, modulesRevision uint64) Snapshot
- type Snapshot
- type Source
- type TableColumn
- type ValueBinding
- type View
Constants ¶
View Source
const ( TypePage = "page.v1" TypeSection = "section.v1" TypeStack = "stack.v1" TypeGrid = "grid.v1" TypeTabs = "tabs.v1" TypeText = "text.v1" TypeKeyValue = "key_value.v1" TypeStat = "stat.v1" TypeBadge = "badge.v1" TypeAlert = "alert.v1" TypeEmptyState = "empty_state.v1" TypeTable = "table.v1" TypeTableColumn = "table_column.v1" TypeForm = "form.v1" TypeButton = "button.v1" TypeActionGroup = "action_group.v1" TypeJSONView = "json_view.v1" TypeTextField = "text_field.v1" TypeNumberField = "number_field.v1" TypeIntegerField = "integer_field.v1" TypeBooleanField = "boolean_field.v1" TypeSelectField = "select_field.v1" TypeSecretField = "secret_field.v1" TypeJSONField = "json_field.v1" TypeRequest = "request.v1" )
View Source
const ( SourceSingle = "single" SourceList = "list" SourceKeyed = "keyed" )
View Source
const ( BindingContext = "context" BindingRow = "row" BindingForm = "form" BindingTableRows = "table_rows" EncodingRepeat = "repeat" )
View Source
const ( SlotRuntimeOverviewSections = "runtime.overview.sections" SlotRuntimePlatformSections = "runtime.platform.sections" SlotUsersPageToolbar = "users.page.toolbar" SlotUsersTableColumns = "users.table.columns" SlotUsersTableRowActions = "users.table.row_actions" SlotUsersDetailSections = "users.detail.sections" SlotUsersDetailSummary = "users.detail.summary" SlotUsersDetailActions = "users.detail.actions" SlotChatsPageToolbar = "chats.page.toolbar" SlotChatsTableColumns = "chats.table.columns" SlotChatsDetailSections = "chats.detail.sections" SlotChatsDetailActions = "chats.detail.actions" SlotPluginsListActions = "plugins.list.actions" SlotPluginsDetailSections = "plugins.detail.sections" SlotPluginsDetailActions = "plugins.detail.actions" SlotLogsToolbar = "logs.toolbar" SlotLogsDetailSections = "logs.detail.sections" SlotMetricsSections = "metrics.sections" )
View Source
const ( MaxDescriptorBytes = 128 << 10 // MaxAggregateBytes bounds the encoded, unfiltered []Provider payload, // including every server-assigned provider wrapper. MaxAggregateBytes = 256 << 10 MaxDepth = 16 MaxNodes = 512 MaxChildren = 64 MaxTableColumns = 32 MaxFormFields = 64 MaxOptions = 128 MaxIDLength = 64 MaxTitleLength = 256 MaxTextLength = 4096 MaxPointerLength = 256 MaxPointerTokens = 32 )
View Source
const OperationProtocolVersion = 1
View Source
const ProtocolVersion = 1
View Source
const TypeOperation = "operation.v1"
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
func Validate(provider string, descriptor Descriptor, modules []resources.Module) error
func ValidateOperationExtension ¶
func ValidateOperationExtension(provider string, extension OperationExtension, base Descriptor, resolve OperationResolver) error
Types ¶
type Action ¶
type Action struct {
ID string `json:"id"`
Type string `json:"type"`
Endpoint EndpointRef `json:"endpoint"`
Label string `json:"label"`
Variant string `json:"variant,omitempty"`
Destructive bool `json:"destructive,omitempty"`
Confirmation *Confirmation `json:"confirmation,omitempty"`
Form string `json:"form,omitempty"`
PathParams []ParameterBinding `json:"path_params,omitempty"`
Query []ParameterBinding `json:"query,omitempty"`
Body []BodyBinding `json:"body,omitempty"`
Invalidate []string `json:"invalidate,omitempty"`
}
type BodyBinding ¶
type Confirmation ¶
type Contribution ¶
type Customizable ¶
type Descriptor ¶
type EndpointRef ¶
type FormField ¶
type FormField struct {
ID string `json:"id"`
Key string `json:"key"`
Type string `json:"type"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
Default any `json:"default,omitempty"`
Configured bool `json:"configured,omitempty"`
PreserveEmpty bool `json:"preserve_empty,omitempty"`
Options []Option `json:"options,omitempty"`
MinLength *int `json:"min_length,omitempty"`
MaxLength *int `json:"max_length,omitempty"`
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
}
type Node ¶
type Node struct {
ID string `json:"id"`
Type string `json:"type"`
Title string `json:"title,omitempty"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Text string `json:"text,omitempty"`
Format string `json:"format,omitempty"`
Value *ValueBinding `json:"value,omitempty"`
Children []Node `json:"children,omitempty"`
Columns []TableColumn `json:"columns,omitempty"`
Form string `json:"form,omitempty"`
Action string `json:"action,omitempty"`
Customizable Customizable `json:"customizable,omitempty,omitzero"`
}
type OperationAction ¶
type OperationAction struct {
ID string `json:"id"`
Type string `json:"type"`
Operation OperationRef `json:"operation"`
Label string `json:"label"`
Variant string `json:"variant,omitempty"`
Destructive bool `json:"destructive,omitempty"`
Confirmation *Confirmation `json:"confirmation,omitempty"`
Form string `json:"form,omitempty"`
Input []OperationInputBinding `json:"input,omitempty"`
Invalidate []string `json:"invalidate,omitempty"`
}
type OperationCapability ¶
type OperationExtension ¶
type OperationExtension struct {
Views []View `json:"views"`
Contributions []Contribution `json:"contributions"`
Forms []Form `json:"forms"`
Actions []OperationAction `json:"actions"`
}
type OperationInputBinding ¶
type OperationProvider ¶
type OperationProvider struct {
ID string `json:"id"`
OperationExtension
}
type OperationRef ¶
type OperationRegistration ¶
type OperationRegistration struct {
Provider string
Base Descriptor
Extension OperationExtension
}
type OperationRegistry ¶
type OperationRegistry struct {
// contains filtered or unexported fields
}
func NewOperationRegistry ¶
func NewOperationRegistry() *OperationRegistry
func (*OperationRegistry) Discovery ¶
func (r *OperationRegistry) Discovery() (uint64, bool)
func (*OperationRegistry) RegisterBatch ¶
func (r *OperationRegistry) RegisterBatch(registrations []OperationRegistration, resolve OperationResolver) error
func (*OperationRegistry) Snapshot ¶
func (r *OperationRegistry) Snapshot(visibility OperationVisibility, uiRevision, modulesRevision uint64) OperationSnapshot
type OperationResolver ¶
type OperationSnapshot ¶
type OperationSnapshot struct {
ProtocolVersion int `json:"protocol_version"`
Revision uint64 `json:"revision"`
UIRevision uint64 `json:"ui_revision"`
ModulesRevision uint64 `json:"modules_revision"`
Providers []OperationProvider `json:"providers"`
}
type OperationVisibility ¶
type ParameterBinding ¶
type Provider ¶
type Provider struct {
ID string `json:"id"`
Descriptor
}
type Registration ¶
type Registration struct {
Provider string
Descriptor Descriptor
}
Registration is one server-namespaced descriptor in an atomic registry batch.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) RegisterBatch ¶
func (r *Registry) RegisterBatch(registrations []Registration, modules []resources.Module) error
RegisterBatch validates every descriptor before atomically publishing any of them.
type Source ¶
type Source struct {
ID string `json:"id"`
Endpoint EndpointRef `json:"endpoint"`
Mode string `json:"mode"`
PathParams []ParameterBinding `json:"path_params,omitempty"`
Query []ParameterBinding `json:"query,omitempty"`
}
type TableColumn ¶
type TableColumn struct {
ID string `json:"id"`
Label string `json:"label"`
Value ValueBinding `json:"value"`
Format string `json:"format,omitempty"`
Customizable Customizable `json:"customizable,omitempty,omitzero"`
}
type ValueBinding ¶
Click to show internal directories.
Click to hide internal directories.