@roadiehq/backstage-plugin-github-pull-requests
Version:
17 lines (14 loc) • 1.15 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { Routes, Route } from 'react-router';
import PullRequestsPage from './PullRequestsPage/PullRequestsPage.esm.js';
import { GITHUB_PULL_REQUESTS_ANNOTATION, GITHUB_PULL_REQUESTS_TEAM_ANNOTATION } from '../utils/isGithubSlugSet.esm.js';
import { MissingAnnotationEmptyState } from '@backstage/core-components';
import { useEntity } from '@backstage/plugin-catalog-react';
const isGithubPullRequestsAvailable = (entity) => Boolean(entity.metadata.annotations?.[GITHUB_PULL_REQUESTS_ANNOTATION]);
const isGithubTeamPullRequestsAvailable = (entity) => Boolean(entity.metadata.annotations?.[GITHUB_PULL_REQUESTS_TEAM_ANNOTATION]);
const Router = () => {
const { entity } = useEntity();
return !isGithubPullRequestsAvailable(entity) ? /* @__PURE__ */ jsx(MissingAnnotationEmptyState, { annotation: GITHUB_PULL_REQUESTS_ANNOTATION }) : /* @__PURE__ */ jsx(Routes, { children: /* @__PURE__ */ jsx(Route, { path: "/", element: /* @__PURE__ */ jsx(PullRequestsPage, {}) }) });
};
export { Router, isGithubPullRequestsAvailable, isGithubTeamPullRequestsAvailable };
//# sourceMappingURL=Router.esm.js.map