@roadiehq/backstage-plugin-jira
Version:
158 lines (155 loc) • 3.8 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { Table, Link } from '@backstage/core-components';
import { Box, Tooltip } from '@material-ui/core';
import Person from '@material-ui/icons/Person';
const availableColumns = [
{
title: "Key",
field: "key",
render: (data) => /* @__PURE__ */ jsx(
Link,
{
to: new URL(`/browse/${data?.key}`, data.self).href,
target: "_blank",
rel: "noopener noreferrer",
children: data?.key
}
),
width: "auto",
id: "key"
},
{
title: "summary",
field: "fields.summary",
width: "40%",
id: "summary"
},
{
title: "Priority",
field: "fields.priority.name",
width: "auto",
id: "priority"
},
{
title: "status",
field: "fields.status.name",
width: "auto",
id: "status"
},
{
title: "Type",
field: "fields.issueType",
width: "auto",
id: "type-icon",
render: (data) => {
return data.fields?.issuetype ? /* @__PURE__ */ jsx(Box, { paddingLeft: 1, children: /* @__PURE__ */ jsx(
"img",
{
src: data.fields?.issuetype?.iconUrl,
alt: data.fields?.issuetype?.name,
title: data.fields?.issuetype?.name
}
) }) : null;
}
},
{
title: "Type",
field: "fields.issuetype.name",
width: "auto",
id: "type"
},
{
title: "Assignee",
field: "fields.assignee",
width: "auto",
id: "assignee",
render: (data) => {
return data.fields?.assignee?.displayName ? /* @__PURE__ */ jsx("span", { children: data.fields?.assignee?.displayName }) : /* @__PURE__ */ jsx("span", { children: "Not Assigned" });
}
},
{
title: "Assignee",
field: "fields.assignee",
width: "auto",
id: "assignee-icon",
render: (data) => {
return /* @__PURE__ */ jsx(Box, { paddingLeft: 1, children: data.fields?.assignee?.displayName ? /* @__PURE__ */ jsx(
"img",
{
src: data.fields?.assignee?.avatarUrls["24x24"],
alt: data.fields?.assignee?.displayName,
title: data.fields?.assignee?.displayName,
width: "24px"
}
) : /* @__PURE__ */ jsx(Tooltip, { title: "Not Assigned", children: /* @__PURE__ */ jsx(Person, { color: "disabled" }) }) });
}
},
{
title: "created",
field: "fields.created",
width: "auto",
render: (data) => {
return data.fields?.created ? new Date(data.fields?.created).toLocaleDateString() : "?";
},
id: "created"
},
{
title: "Updated",
field: "fields.updated",
width: "auto",
id: "updated",
render: (data) => {
return data.fields?.created ? new Date(data.fields?.updated).toLocaleDateString() : "?";
}
},
{
title: "Project",
field: "fields.project.name",
width: "auto",
id: "project",
render: (data) => /* @__PURE__ */ jsx(
Link,
{
to: new URL(
`/browse/${data?.fields?.project?.key}`,
data?.fields?.project?.self
).href,
target: "_blank",
rel: "noopener noreferrer",
children: data?.fields?.project?.name
}
)
}
];
const IssuesTable = ({
issues,
title,
subtitle,
columnIds = [
"key",
"type-icon",
"summary",
"status",
"assignee-icon",
"priority",
"created",
"updated"
]
}) => /* @__PURE__ */ jsx(
Table,
{
title: title ?? "Issues",
subtitle: subtitle ?? "",
options: {
paging: true,
search: false,
sorting: true,
draggable: false,
padding: "dense"
},
data: issues ?? [],
columns: columnIds.map((it) => availableColumns.find((column) => column.id === it)).filter((it) => !!it)
}
);
export { IssuesTable };
//# sourceMappingURL=IssuesTable.esm.js.map