UNPKG

@backstage-community/plugin-puppetdb

Version:

Backstage plugin to visualize resource information and Puppet facts from PuppetDB.

29 lines (26 loc) 1.39 kB
import React from 'react'; import { Routes, Route } from 'react-router-dom'; import { puppetDbReportRouteRef } from '../routes.esm.js'; import { ANNOTATION_PUPPET_CERTNAME } from '../constants.esm.js'; import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react'; import { ReportsPage } from './ReportsPage/ReportsPage.esm.js'; import './ReportsPage/ReportsTable.esm.js'; import { ReportDetailsPage } from './ReportDetailsPage/ReportDetailsPage.esm.js'; import './ReportDetailsPage/ReportDetailsEventsTable.esm.js'; import './ReportDetailsPage/ReportDetailsLogsTable.esm.js'; const isPuppetDbAvailable = (entity) => Boolean(entity.metadata.annotations?.[ANNOTATION_PUPPET_CERTNAME]); const Router = () => { const { entity } = useEntity(); if (!isPuppetDbAvailable(entity)) { return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: ANNOTATION_PUPPET_CERTNAME }); } return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(ReportsPage, null) }), /* @__PURE__ */ React.createElement( Route, { path: `${puppetDbReportRouteRef.path}`, element: /* @__PURE__ */ React.createElement(ReportDetailsPage, null) } )); }; export { Router, isPuppetDbAvailable }; //# sourceMappingURL=Router.esm.js.map