Skip to content

Commit 6974168

Browse files
authored
Merge pull request #1170 from objectstack-ai/copilot/fix-ci-build-test-errors-one-more-time
2 parents 905c24c + 6ff8d03 commit 6974168

6 files changed

Lines changed: 35 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Fixed
1919

20+
- **CI build errors** (`@object-ui/console`): Removed unused imports (`resolveI18nLabel` in `HomePage.tsx`, `Upload`/`FileText` in `QuickActions.tsx`) that caused TS6133 errors. Fixed `appConfig``appConfigs[0]` in `i18n-translations.test.ts` (TS2552). Extracted `customReportsConfig` from aggregated `sharedConfig` into a standalone export so the mock server kernel includes the `sales_performance_q1` report, fixing `ReportView.test.tsx` failures.
21+
2022
- **Charts groupBy value→label resolution** (`@object-ui/plugin-charts`): Chart X-axis labels now display human-readable labels instead of raw values. Select/picklist fields resolve value→label via field metadata options, lookup/master_detail fields batch-fetch referenced record names, and all other fields fall back to `humanizeLabel()` (snake_case → Title Case). Removed hardcoded `value.slice(0, 3)` truncation from `AdvancedChartImpl.tsx` XAxis tick formatters — desktop now shows full labels with angle rotation for long text, mobile truncates at 8 characters with "…".
2123

2224
- **Analytics aggregate measures format** (`@object-ui/data-objectstack`): Fixed `aggregate()` method to send `measures` as string array (`['amount_sum']`, `['count']`) instead of object array (`[{ field, function }]`). The backend `MemoryAnalyticsService.resolveMeasure()` expects strings and calls `.split('.')`, causing `TypeError: t.split is not a function` when receiving objects. Also fixed `dimensions` to send an empty array when `groupBy` is `'_all'` (single-bucket aggregation), and added response mapping to rename measure keys (e.g. `amount_sum`) back to the original field name (`amount`) for consumer compatibility. Additionally fixed chart rendering blank issue: the `rawRows` extraction now handles the `{ rows: [...] }` envelope (when the SDK unwraps the outer `{ success, data }` wrapper) and the `{ data: { rows: [...] } }` envelope (when the SDK returns the full response), matching the actual shape returned by the analytics API (`/api/v1/analytics/query`).

apps/console/objectstack.shared.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,31 @@ export const setupAppConfig = {
5151
manifest: { id: 'setup', name: 'setup' },
5252
};
5353

54+
/**
55+
* Additional reports that are not part of any individual app config.
56+
* Loaded as a separate AppPlugin instance by the mock server (server.ts)
57+
* and browser mock (browser.ts) so that these reports appear in the
58+
* kernel's metadata alongside the app-specific reports.
59+
*/
60+
export const customReportsConfig = {
61+
reports: [
62+
{
63+
name: 'sales_performance_q1',
64+
label: 'Q1 Sales Performance',
65+
description: 'Quarterly analysis of sales revenue by region and product line',
66+
objectName: 'opportunity',
67+
type: 'summary',
68+
columns: [
69+
{ field: 'name', label: 'Deal Name' },
70+
{ field: 'amount', label: 'Amount', aggregate: 'sum' },
71+
{ field: 'stage', label: 'Stage' },
72+
{ field: 'close_date', label: 'Close Date' }
73+
]
74+
}
75+
],
76+
manifest: { id: 'reports', name: 'reports' },
77+
};
78+
5479
// Patch CRM App Navigation to include Report using a supported navigation type
5580
const apps = [
5681
...JSON.parse(JSON.stringify(appConfigs.flatMap((c: any) => c.apps || []))),
@@ -92,19 +117,7 @@ export const sharedConfig = {
92117
dashboards: appConfigs.flatMap((c: any) => c.dashboards || []),
93118
reports: [
94119
...appConfigs.flatMap((c: any) => c.reports || []),
95-
{
96-
name: 'sales_performance_q1',
97-
label: 'Q1 Sales Performance',
98-
description: 'Quarterly analysis of sales revenue by region and product line',
99-
objectName: 'opportunity',
100-
type: 'summary',
101-
columns: [
102-
{ field: 'name', label: 'Deal Name' },
103-
{ field: 'amount', label: 'Amount', aggregate: 'sum' },
104-
{ field: 'stage', label: 'Stage' },
105-
{ field: 'close_date', label: 'Close Date' }
106-
]
107-
}
120+
...customReportsConfig.reports,
108121
],
109122
pages: appConfigs.flatMap((c: any) => c.pages || []),
110123
manifest: {

apps/console/src/__tests__/i18n-translations.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe('i18n translations pipeline', () => {
135135
});
136136

137137
it('appConfig.translations is spec-format array for AppPlugin', () => {
138-
const translations = (appConfig as any).translations;
138+
const translations = (appConfigs[0] as any).translations;
139139

140140
expect(Array.isArray(translations)).toBe(true);
141141
expect(translations.length).toBeGreaterThan(0);
@@ -162,7 +162,7 @@ describe('i18n translations pipeline', () => {
162162
const svc = createMemoryI18n();
163163

164164
// Simulate AppPlugin.loadTranslations() iterating the spec-format translations array
165-
const translations = (appConfig as any).translations;
165+
const translations = (appConfigs[0] as any).translations;
166166
for (const bundle of translations) {
167167
for (const [locale, data] of Object.entries(bundle)) {
168168
if (data && typeof data === 'object') {

apps/console/src/mocks/browser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { setupWorker } from 'msw/browser';
1616
import { ObjectKernel } from '@objectstack/runtime';
1717
import { InMemoryDriver } from '@objectstack/driver-memory';
1818
import type { MSWPlugin } from '@objectstack/plugin-msw';
19-
import { appConfigs, setupAppConfig } from '../../objectstack.shared';
19+
import { appConfigs, setupAppConfig, customReportsConfig } from '../../objectstack.shared';
2020
import { createKernel } from './createKernel';
2121
import { createAuthHandlers } from './authHandlers';
2222

@@ -43,7 +43,7 @@ export async function startMockServer() {
4343
if (import.meta.env.DEV) console.log('[MSW] Starting ObjectStack Runtime (Browser Mode)...');
4444

4545
const result = await createKernel({
46-
appConfigs: [...appConfigs, setupAppConfig],
46+
appConfigs: [...appConfigs, setupAppConfig, customReportsConfig],
4747
mswOptions: {
4848
enableBrowser: false,
4949
baseUrl: '/api/v1',

apps/console/src/mocks/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ObjectKernel } from '@objectstack/runtime';
1616
import { InMemoryDriver } from '@objectstack/driver-memory';
1717
import { setupServer } from 'msw/node';
1818
import type { MSWPlugin } from '@objectstack/plugin-msw';
19-
import { appConfigs, setupAppConfig } from '../../objectstack.shared';
19+
import { appConfigs, setupAppConfig, customReportsConfig } from '../../objectstack.shared';
2020
import { createKernel } from './createKernel';
2121
import { createAuthHandlers } from './authHandlers';
2222

@@ -34,7 +34,7 @@ export async function startMockServer() {
3434
console.log('[MSW] Starting ObjectStack Runtime (Test Mode)...');
3535

3636
const result = await createKernel({
37-
appConfigs: [...appConfigs, setupAppConfig],
37+
appConfigs: [...appConfigs, setupAppConfig, customReportsConfig],
3838
persistence: false,
3939
mswOptions: {
4040
enableBrowser: false,

apps/console/src/pages/home/QuickActions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import { useNavigate } from 'react-router-dom';
1111
import { useObjectTranslation } from '@object-ui/i18n';
1212
import { Card, CardContent } from '@object-ui/components';
13-
import { Plus, Upload, Settings, Database, FileText } from 'lucide-react';
13+
import { Plus, Settings, Database } from 'lucide-react';
1414
import { cn } from '@object-ui/components';
1515

1616
interface QuickAction {

0 commit comments

Comments
 (0)