David Höck 2a5abe51ff fix(dashboard-plugin): Update cache TTL for metrics to 2 hours 5 meses atrás
..
src 2a5abe51ff fix(dashboard-plugin): Update cache TTL for metrics to 2 hours 5 meses atrás
README.md 612d527e14 feat(dashboard-plugin): Introduce Dashboard Plugin with metrics API and static file serving 5 meses atrás
package.json 612d527e14 feat(dashboard-plugin): Introduce Dashboard Plugin with metrics API and static file serving 5 meses atrás
tsconfig.build.json 612d527e14 feat(dashboard-plugin): Introduce Dashboard Plugin with metrics API and static file serving 5 meses atrás
tsconfig.json 612d527e14 feat(dashboard-plugin): Introduce Dashboard Plugin with metrics API and static file serving 5 meses atrás

README.md

Dashboard Plugin

This plugin serves the static files of the Vendure Dashboard UI and provides the GraphQL extensions needed for the order metrics on the dashboard index page.

Installation

yarn add @vendure/dashboard-plugin

or

npm install @vendure/dashboard-plugin

Usage

Basic usage - serving the Dashboard UI

import { DashboardPlugin } from '@vendure/dashboard-plugin';

const config: VendureConfig = {
  // Add an instance of the plugin to the plugins array
  plugins: [
    DashboardPlugin.init({ route: 'dashboard' }),
  ],
};

The Dashboard UI will be served at the /dashboard/ path.

Using only the metrics API

If you are building a stand-alone version of the Dashboard UI app and don't need this plugin to serve the Dashboard UI, you can still use the metricSummary query by adding the DashboardPlugin to the plugins array without calling the init() method:

import { DashboardPlugin } from '@vendure/dashboard-plugin';

const config: VendureConfig = {
  plugins: [
    DashboardPlugin, // <-- no call to .init()
  ],
  // ...
};

Custom Dashboard UI build

You can also provide a custom build of the Dashboard UI:

import { DashboardPlugin } from '@vendure/dashboard-plugin';

const config: VendureConfig = {
  plugins: [
    DashboardPlugin.init({ 
      route: 'dashboard',
      app: path.join(__dirname, 'custom-dashboard-build'),
    }),
  ],
};

API

DashboardPluginOptions

  • route: string - The route at which the Dashboard UI will be served (default: 'dashboard')
  • app?: string - Optional path to a custom build of the Dashboard UI