@backstage-community/plugin-sonarqube 0.16.0 → 0.16.2

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @backstage-community/plugin-sonarqube
2
2
 
3
+ ## 0.16.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1eda234: Fix maximum update depth exceeded in SonarqubeRelatedEntitiesOverview
8
+
9
+ ## 0.16.1
10
+
11
+ ### Patch Changes
12
+
13
+ - b64dc92: Fixed bug in SonarQubeRelatedEntitiesOverview where the projectInstance was always undefined
14
+ - Updated dependencies [b64dc92]
15
+ - @backstage-community/plugin-sonarqube-react@0.8.1
16
+
3
17
  ## 0.16.0
4
18
 
5
19
  ### Minor Changes
@@ -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, SONARQUBE_PROJECT_KEY_ANNOTATION } from '@backstage-community/plugin-sonarqube-react';
7
+ import { sonarQubeApiRef, getProjectInfo } from '@backstage-community/plugin-sonarqube-react';
8
8
  import '../SonarQubeCard/SonarQubeCard.esm.js';
9
9
  import { SonarQubeTable } from '../SonarQubeTable/SonarQubeTable.esm.js';
10
10
 
@@ -22,13 +22,10 @@ const SonarQubeRelatedEntitiesOverview = (props) => {
22
22
  const findingsRequest = [];
23
23
  const entityNameToProjectKey = {};
24
24
  for (const entity of entities || []) {
25
- const projectKey = entity?.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION];
25
+ const { projectKey, projectInstance } = getProjectInfo(entity);
26
26
  if (projectKey) {
27
27
  entityNameToProjectKey[entity.metadata.name] = projectKey;
28
- findingsRequest.push({
29
- componentKey: projectKey,
30
- projectInstance: void 0
31
- });
28
+ findingsRequest.push({ componentKey: projectKey, projectInstance });
32
29
  }
33
30
  }
34
31
  const {
@@ -46,10 +43,9 @@ const SonarQubeRelatedEntitiesOverview = (props) => {
46
43
  if (error) {
47
44
  return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
48
45
  }
49
- const tableContent = [];
50
- entities?.forEach((entity) => {
46
+ const tableContent = entities?.map((entity) => {
51
47
  const projectKey = entityNameToProjectKey[entity.metadata.name];
52
- tableContent.push({
48
+ return {
53
49
  id: projectKey || entity.metadata.name,
54
50
  resolved: {
55
51
  entityRef: stringifyEntityRef(entity),
@@ -57,7 +53,7 @@ const SonarQubeRelatedEntitiesOverview = (props) => {
57
53
  findings: findingResults?.get(projectKey),
58
54
  isSonarQubeAnnotationEnabled: !!projectKey
59
55
  }
60
- });
56
+ };
61
57
  });
62
58
  return /* @__PURE__ */ jsx(SonarQubeTable, { tableContent });
63
59
  };
@@ -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 SONARQUBE_PROJECT_KEY_ANNOTATION,\n sonarQubeApiRef,\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 findingsRequest: Array<{\n projectInstance: string | undefined;\n componentKey: string;\n }> = [];\n const entityNameToProjectKey: { [key: string]: string } = {};\n for (const entity of entities || []) {\n const projectKey =\n entity?.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION];\n if (projectKey) {\n entityNameToProjectKey[entity.metadata.name] = projectKey;\n findingsRequest.push({\n componentKey: projectKey,\n projectInstance: undefined,\n });\n }\n }\n const {\n value: findingResults,\n loading: loadingFindings,\n error: errorFindings,\n } = useAsync(\n async () => sonarQubeApi.getFindingSummaries(findingsRequest),\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 tableContent: any[] = [];\n entities?.forEach(entity => {\n const projectKey = entityNameToProjectKey[entity.metadata.name];\n tableContent.push({\n id: projectKey || entity.metadata.name,\n resolved: {\n entityRef: stringifyEntityRef(entity),\n name: entity.metadata.name,\n findings: findingResults?.get(projectKey),\n isSonarQubeAnnotationEnabled: !!projectKey,\n },\n });\n });\n\n return <SonarQubeTable tableContent={tableContent} />;\n};\n"],"names":[],"mappings":";;;;;;;;;;AAqCa,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,I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AA;AAC9D,IAAA,YAAA,CAAa,IAAK,CAAA;AAAA,MAChB,EAAA,EAAI,UAAc,IAAA,MAAA,CAAO,QAAS,CAAA,IAAA;AAAA,MAClC,QAAU,EAAA;AAAA,QACR,SAAA,EAAW,mBAAmB,MAAM,CAAA;AAAA,QACpC,IAAA,EAAM,OAAO,QAAS,CAAA,IAAA;AAAA,QACtB,QAAA,EAAU,cAAgB,EAAA,GAAA,CAAI,UAAU,CAAA;AAAA,QACxC,4BAAA,EAA8B,CAAC,CAAC;AAAA;AAClC,KACD,CAAA;AAAA,GACF,CAAA;AAED,EAAO,uBAAA,GAAA,CAAC,kBAAe,YAA4B,EAAA,CAAA;AACrD;;;;"}
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 getProjectInfo,\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 findingsRequest: Array<{\n projectInstance: string | undefined;\n componentKey: string;\n }> = [];\n\n const entityNameToProjectKey: { [key: string]: string } = {};\n\n for (const entity of entities || []) {\n const { projectKey, projectInstance } = getProjectInfo(entity);\n if (projectKey) {\n entityNameToProjectKey[entity.metadata.name] = projectKey;\n findingsRequest.push({ componentKey: projectKey, projectInstance });\n }\n }\n const {\n value: findingResults,\n loading: loadingFindings,\n error: errorFindings,\n } = useAsync(\n async () => sonarQubeApi.getFindingSummaries(findingsRequest),\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 tableContent: any[] | undefined = entities?.map(entity => {\n const projectKey = entityNameToProjectKey[entity.metadata.name];\n return {\n id: projectKey || entity.metadata.name,\n resolved: {\n entityRef: stringifyEntityRef(entity),\n name: entity.metadata.name,\n findings: findingResults?.get(projectKey),\n isSonarQubeAnnotationEnabled: !!projectKey,\n },\n };\n });\n\n return <SonarQubeTable tableContent={tableContent} />;\n};\n"],"names":[],"mappings":";;;;;;;;;;AAqCa,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,k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AAI,UAAU,CAAA;AAAA,QACxC,4BAAA,EAA8B,CAAC,CAAC;AAAA;AAClC,KACF;AAAA,GACD,CAAA;AAED,EAAO,uBAAA,GAAA,CAAC,kBAAe,YAA4B,EAAA,CAAA;AACrD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-sonarqube",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -71,7 +71,7 @@
71
71
  "test": "backstage-cli package test"
72
72
  },
73
73
  "dependencies": {
74
- "@backstage-community/plugin-sonarqube-react": "^0.8.0",
74
+ "@backstage-community/plugin-sonarqube-react": "^0.8.1",
75
75
  "@backstage/catalog-model": "^1.7.4",
76
76
  "@backstage/core-compat-api": "^0.4.3",
77
77
  "@backstage/core-components": "^0.17.3",