more api cleanup

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-18 14:11:45 +02:00
parent e195112c5c
commit 3f739be9d9
88 changed files with 358 additions and 594 deletions
+5 -20
View File
@@ -14,24 +14,15 @@ import { IdentityApi } from '@backstage/core-plugin-api';
import { InfoCardVariants } from '@backstage/core-components';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-missing-release-tag) "EntityJenkinsContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityJenkinsContent: (_props: {}) => JSX.Element;
export const EntityJenkinsContent: () => JSX.Element;
// Warning: (ae-missing-release-tag) "EntityLatestJenkinsRunCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityLatestJenkinsRunCard: ({
branch,
variant,
}: {
export const EntityLatestJenkinsRunCard: (props: {
branch: string;
variant?: InfoCardVariants | undefined;
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "isJenkinsAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const isJenkinsAvailable: (entity: Entity) => boolean;
export { isJenkinsAvailable };
@@ -101,8 +92,6 @@ export class JenkinsClient implements JenkinsApi {
}): Promise<void>;
}
// Warning: (ae-missing-release-tag) "jenkinsPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const jenkinsPlugin: BackstagePlugin<
{
@@ -117,12 +106,9 @@ export { jenkinsPlugin as plugin };
// Warning: (ae-missing-release-tag) "LatestRunCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const LatestRunCard: ({
branch,
variant,
}: {
export const LatestRunCard: (props: {
branch: string;
variant?: InfoCardVariants | undefined;
variant?: InfoCardVariants;
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "LEGACY_JENKINS_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -130,9 +116,8 @@ export const LatestRunCard: ({
// @public (undocumented)
export const LEGACY_JENKINS_ANNOTATION = 'jenkins.io/github-folder';
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const Router: (_props: Props) => JSX.Element;
export const Router: () => JSX.Element;
```
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LinearProgress, makeStyles, Theme } from '@material-ui/core';
import ExternalLinkIcon from '@material-ui/icons/Launch';
import { DateTime, Duration } from 'luxon';
@@ -77,13 +78,12 @@ const WidgetContent = ({
);
};
const JenkinsApiErrorPanel = ({
message,
errorType,
}: {
const JenkinsApiErrorPanel = (props: {
message: string;
errorType: ErrorType;
}) => {
const { message, errorType } = props;
let title = undefined;
if (errorType === ErrorType.CONNECTION_ERROR) {
title = "Can't connect to Jenkins";
@@ -94,13 +94,11 @@ const JenkinsApiErrorPanel = ({
return <WarningPanel severity="error" title={title} message={message} />;
};
export const LatestRunCard = ({
branch = 'master',
variant,
}: {
export const LatestRunCard = (props: {
branch: string;
variant?: InfoCardVariants;
}) => {
const { branch = 'master', variant } = props;
const [{ projects, loading, error }] = useBuilds({ branch });
const latestRun = projects?.[0];
return (
+3 -3
View File
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
import { MissingAnnotationEmptyState } from '@backstage/core-components';
import { useEntity } from '@backstage/plugin-catalog-react';
@@ -23,13 +24,12 @@ import { buildRouteRef } from '../plugin';
import { CITable } from './BuildsPage/lib/CITable';
import { DetailedViewPage } from './BuildWithStepsPage/';
/** @public */
export const isJenkinsAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]) ||
Boolean(entity.metadata.annotations?.[LEGACY_JENKINS_ANNOTATION]);
type Props = {};
export const Router = (_props: Props) => {
export const Router = () => {
const { entity } = useEntity();
if (!isJenkinsAvailable(entity)) {
+6
View File
@@ -26,16 +26,19 @@ import {
} from '@backstage/core-plugin-api';
import { JenkinsClient, jenkinsApiRef } from './api';
/** @public */
export const rootRouteRef = createRouteRef({
id: 'jenkins',
});
/** @public */
export const buildRouteRef = createSubRouteRef({
id: 'jenkins/builds',
path: '/builds/:jobFullName/:buildNumber',
parent: rootRouteRef,
});
/** @public */
export const jenkinsPlugin = createPlugin({
id: 'jenkins',
apis: [
@@ -51,6 +54,7 @@ export const jenkinsPlugin = createPlugin({
},
});
/** @public */
export const EntityJenkinsContent = jenkinsPlugin.provide(
createRoutableExtension({
name: 'EntityJenkinsContent',
@@ -58,6 +62,8 @@ export const EntityJenkinsContent = jenkinsPlugin.provide(
mountPoint: rootRouteRef,
}),
);
/** @public */
export const EntityLatestJenkinsRunCard = jenkinsPlugin.provide(
createComponentExtension({
name: 'EntityLatestJenkinsRunCard',