0.7.4 • Published 5 months ago

@get-dx/backstage-plugin v0.7.4

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 months ago

DX Backstage Frontend Plugin

DX Backstage frontend plugin to display DX data in your Backstage app.

Setup

  • Install this plugin in your backstage frontend:

    yarn --cwd packages/app add @get-dx/backstage-plugin
  • Generate an API token on the Web API Keys page that includes the catalog:read scope. Then configure a proxy in your app config file to communicate with the DX API:

    # app-config.yaml
    proxy:
      endpoints:
        "/dx-web-api":
          target: https://api.getdx.com
          headers:
            Authorization: Bearer ${DX_WEB_API_TOKEN}
          allowedHeaders:
            # Forwards the plugin version to DX, to help us provide support and maintain API compatibility
            - X-Client-Type
            - X-Client-Version

Add Components

Service Cloud

These components visualize Scorecards and Tasks for an entity.

ComponentDescription
<EntityScorecardsPage />Dashboard showing scorecard details for the service.
<EntityTasksPage />Dashboard showing outstanding tasks for the service, grouped by priority.
<EntityScorecardsCard />Info card showing current scorecard levels and checks for the service.
<EntityTasksCard />Info card showing outstanding tasks for the service.

Each of these components requires an entityIdentifier prop, in order to fetch the correct DX entity. If you use the Backstage catalog plugin, you can call Backstage's useEntity hook to get metadata to help map or construct the DX entity identifier.

Install the full-page components by defining routes in the service entity page:

// packages/app/src/components/catalog/EntityPage.tsx
import { EntityScorecardsPage, EntityTasksPage } from '@get-dx/backstage-plugin';

const serviceEntityPage = (
  <EntityLayout>
    {/* ... */}

    <EntityLayout.Route path="/dx-scorecards" title="Scorecards">
      <EntityScorecardsPage entityIdentifier="my-app" />
    </EntityLayout.Route>

    <EntityLayout.Route path="/dx-tasks" title="Tasks">
      <EntityTasksPage entityIdentifier="my-app" />
    </EntityLayout.Route>

    {/* ... */}
  </EntityLayout>
)

Getting entity identifiers

If you are using the Backstage Software Catalog and have your entities defined in both Backstage and DX, then you may want to use a pattern like the following to set your component props correctly for each entity.

First, in packages/app/src/components/catalog/EntityPage.tsx, define wrapper components to fetch Backstage entity information and derive the DX entity identifier.

import { EntityScorecardsCard } from "@get-dx/backstage-plugin";

function EntityScorecardsCardWrapped() {
  const { entity } = useEntity();

  // If your *Backstage entity name* matches your *DX entity identifier*:
  const entityIdentifier = entity.metadata.name;

  // Alternatively, run some logic below to read entity metadata and define the `entityIdentifier` prop.

  return <EntityScorecardsCard entityIdentifier={entityIdentifier} />;
}

// ...

const overviewContent = (
  <Grid container spacing={3} alignItems="stretch">
    {entityWarningContent}
    <Grid item md={8} sm={12}>
      <EntityAboutCard variant="gridItem" />
    </Grid>
    <Grid item md={4} sm={12}>
      {/* Using the wrapped component instead of the import */}
      <EntityScorecardsCardWrapped />
    </Grid>
    {/* ... */}
  </Grid>
);

Then, in packages/app/src/App.tsx, add a reference to the DX plugin. This resolves this Backstage issue (related comment) involving React element trees, so we can use the component-wrapping strategy.

import { dxPlugin } from "@get-dx/backstage-plugin";

const app = createApp({
  // ...

  plugins: [dxPlugin],
});

Development

yarn install and yarn start will start a local dev server showing the UI of this component. See dev/index.tsx for setup.

To see real data, link to a local backstage instance and use yalc.

0.7.0-beta.1

8 months ago

0.7.0-beta.2

8 months ago

0.7.0-beta.3

7 months ago

0.7.0-beta.8

7 months ago

0.7.0-beta.9

6 months ago

0.7.0-beta.4

7 months ago

0.7.0-beta.5

7 months ago

0.7.0-beta.6

7 months ago

0.7.0-beta.7

7 months ago

0.7.0-beta.10

6 months ago

0.7.0-beta.11

6 months ago

0.7.2

5 months ago

0.7.1

5 months ago

0.7.4

5 months ago

0.7.3

5 months ago

0.7.0

6 months ago

0.6.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.5.0

1 year ago

0.4.0

1 year ago

0.1.0

2 years ago

0.1.0-rc-7

2 years ago

0.1.0-rc-6

2 years ago

0.1.0-rc-5

2 years ago

0.1.0-rc-4

2 years ago

0.1.0-rc-3

2 years ago

0.1.0-rc-2

2 years ago

0.1.0-rc-1

2 years ago