Documentation / @zerotal/admin / index / PanelInstance
Class: PanelInstance
Defined in: admin/src/PanelInstance.ts:93
Constructors
Constructor
new PanelInstance(
id,config?):PanelInstance
Defined in: admin/src/PanelInstance.ts:115
Parameters
id
string
config?
Partial<AdminConfigShape> = {}
Returns
PanelInstance
Properties
id
readonlyid:string
Defined in: admin/src/PanelInstance.ts:95
Stable identifier, used for route naming and shell identity.
Methods
configure()
configure(
config):void
Defined in: admin/src/PanelInstance.ts:121
Merge in panel configuration.
Parameters
config
Partial<AdminConfigShape>
Returns
void
config()
config():
AdminConfigShape
Defined in: admin/src/PanelInstance.ts:125
Returns
base()
base():
string
Defined in: admin/src/PanelInstance.ts:130
The panel's URL prefix, without a trailing slash.
Returns
string
register()
register(...
resources):void
Defined in: admin/src/PanelInstance.ts:135
Register one or more resources (idempotent by slug).
Parameters
resources
...typeof Resource[]
Returns
void
resources()
resources(): typeof
Resource[]
Defined in: admin/src/PanelInstance.ts:143
Returns
typeof Resource[]
widgets()
widgets(...
widgets):void
Defined in: admin/src/PanelInstance.ts:148
Register dashboard widgets (stats overview and/or charts).
Parameters
widgets
...DashboardWidget[]
Returns
void
dashboardWidgets()
dashboardWidgets():
DashboardWidget[]
Defined in: admin/src/PanelInstance.ts:152
Returns
notifications()
notifications(
provider):void
Defined in: admin/src/PanelInstance.ts:157
Wire up the notification center (app supplies the data).
Parameters
provider
Returns
void
notificationProvider()
notificationProvider():
NotificationProvider|undefined
Defined in: admin/src/PanelInstance.ts:161
Returns
NotificationProvider | undefined
auth()
auth(
config):void
Defined in: admin/src/PanelInstance.ts:166
Enable + configure the built-in auth pages (login / profile / reset / verify).
Parameters
config
Returns
void
authConfig()
authConfig():
AdminAuthConfig|undefined
Defined in: admin/src/PanelInstance.ts:171
The resolved auth-pages config (or undefined when not enabled).
Returns
AdminAuthConfig | undefined
savedViews()
savedViews(
provider):void
Defined in: admin/src/PanelInstance.ts:176
Wire up saved list views (app supplies the storage).
Parameters
provider
Returns
void
savedViewProvider()
savedViewProvider():
SavedViewProvider|undefined
Defined in: admin/src/PanelInstance.ts:181
The saved-view provider, or undefined when the app configured none.
Returns
SavedViewProvider | undefined
media()
media(
provider,options?):void
Defined in: admin/src/PanelInstance.ts:193
Wire up the media library (app supplies the catalogue).
disk names the storage disk files are written to and read back from. It
matters which: the default disk is private and has no URL, so a library
left on it stores uploads successfully and shows broken images for every
one of them.
Parameters
provider
options?
disk?
string
Returns
void
mediaDisk()
mediaDisk():
string|undefined
Defined in: admin/src/PanelInstance.ts:199
The disk the media library reads and writes, or undefined for the default.
Returns
string | undefined
mediaProvider()
mediaProvider():
MediaProvider|undefined
Defined in: admin/src/PanelInstance.ts:204
The media provider, or undefined when the app configured none.
Returns
MediaProvider | undefined
roles()
roles(
provider):void
Defined in: admin/src/PanelInstance.ts:209
Wire up the roles and permissions page (app supplies the storage).
Parameters
provider
Returns
void
roleProvider()
roleProvider():
RoleProvider|undefined
Defined in: admin/src/PanelInstance.ts:214
The role provider, or undefined when the app configured none.
Returns
RoleProvider | undefined
dashboardLayout()
dashboardLayout(
store):void
Defined in: admin/src/PanelInstance.ts:219
Let each user arrange the dashboard (app supplies the storage).
Parameters
store
Returns
void
dashboardLayoutStore()
dashboardLayoutStore():
DashboardLayoutStore|undefined
Defined in: admin/src/PanelInstance.ts:224
The dashboard layout store, or undefined when the app configured none.
Returns
DashboardLayoutStore | undefined
find()
find(
slug): typeofResource|undefined
Defined in: admin/src/PanelInstance.ts:229
Resolve a resource by its URL slug.
Parameters
slug
string
Returns
typeof Resource | undefined
pages()
pages(...
pages):void
Defined in: admin/src/PanelInstance.ts:241
Register one or more AdminPage subclasses (idempotent by slug).
This is the app-facing door. Packages contribute through host instead, so they need no dependency on this one.
Parameters
pages
...AdminPageClass[]
Returns
void
registeredPages()
registeredPages():
PanelPage[]
Defined in: admin/src/PanelInstance.ts:262
Every registered custom page, from both doors.
Returns
findPage()
findPage(
slug):PanelPage|undefined
Defined in: admin/src/PanelInstance.ts:267
Resolve a custom page by its slug.
Parameters
slug
string
Returns
PanelPage | undefined
plugin()
plugin(...
plugins):Promise<void>
Defined in: admin/src/PanelInstance.ts:282
Install an app-authored plugin. The mirror of what a package does through the
admin.panel binding, for code that can name the panel directly.
Parameters
plugins
...AdminPlugin[]
Returns
Promise<void>
pluginEnabled()
pluginEnabled(
id):boolean
Defined in: admin/src/PanelInstance.ts:292
Whether a contributor is switched on. Contributors are on unless the app
turns them off with plugins: { monitor: false } in config/admin.ts.
Parameters
id
string
Returns
boolean
host()
host():
AdminPanelHost
Defined in: admin/src/PanelInstance.ts:303
The panel's write surface, bound into the container as admin.panel.
Contributions are appended, never deduplicated by identity — a provider that boots twice in one process (some test harnesses do) would double up, so each registrar guards on the natural key where it has one.
Returns
renderHook()
renderHook(
name,hook):void
Defined in: admin/src/PanelInstance.ts:352
Render something at a named position in the panel's chrome. See RenderHookName for the positions.
Parameters
name
hook
Returns
void
renderHooks()
renderHooks(
name):RenderHook[]
Defined in: admin/src/PanelInstance.ts:359
Hooks registered at name, in registration order.
Parameters
name
Returns
consoles()
consoles():
ConsoleContribution[]
Defined in: admin/src/PanelInstance.ts:364
Every registered console.
Returns
findConsole()
findConsole(
slug):ConsoleContribution|undefined
Defined in: admin/src/PanelInstance.ts:369
Resolve a console by its slug.
Parameters
slug
string
Returns
ConsoleContribution | undefined
contributedWidgets()
contributedWidgets():
WidgetContribution[]
Defined in: admin/src/PanelInstance.ts:374
Contributed dashboard widgets, in sort order. Not ability-filtered — see visibleWidgets.
Returns
visibleWidgets()
visibleWidgets():
Promise<DashboardWidget[]>
Defined in: admin/src/PanelInstance.ts:379
Contributed dashboard widgets the current user may see.
Returns
Promise<DashboardWidget[]>
visibleSearchProviders()
visibleSearchProviders():
Promise<PanelSearchProvider[]>
Defined in: admin/src/PanelInstance.ts:385
Contributed global-search providers the current user may query.
Returns
Promise<PanelSearchProvider[]>
visibleTopbarSlots()
visibleTopbarSlots():
Promise<TopbarSlot[]>
Defined in: admin/src/PanelInstance.ts:390
Contributed top-bar slots the current user may see, in sort order.
Returns
Promise<TopbarSlot[]>
visibleUserMenuItems()
visibleUserMenuItems():
Promise<UserMenuContribution[]>
Defined in: admin/src/PanelInstance.ts:396
Contributed user-menu entries the current user may see, in sort order.
Returns
Promise<UserMenuContribution[]>
can()
can(
ability):Promise<boolean>
Defined in: admin/src/PanelInstance.ts:410
Whether the current user holds ability, resolved through the app's
authorize hook, then the gate binding, then a fail-closed default.
Resources are not filtered through here — they authorize through their own
Resource.can("viewAny"), which carries record context this cannot.
Parameters
ability
string | undefined
Returns
Promise<boolean>
navigationBadges()
navigationBadges():
Promise<Record<string, {text:string;color:string; }>>
Defined in: admin/src/PanelInstance.ts:427
Resolve every resource's sidebar navigation badge, keyed by slug. Failures are swallowed so a broken badge query never takes down the whole sidebar.
Returns
Promise<Record<string, { text: string; color: string; }>>
reset()
reset():
void
Defined in: admin/src/PanelInstance.ts:457
Reset the registry (tests).
Returns
void
navigation()
navigation():
NavGroup[]
Defined in: admin/src/PanelInstance.ts:484
Build the sidebar navigation, grouped and sorted — resources, custom pages and contributed links together.
Entries are not ability-filtered here; this is the full map, used for route mounting and tests. What a given user may see is visibleNavigation.
Returns
NavGroup[]
visibleNavigation()
visibleNavigation():
Promise<NavGroup[]>
Defined in: admin/src/PanelInstance.ts:612
The navigation as the current user may see it: entries whose ability they lack are dropped, along with any group left empty.
Resource entries are filtered by Resource.can("viewAny"); page and
contributed entries by their declared ability. A parent whose ability is
denied takes its children with it.
Returns
Promise<NavGroup[]>