Skip to content

Commit 131787e

Browse files
xuyushun441-sysos-zhuangclaude
authored
feat(datasource): contribute a Setup-app "Datasources" nav entry (#2091)
datasource is administered through the generic metadata-admin engine (it's a metadata type). Surface it from the Setup app like other capabilities: the datasource-admin plugin registers a navigation contribution into the `group_integrations` slot (ADR-0029 D7 — capability plugins own their slots; core setup-nav must not fill them, enforced by the platform-objects nav test). The entry is `type:'url'` → the metadata-admin engine route (`/apps/setup/component/metadata/resource?type=datasource`) rather than an object view, since a datasource is a definition, not business data. Verified live: the Setup app left menu shows "Datasources" under Integrations and opens the engine-hosted manager. platform-objects 55 + service-datasource 63 tests green. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 92647c1 commit 131787e

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

packages/services/service-datasource/src/datasource-admin-plugin.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,45 @@ export class DatasourceAdminServicePlugin implements Plugin {
223223
this.config = config;
224224
this.service = new DatasourceAdminService(config);
225225
ctx.registerService('datasource-admin', this.service);
226+
227+
// Setup-app nav (ADR-0029 D7): datasources are a *capability* this plugin
228+
// owns, so it contributes its own entry into the `group_integrations` slot
229+
// (core setup-nav must not fill capability-owned slots). datasource is a
230+
// metadata type, so the entry opens the generic metadata-admin engine route
231+
// rather than a bespoke page or an object view.
232+
try {
233+
const manifest = ctx.getService<{ register(m: any): void }>('manifest');
234+
if (manifest && typeof manifest.register === 'function') {
235+
manifest.register({
236+
id: 'com.objectstack.service-datasource.nav',
237+
namespace: 'sys',
238+
version: this.version,
239+
type: 'plugin',
240+
scope: 'system',
241+
name: 'Datasource Navigation',
242+
description: 'Contributes the Datasources entry to the Setup app Integrations group.',
243+
navigationContributions: [
244+
{
245+
app: 'setup',
246+
group: 'group_integrations',
247+
priority: 100,
248+
items: [
249+
{
250+
id: 'nav_datasources',
251+
type: 'url',
252+
label: 'Datasources',
253+
url: '/apps/setup/component/metadata/resource?type=datasource',
254+
icon: 'database',
255+
requiredPermissions: ['manage_platform_settings'],
256+
},
257+
],
258+
},
259+
],
260+
});
261+
}
262+
} catch (err) {
263+
this.options.logger?.warn?.('datasource nav contribution skipped', err);
264+
}
226265
}
227266

228267
async start(ctx: PluginContext): Promise<void> {

0 commit comments

Comments
 (0)