@@ -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<GithubDeployment>;
|
||||
|
||||
// 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<GithubDeployment>;
|
||||
|
||||
// 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<GithubDeployment>;
|
||||
|
||||
// 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<GithubDeployment>;
|
||||
|
||||
// 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<GithubDeployment>;
|
||||
|
||||
// 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<GithubDeployment>[] | 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<GithubDeployment>[];
|
||||
}): JSX.Element;
|
||||
columns: Readonly<{
|
||||
createEnvironmentColumn(): TableColumn<GithubDeployment>;
|
||||
createStatusColumn(): TableColumn<GithubDeployment>;
|
||||
createCommitColumn(): TableColumn<GithubDeployment>;
|
||||
createCreatorColumn(): TableColumn<GithubDeployment>;
|
||||
createLastUpdatedColumn(): TableColumn<GithubDeployment>;
|
||||
}>;
|
||||
defaultDeploymentColumns: TableColumn<GithubDeployment>[];
|
||||
};
|
||||
|
||||
// @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<GithubDeployment>[];
|
||||
}
|
||||
|
||||
// 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 };
|
||||
```
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
+5
-6
@@ -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<GithubDeployment>[];
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -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<GithubDeployment> {
|
||||
return {
|
||||
title: 'Environment',
|
||||
field: 'environment',
|
||||
highlight: true,
|
||||
};
|
||||
}
|
||||
export const columnFactories = Object.freeze({
|
||||
createEnvironmentColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Environment',
|
||||
field: 'environment',
|
||||
highlight: true,
|
||||
};
|
||||
},
|
||||
|
||||
export function createStatusColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Status',
|
||||
render: (row: GithubDeployment): JSX.Element => (
|
||||
<Box display="flex" alignItems="center">
|
||||
<GithubStateIndicator state={row.state} />
|
||||
<Typography variant="caption">{row.state}</Typography>
|
||||
</Box>
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
export function createCommitColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Commit',
|
||||
render: (row: GithubDeployment) =>
|
||||
row.commit && (
|
||||
<Link to={row.commit.commitUrl} target="_blank" rel="noopener">
|
||||
{row.commit.abbreviatedOid}
|
||||
</Link>
|
||||
createStatusColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Status',
|
||||
render: (row: GithubDeployment): JSX.Element => (
|
||||
<Box display="flex" alignItems="center">
|
||||
<GithubStateIndicator state={row.state} />
|
||||
<Typography variant="caption">{row.state}</Typography>
|
||||
</Box>
|
||||
),
|
||||
};
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
export function createCreatorColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Creator',
|
||||
field: 'creator.login',
|
||||
};
|
||||
}
|
||||
createCommitColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Commit',
|
||||
render: (row: GithubDeployment) =>
|
||||
row.commit && (
|
||||
<Link to={row.commit.commitUrl} target="_blank" rel="noopener">
|
||||
{row.commit.abbreviatedOid}
|
||||
</Link>
|
||||
),
|
||||
};
|
||||
},
|
||||
|
||||
export function createLastUpdatedColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Last Updated',
|
||||
render: (row: GithubDeployment): JSX.Element => (
|
||||
<Box>{DateTime.fromISO(row.updatedAt).toRelative({ locale: 'en' })}</Box>
|
||||
),
|
||||
};
|
||||
}
|
||||
createCreatorColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Creator',
|
||||
field: 'creator.login',
|
||||
};
|
||||
},
|
||||
|
||||
createLastUpdatedColumn(): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: 'Last Updated',
|
||||
render: (row: GithubDeployment): JSX.Element => (
|
||||
<Box>
|
||||
{DateTime.fromISO(row.updatedAt).toRelative({ locale: 'en' })}
|
||||
</Box>
|
||||
),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -13,4 +13,5 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { GithubDeploymentsTable } from './GithubDeploymentsTable';
|
||||
|
||||
@@ -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<GithubDeployment>[] = [
|
||||
createEnvironmentColumn(),
|
||||
createStatusColumn(),
|
||||
createCommitColumn(),
|
||||
createCreatorColumn(),
|
||||
createLastUpdatedColumn(),
|
||||
columnFactories.createEnvironmentColumn(),
|
||||
columnFactories.createStatusColumn(),
|
||||
columnFactories.createCommitColumn(),
|
||||
columnFactories.createCreatorColumn(),
|
||||
columnFactories.createLastUpdatedColumn(),
|
||||
];
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user