@roadiehq/backstage-plugin-travis-ci
Version:
61 lines (58 loc) • 1.76 kB
JavaScript
import { jsx, jsxs } from 'react/jsx-runtime';
import { makeStyles, LinearProgress, TableContainer, Card, Link, Typography } from '@material-ui/core';
import { Table } from '@backstage/core-components';
import { useBuilds } from '../hooks/useBuilds.esm.js';
import { getStatusComponent } from './BuildsPage/lib/CITable/CITable.esm.js';
const useStyles = makeStyles({
buildName: {
display: "inline-block",
maxWidth: "190px",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap"
}
});
const LastBuildCard = () => {
const classes = useStyles();
const [{ value, loading }] = useBuilds();
if (loading || !value) return /* @__PURE__ */ jsx(LinearProgress, {});
return /* @__PURE__ */ jsx(TableContainer, { component: Card, children: /* @__PURE__ */ jsx(
Table,
{
title: "Recent Travis-CI Builds",
subtitle: "All Branches",
isLoading: loading,
options: {
search: false,
paging: false
},
columns: [
{
title: "Build name",
field: "buildName",
render: (data) => /* @__PURE__ */ jsx(
Link,
{
href: data.buildUrl,
target: "_blank",
className: classes.buildName,
children: data.buildName
}
)
},
{
title: "Status",
field: "status",
render: (data) => /* @__PURE__ */ jsxs(Typography, { variant: "button", children: [
getStatusComponent(data.status),
data.status
] })
},
{ title: "Branch", field: "source.branchName" }
],
data: value
}
) });
};
export { LastBuildCard };
//# sourceMappingURL=LastBuildCard.esm.js.map