Giter VIP home page Giter VIP logo

cmdb-plugin's Introduction

@backstage/plugin-cmdb

A frontend for CMDB-service, this plugin allows you to applications that are managed by CMDB backend.

This is an experimental plugin to understand how to integrate with backstage echo system.

Introduction

Getting Started

To get started, you will need a running instance of CMDB-service. It's likely you will need to enable CORS to integrate with Backstage. I am hoping that I can use the backend proxy and avoid this need.

When you have an instance running that Backstage can hook into, first install the plugin into your app:

For now I am building the plugin into the tree, later I will play around with building it as a package and try the following:

$ yarn add @backstage/plugin-cmdb

Then make sure to export the plugin in your app's plugins.ts to enable the plugin:

export { plugin as CmdbPlugin } from 'cmdb-plugin';

So for now since I don't have the package I will reference it directly and see if things work:

export { plugin as CmdbPlugin } from '../../../plugins/cmdb/src';

Modify your app routes in App.tsx to include the Router component exported from the plugin, for example:

Similarly reference the CMDB Router directly:

export { Router as CmdbRouter } from '../../../plugins/cmdb/src';
// At the top imports
import { Router as LighthouseRouter } from '@backstage/plugin-lighthouse';

// Inside App component
<Routes>
  // ...
  <Route path="/cmdb/*" element={<CmdbRouter />} />
  // ...
</Routes>;

Then configure the cmdb-service URL in your app-config.yaml.

cmdb:
  baseUrl: http://your-service-url

Integration with the Catalog

The Lighthouse plugin can be integrated into the catalog so that Lighthouse audit information relating to a component can be displayed within that component's entity page. In order to link an Entity to its Lighthouse audits, the entity must be annotated as follows:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  # ...
  annotations:
    # ...
    lighthouse.com/website-url: # A single website url e.g. https://backstage.io/

NOTE: The plugin only supports one website URL per component at this time.

Add a Cmdb tab to the EntityPage:

Similarly reference the CMDB Router directly:

export { EmbeddedRouter as CmdbRouter } from '../../../plugins/cmdb/src';
// packages/app/src/components/catalog/EntityPage.tsx
import { EmbeddedRouter as CmdbRouter } from '@backstage/plugin-cmdb';

// ...
const WebsiteEntityPage = ({ entity }: { entity: Entity }) => (
  <EntityPageLayout>
    // ...
    <EntityPageLayout.Content
      path="/lighthouse/*"
      title="Lighthouse"
      element={<LighthouseRouter entity={entity} />}
    />
  </EntityPageLayout>
);

NOTE: The embedded router renders page content without a header section allowing it to be rendered within a catalog plugin page.

Add a Lighthouse card to the overview tab on the EntityPage:

// packages/app/src/components/catalog/EntityPage.tsx
import {
  LastCmdbhouseAuditCard,
  isPluginApplicableToEntity as isCmdbAvailable,
} from '@backstage/plugin-lighthouse';

// ...

const OverviewContent = ({ entity }: { entity: Entity }) => (
  <Grid container spacing={3}>
    // ...
    {isCmdbAvailable(entity) && (
      <Grid item sm={4}>
        <LastCmdbAuditCard />
      </Grid>
    )}
  </Grid>
);

Development

npm publish

cmdb-plugin's People

Contributors

seizadi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.