feat: Display the plugins InfoCards on EntityPage Overwiev suitable full height (#2826)

* fix(github-actions): change RecentWorkflowRunsCard to InfoCard

* feat: format entity page overview page

* feat: replace InfoCard variant 'height100' with 'gridItem'

* fix: deprecate usage of InfoCard variant height100
This commit is contained in:
Jesko Steinberg
2020-10-20 20:20:30 +02:00
committed by GitHub
parent dc141d2854
commit 6d97d2d6f9
9 changed files with 113 additions and 39 deletions
@@ -81,10 +81,9 @@ const WidgetContent = ({
export const LatestWorkflowRunCard = ({
entity,
branch = 'master',
}: {
entity: Entity;
branch: string;
}) => {
// Display the card full height suitable for
variant,
}: Props) => {
const errorApi = useApi(errorApiRef);
const [owner, repo] = (
entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '/'
@@ -102,7 +101,7 @@ export const LatestWorkflowRunCard = ({
}, [error, errorApi]);
return (
<InfoCard title={`Last ${branch} build`}>
<InfoCard title={`Last ${branch} build`} variant={variant}>
<WidgetContent
error={error}
loading={loading}
@@ -113,14 +112,18 @@ export const LatestWorkflowRunCard = ({
);
};
type Props = {
entity: Entity;
branch: string;
variant?: string;
};
export const LatestWorkflowsForBranchCard = ({
entity,
branch = 'master',
}: {
entity: Entity;
branch: string;
}) => (
<InfoCard title={`Last ${branch} build`}>
variant,
}: Props) => (
<InfoCard title={`Last ${branch} build`} variant={variant}>
<WorkflowRunsTable branch={branch} entity={entity} />
</InfoCard>
);
@@ -18,9 +18,9 @@ import { errorApiRef, useApi } from '@backstage/core-api';
import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName';
import { useWorkflowRuns } from '../useWorkflowRuns';
import React, { useEffect } from 'react';
import { EmptyState, Table } from '@backstage/core';
import { EmptyState, InfoCard, Table } from '@backstage/core';
import { WorkflowRunStatus } from '../WorkflowRunStatus';
import { Button, Card, Link, TableContainer } from '@material-ui/core';
import { Button, Link } from '@material-ui/core';
import { generatePath, Link as RouterLink } from 'react-router-dom';
const firstLine = (message: string): string => message.split('\n')[0];
@@ -30,6 +30,7 @@ export type Props = {
branch?: string;
dense?: boolean;
limit?: number;
variant?: string;
};
export const RecentWorkflowRunsCard = ({
@@ -37,6 +38,7 @@ export const RecentWorkflowRunsCard = ({
branch,
dense = false,
limit = 5,
variant,
}: Props) => {
const errorApi = useApi(errorApiRef);
const [owner, repo] = (
@@ -70,15 +72,19 @@ export const RecentWorkflowRunsCard = ({
}
/>
) : (
<TableContainer component={Card}>
<InfoCard
title="Recent Workflow Runs"
subheader={branch ? `Branch: ${branch}` : 'All Branches'}
noPadding
variant={variant}
>
<Table
title="Recent Workflow Runs"
subtitle={branch ? `Branch: ${branch}` : 'All Branches'}
isLoading={loading}
options={{
search: false,
paging: false,
padding: dense ? 'dense' : 'default',
toolbar: false,
}}
columns={[
{
@@ -98,6 +104,6 @@ export const RecentWorkflowRunsCard = ({
]}
data={runs}
/>
</TableContainer>
</InfoCard>
);
};