diff --git a/plugins/github-deployments/api-report.md b/plugins/github-deployments/api-report.md index 3e75b2f9bc..82d2222127 100644 --- a/plugins/github-deployments/api-report.md +++ b/plugins/github-deployments/api-report.md @@ -9,34 +9,6 @@ import { BackstagePlugin } from '@backstage/core-plugin-api'; import { Entity } from '@backstage/catalog-model'; import { TableColumn } from '@backstage/core-components'; -// Warning: (ae-forgotten-export) The symbol "GithubDeployment" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "createCommitColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function createCommitColumn(): TableColumn; - -// Warning: (ae-missing-release-tag) "createCreatorColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function createCreatorColumn(): TableColumn; - -// Warning: (ae-missing-release-tag) "createEnvironmentColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function createEnvironmentColumn(): TableColumn; - -// Warning: (ae-missing-release-tag) "createLastUpdatedColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function createLastUpdatedColumn(): TableColumn; - -// Warning: (ae-missing-release-tag) "createStatusColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function createStatusColumn(): TableColumn; - -// Warning: (ae-missing-release-tag) "EntityGithubDeploymentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const EntityGithubDeploymentsCard: (props: { last?: number | undefined; @@ -44,37 +16,57 @@ export const EntityGithubDeploymentsCard: (props: { columns?: TableColumn[] | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "githubDeploymentsPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export const GITHUB_PROJECT_SLUG_ANNOTATION = 'github.com/project-slug'; + +// @public (undocumented) +export type GithubDeployment = { + environment: string; + state: string; + updatedAt: string; + commit: { + abbreviatedOid: string; + commitUrl: string; + } | null; + statuses: { + nodes: Node_2[]; + }; + creator: { + login: string; + }; + repository: { + nameWithOwner: string; + }; + payload: string; +}; + // @public (undocumented) export const githubDeploymentsPlugin: BackstagePlugin<{}, {}, {}>; -// Warning: (ae-forgotten-export) The symbol "GithubDeploymentsTableProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "GithubDeploymentsTable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// Warning: (ae-missing-release-tag) "GithubDeploymentsTable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export function GithubDeploymentsTable( - props: GithubDeploymentsTableProps, -): JSX.Element; +export const GithubDeploymentsTable: { + (props: { + deployments: GithubDeployment[]; + isLoading: boolean; + reload: () => void; + columns: TableColumn[]; + }): JSX.Element; + columns: Readonly<{ + createEnvironmentColumn(): TableColumn; + createStatusColumn(): TableColumn; + createCommitColumn(): TableColumn; + createCreatorColumn(): TableColumn; + createLastUpdatedColumn(): TableColumn; + }>; + defaultDeploymentColumns: TableColumn[]; +}; -// @public (undocumented) -export namespace GithubDeploymentsTable { - var // Warning: (ae-forgotten-export) The symbol "columnFactories" needs to be exported by the entry point index.d.ts - // - // (undocumented) - columns: typeof columnFactories; - var // (undocumented) - defaultDeploymentColumns: TableColumn[]; -} - -// Warning: (ae-missing-release-tag) "GithubStateIndicator" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const GithubStateIndicator: (props: { state: string }) => JSX.Element; - -// Warning: (ae-missing-release-tag) "isGithubDeploymentsAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const isGithubDeploymentsAvailable: (entity: Entity) => boolean; + +// @public (undocumented) +type Node_2 = { + logUrl?: string; +}; +export { Node_2 as Node }; ``` diff --git a/plugins/github-deployments/src/Router.tsx b/plugins/github-deployments/src/Router.tsx index 5425a49710..1e6990b991 100644 --- a/plugins/github-deployments/src/Router.tsx +++ b/plugins/github-deployments/src/Router.tsx @@ -13,9 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { Entity } from '@backstage/catalog-model'; +/** @public */ export const GITHUB_PROJECT_SLUG_ANNOTATION = 'github.com/project-slug'; +/** @public */ export const isGithubDeploymentsAvailable = (entity: Entity) => Boolean(entity?.metadata.annotations?.[GITHUB_PROJECT_SLUG_ANNOTATION]); diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index 48363557ff..6e246f7569 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -53,10 +53,12 @@ const getBaseUrl = ( return config?.config.apiBaseUrl; }; -type Node = { +/** @public */ +export type Node = { logUrl?: string; }; +/** @public */ export type GithubDeployment = { environment: string; state: string; diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index 68881617f4..e828116f41 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import useAsyncRetry from 'react-use/lib/useAsyncRetry'; import { GithubDeployment, githubDeploymentsApiRef } from '../api'; diff --git a/plugins/github-deployments/src/components/GithubDeploymentsTable/GithubDeploymentsTable.tsx b/plugins/github-deployments/src/components/GithubDeploymentsTable/GithubDeploymentsTable.tsx index 2c48f3eef1..61295abff0 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsTable/GithubDeploymentsTable.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsTable/GithubDeploymentsTable.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { GithubDeployment } from '../../api'; import { Typography, makeStyles } from '@material-ui/core'; import SyncIcon from '@material-ui/icons/Sync'; -import * as columnFactories from './columns'; +import { columnFactories } from './columns'; import { defaultDeploymentColumns } from './presets'; import { Table, TableColumn } from '@backstage/core-components'; @@ -29,14 +29,13 @@ const useStyles = makeStyles(theme => ({ }, })); -type GithubDeploymentsTableProps = { +/** @public */ +export const GithubDeploymentsTable = (props: { deployments: GithubDeployment[]; isLoading: boolean; reload: () => void; columns: TableColumn[]; -}; - -export function GithubDeploymentsTable(props: GithubDeploymentsTableProps) { +}) => { const { deployments, isLoading, reload, columns } = props; const classes = useStyles(); @@ -64,7 +63,7 @@ export function GithubDeploymentsTable(props: GithubDeploymentsTableProps) { } /> ); -} +}; GithubDeploymentsTable.columns = columnFactories; diff --git a/plugins/github-deployments/src/components/GithubDeploymentsTable/columns.tsx b/plugins/github-deployments/src/components/GithubDeploymentsTable/columns.tsx index 9a720c0e75..5dffdd9089 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsTable/columns.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsTable/columns.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { GithubDeployment } from '../../api'; import { DateTime } from 'luxon'; @@ -43,50 +44,54 @@ export const GithubStateIndicator = (props: { state: string }) => { } }; -export function createEnvironmentColumn(): TableColumn { - return { - title: 'Environment', - field: 'environment', - highlight: true, - }; -} +export const columnFactories = Object.freeze({ + createEnvironmentColumn(): TableColumn { + return { + title: 'Environment', + field: 'environment', + highlight: true, + }; + }, -export function createStatusColumn(): TableColumn { - return { - title: 'Status', - render: (row: GithubDeployment): JSX.Element => ( - - - {row.state} - - ), - }; -} - -export function createCommitColumn(): TableColumn { - return { - title: 'Commit', - render: (row: GithubDeployment) => - row.commit && ( - - {row.commit.abbreviatedOid} - + createStatusColumn(): TableColumn { + return { + title: 'Status', + render: (row: GithubDeployment): JSX.Element => ( + + + {row.state} + ), - }; -} + }; + }, -export function createCreatorColumn(): TableColumn { - return { - title: 'Creator', - field: 'creator.login', - }; -} + createCommitColumn(): TableColumn { + return { + title: 'Commit', + render: (row: GithubDeployment) => + row.commit && ( + + {row.commit.abbreviatedOid} + + ), + }; + }, -export function createLastUpdatedColumn(): TableColumn { - return { - title: 'Last Updated', - render: (row: GithubDeployment): JSX.Element => ( - {DateTime.fromISO(row.updatedAt).toRelative({ locale: 'en' })} - ), - }; -} + createCreatorColumn(): TableColumn { + return { + title: 'Creator', + field: 'creator.login', + }; + }, + + createLastUpdatedColumn(): TableColumn { + return { + title: 'Last Updated', + render: (row: GithubDeployment): JSX.Element => ( + + {DateTime.fromISO(row.updatedAt).toRelative({ locale: 'en' })} + + ), + }; + }, +}); diff --git a/plugins/github-deployments/src/components/GithubDeploymentsTable/index.ts b/plugins/github-deployments/src/components/GithubDeploymentsTable/index.ts index 14cf093337..e3d57629b5 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsTable/index.ts +++ b/plugins/github-deployments/src/components/GithubDeploymentsTable/index.ts @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export { GithubDeploymentsTable } from './GithubDeploymentsTable'; diff --git a/plugins/github-deployments/src/components/GithubDeploymentsTable/presets.ts b/plugins/github-deployments/src/components/GithubDeploymentsTable/presets.ts index ba48857c3c..af0e21ea23 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsTable/presets.ts +++ b/plugins/github-deployments/src/components/GithubDeploymentsTable/presets.ts @@ -13,20 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { GithubDeployment } from '../../api'; -import { - createEnvironmentColumn, - createStatusColumn, - createCommitColumn, - createLastUpdatedColumn, - createCreatorColumn, -} from './columns'; +import { columnFactories } from './columns'; import { TableColumn } from '@backstage/core-components'; export const defaultDeploymentColumns: TableColumn[] = [ - createEnvironmentColumn(), - createStatusColumn(), - createCommitColumn(), - createCreatorColumn(), - createLastUpdatedColumn(), + columnFactories.createEnvironmentColumn(), + columnFactories.createStatusColumn(), + columnFactories.createCommitColumn(), + columnFactories.createCreatorColumn(), + columnFactories.createLastUpdatedColumn(), ]; diff --git a/plugins/github-deployments/src/index.ts b/plugins/github-deployments/src/index.ts index 55c1d2f2d2..7806da54ba 100644 --- a/plugins/github-deployments/src/index.ts +++ b/plugins/github-deployments/src/index.ts @@ -20,6 +20,10 @@ * @packageDocumentation */ +export type { Node, GithubDeployment } from './api'; export { githubDeploymentsPlugin, EntityGithubDeploymentsCard } from './plugin'; export { GithubDeploymentsTable } from './components/GithubDeploymentsTable'; -export { isGithubDeploymentsAvailable } from './Router'; +export { + isGithubDeploymentsAvailable, + GITHUB_PROJECT_SLUG_ANNOTATION, +} from './Router'; diff --git a/plugins/github-deployments/src/plugin.ts b/plugins/github-deployments/src/plugin.ts index 5c4ef9c3e4..1d5dee57bc 100644 --- a/plugins/github-deployments/src/plugin.ts +++ b/plugins/github-deployments/src/plugin.ts @@ -22,6 +22,7 @@ import { githubAuthApiRef, } from '@backstage/core-plugin-api'; +/** @public */ export const githubDeploymentsPlugin = createPlugin({ id: 'github-deployments', apis: [ @@ -37,6 +38,7 @@ export const githubDeploymentsPlugin = createPlugin({ ], }); +/** @public */ export const EntityGithubDeploymentsCard = githubDeploymentsPlugin.provide( createComponentExtension({ name: 'EntityGithubDeploymentsCard', diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index 6368414951..3ba5af6c7b 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -203,7 +203,6 @@ const ALLOW_WARNINGS = [ 'plugins/catalog-import', 'plugins/cost-insights', 'plugins/git-release-manager', - 'plugins/github-deployments', 'plugins/github-pull-requests-board', 'plugins/jenkins', 'plugins/kubernetes',