Skip to content

Commit 256383d

Browse files
Standardize metadata types to singular form across Studio frontend
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/4b4cd0a2-3590-43af-8b11-0e6b59c0e99a Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 3b16333 commit 256383d

File tree

7 files changed

+67
-81
lines changed

7 files changed

+67
-81
lines changed

apps/studio/src/components/app-sidebar.tsx

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -73,38 +73,32 @@ import {
7373
// ─── Icon & label hints ──────────────────────────────────────────────
7474
const META_TYPE_HINTS: Record<string, { label: string; icon: LucideIcon }> = {
7575
object: { label: 'Objects', icon: Package },
76-
objects: { label: 'Objects', icon: Package },
77-
hooks: { label: 'Hooks', icon: Anchor },
78-
mappings: { label: 'Mappings', icon: Map },
79-
analyticsCubes: { label: 'Analytics Cubes', icon: PieChart },
76+
hook: { label: 'Hooks', icon: Anchor },
77+
mapping: { label: 'Mappings', icon: Map },
78+
analyticsCube: { label: 'Analytics Cubes', icon: PieChart },
8079
data: { label: 'Seed Data', icon: Database },
8180
app: { label: 'Apps', icon: AppWindow },
82-
apps: { label: 'Apps', icon: AppWindow },
83-
actions: { label: 'Actions', icon: Zap },
84-
views: { label: 'Views', icon: Eye },
85-
pages: { label: 'Pages', icon: FileCode },
86-
dashboards: { label: 'Dashboards', icon: BarChart3 },
87-
reports: { label: 'Reports', icon: FileText },
88-
themes: { label: 'Themes', icon: Palette },
89-
flows: { label: 'Flows', icon: Workflow },
90-
workflows: { label: 'Workflows', icon: Workflow },
91-
approvals: { label: 'Approvals', icon: CheckSquare },
92-
webhooks: { label: 'Webhooks', icon: Webhook },
93-
roles: { label: 'Roles', icon: UserCog },
94-
permissions: { label: 'Permissions', icon: Lock },
95-
profiles: { label: 'Profiles', icon: Shield },
96-
sharingRules: { label: 'Sharing Rules', icon: Shield },
97-
policies: { label: 'Policies', icon: Shield },
81+
action: { label: 'Actions', icon: Zap },
82+
view: { label: 'Views', icon: Eye },
83+
page: { label: 'Pages', icon: FileCode },
84+
dashboard: { label: 'Dashboards', icon: BarChart3 },
85+
report: { label: 'Reports', icon: FileText },
86+
theme: { label: 'Themes', icon: Palette },
87+
flow: { label: 'Flows', icon: Workflow },
88+
workflow: { label: 'Workflows', icon: Workflow },
89+
approval: { label: 'Approvals', icon: CheckSquare },
90+
webhook: { label: 'Webhooks', icon: Webhook },
91+
role: { label: 'Roles', icon: UserCog },
92+
permission: { label: 'Permissions', icon: Lock },
93+
profile: { label: 'Profiles', icon: Shield },
94+
sharingRule: { label: 'Sharing Rules', icon: Shield },
95+
policy: { label: 'Policies', icon: Shield },
9896
agent: { label: 'Agents', icon: Bot },
99-
agents: { label: 'Agents', icon: Bot },
10097
tool: { label: 'Tools', icon: Wrench },
101-
tools: { label: 'Tools', icon: Wrench },
10298
ragPipeline: { label: 'RAG Pipelines', icon: BookOpen },
103-
ragPipelines: { label: 'RAG Pipelines', icon: BookOpen },
104-
apis: { label: 'APIs', icon: Globe },
105-
connectors: { label: 'Connectors', icon: Link2 },
99+
api: { label: 'APIs', icon: Globe },
100+
connector: { label: 'Connectors', icon: Link2 },
106101
plugin: { label: 'Plugins', icon: Layers },
107-
plugins: { label: 'Plugins', icon: Layers },
108102
kind: { label: 'Kinds', icon: Database },
109103
};
110104

apps/studio/src/plugins/built-in/api-plugin.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ export const apiProtocolPlugin: StudioPlugin = {
2323
key: 'api',
2424
label: 'API',
2525
icon: 'globe',
26-
metadataTypes: ['apis', 'connectors'],
26+
metadataTypes: ['api', 'connector'],
2727
order: 60,
2828
},
2929
],
3030
metadataIcons: [
31-
{ metadataType: 'apis', label: 'APIs', icon: 'globe' },
32-
{ metadataType: 'connectors', label: 'Connectors', icon: 'link-2' },
31+
{ metadataType: 'api', label: 'APIs', icon: 'globe' },
32+
{ metadataType: 'connector', label: 'Connectors', icon: 'link-2' },
3333
],
3434
},
3535
}),
3636

3737
activate(api) {
38-
api.registerMetadataIcon('apis', Globe, 'APIs');
39-
api.registerMetadataIcon('connectors', Link2, 'Connectors');
38+
api.registerMetadataIcon('api', Globe, 'APIs');
39+
api.registerMetadataIcon('connector', Link2, 'Connectors');
4040
},
4141
};

apps/studio/src/plugins/built-in/automation-plugin.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ export const automationProtocolPlugin: StudioPlugin = {
2323
key: 'automation',
2424
label: 'Automation',
2525
icon: 'workflow',
26-
metadataTypes: ['flows', 'workflows', 'approvals', 'webhooks'],
26+
metadataTypes: ['flow', 'workflow', 'approval', 'webhook'],
2727
order: 30,
2828
},
2929
],
3030
metadataIcons: [
31-
{ metadataType: 'flows', label: 'Flows', icon: 'workflow' },
32-
{ metadataType: 'workflows', label: 'Workflows', icon: 'workflow' },
33-
{ metadataType: 'approvals', label: 'Approvals', icon: 'check-square' },
34-
{ metadataType: 'webhooks', label: 'Webhooks', icon: 'webhook' },
31+
{ metadataType: 'flow', label: 'Flows', icon: 'workflow' },
32+
{ metadataType: 'workflow', label: 'Workflows', icon: 'workflow' },
33+
{ metadataType: 'approval', label: 'Approvals', icon: 'check-square' },
34+
{ metadataType: 'webhook', label: 'Webhooks', icon: 'webhook' },
3535
],
3636
},
3737
}),
3838

3939
activate(api) {
40-
api.registerMetadataIcon('flows', Workflow, 'Flows');
41-
api.registerMetadataIcon('workflows', Workflow, 'Workflows');
42-
api.registerMetadataIcon('approvals', CheckSquare, 'Approvals');
43-
api.registerMetadataIcon('webhooks', Webhook, 'Webhooks');
40+
api.registerMetadataIcon('flow', Workflow, 'Flows');
41+
api.registerMetadataIcon('workflow', Workflow, 'Workflows');
42+
api.registerMetadataIcon('approval', CheckSquare, 'Approvals');
43+
api.registerMetadataIcon('webhook', Webhook, 'Webhooks');
4444
},
4545
};

apps/studio/src/plugins/built-in/default-plugin.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,14 @@ import type { StudioPlugin, MetadataViewerProps } from '../types';
2020

2121
// ─── Helpers ─────────────────────────────────────────────────────────
2222

23-
/** Map Studio metadataType (often plural) to CodeExporter's ExportType (singular). */
23+
/** Map Studio metadataType to CodeExporter's ExportType (all now use singular). */
2424
const METADATA_TO_EXPORT_TYPE: Record<string, CodeExporterProps['type']> = {
2525
object: 'object',
26-
objects: 'object',
2726
view: 'view',
28-
views: 'view',
2927
flow: 'flow',
30-
flows: 'flow',
3128
agent: 'agent',
32-
agents: 'agent',
3329
tool: 'tool',
34-
tools: 'tool',
3530
app: 'app',
36-
apps: 'app',
3731
};
3832

3933
// ─── Preview Viewer (JSON Inspector) ─────────────────────────────────

apps/studio/src/plugins/built-in/object-plugin.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const objectDesignerPlugin: StudioPlugin = {
3232
metadataViewers: [
3333
{
3434
id: 'object-explorer',
35-
metadataTypes: ['object', 'objects'],
35+
metadataTypes: ['object'],
3636
label: 'Object Explorer',
3737
priority: 100,
3838
modes: ['preview', 'data', 'code'],
@@ -43,16 +43,15 @@ export const objectDesignerPlugin: StudioPlugin = {
4343
key: 'data',
4444
label: 'Data',
4545
icon: 'database',
46-
metadataTypes: ['object', 'objects', 'hooks', 'mappings', 'analyticsCubes', 'data'],
46+
metadataTypes: ['object', 'hook', 'mapping', 'analyticsCube', 'data'],
4747
order: 10,
4848
},
4949
],
5050
metadataIcons: [
5151
{ metadataType: 'object', label: 'Objects', icon: 'package' },
52-
{ metadataType: 'objects', label: 'Objects', icon: 'package' },
53-
{ metadataType: 'hooks', label: 'Hooks', icon: 'anchor' },
54-
{ metadataType: 'mappings', label: 'Mappings', icon: 'map' },
55-
{ metadataType: 'analyticsCubes', label: 'Analytics Cubes', icon: 'pie-chart' },
52+
{ metadataType: 'hook', label: 'Hooks', icon: 'anchor' },
53+
{ metadataType: 'mapping', label: 'Mappings', icon: 'map' },
54+
{ metadataType: 'analyticsCube', label: 'Analytics Cubes', icon: 'pie-chart' },
5655
{ metadataType: 'data', label: 'Seed Data', icon: 'database' },
5756
],
5857
},
@@ -64,10 +63,9 @@ export const objectDesignerPlugin: StudioPlugin = {
6463

6564
// Register Lucide icons for metadata types
6665
api.registerMetadataIcon('object', Package, 'Objects');
67-
api.registerMetadataIcon('objects', Package, 'Objects');
68-
api.registerMetadataIcon('hooks', Anchor, 'Hooks');
69-
api.registerMetadataIcon('mappings', Map, 'Mappings');
70-
api.registerMetadataIcon('analyticsCubes', PieChart, 'Analytics Cubes');
66+
api.registerMetadataIcon('hook', Anchor, 'Hooks');
67+
api.registerMetadataIcon('mapping', Map, 'Mappings');
68+
api.registerMetadataIcon('analyticsCube', PieChart, 'Analytics Cubes');
7169
api.registerMetadataIcon('data', Database, 'Seed Data');
7270
},
7371
};

apps/studio/src/plugins/built-in/security-plugin.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ export const securityProtocolPlugin: StudioPlugin = {
2323
key: 'security',
2424
label: 'Security',
2525
icon: 'shield',
26-
metadataTypes: ['roles', 'permissions', 'profiles', 'sharingRules', 'policies'],
26+
metadataTypes: ['role', 'permission', 'profile', 'sharingRule', 'policy'],
2727
order: 40,
2828
},
2929
],
3030
metadataIcons: [
31-
{ metadataType: 'roles', label: 'Roles', icon: 'user-cog' },
32-
{ metadataType: 'permissions', label: 'Permissions', icon: 'lock' },
33-
{ metadataType: 'profiles', label: 'Profiles', icon: 'shield' },
34-
{ metadataType: 'sharingRules', label: 'Sharing Rules', icon: 'shield' },
35-
{ metadataType: 'policies', label: 'Policies', icon: 'shield' },
31+
{ metadataType: 'role', label: 'Roles', icon: 'user-cog' },
32+
{ metadataType: 'permission', label: 'Permissions', icon: 'lock' },
33+
{ metadataType: 'profile', label: 'Profiles', icon: 'shield' },
34+
{ metadataType: 'sharingRule', label: 'Sharing Rules', icon: 'shield' },
35+
{ metadataType: 'policy', label: 'Policies', icon: 'shield' },
3636
],
3737
},
3838
}),
3939

4040
activate(api) {
41-
api.registerMetadataIcon('roles', UserCog, 'Roles');
42-
api.registerMetadataIcon('permissions', Lock, 'Permissions');
43-
api.registerMetadataIcon('profiles', Shield, 'Profiles');
44-
api.registerMetadataIcon('sharingRules', Shield, 'Sharing Rules');
45-
api.registerMetadataIcon('policies', Shield, 'Policies');
41+
api.registerMetadataIcon('role', UserCog, 'Roles');
42+
api.registerMetadataIcon('permission', Lock, 'Permissions');
43+
api.registerMetadataIcon('profile', Shield, 'Profiles');
44+
api.registerMetadataIcon('sharingRule', Shield, 'Sharing Rules');
45+
api.registerMetadataIcon('policy', Shield, 'Policies');
4646
},
4747
};

apps/studio/src/plugins/built-in/ui-plugin.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ export const uiProtocolPlugin: StudioPlugin = {
2525
key: 'ui',
2626
label: 'UI',
2727
icon: 'app-window',
28-
metadataTypes: ['actions', 'views', 'pages', 'dashboards', 'reports', 'themes'],
28+
metadataTypes: ['action', 'view', 'page', 'dashboard', 'report', 'theme'],
2929
order: 20,
3030
},
3131
],
3232
metadataIcons: [
33-
{ metadataType: 'actions', label: 'Actions', icon: 'zap' },
34-
{ metadataType: 'views', label: 'Views', icon: 'eye' },
35-
{ metadataType: 'pages', label: 'Pages', icon: 'file-code' },
36-
{ metadataType: 'dashboards', label: 'Dashboards', icon: 'bar-chart-3' },
37-
{ metadataType: 'reports', label: 'Reports', icon: 'file-text' },
38-
{ metadataType: 'themes', label: 'Themes', icon: 'palette' },
33+
{ metadataType: 'action', label: 'Actions', icon: 'zap' },
34+
{ metadataType: 'view', label: 'Views', icon: 'eye' },
35+
{ metadataType: 'page', label: 'Pages', icon: 'file-code' },
36+
{ metadataType: 'dashboard', label: 'Dashboards', icon: 'bar-chart-3' },
37+
{ metadataType: 'report', label: 'Reports', icon: 'file-text' },
38+
{ metadataType: 'theme', label: 'Themes', icon: 'palette' },
3939
],
4040
},
4141
}),
4242

4343
activate(api) {
44-
api.registerMetadataIcon('actions', Zap, 'Actions');
45-
api.registerMetadataIcon('views', Eye, 'Views');
46-
api.registerMetadataIcon('pages', FileCode, 'Pages');
47-
api.registerMetadataIcon('dashboards', BarChart3, 'Dashboards');
48-
api.registerMetadataIcon('reports', FileText, 'Reports');
49-
api.registerMetadataIcon('themes', Palette, 'Themes');
44+
api.registerMetadataIcon('action', Zap, 'Actions');
45+
api.registerMetadataIcon('view', Eye, 'Views');
46+
api.registerMetadataIcon('page', FileCode, 'Pages');
47+
api.registerMetadataIcon('dashboard', BarChart3, 'Dashboards');
48+
api.registerMetadataIcon('report', FileText, 'Reports');
49+
api.registerMetadataIcon('theme', Palette, 'Themes');
5050
},
5151
};

0 commit comments

Comments
 (0)