npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aws/plugin-aws-apps-for-backstage

v0.3.5

Published

App Development for Backstage.io on AWS Frontend plugin

Downloads

127

Readme

OPA on AWS Frontend

This is the frontend UI of the OPA on AWS plugin. An AWS Catalog Page and several entity cards are contributed to the UI from this plugin.

Installation

Install the OPA on AWS frontend plugin into your Backstage application:

# From your Backstage root directory
yarn add --cwd packages/app @aws/[email protected]

Configuration

Each of the UI components contributed in the OPA on AWS frontend plugin can be configured independently and added to your Backstage platform as desired. Details for adding each type of UI component are found in the sections below.

EntityPage customization for AWS apps

To build an AWS app-specific entity presentation, we will rely on identification of a component as being of type "aws-app" (as specified under the spec.type configuration in the entity's catalog-info.yaml file).

Add the code shown below to EntityPage.tsx

// packages/app/src/components/catalog/EntityPage.tsx

[imports ...]

// Add an import for the UI components from the frontend plugin
import {
  AwsEnvironmentPage,
  AwsEnvironmentProviderPage,
  AwsComponentPage,
} from '@aws/plugin-aws-apps-for-backstage';

import { isGitlabAvailable, EntityGitlabContent } from '@immobiliarelabs/backstage-plugin-gitlab';

[...]

// Add these statements
const isCicdApplicable = (entity: Entity) => {
  return isGitlabAvailable(entity) || isGithubActionsAvailable(entity);

const awsEnvironmentProviderEntityPage = (
      <AwsEnvironmentProviderPage />
);

const awsEnvironmentEntityPage = (
      <AwsEnvironmentPage />
);

const resourceEntityPage = (
  <EntitySwitch>
    <EntitySwitch.Case if={isResourceType('aws-resource')}>
       <AwsComponentPage componentType='aws-resource'/>
    </EntitySwitch.Case>
    <EntitySwitch.Case>{defaultEntityPage}</EntitySwitch.Case>
  </EntitySwitch>
);

// Add GitLab support
const cicdContent = (
  ...
  <EntitySwitch>
    ...
  // Add this to the switch statement in the cicdContent variable
    <EntitySwitch.Case if={isGitlabAvailable}>
      <EntityGitlabContent />
    </EntitySwitch.Case>
    ...
  </EntitySwitch>
);

// Add a CI/CD tab to the defaultEntityPage variable
const defaultEntityPage = (
  <EntityLayout>
    ...
    // Add this route
    <EntityLayout.Route path="/ci-cd" title="CI/CD" if={isCicdApplicable}>
      {cicdContent}
    </EntityLayout.Route>
    ...
  </EntityLayout>
);

// Add a new case element to the component page to show aws-app components
const componentPage = (
  <EntitySwitch>
    ...
    // Add this case inside the EntitySwitch element
    <EntitySwitch.Case if={isComponentType('aws-app')}>
      <AwsComponentPage componentType='aws-app'/>
    </EntitySwitch.Case>
    ...
  </EntitySwitch>
);

// Add support for aws resource, environment and environment provider specific entity pages
// to the entityPage variable
const resourceEntityPage = (
  <EntitySwitch>
    ...
    <EntitySwitch.Case if={isKind('resource')} children={resourceEntityPage} />
    <EntitySwitch.Case if={isKind('awsenvironment')} children={awsEnvironmentEntityPage} />
    <EntitySwitch.Case if={isKind('awsenvironmentprovider')} children={awsEnvironmentProviderEntityPage} />
    ...
  </EntitySwitch>
);

When running the Backstage app, you are now setup for customized views of AWS applications in the platform.

AWS Software Catalog Page

The AWS Software Catalog page provides a customized view into the Backstage catalog with a focus on applications deployed to AWS through Backstage. AWS Software Catalog Page

To create the AWS Software Catalog Page in your Backstage app, add the AppCatalogPage JSX Element to the Backstage App.tsx file.
It should be configured as a new <Route ...> in the file.

// packages/app/src/App.tsx

[imports...]
+ import { AppCatalogPage } from '@aws/plugin-aws-apps-for-backstage';

[...]

const routes = (
  <FlatRoutes>
    [other Route configurations...]
+   <Route path="/aws-apps-search-page" element={<CatalogIndexPage />}>
+     <AppCatalogPage kind="all" />
+   </Route>
+   <Route path="/aws-apps-search-page/environments" element={<CatalogIndexPage />}>
+     <AppCatalogPage kind="awsenvironment" />
+   </Route>
+   <Route path="/aws-apps-search-page/providers" element={<CatalogIndexPage />}>
+     <AppCatalogPage kind="awsenvironmentprovider" />
+   </Route>
+   <Route path="/aws-apps-search-page/apps" element={<CatalogIndexPage />}>
+     <AppCatalogPage kind="component" />
+   </Route>
+   <Route path="/aws-apps-search-page/resources" element={<CatalogIndexPage />}>
+     <AppCatalogPage kind="resource" />
+   </Route>
  </FlatRoutes>
);

Next, add the AWS Software Catalog to the sidebar navigation in the Root.tsx file.
Determine your preferred placement in the sidebar using the example below as guidance. Exact contents and children of the may differ in your installation.

// packages/app/src/components/Root/Root.tsx

[imports...]
+ import CloudIcon from '@material-ui/icons/Cloud';

[...]
export const Root = ({ children }: PropsWithChildren<{}>) => (
  <SidebarPage>
    <Sidebar>
      <SidebarLogo />
      <SidebarGroup label="Menu" icon={<MenuIcon />}>
        {/* Global nav, not org-specific */}
        <SidebarItem icon={HomeIcon} to="/" text="Home" />
+       <SidebarDivider />
+       <SidebarGroup label="AWS" icon={<MenuIcon />}>
+         <SidebarItem icon={CloudIcon} text="AWS">
+           <SidebarSubmenu title="AWS Catalog">
+             <SidebarSubmenuItem
+               title="Environments"
+               to="aws-apps-search-page/environments?filters[kind]=awsenvironment"
+               icon={useApp().getSystemIcon('kind:domain')}
+             />
+             <SidebarSubmenuItem
+               title="Providers"
+               to="aws-apps-search-page/providers?filters[kind]=awsenvironmentprovider"
+               icon={useApp().getSystemIcon('kind:system')}
+             />
+             <SidebarSubmenuItem
+               title="Apps"
+               to="aws-apps-search-page/apps?filters[kind]=component"
+               icon={useApp().getSystemIcon('kind:component')}
+             />
+             <SidebarSubmenuItem
+               title="Resources"
+               to="aws-apps-search-page/resources?filters[kind]=resource"
+               icon={useApp().getSystemIcon('kind:resource')}
+             />
+           </SidebarSubmenu>
+         </SidebarItem>
+       </SidebarGroup>
        <SidebarItem icon={LibraryBooks} to="docs" text="Docs" />
        <SidebarItem icon={CreateComponentIcon} to="create" text="Create..." />
        {/* End global nav */}
      </SidebarGroup>
      <SidebarGroup label="Settings" icon={<UserSettingsSignInAvatar />} to="/settings">
        <SidebarSettings />
      </SidebarGroup>
    </Sidebar>
    {children}
  </SidebarPage>
);

Links