Skip to content

Commit 0aa6ece

Browse files
fix: resolve CI build and test errors
- Fix appConfig → appConfigs[0] in i18n-translations.test.ts (lines 138, 165) - Remove unused import resolveI18nLabel from HomePage.tsx - Remove unused imports Upload and FileText from QuickActions.tsx - Export customReportsConfig from objectstack.shared.ts and include in mock server/browser to make sales_performance_q1 report available in test metadata Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/9f8790f4-e34a-4ac2-9322-7a3347f499c6 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 30a07bb commit 0aa6ece

6 files changed

Lines changed: 28 additions & 21 deletions

File tree

apps/console/objectstack.shared.ts

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

54+
// Custom reports not part of any individual app config but needed by tests/aggregated config
55+
export const customReportsConfig = {
56+
reports: [
57+
{
58+
name: 'sales_performance_q1',
59+
label: 'Q1 Sales Performance',
60+
description: 'Quarterly analysis of sales revenue by region and product line',
61+
objectName: 'opportunity',
62+
type: 'summary',
63+
columns: [
64+
{ field: 'name', label: 'Deal Name' },
65+
{ field: 'amount', label: 'Amount', aggregate: 'sum' },
66+
{ field: 'stage', label: 'Stage' },
67+
{ field: 'close_date', label: 'Close Date' }
68+
]
69+
}
70+
],
71+
manifest: { id: 'custom-reports', name: 'custom-reports' },
72+
};
73+
5474
// Patch CRM App Navigation to include Report using a supported navigation type
5575
const apps = [
5676
...JSON.parse(JSON.stringify(appConfigs.flatMap((c: any) => c.apps || []))),
@@ -92,19 +112,7 @@ export const sharedConfig = {
92112
dashboards: appConfigs.flatMap((c: any) => c.dashboards || []),
93113
reports: [
94114
...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-
}
115+
...customReportsConfig.reports,
108116
],
109117
pages: appConfigs.flatMap((c: any) => c.pages || []),
110118
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/HomePage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { useMetadata } from '../../context/MetadataProvider';
2121
import { useRecentItems } from '../../hooks/useRecentItems';
2222
import { useFavorites } from '../../hooks/useFavorites';
2323
import { useObjectTranslation } from '@object-ui/i18n';
24-
import { resolveI18nLabel } from '../../utils';
2524
import { QuickActions } from './QuickActions';
2625
import { AppCard } from './AppCard';
2726
import { RecentApps } from './RecentApps';

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)