Frontend extensions
About 297 words
@spechtlabs/backstage-plugin-tailscale is a plugin for Backstage's new frontend system, with the plugin ID tailscale. Its default export is the plugin. It adds five extensions:
| Extension ID | Kind | What it adds | Shown for |
|---|---|---|---|
api:tailscale | API | tailscaleApiRef, implemented by TailscaleClient | |
page:tailscale | page | the policy console at /tailscale, titled Tailscale | |
entity-content:tailscale/policy | entity content | the Policy tab, at the entity's policy path | Tailscale entities of spec.type: policy |
entity-card:tailscale/rule | entity card (content) | the rule an entity is, its problems, and the lines it renders to | Tailscale entities of any other type |
entity-card:tailscale/access | entity card (content) | how the entity is on the tailnet; renders nothing when it isn't | Components, APIs, Resources, Groups and Users |
Turn an extension off
Like any extension of the new frontend system, each one can be turned off or configured in app-config.yaml. To hide the access card, for example:
app:
extensions:
- entity-card:tailscale/access: falseThe API
The package exports tailscaleApiRef (ID plugin.tailscale), the TailscaleApi interface and its default implementation, TailscaleClient:
interface TailscaleApi {
getOverview(): Promise<Overview>;
getAccess(entityRef: string): Promise<EntityAccess[]>;
}getOverview() calls GET /api/tailscale/overview and keeps the result for a minute, since the page, the Policy tab and every entity card read it. getAccess() calls GET /api/tailscale/access. Both use the discovery and fetch APIs, so requests carry the signed-in user's token. The types come from @spechtlabs/backstage-plugin-tailscale-common; see HTTP API.
Not supported
There is no export for the legacy frontend system (no createPlugin, no routable components to put in App.tsx). The frontend needs the backend plugin; without it, every view shows an error from /api/tailscale.
