Merge branch 'master' into rugvip/test-port

This commit is contained in:
Patrik Oldsberg
2021-11-22 17:33:10 +01:00
committed by GitHub
606 changed files with 10288 additions and 2245 deletions
@@ -17,7 +17,7 @@ import React from 'react';
import { Entity } from '@backstage/catalog-model';
import { useEntity } from '@backstage/plugin-catalog-react';
import { Routes, Route } from 'react-router';
import { rootRouteRef, buildRouteRef } from '../routes';
import { buildRouteRef } from '../routes';
import { WorkflowRunDetails } from './WorkflowRunDetails';
import { WorkflowRunsTable } from './WorkflowRunsTable';
import { GITHUB_ACTIONS_ANNOTATION } from './useProjectName';
@@ -41,12 +41,9 @@ export const Router = (_props: Props) => {
}
return (
<Routes>
<Route path="/" element={<WorkflowRunsTable entity={entity} />} />
<Route
path={`/${rootRouteRef.path}`}
element={<WorkflowRunsTable entity={entity} />}
/>
<Route
path={`/${buildRouteRef.path}`}
path={`${buildRouteRef.path}`}
element={<WorkflowRunDetails entity={entity} />}
/>
)
@@ -24,7 +24,7 @@ import {
} from '@material-ui/core';
import RetryIcon from '@material-ui/icons/Replay';
import GitHubIcon from '@material-ui/icons/GitHub';
import { Link as RouterLink, generatePath } from 'react-router-dom';
import { Link as RouterLink } from 'react-router-dom';
import { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';
import { WorkflowRunStatus } from '../WorkflowRunStatus';
import SyncIcon from '@material-ui/icons/Sync';
@@ -34,7 +34,7 @@ import { Entity } from '@backstage/catalog-model';
import { readGitHubIntegrationConfigs } from '@backstage/integration';
import { EmptyState, Table, TableColumn } from '@backstage/core-components';
import { configApiRef, useApi } from '@backstage/core-plugin-api';
import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';
const generatedColumns: TableColumn[] = [
{
@@ -47,14 +47,18 @@ const generatedColumns: TableColumn[] = [
title: 'Message',
field: 'message',
highlight: true,
render: (row: Partial<WorkflowRun>) => (
<Link
component={RouterLink}
to={generatePath(buildRouteRef.path, { id: row.id! })}
>
{row.message}
</Link>
),
render: (row: Partial<WorkflowRun>) => {
const LinkWrapper = () => {
const routeLink = useRouteRef(buildRouteRef);
return (
<Link component={RouterLink} to={routeLink({ id: row.id! })}>
{row.message}
</Link>
);
};
return <LinkWrapper />;
},
},
{
title: 'Source',
+6 -7
View File
@@ -14,15 +14,14 @@
* limitations under the License.
*/
import { createRouteRef } from '@backstage/core-plugin-api';
import { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';
export const rootRouteRef = createRouteRef({
path: '',
title: 'GitHub Actions',
id: 'github-actions',
});
export const buildRouteRef = createRouteRef({
path: ':id',
params: ['id'],
title: 'GitHub Actions Workflow Run',
export const buildRouteRef = createSubRouteRef({
id: 'github-actions/build',
path: '/:id',
parent: rootRouteRef,
});