Skip to content

Commit e7e1d80

Browse files
Copilothotlong
andcommitted
refactor: inline previewSchema variable and update ROADMAP
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 01ee874 commit e7e1d80

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,7 @@ The `FlowDesigner` is a canvas-based flow editor that bridges the gap between th
986986
- [x] **P1: Dashboard Widget Data Blank — useDataScope/dataSource Injection Fix** — Fixed root cause of dashboard widgets showing blank data with no server requests: `useDataScope(undefined)` was returning the full context `dataSource` (service adapter) instead of `undefined` when no bind path was given, causing ObjectChart and all data components (ObjectKanban, ObjectGallery, ObjectTimeline, ObjectGrid) to treat the adapter as pre-bound data and skip async fetching. Fixed `useDataScope` to return `undefined` when no path is provided. Also improved ObjectChart fault tolerance: uses `useContext` directly instead of `useSchemaContext` (no throw without provider), validates `dataSource.find` is callable before invoking. 14 new tests (7 useDataScope + 7 ObjectChart data fetch/fault tolerance).
987987
- [x] **P1: URL-Driven Debug/Developer Panel** — Universal debug mode activated via `?__debug` URL parameter (amis devtools-style). `@object-ui/core`: exported `DebugFlags`, `DebugCollector` (perf/expr/event data collection, tree-shakeable), `parseDebugFlags()`, enhanced `isDebugEnabled()` (URL → globalThis → env resolution, SSR-safe). `@object-ui/react`: `useDebugMode` hook with URL detection, Ctrl+Shift+D shortcut, manual toggle; `SchemaRendererContext` extended with `debugFlags`; `SchemaRenderer` injects `data-debug-type`/`data-debug-id` attrs + reports render perf to `DebugCollector` when debug enabled. `@object-ui/components`: floating `DebugPanel` with 7 built-in tabs (Schema, Data, Perf, Expr, Events, Registry, Flags), plugin-extensible via `extraTabs`. Console `MetadataInspector` auto-opens when `?__debug` detected. Fine-grained sub-flags: `?__debug_schema`, `?__debug_perf`, `?__debug_data`, `?__debug_expr`, `?__debug_events`, `?__debug_registry`. 48 new tests.
988988
- [x] **P1: Chart Widget Server-Side Aggregation** — Fixed chart widgets (bar/line/area/pie/donut/scatter) downloading all raw data and aggregating client-side. Added optional `aggregate()` method to `DataSource` interface (`AggregateParams`, `AggregateResult` types) enabling server-side grouping/aggregation via analytics API (e.g. `GET /api/v1/analytics/{resource}?category=…&metric=…&agg=…`). `ObjectChart` now prefers `dataSource.aggregate()` when available, falling back to `dataSource.find()` + client-side aggregation for backward compatibility. Implemented `aggregate()` in `ValueDataSource` (in-memory), `ApiDataSource` (HTTP), and `ObjectStackAdapter` (analytics API with client-side fallback). Only detail widgets (grid/table/list) continue to fetch full data. 9 new tests.
989+
- [x] **P1: CRM i18n Console Integration** — Fixed CRM internationalization not taking effect on the console. Root cause: `crmLocales` (10 languages) were exported from the CRM example but never loaded into the I18nProvider. Fix: imported `crmLocales` in `main.tsx` and passed them under the `crm.*` namespace to `I18nProvider` config. Added `translateCrmNavigation()` utility to translate sidebar navigation labels, `translateCrmDashboardWidgets()` for dashboard widget titles, and CRM app name/description translation in AppSidebar. Updated `resolveI18nLabel()` to optionally accept a `t` function for I18nLabel objects.
989990

990991
### Ecosystem & Marketplace
991992
- Plugin marketplace website with search, ratings, and install count

apps/console/src/components/DashboardView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,11 @@ export function DashboardView({ dataSource }: { dataSource?: any }) {
376376
);
377377
}
378378

379-
const previewSchemaRaw = editSchema || dashboard;
380379
const previewSchema = useMemo(() => {
381-
if (!previewSchemaRaw?.widgets) return previewSchemaRaw;
382-
return { ...previewSchemaRaw, widgets: translateCrmDashboardWidgets(previewSchemaRaw.widgets, t) };
383-
}, [previewSchemaRaw, t]);
380+
const raw = editSchema || dashboard;
381+
if (!raw?.widgets) return raw;
382+
return { ...raw, widgets: translateCrmDashboardWidgets(raw.widgets, t) };
383+
}, [editSchema, dashboard, t]);
384384

385385
return (
386386
<div className="flex flex-col h-full overflow-hidden bg-background">

0 commit comments

Comments
 (0)