Skip to content

Commit b7634c1

Browse files
committed
docs: move dashboard plugin to globalPlugins
1 parent 800e3fe commit b7634c1

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

adminforth/documentation/docs/tutorial/09-Plugins/27-0-dashboard.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,27 @@ export const admin = new AdminForth({
175175

176176
### 4. Configure Plugin
177177

178-
Attach the plugin to one of your resources, usually the users resource:
178+
Register the plugin in the application's `globalPlugins` array:
179179

180-
```ts title="./resources/adminuser.ts"
180+
```ts title="./globalPlugins.ts"
181181
import DashboardPlugin from '@adminforth/dashboard';
182182

183-
export default {
183+
export const globalPlugins = [
184+
new DashboardPlugin({
185+
dashboardConfigsResourceId: 'dashboard_configs',
186+
}),
187+
];
188+
```
189+
190+
Then pass it to the AdminForth configuration:
191+
192+
```ts title="./index.ts"
193+
import { globalPlugins } from './globalPlugins.js';
194+
195+
export const admin = new AdminForth({
184196
// ...
185-
plugins: [
186-
// ...
187-
new DashboardPlugin({
188-
dashboardConfigsResourceId: 'dashboard_configs',
189-
}),
190-
],
191-
} as AdminForthResourceInput;
197+
globalPlugins,
198+
});
192199
```
193200

194201
After `admin.discoverDatabases()` runs, the plugin creates a default dashboard config if the table is empty:

0 commit comments

Comments
 (0)