Skip to content

Repository files navigation

Run History Stats (odm-usage-stat)

An OWOX Data Marts plugin that visualizes data-mart run history: a time-series bar chart (day/week/month buckets) plus five cross-filtering donut charts (data mart, status, type, run type, triggered-by), with a date-range picker and multiselect filters over each dimension.

Data source

Reads run history from the host's brokered API:

GET /api/data-marts/runs?limit=<n>&offset=<n>

Runs are paged newest-first and fetched incrementally as the selected date range widens (an in-memory cache avoids re-fetching pages already loaded). Paging stops once a page is older than the selected range's start, or after a safety cap (~5000 runs) — the UI surfaces a "capped" notice when that cap is hit so counts are known to be partial.

Credentials

Declares the data-mart credential (scope: "all") in plugin.json. Grant it when installing the plugin so owox.request can reach /api/data-marts/runs; without it, calls fail and the UI shows a permissions error.

Development

npm install
npm run dev         # Vite dev server, http://localhost:5173, hot reload — uses ui/sdk-mock.ts
                     # (local mock of @owox/plugin-sdk, backed by ui/lib/sample-runs.ts)
npm test            # vitest run --maxWorkers=4
npm run typecheck   # tsc --noEmit

npm run dev never talks to a real host — it aliases @owox/plugin-sdk to ui/sdk-mock.ts, which serves paged sample runs. You don't need npm run build for publishing — the host builds ui/ with esbuild on install (shared deps external — see the OWOX Plugin Author Contract §7.1). (npm run build runs a local Vite build for preview only.)

UI: shadcn/ui + precompiled token CSS

The UI uses shadcn/ui primitives (ui/components/ui/*, built on Radix + class-variance-authority) mapped to OWOX design tokens. The host compiles plugin CSS with the default Tailwind theme and ignores tailwind.config (Contract §7.1) — so shadcn's token utilities (bg-primary, border-input, rounded-md = var(--radius) = 8px…) would not compile in the sandboxed iframe. Instead the theme is precompiled:

  • ui/theme.css is the Tailwind source (OWOX :root/.dark tokens + the .dm-* page chrome).
  • npm run build:css compiles it with tailwind.config.ts into the shipped ui/styles.css (which ui/main.tsx imports). dev and build run it automatically; run it after changing any class names, and commit the regenerated ui/styles.css.

Radix/cva/lucide are in dependencies (the host bundles them); the token utilities live in the committed ui/styles.css. Charts remain visx.

Host integration testing

To exercise real capability calls (dev:broker) or a full install against a running host, this repo needs to live inside the owox monorepo under packages/:

# from the owox monorepo root
cp -r /path/to/odm-usage-stat packages/odm-usage-stat
npm install   # run once from the monorepo root; workspaces link the SDK + the dev runner
cd packages/odm-usage-stat
npm run dev:broker   # iframe on :5177, capability broker on :5178, fed from owox.dev.json

See the OWOX Plugin Author Contract, §10 Steps 3–4, for owox.dev.json setup and the full install/consent flow against a locally running host (./start.sh --dev).

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages