@ossy/dashboard
v3.21.0
Published
Workspace dashboards with pinnable slot widgets
Readme
@ossy/dashboard
Workspace dashboards. Authenticated / hosts render WorkspaceDashboard when the package is enabled. Dashboards store pinned slot widgets by metadata.id.
Primitives
| Primitive | Id |
|-----------|----|
| Schema | @ossy/dashboard/schema/dashboard |
| Actions | @ossy/dashboard/actions/{create-dashboard,list-dashboards,update-dashboard,pin-widget} |
| Location | /@ossy/dashboard/dashboards/ |
Dashboard content.widgets is [{ id, componentId, props? }]. The host renders each with <Slot view={componentId} />.
Registering widgets (any package)
Pinable widgets are not hardcoded in @ossy/dashboard. Feature packages register them on a *.component.jsx:
export const metadata = {
id: '@ossy/consultancy/view/current-month',
dashboardWidget: {
titleKey: 'consultancy.widgets.forecastCurrentMonth.title',
descriptionKey: 'consultancy.widgets.forecastCurrentMonth.description',
},
}
export default CurrentMonthForecastWidgetapp build writes matching entries to manifest.dashboardWidgets (and onto manifest.components[]). The dashboard UI reads app.dashboardWidgets at runtime.
Sharing
Dashboards default to access: 'workspace' so teammates see them. Multiple dashboards per workspace are supported; isDefault selects the signed-in home. The in-page switcher is local session selection and does not mutate the shared default.
Host wiring
Only mount when the workspace has @ossy/dashboard enabled — do not invoke list/create actions otherwise.
import { WorkspaceDashboard } from '@ossy/dashboard'
import { isServiceEntitled } from '@ossy/workspaces/entitlements'
if (isServiceEntitled(services, '@ossy/dashboard')) {
return <WorkspaceDashboard />
}