@backstage-community/plugin-sonarqube
Version:
41 lines (38 loc) • 1.19 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { ErrorPanel, Table } from '@backstage/core-components';
import { getColumns } from './Columns.esm.js';
import { useTranslationRef } from '@backstage/frontend-plugin-api';
import { sonarqubeTranslationRef } from '../../translation.esm.js';
const SonarQubeTable = ({
tableContent,
title,
options,
emptyContent,
localization
}) => {
const { t } = useTranslationRef(sonarqubeTranslationRef);
if (!tableContent) {
return /* @__PURE__ */ jsx(ErrorPanel, { error: Error("Table could not be rendered") });
}
const pageSize = options?.pageSize || 20;
const showPagination = tableContent?.length > pageSize;
return /* @__PURE__ */ jsx(
Table,
{
title: /* @__PURE__ */ jsx("div", { children: `${title ?? t("sonarQubeCard.title")} (${tableContent.length})` }),
options: {
padding: "dense",
paging: showPagination,
pageSize,
pageSizeOptions: [10, 20, 50, 100],
...options
},
data: tableContent || [],
columns: getColumns(t),
emptyContent,
localization
}
);
};
export { SonarQubeTable };
//# sourceMappingURL=SonarQubeTable.esm.js.map