@backstage-community/plugin-sonarqube
Version:
92 lines (89 loc) • 3.8 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { EntityPeekAheadPopover, EntityRefLink } from '@backstage/plugin-catalog-react';
import { QualityBadge, NoSonarQubeCard, LastAnalyzedRatingCard, BugReportRatingCard, VulnerabilitiesRatingCard, CodeSmellsRatingCard, HotspotsReviewed, CoverageRatingCard, DuplicationsRatingCard } from '../SonarQubeCard/MetricInsights.esm.js';
const getColumns = (t) => {
return [
{
title: t("sonarQubeTable.columnsTitle.name"),
field: "resolved.name",
type: "string",
highlight: true,
render: ({ resolved }) => {
if (!resolved?.name) {
return null;
}
const entityRef = resolved.entityRef || `component:default/${resolved.name}`;
return /* @__PURE__ */ jsx(EntityPeekAheadPopover, { entityRef, children: /* @__PURE__ */ jsx(EntityRefLink, { entityRef }) });
}
},
{
title: t("sonarQubeTable.columnsTitle.qualityGate"),
field: "resolved.findings.metrics.alert_status",
type: "string",
render: ({ resolved, id }) => {
if (resolved?.findings?.metrics) {
return /* @__PURE__ */ jsx(QualityBadge, { value: resolved?.findings, compact: true });
}
return /* @__PURE__ */ jsx(NoSonarQubeCard, { value: resolved, sonarQubeComponentKey: id });
}
},
{
title: t("sonarQubeTable.columnsTitle.lastAnalysis"),
field: "resolved.findings.metrics.lastAnalysis",
align: "right",
type: "datetime",
width: "8%",
render: ({ resolved }) => resolved?.findings?.metrics && /* @__PURE__ */ jsx(LastAnalyzedRatingCard, { value: resolved?.findings })
},
{
title: t("sonarQubeTable.columnsTitle.bugs"),
field: "resolved.findings.metrics.bugs",
align: "center",
type: "numeric",
width: "7%",
render: ({ resolved }) => resolved?.findings?.metrics && /* @__PURE__ */ jsx(BugReportRatingCard, { value: resolved?.findings, compact: true })
},
{
title: t("sonarQubeTable.columnsTitle.vulnerabilities"),
field: "resolved.findings.metrics.vulnerabilities",
align: "center",
width: "7%",
type: "numeric",
render: ({ resolved }) => resolved?.findings?.metrics && /* @__PURE__ */ jsx(VulnerabilitiesRatingCard, { value: resolved?.findings, compact: true })
},
{
title: t("sonarQubeTable.columnsTitle.codeSmells"),
field: "resolved.findings.metrics.code_smells",
align: "center",
type: "numeric",
width: "7%",
render: ({ resolved }) => resolved?.findings?.metrics && /* @__PURE__ */ jsx(CodeSmellsRatingCard, { value: resolved?.findings, compact: true })
},
{
title: t("sonarQubeTable.columnsTitle.hotspotsReviewed"),
field: "resolved.findings.metrics.security_hotspots_reviewed",
align: "center",
type: "numeric",
width: "7%",
render: ({ resolved }) => resolved?.findings?.metrics && /* @__PURE__ */ jsx(HotspotsReviewed, { value: resolved?.findings, compact: true })
},
{
title: t("sonarQubeTable.columnsTitle.coverage"),
field: "resolved.findings.metrics.coverage",
align: "center",
type: "numeric",
width: "7%",
render: ({ resolved }) => resolved?.findings?.metrics && /* @__PURE__ */ jsx(CoverageRatingCard, { value: resolved?.findings, compact: true })
},
{
title: t("sonarQubeTable.columnsTitle.duplications"),
field: "resolved.findings.metrics.duplicated_lines_density",
align: "center",
type: "numeric",
width: "7%",
render: ({ resolved }) => resolved?.findings?.metrics && /* @__PURE__ */ jsx(DuplicationsRatingCard, { value: resolved?.findings, compact: true })
}
];
};
export { getColumns };
//# sourceMappingURL=Columns.esm.js.map