@backstage-community/plugin-sonarqube 0.22.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/api/SonarQubeClient.esm.js +28 -48
- package/dist/api/SonarQubeClient.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/SonarQubeCard.esm.js +55 -19
- package/dist/components/SonarQubeCard/SonarQubeCard.esm.js.map +1 -1
- package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js +12 -16
- package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/translation.esm.js +12 -0
- package/dist/translation.esm.js.map +1 -1
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @backstage-community/plugin-sonarqube
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 39ef4af: A new `GET /entities/:kind/:namespace/:name/summary` endpoint has been introduced, which resolves the entity, reads the `sonarqube.org/project-key` annotation, and fetches findings and instance URL server-side. This replaces the old `/findings` and `/instanceUrl` endpoints (now deprecated), removing the need for the frontend to parse annotations or pass project keys directly.
|
|
8
|
+
|
|
9
|
+
**BREAKING**: The `SonarQubeApi` interface has been consolidated from two methods (`getFindingSummary` and `getFindingSummaries`) into a single `getSummaries` method that accepts an array of `Entity` objects (instead of `componentKey`/`projectInstance` options).
|
|
10
|
+
|
|
11
|
+
The `<SonarQubeCard />` component now displays more specific error messages.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [39ef4af]
|
|
16
|
+
- @backstage-community/plugin-sonarqube-react@1.0.0
|
|
17
|
+
|
|
18
|
+
## 0.23.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 3b18fd5: Backstage version bump to v1.47.2
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [3b18fd5]
|
|
27
|
+
- @backstage-community/plugin-sonarqube-react@0.15.0
|
|
28
|
+
|
|
3
29
|
## 0.22.2
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ResponseError } from '@backstage/errors';
|
|
2
|
+
|
|
1
3
|
class SonarQubeClient {
|
|
2
4
|
discoveryApi;
|
|
3
5
|
fetchApi;
|
|
@@ -16,19 +18,29 @@ class SonarQubeClient {
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
);
|
|
19
|
-
if (response.
|
|
21
|
+
if (response.ok) {
|
|
20
22
|
return await response.json();
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
throw await ResponseError.fromResponse(response);
|
|
23
25
|
}
|
|
24
|
-
async
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
async fetchSummary(entity) {
|
|
27
|
+
const kind = entity.kind;
|
|
28
|
+
const namespace = entity.metadata.namespace ?? "default";
|
|
29
|
+
const name = entity.metadata.name;
|
|
30
|
+
const summary = await this.callApi(
|
|
31
|
+
`entities/${encodeURIComponent(kind)}/${encodeURIComponent(
|
|
32
|
+
namespace
|
|
33
|
+
)}/${encodeURIComponent(name)}/summary`,
|
|
34
|
+
{}
|
|
35
|
+
);
|
|
36
|
+
if (!summary || !summary.findings) {
|
|
29
37
|
return void 0;
|
|
30
38
|
}
|
|
31
|
-
const
|
|
39
|
+
const { componentKey, instanceUrl: rawUrl, findings } = summary;
|
|
40
|
+
let baseUrl = rawUrl;
|
|
41
|
+
if (!baseUrl.endsWith("/")) {
|
|
42
|
+
baseUrl += "/";
|
|
43
|
+
}
|
|
32
44
|
const metrics = {
|
|
33
45
|
alert_status: void 0,
|
|
34
46
|
bugs: void 0,
|
|
@@ -42,26 +54,6 @@ class SonarQubeClient {
|
|
|
42
54
|
coverage: void 0,
|
|
43
55
|
duplicated_lines_density: void 0
|
|
44
56
|
};
|
|
45
|
-
const baseUrlWrapper = await this.callApi(
|
|
46
|
-
"instanceUrl",
|
|
47
|
-
{
|
|
48
|
-
instanceKey
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
let baseUrl = baseUrlWrapper?.instanceUrl;
|
|
52
|
-
if (!baseUrl) {
|
|
53
|
-
return void 0;
|
|
54
|
-
}
|
|
55
|
-
if (!baseUrl.endsWith("/")) {
|
|
56
|
-
baseUrl += "/";
|
|
57
|
-
}
|
|
58
|
-
const findings = await this.callApi("findings", {
|
|
59
|
-
componentKey,
|
|
60
|
-
instanceKey
|
|
61
|
-
});
|
|
62
|
-
if (!findings) {
|
|
63
|
-
return void 0;
|
|
64
|
-
}
|
|
65
57
|
findings.measures.forEach((m) => {
|
|
66
58
|
metrics[m.metric] = m.value;
|
|
67
59
|
});
|
|
@@ -81,28 +73,16 @@ class SonarQubeClient {
|
|
|
81
73
|
getSecurityHotspotsUrl: () => `${baseUrl}${baseUrl === "https://sonarcloud.io/" ? "project/" : ""}security_hotspots?id=${encodeURIComponent(componentKey)}`
|
|
82
74
|
};
|
|
83
75
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
async getFindingSummaries(components) {
|
|
90
|
-
const map = /* @__PURE__ */ new Map();
|
|
91
|
-
if (components.length === 0) {
|
|
92
|
-
return map;
|
|
76
|
+
async getSummaries(entities) {
|
|
77
|
+
if (entities.length === 0) {
|
|
78
|
+
return [];
|
|
93
79
|
}
|
|
94
|
-
const
|
|
95
|
-
(
|
|
80
|
+
const results = await Promise.allSettled(
|
|
81
|
+
entities.map((e) => this.fetchSummary(e))
|
|
82
|
+
);
|
|
83
|
+
return results.map(
|
|
84
|
+
(result) => result.status === "fulfilled" ? result.value : void 0
|
|
96
85
|
);
|
|
97
|
-
const summaries = await Promise.allSettled(promises).then((results) => {
|
|
98
|
-
return results.map((result) => result).map((result) => result.value);
|
|
99
|
-
});
|
|
100
|
-
for await (const summary of summaries) {
|
|
101
|
-
if (summary?.title && !map.has(summary.title)) {
|
|
102
|
-
map.set(summary.title, summary);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return map;
|
|
106
86
|
}
|
|
107
87
|
}
|
|
108
88
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SonarQubeClient.esm.js","sources":["../../src/api/SonarQubeClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FindingSummary,\n Metrics,\n SonarQubeApi,\n} from '@backstage-community/plugin-sonarqube-react';\nimport {
|
|
1
|
+
{"version":3,"file":"SonarQubeClient.esm.js","sources":["../../src/api/SonarQubeClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport {\n FindingSummary,\n Metrics,\n SonarQubeApi,\n} from '@backstage-community/plugin-sonarqube-react';\nimport { SummaryWrapper } from './types';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\n\n/** @public */\nexport class SonarQubeClient implements SonarQubeApi {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n private async callApi<T>(\n path: string,\n query: { [key in string]: string },\n ): Promise<T | undefined> {\n const response = await this.fetchApi.fetch(\n `${await this.discoveryApi.getBaseUrl(\n 'sonarqube',\n )}/${path}?${new URLSearchParams(query).toString()}`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.ok) {\n return (await response.json()) as T;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n private async fetchSummary(\n entity: Entity,\n ): Promise<FindingSummary | undefined> {\n const kind = entity.kind;\n const namespace = entity.metadata.namespace ?? 'default';\n const name = entity.metadata.name;\n const summary = await this.callApi<SummaryWrapper>(\n `entities/${encodeURIComponent(kind)}/${encodeURIComponent(\n namespace,\n )}/${encodeURIComponent(name)}/summary`,\n {},\n );\n\n if (!summary || !summary.findings) {\n return undefined;\n }\n\n const { componentKey, instanceUrl: rawUrl, findings } = summary;\n let baseUrl = rawUrl;\n if (!baseUrl.endsWith('/')) {\n baseUrl += '/';\n }\n\n const metrics: Metrics = {\n alert_status: undefined,\n bugs: undefined,\n reliability_rating: undefined,\n vulnerabilities: undefined,\n security_rating: undefined,\n security_hotspots_reviewed: undefined,\n security_review_rating: undefined,\n code_smells: undefined,\n sqale_rating: undefined,\n coverage: undefined,\n duplicated_lines_density: undefined,\n };\n\n findings.measures.forEach(m => {\n metrics[m.metric] = m.value;\n });\n\n return {\n title: componentKey,\n lastAnalysis: findings.analysisDate,\n metrics,\n projectUrl: `${baseUrl}dashboard?id=${encodeURIComponent(componentKey)}`,\n getIssuesUrl: identifier =>\n `${baseUrl}project/issues?id=${encodeURIComponent(\n componentKey,\n )}&types=${identifier.toLocaleUpperCase('en-US')}&resolved=false`,\n getComponentMeasuresUrl: identifier =>\n `${baseUrl}component_measures?id=${encodeURIComponent(\n componentKey,\n )}&metric=${identifier.toLocaleLowerCase(\n 'en-US',\n )}&resolved=false&view=list`,\n getSecurityHotspotsUrl: () =>\n `${baseUrl}${\n baseUrl === 'https://sonarcloud.io/' ? 'project/' : ''\n }security_hotspots?id=${encodeURIComponent(componentKey)}`,\n };\n }\n\n async getSummaries(\n entities: Entity[],\n ): Promise<(FindingSummary | undefined)[]> {\n if (entities.length === 0) {\n return [];\n }\n const results = await Promise.allSettled(\n entities.map(e => this.fetchSummary(e)),\n );\n return results.map(result =>\n result.status === 'fulfilled' ? result.value : undefined,\n );\n }\n}\n"],"names":[],"mappings":";;AA2BO,MAAM,eAAwC,CAAA;AAAA,EACnD,YAAA;AAAA,EACA,QAAA;AAAA,EAEA,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA;AAAA;AAC1B,EAEA,MAAc,OACZ,CAAA,IAAA,EACA,KACwB,EAAA;AACxB,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MACnC,CAAA,EAAG,MAAM,IAAA,CAAK,YAAa,CAAA,UAAA;AAAA,QACzB;AAAA,OACD,IAAI,IAAI,CAAA,CAAA,EAAI,IAAI,eAAgB,CAAA,KAAK,CAAE,CAAA,QAAA,EAAU,CAAA,CAAA;AAAA,MAClD;AAAA,QACE,OAAS,EAAA;AAAA,UACP,cAAgB,EAAA;AAAA;AAClB;AACF,KACF;AACA,IAAA,IAAI,SAAS,EAAI,EAAA;AACf,MAAQ,OAAA,MAAM,SAAS,IAAK,EAAA;AAAA;AAE9B,IAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,QAAQ,CAAA;AAAA;AACjD,EAEA,MAAc,aACZ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,GAAA,KAAA;AAAA,KACjD;AAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
3
|
-
import { sonarQubeApiRef,
|
|
3
|
+
import { sonarQubeApiRef, isSonarQubeAvailable, SONARQUBE_PROJECT_KEY_ANNOTATION } from '@backstage-community/plugin-sonarqube-react';
|
|
4
4
|
import Grid from '@material-ui/core/Grid';
|
|
5
5
|
import { makeStyles } from '@material-ui/core/styles';
|
|
6
6
|
import useAsync from 'react-use/esm/useAsync';
|
|
@@ -26,13 +26,13 @@ const SonarQubeCard = (props) => {
|
|
|
26
26
|
const { entity } = useEntity();
|
|
27
27
|
const sonarQubeApi = useApi(sonarQubeApiRef);
|
|
28
28
|
const { t } = useTranslationRef(sonarqubeTranslationRef);
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[sonarQubeApi,
|
|
29
|
+
const {
|
|
30
|
+
value: summaryFinding,
|
|
31
|
+
error,
|
|
32
|
+
loading
|
|
33
|
+
} = useAsync(
|
|
34
|
+
async () => sonarQubeApi.getSummaries([entity]).then((r) => r[0]),
|
|
35
|
+
[sonarQubeApi, entity]
|
|
36
36
|
);
|
|
37
37
|
const deepLink = !loading && summaryFinding?.metrics ? {
|
|
38
38
|
title: t("sonarQubeCard.deepLinkTitle"),
|
|
@@ -54,23 +54,14 @@ const SonarQubeCard = (props) => {
|
|
|
54
54
|
},
|
|
55
55
|
children: [
|
|
56
56
|
loading && /* @__PURE__ */ jsx(Progress, {}),
|
|
57
|
-
!loading && !
|
|
57
|
+
!loading && !isSonarQubeAvailable(entity) && /* @__PURE__ */ jsx(
|
|
58
58
|
MissingAnnotationEmptyState,
|
|
59
59
|
{
|
|
60
60
|
annotation: SONARQUBE_PROJECT_KEY_ANNOTATION,
|
|
61
61
|
readMoreUrl: missingAnnotationReadMoreUrl
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
!loading &&
|
|
65
|
-
EmptyState,
|
|
66
|
-
{
|
|
67
|
-
missing: "info",
|
|
68
|
-
title: t("sonarQubeCard.emptyState.title"),
|
|
69
|
-
description: t("sonarQubeCard.emptyState.description", {
|
|
70
|
-
projectTitle
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
),
|
|
64
|
+
!loading && error && /* @__PURE__ */ jsx(ErrorMessage, { error }),
|
|
74
65
|
!loading && summaryFinding?.metrics && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
75
66
|
Grid,
|
|
76
67
|
{
|
|
@@ -135,6 +126,51 @@ const SonarQubeCard = (props) => {
|
|
|
135
126
|
}
|
|
136
127
|
);
|
|
137
128
|
};
|
|
129
|
+
function ErrorMessage({ error }) {
|
|
130
|
+
const { t } = useTranslationRef(sonarqubeTranslationRef);
|
|
131
|
+
const statusCode = isResponseError(error) ? error.statusCode : void 0;
|
|
132
|
+
if (statusCode === 401) {
|
|
133
|
+
return /* @__PURE__ */ jsx(
|
|
134
|
+
EmptyState,
|
|
135
|
+
{
|
|
136
|
+
missing: "info",
|
|
137
|
+
title: t("sonarQubeCard.unauthorizedError.title"),
|
|
138
|
+
description: t("sonarQubeCard.unauthorizedError.description")
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
if (statusCode === 403) {
|
|
143
|
+
return /* @__PURE__ */ jsx(
|
|
144
|
+
EmptyState,
|
|
145
|
+
{
|
|
146
|
+
missing: "info",
|
|
147
|
+
title: t("sonarQubeCard.forbiddenError.title"),
|
|
148
|
+
description: t("sonarQubeCard.forbiddenError.description")
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
if (statusCode === 404) {
|
|
153
|
+
return /* @__PURE__ */ jsx(
|
|
154
|
+
EmptyState,
|
|
155
|
+
{
|
|
156
|
+
missing: "info",
|
|
157
|
+
title: t("sonarQubeCard.notFoundError.title"),
|
|
158
|
+
description: t("sonarQubeCard.notFoundError.description")
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
return /* @__PURE__ */ jsx(
|
|
163
|
+
EmptyState,
|
|
164
|
+
{
|
|
165
|
+
missing: "info",
|
|
166
|
+
title: t("sonarQubeCard.emptyState.title"),
|
|
167
|
+
description: error.cause instanceof Error ? error.cause.message : error.message
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
function isResponseError(error) {
|
|
172
|
+
return "statusCode" in error;
|
|
173
|
+
}
|
|
138
174
|
|
|
139
175
|
export { SonarQubeCard };
|
|
140
176
|
//# sourceMappingURL=SonarQubeCard.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SonarQubeCard.esm.js","sources":["../../../src/components/SonarQubeCard/SonarQubeCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport {\n sonarQubeApiRef,\n useProjectInfo,\n SONARQUBE_PROJECT_KEY_ANNOTATION,\n} from '@backstage-community/plugin-sonarqube-react';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n EmptyState,\n InfoCard,\n InfoCardVariants,\n Progress,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n BugReportRatingCard,\n CodeSmellsRatingCard,\n CoverageRatingCard,\n DuplicationsRatingCard,\n HotspotsReviewed,\n LastAnalyzedRatingCard,\n QualityBadge,\n VulnerabilitiesRatingCard,\n} from './MetricInsights';\nimport { DuplicationRating } from '../SonarQubeTable/types';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n action: {\n margin: 0,\n },\n lastAnalyzed: {\n color: theme.palette.text.secondary,\n },\n}));\n\n/** @public */\nexport const SonarQubeCard = (props: {\n variant?: InfoCardVariants;\n duplicationRatings?: DuplicationRating[];\n missingAnnotationReadMoreUrl?: string;\n}) => {\n const { variant = 'gridItem', missingAnnotationReadMoreUrl } = props;\n const { entity } = useEntity();\n const sonarQubeApi = useApi(sonarQubeApiRef);\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n\n const { projectKey: projectTitle, projectInstance } = useProjectInfo(entity);\n\n const { value: summaryFinding, loading } = useAsync(\n async () =>\n sonarQubeApi.getFindingSummary({\n componentKey: projectTitle,\n projectInstance: projectInstance,\n }),\n [sonarQubeApi, projectTitle],\n );\n\n const deepLink =\n !loading && summaryFinding?.metrics\n ? {\n title: t('sonarQubeCard.deepLinkTitle'),\n link: `${summaryFinding.projectUrl}&codeScope=overall`,\n }\n : undefined;\n\n const classes = useStyles();\n return (\n <InfoCard\n title={t('sonarQubeCard.title')}\n deepLink={deepLink}\n variant={variant}\n headerProps={{\n action: !loading && summaryFinding?.metrics && (\n <QualityBadge value={summaryFinding} />\n ),\n classes: {\n root: classes.header,\n action: classes.action,\n },\n }}\n >\n {loading && <Progress />}\n\n {!loading && !projectTitle && (\n <MissingAnnotationEmptyState\n annotation={SONARQUBE_PROJECT_KEY_ANNOTATION}\n readMoreUrl={missingAnnotationReadMoreUrl}\n />\n )}\n\n {!loading && projectTitle && !summaryFinding?.metrics && (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.emptyState.title')}\n description={t('sonarQubeCard.emptyState.description', {\n projectTitle,\n })}\n />\n )}\n\n {!loading && summaryFinding?.metrics && (\n <>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n style={{ height: '100%' }}\n spacing={0}\n >\n <Grid item container justifyContent=\"space-around\">\n <BugReportRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.bugReportRatingCardTitle')}\n />\n <VulnerabilitiesRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.vulnerabilitiesRatingCardTitle')}\n />\n <CodeSmellsRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.codeSmellsRatingCardTitle')}\n />\n <HotspotsReviewed\n value={summaryFinding}\n title={t('sonarQubeCard.hotspotsReviewedTitle')}\n />\n <div style={{ width: '100%' }} />\n <CoverageRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.coverageRatingCardTitle')}\n />\n <DuplicationsRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.duplicationsRatingCard')}\n />\n </Grid>\n <Grid item className={classes.lastAnalyzed}>\n <LastAnalyzedRatingCard value={summaryFinding} />\n </Grid>\n </Grid>\n </>\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAiDA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,GAAG;AAAA,GACrC;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA;AAE9B,CAAE,CAAA,CAAA;AAGW,MAAA,aAAA,GAAgB,CAAC,KAIxB,KAAA;AACJ,EAAA,MAAM,EAAE,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,kBAAC,oBAAA;AAAA,kBAAA;AAAA,oBACC,KAAO,EAAA,cAAA;AAAA,oBACP,KAAA,EAAO,EAAE,yCAAyC;AAAA;AAAA,iBACpD;AAAA,gCACA,GAAA;AAAA,kBAAC,gBAAA;AAAA,kBAAA;AAAA,oBACC,KAAO,EAAA,cAAA;AAAA,oBACP,KAAA,EAAO,EAAE,qCAAqC;AAAA;AAAA,iBAChD;AAAA,oCACC,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,KAAA,EAAO,QAAU,EAAA,CAAA;AAAA,gCAC/B,GAAA;AAAA,kBAAC,kBAAA;AAAA,kBAAA;AAAA,oBACC,KAAO,EAAA,cAAA;AAAA,oBACP,KAAA,EAAO,EAAE,uCAAuC;AAAA;AAAA,iBAClD;AAAA,gCACA,GAAA;AAAA,kBAAC,sBAAA;AAAA,kBAAA;AAAA,oBACC,KAAO,EAAA,cAAA;AAAA,oBACP,KAAA,EAAO,EAAE,sCAAsC;AAAA;AAAA;AACjD,eACF,EAAA,CAAA;AAAA,8BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,SAAA,EAAW,OAAQ,CAAA,YAAA,EAC5B,QAAC,kBAAA,GAAA,CAAA,sBAAA,EAAA,EAAuB,KAAO,EAAA,cAAA,EAAgB,CACjD,EAAA;AAAA;AAAA;AAAA,SAEJ,EAAA;AAAA;AAAA;AAAA,GAEJ;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"SonarQubeCard.esm.js","sources":["../../../src/components/SonarQubeCard/SonarQubeCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport {\n sonarQubeApiRef,\n SONARQUBE_PROJECT_KEY_ANNOTATION,\n isSonarQubeAvailable,\n} from '@backstage-community/plugin-sonarqube-react';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n EmptyState,\n InfoCard,\n InfoCardVariants,\n Progress,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n BugReportRatingCard,\n CodeSmellsRatingCard,\n CoverageRatingCard,\n DuplicationsRatingCard,\n HotspotsReviewed,\n LastAnalyzedRatingCard,\n QualityBadge,\n VulnerabilitiesRatingCard,\n} from './MetricInsights';\nimport { DuplicationRating } from '../SonarQubeTable/types';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n action: {\n margin: 0,\n },\n lastAnalyzed: {\n color: theme.palette.text.secondary,\n },\n}));\n\n/** @public */\nexport const SonarQubeCard = (props: {\n variant?: InfoCardVariants;\n duplicationRatings?: DuplicationRating[];\n missingAnnotationReadMoreUrl?: string;\n}) => {\n const { variant = 'gridItem', missingAnnotationReadMoreUrl } = props;\n const { entity } = useEntity();\n const sonarQubeApi = useApi(sonarQubeApiRef);\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n\n const {\n value: summaryFinding,\n error,\n loading,\n } = useAsync(\n async () => sonarQubeApi.getSummaries([entity]).then(r => r[0]),\n [sonarQubeApi, entity],\n );\n\n const deepLink =\n !loading && summaryFinding?.metrics\n ? {\n title: t('sonarQubeCard.deepLinkTitle'),\n link: `${summaryFinding.projectUrl}&codeScope=overall`,\n }\n : undefined;\n\n const classes = useStyles();\n return (\n <InfoCard\n title={t('sonarQubeCard.title')}\n deepLink={deepLink}\n variant={variant}\n headerProps={{\n action: !loading && summaryFinding?.metrics && (\n <QualityBadge value={summaryFinding} />\n ),\n classes: {\n root: classes.header,\n action: classes.action,\n },\n }}\n >\n {loading && <Progress />}\n\n {!loading && !isSonarQubeAvailable(entity) && (\n <MissingAnnotationEmptyState\n annotation={SONARQUBE_PROJECT_KEY_ANNOTATION}\n readMoreUrl={missingAnnotationReadMoreUrl}\n />\n )}\n\n {!loading && error && <ErrorMessage error={error} />}\n\n {!loading && summaryFinding?.metrics && (\n <>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n style={{ height: '100%' }}\n spacing={0}\n >\n <Grid item container justifyContent=\"space-around\">\n <BugReportRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.bugReportRatingCardTitle')}\n />\n <VulnerabilitiesRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.vulnerabilitiesRatingCardTitle')}\n />\n <CodeSmellsRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.codeSmellsRatingCardTitle')}\n />\n <HotspotsReviewed\n value={summaryFinding}\n title={t('sonarQubeCard.hotspotsReviewedTitle')}\n />\n <div style={{ width: '100%' }} />\n <CoverageRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.coverageRatingCardTitle')}\n />\n <DuplicationsRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.duplicationsRatingCard')}\n />\n </Grid>\n <Grid item className={classes.lastAnalyzed}>\n <LastAnalyzedRatingCard value={summaryFinding} />\n </Grid>\n </Grid>\n </>\n )}\n </InfoCard>\n );\n};\n\nfunction ErrorMessage({ error }: { error: Error }) {\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n const statusCode = isResponseError(error) ? error.statusCode : undefined;\n\n if (statusCode === 401) {\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.unauthorizedError.title')}\n description={t('sonarQubeCard.unauthorizedError.description')}\n />\n );\n }\n\n if (statusCode === 403) {\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.forbiddenError.title')}\n description={t('sonarQubeCard.forbiddenError.description')}\n />\n );\n }\n\n if (statusCode === 404) {\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.notFoundError.title')}\n description={t('sonarQubeCard.notFoundError.description')}\n />\n );\n }\n\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.emptyState.title')}\n description={\n error.cause instanceof Error ? error.cause.message : error.message\n }\n />\n );\n}\n\nfunction isResponseError(\n error: Error,\n): error is Error & { statusCode: number } {\n return 'statusCode' in error;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAiDA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,GAAG;AAAA,GACrC;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA;AAE9B,CAAE,CAAA,CAAA;AAGW,MAAA,aAAA,GAAgB,CAAC,KAIxB,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,GAAU,UAAY,EAAA,4BAAA,EAAiC,GAAA,KAAA;AAC/D,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,uBAAuB,CAAA;AAEvD,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,cAAA;AAAA,IACP,KAAA;AAAA,IACA;AAAA,GACE,GAAA,QAAA;AAAA,IACF,YAAY,YAAa,CAAA,YAAA,CAAa,CAAC,MAAM,CAAC,CAAA,CAAE,IAAK,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;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,KAAA,EAAO,EAAE,gCAAgC,CAAA;AAAA,MACzC,aACE,KAAM,CAAA,KAAA,YAAiB,QAAQ,KAAM,CAAA,KAAA,CAAM,UAAU,KAAM,CAAA;AAAA;AAAA,GAE/D;AAEJ;AAEA,SAAS,gBACP,KACyC,EAAA;AACzC,EAAA,OAAO,YAAgB,IAAA,KAAA;AACzB;;;;"}
|
package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
|
4
4
|
import { useApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import { Progress, ResponseErrorPanel } from '@backstage/core-components';
|
|
6
6
|
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
7
|
-
import { sonarQubeApiRef,
|
|
7
|
+
import { sonarQubeApiRef, isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';
|
|
8
8
|
import '../SonarQubeCard/SonarQubeCard.esm.js';
|
|
9
9
|
import { SonarQubeTable } from '../SonarQubeTable/SonarQubeTable.esm.js';
|
|
10
10
|
|
|
@@ -19,21 +19,13 @@ const SonarQubeRelatedEntitiesOverview = (props) => {
|
|
|
19
19
|
type: props.relationType,
|
|
20
20
|
kind: props.entityKind
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
const entityNameToProjectKey = {};
|
|
24
|
-
for (const entity of entities || []) {
|
|
25
|
-
const { projectKey, projectInstance } = getProjectInfo(entity);
|
|
26
|
-
if (projectKey) {
|
|
27
|
-
entityNameToProjectKey[entity.metadata.name] = projectKey;
|
|
28
|
-
findingsRequest.push({ componentKey: projectKey, projectInstance });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
22
|
+
const sonarEntities = (entities || []).filter(isSonarQubeAvailable);
|
|
31
23
|
const {
|
|
32
24
|
value: findingResults,
|
|
33
25
|
loading: loadingFindings,
|
|
34
26
|
error: errorFindings
|
|
35
27
|
} = useAsync(
|
|
36
|
-
async () => sonarQubeApi.
|
|
28
|
+
async () => sonarQubeApi.getSummaries(sonarEntities),
|
|
37
29
|
[sonarQubeApi, entities]
|
|
38
30
|
);
|
|
39
31
|
if (loadingEntities || loadingFindings) {
|
|
@@ -43,15 +35,19 @@ const SonarQubeRelatedEntitiesOverview = (props) => {
|
|
|
43
35
|
if (error) {
|
|
44
36
|
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
45
37
|
}
|
|
38
|
+
const findingsMap = /* @__PURE__ */ new Map();
|
|
39
|
+
sonarEntities.forEach((e, i) => {
|
|
40
|
+
findingsMap.set(stringifyEntityRef(e), findingResults?.[i]);
|
|
41
|
+
});
|
|
46
42
|
const tableContent = entities?.map((entity) => {
|
|
47
|
-
const
|
|
43
|
+
const entityRef = stringifyEntityRef(entity);
|
|
48
44
|
return {
|
|
49
|
-
id:
|
|
45
|
+
id: entityRef,
|
|
50
46
|
resolved: {
|
|
51
|
-
entityRef
|
|
47
|
+
entityRef,
|
|
52
48
|
name: entity.metadata.name,
|
|
53
|
-
findings:
|
|
54
|
-
isSonarQubeAnnotationEnabled:
|
|
49
|
+
findings: findingsMap.get(entityRef),
|
|
50
|
+
isSonarQubeAnnotationEnabled: isSonarQubeAvailable(entity)
|
|
55
51
|
}
|
|
56
52
|
};
|
|
57
53
|
});
|
package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SonarQubeRelatedEntitiesOverview.esm.js","sources":["../../../src/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/esm/useAsync';\nimport { useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n sonarQubeApiRef,\n
|
|
1
|
+
{"version":3,"file":"SonarQubeRelatedEntitiesOverview.esm.js","sources":["../../../src/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/esm/useAsync';\nimport { useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n sonarQubeApiRef,\n isSonarQubeAvailable,\n FindingSummary,\n} from '@backstage-community/plugin-sonarqube-react';\nimport { SonarQubeTable } from '../index.ts';\n\n/**\n * @public\n */\nexport type SonarOverviewProps = {\n relationType: string;\n entityKind: string;\n};\n\n/**\n * @public\n */\nexport const SonarQubeRelatedEntitiesOverview = (props: SonarOverviewProps) => {\n const sonarQubeApi = useApi(sonarQubeApiRef);\n const { entity: parentEntity } = useEntity();\n const {\n entities,\n loading: loadingEntities,\n error: errorEntities,\n } = useRelatedEntities(parentEntity, {\n type: props.relationType,\n kind: props.entityKind,\n });\n\n const sonarEntities = (entities || []).filter(isSonarQubeAvailable);\n\n const {\n value: findingResults,\n loading: loadingFindings,\n error: errorFindings,\n } = useAsync(\n async () => sonarQubeApi.getSummaries(sonarEntities),\n [sonarQubeApi, entities],\n );\n\n if (loadingEntities || loadingFindings) {\n return <Progress />;\n }\n const error = errorEntities || errorFindings;\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const findingsMap = new Map<string, FindingSummary | undefined>();\n sonarEntities.forEach((e, i) => {\n findingsMap.set(stringifyEntityRef(e), findingResults?.[i]);\n });\n\n const tableContent: any[] | undefined = entities?.map(entity => {\n const entityRef = stringifyEntityRef(entity);\n return {\n id: entityRef,\n resolved: {\n entityRef: entityRef,\n name: entity.metadata.name,\n findings: findingsMap.get(entityRef),\n isSonarQubeAnnotationEnabled: isSonarQubeAvailable(entity),\n },\n };\n });\n\n return <SonarQubeTable tableContent={tableContent} />;\n};\n"],"names":[],"mappings":";;;;;;;;;;AAsCa,MAAA,gCAAA,GAAmC,CAAC,KAA8B,KAAA;AAC7E,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAI,SAAU,EAAA;AAC3C,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,OAAS,EAAA,eAAA;AAAA,IACT,KAAO,EAAA;AAAA,GACT,GAAI,mBAAmB,YAAc,EAAA;AAAA,IACnC,MAAM,KAAM,CAAA,YAAA;AAAA,IACZ,MAAM,KAAM,CAAA;AAAA,GACb,CAAA;AAED,EAAA,MAAM,aAAiB,GAAA,CAAA,QAAA,IAAY,EAAC,EAAG,OAAO,oBAAoB,CAAA;AAElE,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,cAAA;AAAA,IACP,OAAS,EAAA,eAAA;AAAA,IACT,KAAO,EAAA;AAAA,GACL,GAAA,QAAA;AAAA,IACF,YAAY,YAAa,CAAA,YAAA,CAAa,aAAa,CAAA;AAAA,IACnD,CAAC,cAAc,QAAQ;AAAA,GACzB;AAEA,EAAA,IAAI,mBAAmB,eAAiB,EAAA;AACtC,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAEnB,EAAA,MAAM,QAAQ,aAAiB,IAAA,aAAA;AAC/B,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EAAM,MAAA,WAAA,uBAAkB,GAAwC,EAAA;AAChE,EAAc,aAAA,CAAA,OAAA,CAAQ,CAAC,CAAA,EAAG,CAAM,KAAA;AAC9B,IAAA,WAAA,CAAY,IAAI,kBAAmB,CAAA,CAAC,CAAG,EAAA,cAAA,GAAiB,CAAC,CAAC,CAAA;AAAA,GAC3D,CAAA;AAED,EAAM,MAAA,YAAA,GAAkC,QAAU,EAAA,GAAA,CAAI,CAAU,MAAA,KAAA;AAC9D,IAAM,MAAA,SAAA,GAAY,mBAAmB,MAAM,CAAA;AAC3C,IAAO,OAAA;AAAA,MACL,EAAI,EAAA,SAAA;AAAA,MACJ,QAAU,EAAA;AAAA,QACR,SAAA;AAAA,QACA,IAAA,EAAM,OAAO,QAAS,CAAA,IAAA;AAAA,QACtB,QAAA,EAAU,WAAY,CAAA,GAAA,CAAI,SAAS,CAAA;AAAA,QACnC,4BAAA,EAA8B,qBAAqB,MAAM;AAAA;AAC3D,KACF;AAAA,GACD,CAAA;AAED,EAAO,uBAAA,GAAA,CAAC,kBAAe,YAA4B,EAAA,CAAA;AACrD;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
2
|
+
import { Entity } from '@backstage/catalog-model';
|
|
1
3
|
import { SonarQubeApi, FindingSummary } from '@backstage-community/plugin-sonarqube-react';
|
|
2
4
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
3
5
|
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
|
4
|
-
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
5
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
7
|
import * as _backstage_core_components from '@backstage/core-components';
|
|
7
8
|
import { InfoCardVariants } from '@backstage/core-components';
|
|
@@ -17,15 +18,8 @@ declare class SonarQubeClient implements SonarQubeApi {
|
|
|
17
18
|
fetchApi: FetchApi;
|
|
18
19
|
});
|
|
19
20
|
private callApi;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
projectInstance?: string;
|
|
23
|
-
}): Promise<FindingSummary | undefined>;
|
|
24
|
-
settledResponseOf(responses: PromiseSettledResult<any>[]): Array<any>;
|
|
25
|
-
getFindingSummaries(components: Array<{
|
|
26
|
-
projectInstance: string | undefined;
|
|
27
|
-
componentKey: string;
|
|
28
|
-
}>): Promise<Map<string, FindingSummary>>;
|
|
21
|
+
private fetchSummary;
|
|
22
|
+
getSummaries(entities: Entity[]): Promise<(FindingSummary | undefined)[]>;
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
/** @public */
|
|
@@ -115,6 +109,12 @@ declare const sonarqubeTranslationRef: _backstage_frontend_plugin_api.Translatio
|
|
|
115
109
|
readonly "sonarQubeCard.qualityBadgeTooltip": "View SonarQube Dashboard";
|
|
116
110
|
readonly "sonarQubeCard.emptyState.title": "No information to display";
|
|
117
111
|
readonly "sonarQubeCard.emptyState.description": "There is no SonarQube project with key '{{ projectTitle }}', check that project exists and permissions.";
|
|
112
|
+
readonly "sonarQubeCard.unauthorizedError.title": "Unauthorized";
|
|
113
|
+
readonly "sonarQubeCard.unauthorizedError.description": "Your authentication token for SonarQube is missing or invalid. Please verify your SonarQube token configuration.";
|
|
114
|
+
readonly "sonarQubeCard.notFoundError.title": "SonarQube project not found";
|
|
115
|
+
readonly "sonarQubeCard.notFoundError.description": "The sonarqube.org/project-key annotation may be invalid or the project does not exist in SonarQube. Please verify the annotation value.";
|
|
116
|
+
readonly "sonarQubeCard.forbiddenError.title": "Access denied";
|
|
117
|
+
readonly "sonarQubeCard.forbiddenError.description": "Your SonarQube token does not have sufficient permissions to access this project. Please check the project permissions in SonarQube.";
|
|
118
118
|
readonly "sonarQubeCard.noSonarQubeError.hasAnnotation": "There is no SonarQube project with key '{{project}}'";
|
|
119
119
|
readonly "sonarQubeCard.noSonarQubeError.noAnnotation": "No SonarQube annotation found";
|
|
120
120
|
readonly "sonarQubeCard.qualityBadgeLabel.notComputed": "Not computed";
|
package/dist/translation.esm.js
CHANGED
|
@@ -11,6 +11,18 @@ const sonarqubeTranslationRef = createTranslationRef({
|
|
|
11
11
|
title: "No information to display",
|
|
12
12
|
description: "There is no SonarQube project with key '{{ projectTitle }}', check that project exists and permissions."
|
|
13
13
|
},
|
|
14
|
+
unauthorizedError: {
|
|
15
|
+
title: "Unauthorized",
|
|
16
|
+
description: "Your authentication token for SonarQube is missing or invalid. Please verify your SonarQube token configuration."
|
|
17
|
+
},
|
|
18
|
+
notFoundError: {
|
|
19
|
+
title: "SonarQube project not found",
|
|
20
|
+
description: "The sonarqube.org/project-key annotation may be invalid or the project does not exist in SonarQube. Please verify the annotation value."
|
|
21
|
+
},
|
|
22
|
+
forbiddenError: {
|
|
23
|
+
title: "Access denied",
|
|
24
|
+
description: "Your SonarQube token does not have sufficient permissions to access this project. Please check the project permissions in SonarQube."
|
|
25
|
+
},
|
|
14
26
|
noSonarQubeError: {
|
|
15
27
|
hasAnnotation: "There is no SonarQube project with key '{{project}}'",
|
|
16
28
|
noAnnotation: "No SonarQube annotation found"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/**\n * @public\n */\nexport const sonarqubeTranslationRef = createTranslationRef({\n id: 'sonarqube',\n messages: {\n title: 'SonarQube Dashboard',\n sonarQubeCard: {\n title: 'Code Quality',\n deepLinkTitle: 'View more',\n emptyState: {\n title: 'No information to display',\n description:\n \"There is no SonarQube project with key '{{ projectTitle }}', check that project exists and permissions.\",\n },\n noSonarQubeError: {\n hasAnnotation: \"There is no SonarQube project with key '{{project}}'\",\n noAnnotation: 'No SonarQube annotation found',\n },\n bugReportRatingCardTitle: 'Bugs',\n vulnerabilitiesRatingCardTitle: 'Vulnerabilities',\n codeSmellsRatingCardTitle: 'Code Smells',\n hotspotsReviewedTitle: 'Hotspots Reviewed',\n coverageRatingCardTitle: 'Coverage',\n duplicationsRatingCard: 'Duplications',\n qualityBadgeLabel: {\n notComputed: 'Not computed',\n gatePassed: 'Gate passed',\n gateFailed: 'Gate failed',\n },\n qualityBadgeTooltip: 'View SonarQube Dashboard',\n },\n sonarQubeTable: {\n columnsTitle: {\n name: 'Name',\n qualityGate: 'Quality Gate',\n lastAnalysis: 'Last Analysis',\n bugs: 'Bugs',\n vulnerabilities: 'Vulnerabilities',\n codeSmells: 'Code Smells',\n hotspotsReviewed: 'Hotspots Reviewed',\n coverage: 'Coverage',\n duplications: 'Duplications',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,0BAA0B,oBAAqB,CAAA;AAAA,EAC1D,EAAI,EAAA,WAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,qBAAA;AAAA,IACP,aAAe,EAAA;AAAA,MACb,KAAO,EAAA,cAAA;AAAA,MACP,aAAe,EAAA,WAAA;AAAA,MACf,UAAY,EAAA;AAAA,QACV,KAAO,EAAA,2BAAA;AAAA,QACP,WACE,EAAA;AAAA,OACJ;AAAA,MACA,gBAAkB,EAAA;AAAA,QAChB,aAAe,EAAA,sDAAA;AAAA,QACf,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,wBAA0B,EAAA,MAAA;AAAA,MAC1B,8BAAgC,EAAA,iBAAA;AAAA,MAChC,yBAA2B,EAAA,aAAA;AAAA,MAC3B,qBAAuB,EAAA,mBAAA;AAAA,MACvB,uBAAyB,EAAA,UAAA;AAAA,MACzB,sBAAwB,EAAA,cAAA;AAAA,MACxB,iBAAmB,EAAA;AAAA,QACjB,WAAa,EAAA,cAAA;AAAA,QACb,UAAY,EAAA,aAAA;AAAA,QACZ,UAAY,EAAA;AAAA,OACd;AAAA,MACA,mBAAqB,EAAA;AAAA,KACvB;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,MAAA;AAAA,QACN,WAAa,EAAA,cAAA;AAAA,QACb,YAAc,EAAA,eAAA;AAAA,QACd,IAAM,EAAA,MAAA;AAAA,QACN,eAAiB,EAAA,iBAAA;AAAA,QACjB,UAAY,EAAA,aAAA;AAAA,QACZ,gBAAkB,EAAA,mBAAA;AAAA,QAClB,QAAU,EAAA,UAAA;AAAA,QACV,YAAc,EAAA;AAAA;AAChB;AACF;AAEJ,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/**\n * @public\n */\nexport const sonarqubeTranslationRef = createTranslationRef({\n id: 'sonarqube',\n messages: {\n title: 'SonarQube Dashboard',\n sonarQubeCard: {\n title: 'Code Quality',\n deepLinkTitle: 'View more',\n emptyState: {\n title: 'No information to display',\n description:\n \"There is no SonarQube project with key '{{ projectTitle }}', check that project exists and permissions.\",\n },\n unauthorizedError: {\n title: 'Unauthorized',\n description:\n 'Your authentication token for SonarQube is missing or invalid. Please verify your SonarQube token configuration.',\n },\n notFoundError: {\n title: 'SonarQube project not found',\n description:\n 'The sonarqube.org/project-key annotation may be invalid or the project does not exist in SonarQube. Please verify the annotation value.',\n },\n forbiddenError: {\n title: 'Access denied',\n description:\n 'Your SonarQube token does not have sufficient permissions to access this project. Please check the project permissions in SonarQube.',\n },\n noSonarQubeError: {\n hasAnnotation: \"There is no SonarQube project with key '{{project}}'\",\n noAnnotation: 'No SonarQube annotation found',\n },\n bugReportRatingCardTitle: 'Bugs',\n vulnerabilitiesRatingCardTitle: 'Vulnerabilities',\n codeSmellsRatingCardTitle: 'Code Smells',\n hotspotsReviewedTitle: 'Hotspots Reviewed',\n coverageRatingCardTitle: 'Coverage',\n duplicationsRatingCard: 'Duplications',\n qualityBadgeLabel: {\n notComputed: 'Not computed',\n gatePassed: 'Gate passed',\n gateFailed: 'Gate failed',\n },\n qualityBadgeTooltip: 'View SonarQube Dashboard',\n },\n sonarQubeTable: {\n columnsTitle: {\n name: 'Name',\n qualityGate: 'Quality Gate',\n lastAnalysis: 'Last Analysis',\n bugs: 'Bugs',\n vulnerabilities: 'Vulnerabilities',\n codeSmells: 'Code Smells',\n hotspotsReviewed: 'Hotspots Reviewed',\n coverage: 'Coverage',\n duplications: 'Duplications',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,0BAA0B,oBAAqB,CAAA;AAAA,EAC1D,EAAI,EAAA,WAAA;AAAA,EACJ,QAAU,EAAA;AAAA,I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J,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-sonarqube",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -71,14 +71,15 @@
|
|
|
71
71
|
"test": "backstage-cli package test"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@backstage-community/plugin-sonarqube-react": "^0.
|
|
74
|
+
"@backstage-community/plugin-sonarqube-react": "^1.0.0",
|
|
75
75
|
"@backstage/catalog-model": "^1.7.6",
|
|
76
|
-
"@backstage/core-compat-api": "^0.5.
|
|
77
|
-
"@backstage/core-components": "^0.18.
|
|
78
|
-
"@backstage/core-plugin-api": "^1.12.
|
|
79
|
-
"@backstage/
|
|
80
|
-
"@backstage/frontend-
|
|
81
|
-
"@backstage/plugin-
|
|
76
|
+
"@backstage/core-compat-api": "^0.5.7",
|
|
77
|
+
"@backstage/core-components": "^0.18.6",
|
|
78
|
+
"@backstage/core-plugin-api": "^1.12.2",
|
|
79
|
+
"@backstage/errors": "^1.2.7",
|
|
80
|
+
"@backstage/frontend-app-api": "^0.14.1",
|
|
81
|
+
"@backstage/frontend-plugin-api": "^0.13.4",
|
|
82
|
+
"@backstage/plugin-catalog-react": "^1.21.6",
|
|
82
83
|
"@material-ui/core": "^4.12.2",
|
|
83
84
|
"@material-ui/icons": "^4.9.1",
|
|
84
85
|
"@material-ui/styles": "^4.10.0",
|
|
@@ -89,10 +90,10 @@
|
|
|
89
90
|
"react-use": "^17.2.4"
|
|
90
91
|
},
|
|
91
92
|
"devDependencies": {
|
|
92
|
-
"@backstage/cli": "^0.35.
|
|
93
|
-
"@backstage/core-app-api": "^1.19.
|
|
94
|
-
"@backstage/dev-utils": "^1.1.
|
|
95
|
-
"@backstage/frontend-test-utils": "^0.4.
|
|
93
|
+
"@backstage/cli": "^0.35.3",
|
|
94
|
+
"@backstage/core-app-api": "^1.19.4",
|
|
95
|
+
"@backstage/dev-utils": "^1.1.19",
|
|
96
|
+
"@backstage/frontend-test-utils": "^0.4.5",
|
|
96
97
|
"@backstage/test-utils": "^1.7.14",
|
|
97
98
|
"@testing-library/dom": "^10.0.0",
|
|
98
99
|
"@testing-library/jest-dom": "^6.0.0",
|