Skip to content

Commit 10625d6

Browse files
os-zhuangCopilot
andcommitted
refactor: remove fake page/view designers, keep dashboard editor
The View 'designer' tab and Page Canvas Editor never produced usable output. They are removed entirely: - Drop ObjectViewConfigurator, PageCanvasEditor, PageDesignPage from @object-ui/plugin-designer - Drop DesignDrawer from @object-ui/app-shell; PageView now renders pages read-only from metadata - Drop /design/page route DashboardEditor + DashboardDesignPage are kept since they are a real, working editor. /design/dashboard/:dashboardName route is preserved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 72229f4 commit 10625d6

8 files changed

Lines changed: 192 additions & 1616 deletions

File tree

packages/app-shell/src/console/AppContent.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ const MetadataResourceListPage = lazy(() => import('../views/metadata-admin').th
5353
const MetadataResourceEditPage = lazy(() => import('../views/metadata-admin').then(m => ({ default: m.MetadataResourceEditPage })));
5454
const MetadataResourceHistoryPage = lazy(() => import('../views/metadata-admin').then(m => ({ default: m.MetadataResourceHistoryPage })));
5555

56-
// App authoring pages — sourced from @object-ui/plugin-designer so third-party
57-
// hosts can opt out by not registering these routes.
56+
// App authoring + dashboard editor pages — sourced from
57+
// @object-ui/plugin-designer so third-party hosts can opt out by not
58+
// registering these routes.
5859
const CreateAppPage = lazy(() => import('@object-ui/plugin-designer').then(m => ({ default: m.CreateAppPage })));
5960
const EditAppPage = lazy(() => import('@object-ui/plugin-designer').then(m => ({ default: m.EditAppPage })));
61+
const DashboardDesignPage = lazy(() => import('@object-ui/plugin-designer').then(m => ({ default: m.DashboardDesignPage })));
6062

6163
// Marketplace pages — first-class platform feature; mounted at `system/marketplace`
6264
// under any active app so admins can browse + install from inside the runtime.
@@ -406,6 +408,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
406408
landed. Redirect to the new /metadata/:type/... shape. */}
407409
<Route path="component/metadata/directory" element={<LegacyMetadataRedirect mode="directory" />} />
408410
<Route path="component/metadata/resource/*" element={<LegacyMetadataRedirect mode="resource" />} />
411+
<Route path="design/dashboard/:dashboardName" element={<DashboardDesignPage />} />
409412
<Route path="search" element={<SearchResultsPage />} />
410413
<Route path="create-app" element={<CreateAppPage />} />
411414
<Route path="edit-app/:editAppName" element={<EditAppPage />} />

packages/app-shell/src/views/DesignDrawer.tsx

Lines changed: 0 additions & 115 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Page View Component
3+
*
4+
* Renders a custom page based on the pageName parameter. Page authoring
5+
* happens via the metadata admin (JSON form / preview tabs); no bespoke
6+
* canvas editor is offered here.
7+
*/
8+
9+
import { useParams, useSearchParams } from 'react-router-dom';
10+
import { SchemaRenderer } from '@object-ui/react';
11+
import { Empty, EmptyTitle, EmptyDescription } from '@object-ui/components';
12+
import { FileText } from 'lucide-react';
13+
import { useObjectTranslation } from '@object-ui/i18n';
14+
import { MetadataPanel, useMetadataInspector } from './MetadataInspector';
15+
import { useMetadata } from '../providers/MetadataProvider';
16+
17+
export function PageView() {
18+
const { t } = useObjectTranslation();
19+
const { pageName } = useParams<{ pageName: string }>();
20+
const [searchParams] = useSearchParams();
21+
const { showDebug } = useMetadataInspector();
22+
23+
const { pages } = useMetadata();
24+
const page = pages?.find((p: any) => p.name === pageName);
25+
26+
if (!page) {
27+
return (
28+
<div className="h-full flex items-center justify-center p-8">
29+
<Empty>
30+
<div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted">
31+
<FileText className="h-6 w-6 text-muted-foreground" />
32+
</div>
33+
<EmptyTitle>{t('empty.pageNotFound')}</EmptyTitle>
34+
<EmptyDescription>
35+
{t('empty.pageNotFoundDescription', { name: pageName })}
36+
</EmptyDescription>
37+
</Empty>
38+
</div>
39+
);
40+
}
41+
42+
const params = Object.fromEntries(searchParams.entries());
43+
44+
return (
45+
<div className="flex flex-row h-full w-full overflow-hidden relative">
46+
<div className="flex-1 overflow-auto h-full relative">
47+
<SchemaRenderer
48+
schema={{
49+
...page,
50+
type: (page as any).type || 'page',
51+
context: { ...(page as any).context, params },
52+
}}
53+
/>
54+
</div>
55+
<MetadataPanel
56+
open={showDebug}
57+
sections={[{ title: 'Page Configuration', data: page }]}
58+
/>
59+
</div>
60+
);
61+
}

packages/app-shell/src/views/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ export { ActionResultDialog, type ResultDialogState } from './ActionResultDialog
1212
export { MetadataToggle, MetadataPanel } from './MetadataInspector';
1313
export { ViewConfigPanel } from './ViewConfigPanel';
1414
export { CreateViewDialog } from './CreateViewDialog';
15-
export { DesignDrawer } from './DesignDrawer';

0 commit comments

Comments
 (0)