code-coverage: clean up exports
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import 'highlight.js/styles/atom-one-dark.css';
|
||||
import highlight from 'highlight.js';
|
||||
|
||||
|
||||
@@ -13,16 +13,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { CodeCoveragePage } from './CodeCoveragePage';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
|
||||
export const isCodeCoverageAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.['backstage.io/code-coverage']);
|
||||
/**
|
||||
* Returns true if the given entity has code coverage enabled.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function isCodeCoverageAvailable(entity: Entity) {
|
||||
return Boolean(entity.metadata.annotations?.['backstage.io/code-coverage']);
|
||||
}
|
||||
|
||||
export const Router = () => {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const Router = (): JSX.Element => {
|
||||
const { entity } = useEntity();
|
||||
|
||||
if (!isCodeCoverageAvailable(entity)) {
|
||||
@@ -30,5 +40,6 @@ export const Router = () => {
|
||||
<MissingAnnotationEmptyState annotation="backstage.io/code-coverage" />
|
||||
);
|
||||
}
|
||||
|
||||
return <CodeCoveragePage />;
|
||||
};
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
import { isCodeCoverageAvailable } from './components/Router';
|
||||
|
||||
export { codeCoveragePlugin, EntityCodeCoverageContent } from './plugin';
|
||||
export {
|
||||
Router,
|
||||
isCodeCoverageAvailable,
|
||||
isCodeCoverageAvailable as isPluginApplicableToEntity,
|
||||
} from './components/Router';
|
||||
export { isCodeCoverageAvailable };
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @deprecated Use `isPluginApplicableToEntity` instead.
|
||||
*/
|
||||
export const isPluginApplicableToEntity = isCodeCoverageAvailable;
|
||||
|
||||
@@ -23,6 +23,9 @@ import {
|
||||
discoveryApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const codeCoveragePlugin = createPlugin({
|
||||
id: 'code-coverage',
|
||||
routes: {
|
||||
@@ -37,6 +40,11 @@ export const codeCoveragePlugin = createPlugin({
|
||||
],
|
||||
});
|
||||
|
||||
/**
|
||||
* An entity code coverage page.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const EntityCodeCoverageContent = codeCoveragePlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'EntityCodeCoverageContent',
|
||||
|
||||
Reference in New Issue
Block a user