UNPKG

@backstage-community/plugin-puppetdb

Version:

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

32 lines (29 loc) 1.34 kB
import { jsx, jsxs } from 'react/jsx-runtime'; 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__ */ jsx(MissingAnnotationEmptyState, { annotation: ANNOTATION_PUPPET_CERTNAME }); } return /* @__PURE__ */ jsxs(Routes, { children: [ /* @__PURE__ */ jsx(Route, { path: "/", element: /* @__PURE__ */ jsx(ReportsPage, {}) }), /* @__PURE__ */ jsx( Route, { path: `${puppetDbReportRouteRef.path}`, element: /* @__PURE__ */ jsx(ReportDetailsPage, {}) } ) ] }); }; export { Router, isPuppetDbAvailable }; //# sourceMappingURL=Router.esm.js.map