From b3ea03a41bee9ecc47f627e9f0275a31a4ade294 Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Sun, 21 Jun 2026 13:21:50 +0800 Subject: [PATCH] feat(datasource): contribute a Setup-app "Datasources" nav entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Claude Opus 4.8 --- .../src/datasource-admin-plugin.ts | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/packages/services/service-datasource/src/datasource-admin-plugin.ts b/packages/services/service-datasource/src/datasource-admin-plugin.ts index 6253398156..9a7b4f74fd 100644 --- a/packages/services/service-datasource/src/datasource-admin-plugin.ts +++ b/packages/services/service-datasource/src/datasource-admin-plugin.ts @@ -223,6 +223,45 @@ export class DatasourceAdminServicePlugin implements Plugin { this.config = config; this.service = new DatasourceAdminService(config); ctx.registerService('datasource-admin', this.service); + + // Setup-app nav (ADR-0029 D7): datasources are a *capability* this plugin + // owns, so it contributes its own entry into the `group_integrations` slot + // (core setup-nav must not fill capability-owned slots). datasource is a + // metadata type, so the entry opens the generic metadata-admin engine route + // rather than a bespoke page or an object view. + try { + const manifest = ctx.getService<{ register(m: any): void }>('manifest'); + if (manifest && typeof manifest.register === 'function') { + manifest.register({ + id: 'com.objectstack.service-datasource.nav', + namespace: 'sys', + version: this.version, + type: 'plugin', + scope: 'system', + name: 'Datasource Navigation', + description: 'Contributes the Datasources entry to the Setup app Integrations group.', + navigationContributions: [ + { + app: 'setup', + group: 'group_integrations', + priority: 100, + items: [ + { + id: 'nav_datasources', + type: 'url', + label: 'Datasources', + url: '/apps/setup/component/metadata/resource?type=datasource', + icon: 'database', + requiredPermissions: ['manage_platform_settings'], + }, + ], + }, + ], + }); + } + } catch (err) { + this.options.logger?.warn?.('datasource nav contribution skipped', err); + } } async start(ctx: PluginContext): Promise {