@backstage-community/plugin-sonarqube 0.23.0 → 1.1.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/alpha/apis.esm.js +1 -1
  3. package/dist/alpha/apis.esm.js.map +1 -1
  4. package/dist/alpha/entityCard.esm.js.map +1 -1
  5. package/dist/alpha/entityContent.esm.js.map +1 -1
  6. package/dist/alpha/plugin.esm.js.map +1 -1
  7. package/dist/alpha.d.ts +24 -21
  8. package/dist/api/SonarQubeClient.esm.js +28 -48
  9. package/dist/api/SonarQubeClient.esm.js.map +1 -1
  10. package/dist/components/SonarQubeCard/MetricInsights.esm.js.map +1 -1
  11. package/dist/components/SonarQubeCard/Percentage.esm.js.map +1 -1
  12. package/dist/components/SonarQubeCard/Rating.esm.js.map +1 -1
  13. package/dist/components/SonarQubeCard/RatingCard.esm.js.map +1 -1
  14. package/dist/components/SonarQubeCard/SonarQubeCard.esm.js +56 -20
  15. package/dist/components/SonarQubeCard/SonarQubeCard.esm.js.map +1 -1
  16. package/dist/components/SonarQubeCard/Value.esm.js.map +1 -1
  17. package/dist/components/SonarQubeCard/index.esm.js +5 -1
  18. package/dist/components/SonarQubeCard/index.esm.js.map +1 -1
  19. package/dist/components/SonarQubeContentPage/SonarQubeContentPage.esm.js.map +1 -1
  20. package/dist/components/SonarQubeContentPage/index.esm.js +5 -1
  21. package/dist/components/SonarQubeContentPage/index.esm.js.map +1 -1
  22. package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js +12 -16
  23. package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js.map +1 -1
  24. package/dist/components/SonarQubeTable/Columns.esm.js.map +1 -1
  25. package/dist/components/SonarQubeTable/SonarQubeTable.esm.js.map +1 -1
  26. package/dist/components/SonarQubeTable/types.esm.js.map +1 -1
  27. package/dist/components/index.esm.js +1 -1
  28. package/dist/components/index.esm.js.map +1 -1
  29. package/dist/index.d.ts +15 -15
  30. package/dist/plugin.esm.js +1 -1
  31. package/dist/plugin.esm.js.map +1 -1
  32. package/dist/translation.esm.js +12 -0
  33. package/dist/translation.esm.js.map +1 -1
  34. package/package.json +15 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @backstage-community/plugin-sonarqube
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 188e3e6: Backstage version bump to v1.49.3
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [188e3e6]
12
+ - @backstage-community/plugin-sonarqube-react@1.1.0
13
+
14
+ ## 1.0.0
15
+
16
+ ### Major Changes
17
+
18
+ - 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.
19
+
20
+ **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).
21
+
22
+ The `<SonarQubeCard />` component now displays more specific error messages.
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [39ef4af]
27
+ - @backstage-community/plugin-sonarqube-react@1.0.0
28
+
3
29
  ## 0.23.0
4
30
 
5
31
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  import { ApiBlueprint } from '@backstage/frontend-plugin-api';
2
2
  import { SonarQubeClient } from '../api/SonarQubeClient.esm.js';
3
3
  import { sonarQubeApiRef } from '@backstage-community/plugin-sonarqube-react';
4
- import { discoveryApiRef, fetchApiRef } from '@backstage/core-plugin-api';
4
+ import { fetchApiRef, discoveryApiRef } from '@backstage/core-plugin-api';
5
5
 
6
6
  const sonarQubeApi = ApiBlueprint.make({
7
7
  params: (defineParams) => defineParams({
@@ -1 +1 @@
1
- {"version":3,"file":"apis.esm.js","sources":["../../src/alpha/apis.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { ApiBlueprint } from '@backstage/frontend-plugin-api';\nimport { SonarQubeClient } from '../api';\nimport { sonarQubeApiRef } from '@backstage-community/plugin-sonarqube-react';\nimport { discoveryApiRef, fetchApiRef } from '@backstage/core-plugin-api';\n\n/**\n * @alpha\n */\nexport const sonarQubeApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: sonarQubeApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new SonarQubeClient({\n discoveryApi,\n fetchApi,\n }),\n }),\n});\n"],"names":[],"mappings":";;;;;AAuBa,MAAA,YAAA,GAAe,aAAa,IAAK,CAAA;AAAA,EAC5C,MAAA,EAAQ,kBACN,YAAa,CAAA;AAAA,IACX,GAAK,EAAA,eAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,eAAA;AAAA,MACd,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,SAAS,CAAC,EAAE,cAAc,QAAS,EAAA,KACjC,IAAI,eAAgB,CAAA;AAAA,MAClB,YAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC;;;;"}
1
+ {"version":3,"file":"apis.esm.js","sources":["../../src/alpha/apis.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { ApiBlueprint } from '@backstage/frontend-plugin-api';\nimport { SonarQubeClient } from '../api';\nimport { sonarQubeApiRef } from '@backstage-community/plugin-sonarqube-react';\nimport { discoveryApiRef, fetchApiRef } from '@backstage/core-plugin-api';\n\n/**\n * @alpha\n */\nexport const sonarQubeApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: sonarQubeApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new SonarQubeClient({\n discoveryApi,\n fetchApi,\n }),\n }),\n});\n"],"names":[],"mappings":";;;;;AAuBO,MAAM,YAAA,GAAe,aAAa,IAAA,CAAK;AAAA,EAC5C,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,eAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,SAAS,CAAC,EAAE,cAAc,QAAA,EAAS,KACjC,IAAI,eAAA,CAAgB;AAAA,MAClB,YAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"entityCard.esm.js","sources":["../../src/alpha/entityCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { compatWrapper } from '@backstage/core-compat-api';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';\n\n/**\n * @alpha\n */\nexport const entitySonarQubeCard = EntityCardBlueprint.make({\n name: 'card',\n params: {\n filter: isSonarQubeAvailable,\n loader: () =>\n import('../components/SonarQubeCard').then(m =>\n compatWrapper(<m.SonarQubeCard />),\n ),\n },\n});\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,mBAAA,GAAsB,oBAAoB,IAAK,CAAA;AAAA,EAC1D,IAAM,EAAA,MAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,oBAAA;AAAA,IACR,MAAQ,EAAA,MACN,OAAO,0CAA6B,CAAE,CAAA,IAAA;AAAA,MAAK,OACzC,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,aAAA,EAAF,EAAgB,CAAE;AAAA;AACnC;AAEN,CAAC;;;;"}
1
+ {"version":3,"file":"entityCard.esm.js","sources":["../../src/alpha/entityCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { compatWrapper } from '@backstage/core-compat-api';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';\n\n/**\n * @alpha\n */\nexport const entitySonarQubeCard = EntityCardBlueprint.make({\n name: 'card',\n params: {\n filter: isSonarQubeAvailable,\n loader: () =>\n import('../components/SonarQubeCard').then(m =>\n compatWrapper(<m.SonarQubeCard />),\n ),\n },\n});\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,mBAAA,GAAsB,oBAAoB,IAAA,CAAK;AAAA,EAC1D,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ,oBAAA;AAAA,IACR,MAAA,EAAQ,MACN,OAAO,0CAA6B,CAAA,CAAE,IAAA;AAAA,MAAK,OACzC,aAAA,iBAAc,GAAA,CAAC,CAAA,CAAE,aAAA,EAAF,EAAgB,CAAE;AAAA;AACnC;AAEN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"entityContent.esm.js","sources":["../../src/alpha/entityContent.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';\n\n/**\n * @alpha\n */\nexport const entitySonarQubeContent = EntityContentBlueprint.make({\n name: 'entity',\n params: {\n path: '/sonarqube',\n title: 'SonarQube',\n filter: isSonarQubeAvailable,\n loader: () =>\n import('../components/SonarQubeContentPage').then(m => (\n <m.SonarQubeContentPage />\n )),\n },\n});\n"],"names":[],"mappings":";;;;AAqBa,MAAA,sBAAA,GAAyB,uBAAuB,IAAK,CAAA;AAAA,EAChE,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,IACN,KAAO,EAAA,WAAA;AAAA,IACP,MAAQ,EAAA,oBAAA;AAAA,IACR,MAAA,EAAQ,MACN,OAAO,iDAAoC,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,qBAC/C,GAAA,CAAA,CAAA,CAAE,oBAAF,EAAA,EAAuB,CACzB;AAAA;AAEP,CAAC;;;;"}
1
+ {"version":3,"file":"entityContent.esm.js","sources":["../../src/alpha/entityContent.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';\n\n/**\n * @alpha\n */\nexport const entitySonarQubeContent = EntityContentBlueprint.make({\n name: 'entity',\n params: {\n path: '/sonarqube',\n title: 'SonarQube',\n filter: isSonarQubeAvailable,\n loader: () =>\n import('../components/SonarQubeContentPage').then(m => (\n <m.SonarQubeContentPage />\n )),\n },\n});\n"],"names":[],"mappings":";;;;AAqBO,MAAM,sBAAA,GAAyB,uBAAuB,IAAA,CAAK;AAAA,EAChE,IAAA,EAAM,QAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,YAAA;AAAA,IACN,KAAA,EAAO,WAAA;AAAA,IACP,MAAA,EAAQ,oBAAA;AAAA,IACR,MAAA,EAAQ,MACN,OAAO,iDAAoC,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,qBAChD,GAAA,CAAC,CAAA,CAAE,oBAAA,EAAF,EAAuB,CACzB;AAAA;AAEP,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport { entitySonarQubeCard } from './entityCard';\nimport { sonarQubeApi } from './apis';\nimport { entitySonarQubeContent } from './entityContent';\n\n/**\n * @alpha\n */\nexport default createFrontendPlugin({\n pluginId: 'sonarqube',\n extensions: [sonarQubeApi, entitySonarQubeCard, entitySonarQubeContent],\n});\n"],"names":[],"mappings":";;;;;AAuBA,aAAe,oBAAqB,CAAA;AAAA,EAClC,QAAU,EAAA,WAAA;AAAA,EACV,UAAY,EAAA,CAAC,YAAc,EAAA,mBAAA,EAAqB,sBAAsB;AACxE,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport { entitySonarQubeCard } from './entityCard';\nimport { sonarQubeApi } from './apis';\nimport { entitySonarQubeContent } from './entityContent';\n\n/**\n * @alpha\n */\nexport default createFrontendPlugin({\n pluginId: 'sonarqube',\n extensions: [sonarQubeApi, entitySonarQubeCard, entitySonarQubeContent],\n});\n"],"names":[],"mappings":";;;;;AAuBA,aAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,WAAA;AAAA,EACV,UAAA,EAAY,CAAC,YAAA,EAAc,mBAAA,EAAqB,sBAAsB;AACxE,CAAC,CAAA;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
2
2
  import * as _backstage_catalog_model from '@backstage/catalog-model';
3
3
  import * as react from 'react';
4
- import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
4
+ import * as _backstage_filter_predicates from '@backstage/filter-predicates';
5
5
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
6
6
 
7
7
  /**
@@ -15,20 +15,18 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
15
15
  configInput: {};
16
16
  output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
17
17
  inputs: {};
18
- params: <TApi, TImpl extends TApi, TDeps extends {
19
- [x: string]: unknown;
20
- }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
18
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
21
19
  }>;
22
20
  "entity-card:sonarqube/card": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
23
21
  kind: "entity-card";
24
22
  name: "card";
25
23
  config: {
26
- filter: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
27
- type: "content" | "summary" | "info" | undefined;
24
+ filter: _backstage_filter_predicates.FilterPredicate | undefined;
25
+ type: "content" | "info" | undefined;
28
26
  };
29
27
  configInput: {
30
- filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
31
- type?: "content" | "summary" | "info" | undefined;
28
+ filter?: _backstage_filter_predicates.FilterPredicate | undefined;
29
+ type?: "content" | "info" | undefined;
32
30
  };
33
31
  output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
34
32
  optional: true;
@@ -40,8 +38,8 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
40
38
  inputs: {};
41
39
  params: {
42
40
  loader: () => Promise<JSX.Element>;
43
- filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
44
- type?: _backstage_plugin_catalog_react_alpha.EntityCardType | undefined;
41
+ filter?: string | _backstage_filter_predicates.FilterPredicate | ((entity: _backstage_catalog_model.Entity) => boolean);
42
+ type?: _backstage_plugin_catalog_react_alpha.EntityCardType;
45
43
  };
46
44
  }>;
47
45
  "entity-content:sonarqube/entity": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
@@ -50,35 +48,40 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
50
48
  config: {
51
49
  path: string | undefined;
52
50
  title: string | undefined;
53
- filter: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
51
+ filter: _backstage_filter_predicates.FilterPredicate | undefined;
54
52
  group: string | false | undefined;
53
+ icon: string | undefined;
55
54
  };
56
55
  configInput: {
57
- filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
56
+ filter?: _backstage_filter_predicates.FilterPredicate | undefined;
58
57
  title?: string | undefined;
59
58
  path?: string | undefined;
60
59
  group?: string | false | undefined;
60
+ icon?: string | undefined;
61
61
  };
62
- output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
62
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
63
63
  optional: true;
64
64
  }> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
65
65
  optional: true;
66
66
  }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
67
67
  optional: true;
68
- }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-group", {
68
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-group", {
69
+ optional: true;
70
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string | react.ReactElement<any, string | react.JSXElementConstructor<any>>, "catalog.entity-content-icon", {
69
71
  optional: true;
70
72
  }>;
71
73
  inputs: {};
72
74
  params: {
73
- defaultPath?: [Error: "Use the 'path' param instead"] | undefined;
75
+ defaultPath?: [Error: `Use the 'path' param instead`];
74
76
  path: string;
75
- defaultTitle?: [Error: "Use the 'title' param instead"] | undefined;
77
+ defaultTitle?: [Error: `Use the 'title' param instead`];
76
78
  title: string;
77
- defaultGroup?: [Error: "Use the 'group' param instead"] | undefined;
78
- group?: (string & {}) | "development" | "deployment" | "overview" | "documentation" | "operation" | "observability" | undefined;
79
+ defaultGroup?: [Error: `Use the 'group' param instead`];
80
+ group?: ("development" | "deployment" | "overview" | "documentation" | "operation" | "observability") | (string & {});
81
+ icon?: string | react.ReactElement;
79
82
  loader: () => Promise<JSX.Element>;
80
- routeRef?: _backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
81
- filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
83
+ routeRef?: _backstage_frontend_plugin_api.RouteRef;
84
+ filter?: string | _backstage_filter_predicates.FilterPredicate | ((entity: _backstage_catalog_model.Entity) => boolean);
82
85
  };
83
86
  }>;
84
87
  }>;
@@ -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.status === 200) {
21
+ if (response.ok) {
20
22
  return await response.json();
21
23
  }
22
- return void 0;
24
+ throw await ResponseError.fromResponse(response);
23
25
  }
24
- async getFindingSummary({
25
- componentKey,
26
- projectInstance
27
- } = {}) {
28
- if (!componentKey) {
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 instanceKey = projectInstance || "";
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
- settledResponseOf(responses) {
85
- return responses.map(
86
- (response) => response.status === "fulfilled" ? response.value : null
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 promises = components.map(
95
- ({ projectInstance, componentKey }) => this.getFindingSummary({ componentKey, projectInstance })
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 { InstanceUrlWrapper, FindingsWrapper } from './types';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\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]: any },\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.status === 200) {\n return (await response.json()) as T;\n }\n return undefined;\n }\n\n async getFindingSummary({\n componentKey,\n projectInstance,\n }: {\n componentKey?: string;\n projectInstance?: string;\n } = {}): Promise<FindingSummary | undefined> {\n if (!componentKey) {\n return undefined;\n }\n\n const instanceKey = projectInstance || '';\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 const baseUrlWrapper = await this.callApi<InstanceUrlWrapper>(\n 'instanceUrl',\n {\n instanceKey,\n },\n );\n let baseUrl = baseUrlWrapper?.instanceUrl;\n if (!baseUrl) {\n return undefined;\n }\n // ensure trailing slash for later on\n if (!baseUrl.endsWith('/')) {\n baseUrl += '/';\n }\n\n const findings = await this.callApi<FindingsWrapper>('findings', {\n componentKey,\n instanceKey,\n });\n if (!findings) {\n return 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 settledResponseOf(responses: PromiseSettledResult<any>[]): Array<any> {\n return responses.map(response =>\n response.status === 'fulfilled' ? response.value : null,\n );\n }\n\n async getFindingSummaries(\n components: Array<{\n projectInstance: string | undefined;\n componentKey: string;\n }>,\n ): Promise<Map<string, FindingSummary>> {\n const map = new Map<string, FindingSummary>();\n if (components.length === 0) {\n return map;\n }\n const promises = components.map(({ projectInstance, componentKey }) =>\n this.getFindingSummary({ componentKey, projectInstance }),\n );\n const summaries: any = await Promise.allSettled(promises).then(results => {\n return results\n .map(result => result as PromiseFulfilledResult<FindingSummary>)\n .map(result => result.value);\n });\n\n for await (const summary of summaries) {\n if (summary?.title && !map.has(summary.title)) {\n map.set(summary.title, summary);\n }\n }\n return map;\n }\n}\n"],"names":[],"mappings":"AAyBO,MAAM,eAAwC,CAAA;AAAA,EACnD,YAAA;AAAA,EACA,QAAA;A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
+ {"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,eAAA,CAAwC;AAAA,EACnD,YAAA;AAAA,EACA,QAAA;AAAA,EAEA,YAAY,OAAA,EAA6D;AACvE,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAA,CAAQ,QAAA;AAAA,EAC1B;AAAA,EAEA,MAAc,OAAA,CACZ,IAAA,EACA,KAAA,EACwB;AACxB,IAAA,MAAM,Q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BAAA,CAAmB,YAAY,CAAC,CAAA;AAAA,KAC5D;AAAA,EACF;AAAA,EAEA,MAAM,aACJ,QAAA,EACyC;AACzC,IAAA,IAAI,QAAA,CAAS,WAAW,CAAA,EAAG;AACzB,MAAA,OAAO,EAAC;AAAA,IACV;AACA,IAAA,MAAM,OAAA,GAAU,MAAM,OAAA,CAAQ,UAAA;AAAA,MAC5B,SAAS,GAAA,CAAI,CAAA,CAAA,KAAK,IAAA,CAAK,YAAA,CAAa,CAAC,CAAC;AAAA,KACxC;AACA,IAAA,OAAO,OAAA,CAAQ,GAAA;AAAA,MAAI,CAAA,MAAA,KACjB,MAAA,CAAO,MAAA,KAAW,WAAA,GAAc,OAAO,KAAA,GAAQ;AAAA,KACjD;AAAA,EACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MetricInsights.esm.js","sources":["../../../src/components/SonarQubeCard/MetricInsights.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { useMemo } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { defaultDuplicationRatings } from '../SonarQubeTable/types';\nimport BugReport from '@material-ui/icons/BugReport';\nimport Lock from '@material-ui/icons/Lock';\nimport Typography from '@material-ui/core/Typography';\nimport LockOpen from '@material-ui/icons/LockOpen';\nimport SentimentVeryDissatisfied from '@material-ui/icons/SentimentVeryDissatisfied';\nimport SentimentVerySatisfied from '@material-ui/icons/SentimentVerySatisfied';\nimport Security from '@material-ui/icons/Security';\nimport { DateTime } from 'luxon';\nimport { Percentage } from './Percentage';\nimport { Rating } from './Rating';\nimport { RatingCard } from './RatingCard';\nimport { Value } from './Value';\nimport { FindingSummary } from '@backstage-community/plugin-sonarqube-react';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport LinkIcon from '@material-ui/icons/Link';\n\ntype MetricInsightsProps = {\n value: FindingSummary | any;\n compact?: boolean;\n title?: string;\n sonarQubeComponentKey?: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n badgeLabel: {\n color: theme.palette.common.white,\n },\n badgeCompact: {\n margin: 0,\n height: 28,\n },\n badgeError: {\n backgroundColor: theme.palette.error.main,\n },\n badgeSuccess: {\n backgroundColor: theme.palette.success.main,\n },\n badgeUnknown: {\n backgroundColor: theme.palette.grey[500],\n },\n}));\n\nexport const QualityBadge = (props: MetricInsightsProps) => {\n const classes = useStyles();\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n\n const { value } = props;\n let gateLabel: string = t('sonarQubeCard.qualityBadgeLabel.notComputed');\n let gateColor = classes.badgeUnknown;\n let gateLinkToolTip = '';\n if (value?.metrics.alert_status) {\n const gatePassed = value?.metrics.alert_status === 'OK';\n gateLabel = gatePassed\n ? t('sonarQubeCard.qualityBadgeLabel.gatePassed')\n : t('sonarQubeCard.qualityBadgeLabel.gateFailed');\n gateColor = gatePassed ? classes.badgeSuccess : classes.badgeError;\n }\n let clickableAttrs = {};\n if (value.projectUrl) {\n gateLinkToolTip = t('sonarQubeCard.qualityBadgeTooltip');\n clickableAttrs = {\n component: 'a',\n href: value.projectUrl,\n target: '_blank',\n rel: 'noopener noreferrer',\n clickable: true,\n };\n }\n const qualityBadge = (\n <Tooltip title={gateLinkToolTip}>\n <Chip\n label={gateLabel}\n {...clickableAttrs}\n className={props.compact ? classes.badgeCompact : ''}\n classes={{ root: gateColor, label: classes.badgeLabel }}\n icon={value.projectUrl ? <LinkIcon /> : undefined}\n />\n </Tooltip>\n );\n return qualityBadge;\n};\n\nexport const BugReportRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n titleIcon={<BugReport />}\n title={title}\n link={value.getIssuesUrl('BUG')}\n leftSlot={<Value value={value.metrics.bugs} compact={props.compact} />}\n rightSlot={<Rating rating={value.metrics.reliability_rating} />}\n />\n );\n};\n\nexport const VulnerabilitiesRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n titleIcon={\n value.metrics.vulnerabilities === '0' ? <Lock /> : <LockOpen />\n }\n title={title}\n link={value.getIssuesUrl('VULNERABILITY')}\n leftSlot={\n <Value value={value.metrics.vulnerabilities} compact={props.compact} />\n }\n rightSlot={<Rating rating={value.metrics.security_rating} />}\n />\n );\n};\n\nexport const CodeSmellsRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n titleIcon={\n value.metrics.code_smells === '0' ? (\n <SentimentVerySatisfied />\n ) : (\n <SentimentVeryDissatisfied />\n )\n }\n title={title}\n link={value.getIssuesUrl('CODE_SMELL')}\n leftSlot={\n <Value value={value.metrics.code_smells} compact={props.compact} />\n }\n rightSlot={<Rating rating={value.metrics.sqale_rating} />}\n />\n );\n};\n\nexport const HotspotsReviewed = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n value.metrics.security_review_rating && (\n <RatingCard\n compact={props.compact}\n titleIcon={<Security />}\n title={title}\n link={value.getSecurityHotspotsUrl()}\n leftSlot={\n <Value\n value={\n value.metrics.security_hotspots_reviewed\n ? `${value.metrics.security_hotspots_reviewed}%`\n : '—'\n }\n compact={props.compact}\n />\n }\n rightSlot={<Rating rating={value.metrics.security_review_rating} />}\n />\n )\n );\n};\n\nexport const CoverageRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n link={value.getComponentMeasuresUrl('COVERAGE')}\n title={title}\n leftSlot={<Percentage value={value.metrics.coverage} />}\n rightSlot={\n <Value\n value={value.metrics.coverage ? `${value.metrics.coverage}%` : '—'}\n compact={props.compact}\n />\n }\n />\n );\n};\n\nexport const DuplicationsRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n const duplicationRating = useMemo(() => {\n if (!value || !value.metrics.duplicated_lines_density) {\n return '';\n }\n\n let rating = '';\n\n for (const r of defaultDuplicationRatings) {\n if (+value.metrics.duplicated_lines_density >= r.greaterThan) {\n rating = r.rating;\n }\n }\n\n return rating;\n }, [value]);\n\n return (\n <RatingCard\n compact={props.compact}\n title={title}\n link={value.getComponentMeasuresUrl('DUPLICATED_LINES_DENSITY')}\n leftSlot={<Rating rating={duplicationRating} hideValue />}\n rightSlot={\n <Value\n value={`${value.metrics.duplicated_lines_density}%`}\n compact={props.compact}\n />\n }\n />\n );\n};\n\nexport const LastAnalyzedRatingCard = (props: MetricInsightsProps) => {\n const { value } = props;\n return (\n <div\n title={DateTime.fromISO(value.lastAnalysis).toLocaleString(\n DateTime.DATETIME_MED,\n )}\n >\n {DateTime.fromISO(value.lastAnalysis).toRelative()}\n </div>\n );\n};\n\nexport const NoSonarQubeCard = (props: MetricInsightsProps) => {\n const { value, sonarQubeComponentKey } = props;\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n return (\n <Typography color=\"textSecondary\" variant=\"subtitle2\">\n {value?.isSonarQubeAnnotationEnabled &&\n t('sonarQubeCard.noSonarQubeError.hasAnnotation', {\n project: sonarQubeComponentKey || '',\n })}\n {!value?.isSonarQubeAnnotationEnabled &&\n t('sonarQubeCard.noSonarQubeError.noAnnotation')}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,UAAY,EAAA;AAAA,IACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAAA,EACA,YAAc,EAAA;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AA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,QAAA,CAAS,OAAQ,CAAA,KAAA,CAAM,YAAY,CAAE,CAAA,cAAA;AAAA,QAC1C,QAAS,CAAA;AAAA,OACX;AAAA,MAEC,QAAS,EAAA,QAAA,CAAA,OAAA,CAAQ,KAAM,CAAA,YAAY,EAAE,UAAW;AAAA;AAAA,GACnD;AAEJ;AAEa,MAAA,eAAA,GAAkB,CAAC,KAA+B,KAAA;AAC7D,EAAM,MAAA,EAAE,KAAO,EAAA,qBAAA,EAA0B,GAAA,KAAA;AACzC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,uBAAuB,CAAA;AACvD,EAAA,uBACG,IAAA,CAAA,UAAA,EAAA,EAAW,KAAM,EAAA,eAAA,EAAgB,SAAQ,WACvC,EAAA,QAAA,EAAA;AAAA,IAAO,KAAA,EAAA,4BAAA,IACN,EAAE,8CAAgD,EAAA;AAAA,MAChD,SAAS,qBAAyB,IAAA;AAAA,KACnC,CAAA;AAAA,IACF,CAAC,KAAA,EAAO,4BACP,IAAA,CAAA,CAAE,6CAA6C;AAAA,GACnD,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"MetricInsights.esm.js","sources":["../../../src/components/SonarQubeCard/MetricInsights.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { useMemo } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { defaultDuplicationRatings } from '../SonarQubeTable/types';\nimport BugReport from '@material-ui/icons/BugReport';\nimport Lock from '@material-ui/icons/Lock';\nimport Typography from '@material-ui/core/Typography';\nimport LockOpen from '@material-ui/icons/LockOpen';\nimport SentimentVeryDissatisfied from '@material-ui/icons/SentimentVeryDissatisfied';\nimport SentimentVerySatisfied from '@material-ui/icons/SentimentVerySatisfied';\nimport Security from '@material-ui/icons/Security';\nimport { DateTime } from 'luxon';\nimport { Percentage } from './Percentage';\nimport { Rating } from './Rating';\nimport { RatingCard } from './RatingCard';\nimport { Value } from './Value';\nimport { FindingSummary } from '@backstage-community/plugin-sonarqube-react';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport LinkIcon from '@material-ui/icons/Link';\n\ntype MetricInsightsProps = {\n value: FindingSummary | any;\n compact?: boolean;\n title?: string;\n sonarQubeComponentKey?: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n badgeLabel: {\n color: theme.palette.common.white,\n },\n badgeCompact: {\n margin: 0,\n height: 28,\n },\n badgeError: {\n backgroundColor: theme.palette.error.main,\n },\n badgeSuccess: {\n backgroundColor: theme.palette.success.main,\n },\n badgeUnknown: {\n backgroundColor: theme.palette.grey[500],\n },\n}));\n\nexport const QualityBadge = (props: MetricInsightsProps) => {\n const classes = useStyles();\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n\n const { value } = props;\n let gateLabel: string = t('sonarQubeCard.qualityBadgeLabel.notComputed');\n let gateColor = classes.badgeUnknown;\n let gateLinkToolTip = '';\n if (value?.metrics.alert_status) {\n const gatePassed = value?.metrics.alert_status === 'OK';\n gateLabel = gatePassed\n ? t('sonarQubeCard.qualityBadgeLabel.gatePassed')\n : t('sonarQubeCard.qualityBadgeLabel.gateFailed');\n gateColor = gatePassed ? classes.badgeSuccess : classes.badgeError;\n }\n let clickableAttrs = {};\n if (value.projectUrl) {\n gateLinkToolTip = t('sonarQubeCard.qualityBadgeTooltip');\n clickableAttrs = {\n component: 'a',\n href: value.projectUrl,\n target: '_blank',\n rel: 'noopener noreferrer',\n clickable: true,\n };\n }\n const qualityBadge = (\n <Tooltip title={gateLinkToolTip}>\n <Chip\n label={gateLabel}\n {...clickableAttrs}\n className={props.compact ? classes.badgeCompact : ''}\n classes={{ root: gateColor, label: classes.badgeLabel }}\n icon={value.projectUrl ? <LinkIcon /> : undefined}\n />\n </Tooltip>\n );\n return qualityBadge;\n};\n\nexport const BugReportRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n titleIcon={<BugReport />}\n title={title}\n link={value.getIssuesUrl('BUG')}\n leftSlot={<Value value={value.metrics.bugs} compact={props.compact} />}\n rightSlot={<Rating rating={value.metrics.reliability_rating} />}\n />\n );\n};\n\nexport const VulnerabilitiesRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n titleIcon={\n value.metrics.vulnerabilities === '0' ? <Lock /> : <LockOpen />\n }\n title={title}\n link={value.getIssuesUrl('VULNERABILITY')}\n leftSlot={\n <Value value={value.metrics.vulnerabilities} compact={props.compact} />\n }\n rightSlot={<Rating rating={value.metrics.security_rating} />}\n />\n );\n};\n\nexport const CodeSmellsRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n titleIcon={\n value.metrics.code_smells === '0' ? (\n <SentimentVerySatisfied />\n ) : (\n <SentimentVeryDissatisfied />\n )\n }\n title={title}\n link={value.getIssuesUrl('CODE_SMELL')}\n leftSlot={\n <Value value={value.metrics.code_smells} compact={props.compact} />\n }\n rightSlot={<Rating rating={value.metrics.sqale_rating} />}\n />\n );\n};\n\nexport const HotspotsReviewed = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n value.metrics.security_review_rating && (\n <RatingCard\n compact={props.compact}\n titleIcon={<Security />}\n title={title}\n link={value.getSecurityHotspotsUrl()}\n leftSlot={\n <Value\n value={\n value.metrics.security_hotspots_reviewed\n ? `${value.metrics.security_hotspots_reviewed}%`\n : '—'\n }\n compact={props.compact}\n />\n }\n rightSlot={<Rating rating={value.metrics.security_review_rating} />}\n />\n )\n );\n};\n\nexport const CoverageRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n compact={props.compact}\n link={value.getComponentMeasuresUrl('COVERAGE')}\n title={title}\n leftSlot={<Percentage value={value.metrics.coverage} />}\n rightSlot={\n <Value\n value={value.metrics.coverage ? `${value.metrics.coverage}%` : '—'}\n compact={props.compact}\n />\n }\n />\n );\n};\n\nexport const DuplicationsRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n const duplicationRating = useMemo(() => {\n if (!value || !value.metrics.duplicated_lines_density) {\n return '';\n }\n\n let rating = '';\n\n for (const r of defaultDuplicationRatings) {\n if (+value.metrics.duplicated_lines_density >= r.greaterThan) {\n rating = r.rating;\n }\n }\n\n return rating;\n }, [value]);\n\n return (\n <RatingCard\n compact={props.compact}\n title={title}\n link={value.getComponentMeasuresUrl('DUPLICATED_LINES_DENSITY')}\n leftSlot={<Rating rating={duplicationRating} hideValue />}\n rightSlot={\n <Value\n value={`${value.metrics.duplicated_lines_density}%`}\n compact={props.compact}\n />\n }\n />\n );\n};\n\nexport const LastAnalyzedRatingCard = (props: MetricInsightsProps) => {\n const { value } = props;\n return (\n <div\n title={DateTime.fromISO(value.lastAnalysis).toLocaleString(\n DateTime.DATETIME_MED,\n )}\n >\n {DateTime.fromISO(value.lastAnalysis).toRelative()}\n </div>\n );\n};\n\nexport const NoSonarQubeCard = (props: MetricInsightsProps) => {\n const { value, sonarQubeComponentKey } = props;\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n return (\n <Typography color=\"textSecondary\" variant=\"subtitle2\">\n {value?.isSonarQubeAnnotationEnabled &&\n t('sonarQubeCard.noSonarQubeError.hasAnnotation', {\n project: sonarQubeComponentKey || '',\n })}\n {!value?.isSonarQubeAnnotationEnabled &&\n t('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,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,wBAAwB,CAAA,CAAA,CAAA;AAAA,UAChD,SAAS,KAAA,CAAM;AAAA;AAAA;AACjB;AAAA,GAEJ;AAEJ;AAEO,MAAM,sBAAA,GAAyB,CAAC,KAAA,KAA+B;AACpE,EAAA,MAAM,EAAE,OAAM,GAAI,KAAA;AAClB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,QAAA,CAAS,OAAA,CAAQ,KAAA,CAAM,YAAY,CAAA,CAAE,cAAA;AAAA,QAC1C,QAAA,CAAS;AAAA,OACX;AAAA,MAEC,QAAA,EAAA,QAAA,CAAS,OAAA,CAAQ,KAAA,CAAM,YAAY,EAAE,UAAA;AAAW;AAAA,GACnD;AAEJ;AAEO,MAAM,eAAA,GAAkB,CAAC,KAAA,KAA+B;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,qBAAA,EAAsB,GAAI,KAAA;AACzC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,uBAAuB,CAAA;AACvD,EAAA,uBACE,IAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAM,eAAA,EAAgB,SAAQ,WAAA,EACvC,QAAA,EAAA;AAAA,IAAA,KAAA,EAAO,4BAAA,IACN,EAAE,8CAAA,EAAgD;AAAA,MAChD,SAAS,qBAAA,IAAyB;AAAA,KACnC,CAAA;AAAA,IACF,CAAC,KAAA,EAAO,4BAAA,IACP,CAAA,CAAE,6CAA6C;AAAA,GAAA,EACnD,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Percentage.esm.js","sources":["../../../src/components/SonarQubeCard/Percentage.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 { makeStyles } from '@material-ui/core/styles';\nimport { useTheme } from '@material-ui/core/styles';\nimport { Circle } from 'rc-progress';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n height: theme.spacing(3),\n width: theme.spacing(3),\n },\n}));\n\nexport const Percentage = ({ value }: { value?: string }) => {\n const classes = useStyles();\n const theme = useTheme();\n\n return (\n <Circle\n strokeLinecap=\"butt\"\n percent={+(value || 0)}\n strokeWidth={16}\n strokeColor={theme.palette.status.ok}\n trailColor={theme.palette.status.error}\n trailWidth={16}\n className={classes.root}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAoBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACvB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAE1B,CAAE,CAAA,CAAA;AAEK,MAAM,UAAa,GAAA,CAAC,EAAE,KAAA,EAAgC,KAAA;AAC3D,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EACE,uBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,aAAc,EAAA,MAAA;AAAA,MACd,OAAA,EAAS,EAAE,KAAS,IAAA,CAAA,CAAA;AAAA,MACpB,WAAa,EAAA,EAAA;AAAA,MACb,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,EAAA;AAAA,MAClC,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,MACjC,UAAY,EAAA,EAAA;AAAA,MACZ,WAAW,OAAQ,CAAA;AAAA;AAAA,GACrB;AAEJ;;;;"}
1
+ {"version":3,"file":"Percentage.esm.js","sources":["../../../src/components/SonarQubeCard/Percentage.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 { makeStyles } from '@material-ui/core/styles';\nimport { useTheme } from '@material-ui/core/styles';\nimport { Circle } from 'rc-progress';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n height: theme.spacing(3),\n width: theme.spacing(3),\n },\n}));\n\nexport const Percentage = ({ value }: { value?: string }) => {\n const classes = useStyles();\n const theme = useTheme();\n\n return (\n <Circle\n strokeLinecap=\"butt\"\n percent={+(value || 0)}\n strokeWidth={16}\n strokeColor={theme.palette.status.ok}\n trailColor={theme.palette.status.error}\n trailWidth={16}\n className={classes.root}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAoBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IACvB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA;AAE1B,CAAA,CAAE,CAAA;AAEK,MAAM,UAAA,GAAa,CAAC,EAAE,KAAA,EAAM,KAA0B;AAC3D,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,QAAQ,QAAA,EAAS;AAEvB,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAc,MAAA;AAAA,MACd,OAAA,EAAS,EAAE,KAAA,IAAS,CAAA,CAAA;AAAA,MACpB,WAAA,EAAa,EAAA;AAAA,MACb,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,EAAA;AAAA,MAClC,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,MACjC,UAAA,EAAY,EAAA;AAAA,MACZ,WAAW,OAAA,CAAQ;AAAA;AAAA,GACrB;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Rating.esm.js","sources":["../../../src/components/SonarQubeCard/Rating.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 Avatar from '@material-ui/core/Avatar';\nimport { lighten, makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport { useMemo } from 'react';\n\nconst useStyles = makeStyles(theme => {\n const commonCardRating: CSSProperties = {\n height: theme.spacing(3),\n width: theme.spacing(3),\n color: theme.palette.common.white,\n };\n\n return {\n ratingDefault: {\n ...commonCardRating,\n background: theme.palette.status.aborted,\n },\n ratingA: {\n ...commonCardRating,\n background: theme.palette.status.ok,\n },\n ratingB: {\n ...commonCardRating,\n background: lighten(theme.palette.status.ok, 0.5),\n },\n ratingC: {\n ...commonCardRating,\n background: theme.palette.status.pending,\n },\n ratingD: {\n ...commonCardRating,\n background: theme.palette.status.warning,\n },\n ratingE: {\n ...commonCardRating,\n background: theme.palette.error.main,\n },\n };\n});\n\nexport const Rating = ({\n rating,\n hideValue,\n}: {\n rating?: string;\n hideValue?: boolean;\n}) => {\n const classes = useStyles();\n\n const ratingProp = useMemo(() => {\n switch (rating) {\n case '1.0':\n return {\n name: 'A',\n className: classes.ratingA,\n };\n\n case '2.0':\n return {\n name: 'B',\n className: classes.ratingB,\n };\n\n case '3.0':\n return {\n name: 'C',\n className: classes.ratingC,\n };\n\n case '4.0':\n return {\n name: 'D',\n className: classes.ratingD,\n };\n\n case '5.0':\n return {\n name: 'E',\n className: classes.ratingE,\n };\n\n default:\n return {\n name: '',\n className: classes.ratingDefault,\n };\n }\n }, [classes, rating]);\n\n return (\n <Avatar className={ratingProp.className}>\n {!hideValue && ratingProp.name}\n </Avatar>\n );\n};\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,SAAA,GAAY,WAAW,CAAS,KAAA,KAAA;AACpC,EAAA,MAAM,gBAAkC,GAAA;AAAA,IACtC,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACvB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACtB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAEA,EAAO,OAAA;AAAA,IACL,aAAe,EAAA;AAAA,MACb,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,KACnC;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,KACnC;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,YAAY,OAAQ,CAAA,KAAA,CAAM,OAAQ,CAAA,MAAA,CAAO,IAAI,GAAG;AAAA,KAClD;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAA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QAAC,EAAA,CAAA,SAAA,IAAa,WAAW,IAC5B,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Rating.esm.js","sources":["../../../src/components/SonarQubeCard/Rating.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 Avatar from '@material-ui/core/Avatar';\nimport { lighten, makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport { useMemo } from 'react';\n\nconst useStyles = makeStyles(theme => {\n const commonCardRating: CSSProperties = {\n height: theme.spacing(3),\n width: theme.spacing(3),\n color: theme.palette.common.white,\n };\n\n return {\n ratingDefault: {\n ...commonCardRating,\n background: theme.palette.status.aborted,\n },\n ratingA: {\n ...commonCardRating,\n background: theme.palette.status.ok,\n },\n ratingB: {\n ...commonCardRating,\n background: lighten(theme.palette.status.ok, 0.5),\n },\n ratingC: {\n ...commonCardRating,\n background: theme.palette.status.pending,\n },\n ratingD: {\n ...commonCardRating,\n background: theme.palette.status.warning,\n },\n ratingE: {\n ...commonCardRating,\n background: theme.palette.error.main,\n },\n };\n});\n\nexport const Rating = ({\n rating,\n hideValue,\n}: {\n rating?: string;\n hideValue?: boolean;\n}) => {\n const classes = useStyles();\n\n const ratingProp = useMemo(() => {\n switch (rating) {\n case '1.0':\n return {\n name: 'A',\n className: classes.ratingA,\n };\n\n case '2.0':\n return {\n name: 'B',\n className: classes.ratingB,\n };\n\n case '3.0':\n return {\n name: 'C',\n className: classes.ratingC,\n };\n\n case '4.0':\n return {\n name: 'D',\n className: classes.ratingD,\n };\n\n case '5.0':\n return {\n name: 'E',\n className: classes.ratingE,\n };\n\n default:\n return {\n name: '',\n className: classes.ratingDefault,\n };\n }\n }, [classes, rating]);\n\n return (\n <Avatar className={ratingProp.className}>\n {!hideValue && ratingProp.name}\n </Avatar>\n );\n};\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,KAAS;AACpC,EAAA,MAAM,gBAAA,GAAkC;AAAA,IACtC,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IACvB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IACtB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,GAC9B;AAEA,EAAA,OAAO;AAAA,IACL,aAAA,EAAe;AAAA,MACb,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,KACnC;AAAA,IACA,OAAA,EAAS;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,KACnC;AAAA,IACA,OAAA,EAAS;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,YAAY,OAAA,CAAQ,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,IAAI,GAAG;AAAA,KAClD;AAAA,IACA,OAAA,EAAS;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,KACnC;AAAA,IACA,OAAA,EAAS;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,KACnC;AAAA,IACA,OAAA,EAAS;AAAA,MACP,GAAG,gBAAA;AAAA,MACH,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,KAAA,CAAM;AAAA;AAClC,GACF;AACF,CAAC,CAAA;AAEM,MAAM,SAAS,CAAC;AAAA,EACrB,MAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,MAAM,UAAA,GAAa,QAAQ,MAAM;AAC/B,IAAA,QAAQ,MAAA;AAAQ,MACd,KAAK,KAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,GAAA;AAAA,UACN,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA,MAEF,KAAK,KAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,GAAA;AAAA,UACN,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA,MAEF,KAAK,KAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,GAAA;AAAA,UACN,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA,MAEF,KAAK,KAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,GAAA;AAAA,UACN,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA,MAEF,KAAK,KAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,GAAA;AAAA,UACN,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA,MAEF;AACE,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,EAAA;AAAA,UACN,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA;AACJ,EACF,CAAA,EAAG,CAAC,OAAA,EAAS,MAAM,CAAC,CAAA;AAEpB,EAAA,uBACE,GAAA,CAAC,UAAO,SAAA,EAAW,UAAA,CAAW,WAC3B,QAAA,EAAA,CAAC,SAAA,IAAa,WAAW,IAAA,EAC5B,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RatingCard.esm.js","sources":["../../../src/components/SonarQubeCard/RatingCard.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 { Link } from '@backstage/core-components';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ReactNode } from 'react';\n\nconst useStyles = makeStyles(theme => {\n return {\n root: {\n margin: theme.spacing(1, 0),\n minWidth: '140px',\n },\n upper: {\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n },\n cardTitle: {\n textAlign: 'center',\n },\n wrapIcon: {\n display: 'inline-flex',\n verticalAlign: 'baseline',\n },\n left: {\n display: 'flex',\n },\n right: {\n display: 'flex',\n marginLeft: theme.spacing(0.5),\n },\n };\n});\n\nexport const RatingCard = ({\n leftSlot,\n rightSlot,\n title,\n titleIcon,\n link,\n compact,\n}: {\n leftSlot: ReactNode;\n rightSlot: ReactNode;\n title?: string;\n titleIcon?: ReactNode;\n link: string;\n compact?: boolean;\n}) => {\n const classes = useStyles();\n\n return (\n <Link to={link} color=\"inherit\" underline=\"none\">\n <Grid item className={compact ? '' : classes.root}>\n <Grid item className={classes.upper}>\n <Grid item className={classes.left}>\n {leftSlot}\n </Grid>\n <Grid item className={classes.right}>\n {rightSlot}\n </Grid>\n </Grid>\n {compact || (\n <Grid item className={classes.cardTitle}>\n <Typography variant=\"body1\" className={classes.wrapIcon}>\n {titleIcon} {title}\n </Typography>\n </Grid>\n )}\n </Grid>\n </Link>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAS,KAAA,KAAA;AACpC,EAAO,OAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;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A;AAAA,KACF,EAAA,CAAA;AAAA,IACC,OACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,SAAW,EAAA,OAAA,CAAQ,SAC5B,EAAA,QAAA,kBAAA,IAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,SAAA,EAAW,QAAQ,QAC5C,EAAA,QAAA,EAAA;AAAA,MAAA,SAAA;AAAA,MAAU,GAAA;AAAA,MAAE;AAAA,KAAA,EACf,CACF,EAAA;AAAA,GAAA,EAEJ,CACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RatingCard.esm.js","sources":["../../../src/components/SonarQubeCard/RatingCard.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 { Link } from '@backstage/core-components';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ReactNode } from 'react';\n\nconst useStyles = makeStyles(theme => {\n return {\n root: {\n margin: theme.spacing(1, 0),\n minWidth: '140px',\n },\n upper: {\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n },\n cardTitle: {\n textAlign: 'center',\n },\n wrapIcon: {\n display: 'inline-flex',\n verticalAlign: 'baseline',\n },\n left: {\n display: 'flex',\n },\n right: {\n display: 'flex',\n marginLeft: theme.spacing(0.5),\n },\n };\n});\n\nexport const RatingCard = ({\n leftSlot,\n rightSlot,\n title,\n titleIcon,\n link,\n compact,\n}: {\n leftSlot: ReactNode;\n rightSlot: ReactNode;\n title?: string;\n titleIcon?: ReactNode;\n link: string;\n compact?: boolean;\n}) => {\n const classes = useStyles();\n\n return (\n <Link to={link} color=\"inherit\" underline=\"none\">\n <Grid item className={compact ? '' : classes.root}>\n <Grid item className={classes.upper}>\n <Grid item className={classes.left}>\n {leftSlot}\n </Grid>\n <Grid item className={classes.right}>\n {rightSlot}\n </Grid>\n </Grid>\n {compact || (\n <Grid item className={classes.cardTitle}>\n <Typography variant=\"body1\" className={classes.wrapIcon}>\n {titleIcon} {title}\n </Typography>\n </Grid>\n )}\n </Grid>\n </Link>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,KAAS;AACpC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,CAAA,EAAG,CAAC,CAAA;AAAA,MAC1B,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,KAAA,EAAO;AAAA,MACL,OAAA,EAAS,MAAA;AAAA,MACT,cAAA,EAAgB,QAAA;AAAA,MAChB,UAAA,EAAY;AAAA,KACd;AAAA,IACA,SAAA,EAAW;AAAA,MACT,SAAA,EAAW;AAAA,KACb;AAAA,IACA,QAAA,EAAU;AAAA,MACR,OAAA,EAAS,aAAA;AAAA,MACT,aAAA,EAAe;AAAA,KACjB;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS;AAAA,KACX;AAAA,IACA,KAAA,EAAO;AAAA,MACL,OAAA,EAAS,MAAA;AAAA,MACT,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA;AAC/B,GACF;AACF,CAAC,CAAA;AAEM,MAAM,aAAa,CAAC;AAAA,EACzB,QAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA,KAOM;AACJ,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,2BACG,IAAA,EAAA,EAAK,EAAA,EAAI,IAAA,EAAM,KAAA,EAAM,WAAU,SAAA,EAAU,MAAA,EACxC,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,MAAI,IAAA,EAAC,SAAA,EAAW,OAAA,GAAU,EAAA,GAAK,QAAQ,IAAA,EAC3C,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,SAAA,EAAW,QAAQ,KAAA,EAC5B,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,QAAK,IAAA,EAAI,IAAA,EAAC,SAAA,EAAW,OAAA,CAAQ,MAC3B,QAAA,EAAA,QAAA,EACH,CAAA;AAAA,0BACC,IAAA,EAAA,EAAK,IAAA,EAAI,MAAC,SAAA,EAAW,OAAA,CAAQ,OAC3B,QAAA,EAAA,SAAA,EACH;AAAA,KAAA,EACF,CAAA;AAAA,IACC,OAAA,oBACC,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,MAAC,SAAA,EAAW,OAAA,CAAQ,SAAA,EAC5B,QAAA,kBAAA,IAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,SAAA,EAAW,QAAQ,QAAA,EAC5C,QAAA,EAAA;AAAA,MAAA,SAAA;AAAA,MAAU,GAAA;AAAA,MAAE;AAAA,KAAA,EACf,CAAA,EACF;AAAA,GAAA,EAEJ,CAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
3
- import { sonarQubeApiRef, useProjectInfo, SONARQUBE_PROJECT_KEY_ANNOTATION } from '@backstage-community/plugin-sonarqube-react';
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';
7
7
  import { InfoCard, Progress, EmptyState } from '@backstage/core-components';
8
8
  import { useApi } from '@backstage/core-plugin-api';
9
- import { QualityBadge, BugReportRatingCard, VulnerabilitiesRatingCard, CodeSmellsRatingCard, HotspotsReviewed, CoverageRatingCard, DuplicationsRatingCard, LastAnalyzedRatingCard } from './MetricInsights.esm.js';
9
+ import { BugReportRatingCard, VulnerabilitiesRatingCard, CodeSmellsRatingCard, HotspotsReviewed, CoverageRatingCard, DuplicationsRatingCard, LastAnalyzedRatingCard, QualityBadge } from './MetricInsights.esm.js';
10
10
  import { useTranslationRef } from '@backstage/frontend-plugin-api';
11
11
  import { sonarqubeTranslationRef } from '../../translation.esm.js';
12
12
 
@@ -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 { projectKey: projectTitle, projectInstance } = useProjectInfo(entity);
30
- const { value: summaryFinding, loading } = useAsync(
31
- async () => sonarQubeApi.getFindingSummary({
32
- componentKey: projectTitle,
33
- projectInstance
34
- }),
35
- [sonarQubeApi, projectTitle]
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 && !projectTitle && /* @__PURE__ */ jsx(
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 && projectTitle && !summaryFinding?.metrics && /* @__PURE__ */ jsx(
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,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,EAAA,MAAM,EAAE,UAAY,EAAA,YAAA,EAAc,eAAgB,EAAA,GAAI,eAAe,MAAM,CAAA;AAE3E,EAAA,MAAM,EAAE,KAAA,EAAO,cAAgB,EAAA,OAAA,EAAY,GAAA,QAAA;AAAA,IACzC,YACE,aAAa,iBAAkB,CAAA;AAAA,MAC7B,YAAc,EAA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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,CAAA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I,MAAM,UAAA,GAAa,MAAA;AAE/D,EAAA,IAAI,eAAe,GAAA,EAAK;AACtB,IAAA,uBACE,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,MAAA;AAAA,QACR,KAAA,EAAO,EAAE,uCAAuC,CAAA;AAAA,QAChD,WAAA,EAAa,EAAE,6CAA6C;AAAA;AAAA,KAC9D;AAAA,EAEJ;AAEA,EAAA,IAAI,eAAe,GAAA,EAAK;AACtB,IAAA,uBACE,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,MAAA;AAAA,QACR,KAAA,EAAO,EAAE,oCAAoC,CAAA;AAAA,QAC7C,WAAA,EAAa,EAAE,0CAA0C;AAAA;AAAA,KAC3D;AAAA,EAEJ;AAEA,EAAA,IAAI,eAAe,GAAA,EAAK;AACtB,IAAA,uBACE,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,MAAA;AAAA,QACR,KAAA,EAAO,EAAE,mCAAmC,CAAA;AAAA,QAC5C,WAAA,EAAa,EAAE,yCAAyC;AAAA;AAAA,KAC1D;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,EAAE,gCAAgC,CAAA;AAAA,MACzC,aACE,KAAA,CAAM,KAAA,YAAiB,QAAQ,KAAA,CAAM,KAAA,CAAM,UAAU,KAAA,CAAM;AAAA;AAAA,GAE/D;AAEJ;AAEA,SAAS,gBACP,KAAA,EACyC;AACzC,EAAA,OAAO,YAAA,IAAgB,KAAA;AACzB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Value.esm.js","sources":["../../../src/components/SonarQubeCard/Value.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 { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\n\nconst useStyles = makeStyles(theme => {\n return {\n value: {\n fontSize: '1.5rem',\n fontWeight: theme.typography.fontWeightMedium,\n },\n compact: {\n lineHeight: '1.0',\n },\n };\n});\n\nexport const Value = (props: { value?: string; compact?: boolean }) => {\n const classes = useStyles();\n return (\n <Typography\n component=\"span\"\n className={props.compact ? classes.compact : ''}\n classes={{ root: classes.value }}\n >\n {props.value}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,SAAA,GAAY,WAAW,CAAS,KAAA,KAAA;AACpC,EAAO,OAAA;AAAA,IACL,KAAO,EAAA;AAAA,MACL,QAAU,EAAA,QAAA;AAAA,MACV,UAAA,EAAY,MAAM,UAAW,CAAA;AAAA,KAC/B;AAAA,IACA,OAAS,EAAA;AAAA,MACP,UAAY,EAAA;AAAA;AACd,GACF;AACF,CAAC,CAAA;AAEY,MAAA,KAAA,GAAQ,CAAC,KAAiD,KAAA;AACrE,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAU,EAAA,MAAA;AAAA,MACV,SAAW,EAAA,KAAA,CAAM,OAAU,GAAA,OAAA,CAAQ,OAAU,GAAA,EAAA;AAAA,MAC7C,OAAS,EAAA,EAAE,IAAM,EAAA,OAAA,CAAQ,KAAM,EAAA;AAAA,MAE9B,QAAM,EAAA,KAAA,CAAA;AAAA;AAAA,GACT;AAEJ;;;;"}
1
+ {"version":3,"file":"Value.esm.js","sources":["../../../src/components/SonarQubeCard/Value.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 { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\n\nconst useStyles = makeStyles(theme => {\n return {\n value: {\n fontSize: '1.5rem',\n fontWeight: theme.typography.fontWeightMedium,\n },\n compact: {\n lineHeight: '1.0',\n },\n };\n});\n\nexport const Value = (props: { value?: string; compact?: boolean }) => {\n const classes = useStyles();\n return (\n <Typography\n component=\"span\"\n className={props.compact ? classes.compact : ''}\n classes={{ root: classes.value }}\n >\n {props.value}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,KAAS;AACpC,EAAA,OAAO;AAAA,IACL,KAAA,EAAO;AAAA,MACL,QAAA,EAAU,QAAA;AAAA,MACV,UAAA,EAAY,MAAM,UAAA,CAAW;AAAA,KAC/B;AAAA,IACA,OAAA,EAAS;AAAA,MACP,UAAA,EAAY;AAAA;AACd,GACF;AACF,CAAC,CAAA;AAEM,MAAM,KAAA,GAAQ,CAAC,KAAA,KAAiD;AACrE,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,MAAA;AAAA,MACV,SAAA,EAAW,KAAA,CAAM,OAAA,GAAU,OAAA,CAAQ,OAAA,GAAU,EAAA;AAAA,MAC7C,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA,EAAM;AAAA,MAE9B,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,GACT;AAEJ;;;;"}
@@ -1,2 +1,6 @@
1
- export { SonarQubeCard } from './SonarQubeCard.esm.js';
1
+ import { SonarQubeCard } from './SonarQubeCard.esm.js';
2
+
3
+
4
+
5
+ export { SonarQubeCard };
2
6
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SonarQubeContentPage.esm.js","sources":["../../../src/components/SonarQubeContentPage/SonarQubeContentPage.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 Content,\n ContentHeader,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { SonarQubeCard } from '../SonarQubeCard';\nimport {\n isSonarQubeAvailable,\n SONARQUBE_PROJECT_KEY_ANNOTATION,\n} from '@backstage-community/plugin-sonarqube-react';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\n/** @public */\nexport type SonarQubeContentPageProps = {\n title?: string;\n supportTitle?: string;\n missingAnnotationReadMoreUrl?: string;\n};\n\nexport const SonarQubeContentPage = (props: SonarQubeContentPageProps) => {\n const { entity } = useEntity();\n const { title, supportTitle, missingAnnotationReadMoreUrl } = props;\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n\n return isSonarQubeAvailable(entity) ? (\n <Content>\n <ContentHeader title={title ?? t('title')}>\n {supportTitle && <SupportButton>{supportTitle}</SupportButton>}\n </ContentHeader>\n <SonarQubeCard\n missingAnnotationReadMoreUrl={missingAnnotationReadMoreUrl}\n />\n </Content>\n ) : (\n <MissingAnnotationEmptyState\n annotation={SONARQUBE_PROJECT_KEY_ANNOTATION}\n readMoreUrl={missingAnnotationReadMoreUrl}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwCa,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,YAAc,EAAA,4BAAA,EAAiC,GAAA,KAAA;AAC9D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,uBAAuB,CAAA;AAEvD,EAAA,OAAO,oBAAqB,CAAA,MAAM,CAChC,mBAAA,IAAA,CAAC,OACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,aAAA,EAAA,EAAc,KAAO,EAAA,KAAA,IAAS,CAAE,CAAA,OAAO,GACrC,QAAgB,EAAA,YAAA,oBAAA,GAAA,CAAC,aAAe,EAAA,EAAA,QAAA,EAAA,YAAA,EAAa,CAChD,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC;AAAA;AAAA;AACF,GAAA,EACF,CAEA,mBAAA,GAAA;AAAA,IAAC,2BAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,gCAAA;AAAA,MACZ,WAAa,EAAA;AAAA;AAAA,GACf;AAEJ;;;;"}
1
+ {"version":3,"file":"SonarQubeContentPage.esm.js","sources":["../../../src/components/SonarQubeContentPage/SonarQubeContentPage.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 Content,\n ContentHeader,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { SonarQubeCard } from '../SonarQubeCard';\nimport {\n isSonarQubeAvailable,\n SONARQUBE_PROJECT_KEY_ANNOTATION,\n} from '@backstage-community/plugin-sonarqube-react';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\n/** @public */\nexport type SonarQubeContentPageProps = {\n title?: string;\n supportTitle?: string;\n missingAnnotationReadMoreUrl?: string;\n};\n\nexport const SonarQubeContentPage = (props: SonarQubeContentPageProps) => {\n const { entity } = useEntity();\n const { title, supportTitle, missingAnnotationReadMoreUrl } = props;\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n\n return isSonarQubeAvailable(entity) ? (\n <Content>\n <ContentHeader title={title ?? t('title')}>\n {supportTitle && <SupportButton>{supportTitle}</SupportButton>}\n </ContentHeader>\n <SonarQubeCard\n missingAnnotationReadMoreUrl={missingAnnotationReadMoreUrl}\n />\n </Content>\n ) : (\n <MissingAnnotationEmptyState\n annotation={SONARQUBE_PROJECT_KEY_ANNOTATION}\n readMoreUrl={missingAnnotationReadMoreUrl}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwCO,MAAM,oBAAA,GAAuB,CAAC,KAAA,KAAqC;AACxE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,YAAA,EAAc,4BAAA,EAA6B,GAAI,KAAA;AAC9D,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,uBAAuB,CAAA;AAEvD,EAAA,OAAO,oBAAA,CAAqB,MAAM,CAAA,mBAChC,IAAA,CAAC,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,KAAA,EAAO,KAAA,IAAS,CAAA,CAAE,OAAO,GACrC,QAAA,EAAA,YAAA,oBAAgB,GAAA,CAAC,aAAA,EAAA,EAAe,QAAA,EAAA,YAAA,EAAa,CAAA,EAChD,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC;AAAA;AAAA;AACF,GAAA,EACF,CAAA,mBAEA,GAAA;AAAA,IAAC,2BAAA;AAAA,IAAA;AAAA,MACC,UAAA,EAAY,gCAAA;AAAA,MACZ,WAAA,EAAa;AAAA;AAAA,GACf;AAEJ;;;;"}
@@ -1,2 +1,6 @@
1
- export { SonarQubeContentPage } from './SonarQubeContentPage.esm.js';
1
+ import { SonarQubeContentPage } from './SonarQubeContentPage.esm.js';
2
+
3
+
4
+
5
+ export { SonarQubeContentPage };
2
6
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -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, getProjectInfo } from '@backstage-community/plugin-sonarqube-react';
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 findingsRequest = [];
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.getFindingSummaries(findingsRequest),
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 projectKey = entityNameToProjectKey[entity.metadata.name];
43
+ const entityRef = stringifyEntityRef(entity);
48
44
  return {
49
- id: projectKey || entity.metadata.name,
45
+ id: entityRef,
50
46
  resolved: {
51
- entityRef: stringifyEntityRef(entity),
47
+ entityRef,
52
48
  name: entity.metadata.name,
53
- findings: findingResults?.get(projectKey),
54
- isSonarQubeAnnotationEnabled: !!projectKey
49
+ findings: findingsMap.get(entityRef),
50
+ isSonarQubeAnnotationEnabled: isSonarQubeAvailable(entity)
55
51
  }
56
52
  };
57
53
  });
@@ -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 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,kBAGD,EAAC;AAEN,EAAA,MAAM,yBAAoD,EAAC;AAE3D,EAAW,KAAA,MAAA,MAAA,IAAU,QAAY,IAAA,EAAI,EAAA;AACnC,IAAA,MAAM,EAAE,UAAA,EAAY,eAAgB,EAAA,GAAI,eAAe,MAAM,CAAA;AAC7D,IAAA,IAAI,UAAY,EAAA;AACd,MAAuB,sBAAA,CAAA,MAAA,CAAO,QAAS,CAAA,IAAI,CAAI,GAAA,UAAA;AAC/C,MAAA,eAAA,CAAgB,IAAK,CAAA,EAAE,YAAc,EAAA,UAAA,EAAY,iBAAiB,CAAA;AAAA;AACpE;AAEF,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,mBAAA,CAAoB,eAAe,CAAA;AAAA,IAC5D,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,YAAA,GAAkC,QAAU,EAAA,GAAA,CAAI,CAAU,MAAA,KAAA;AAC9D,IAAA,MAAM,UAAa,GAAA,sBAAA,CAAuB,MAAO,CAAA,QAAA,CAAS,IAAI,CAAA;AAC9D,IAAO,OAAA;AAAA,MACL,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,KACF;AAAA,GACD,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 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":";;;;;;;;;;AAsCO,MAAM,gCAAA,GAAmC,CAAC,KAAA,KAA8B;AAC7E,EAAA,MAA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,MACL,EAAA,EAAI,SAAA;AAAA,MACJ,QAAA,EAAU;AAAA,QACR,SAAA;AAAA,QACA,IAAA,EAAM,OAAO,QAAA,CAAS,IAAA;AAAA,QACtB,QAAA,EAAU,WAAA,CAAY,GAAA,CAAI,SAAS,CAAA;AAAA,QACnC,4BAAA,EAA8B,qBAAqB,MAAM;AAAA;AAC3D,KACF;AAAA,EACF,CAAC,CAAA;AAED,EAAA,uBAAO,GAAA,CAAC,kBAAe,YAAA,EAA4B,CAAA;AACrD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Columns.esm.js","sources":["../../../src/components/SonarQubeTable/Columns.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { TableColumn } from '@backstage/core-components';\nimport {\n EntityPeekAheadPopover,\n EntityRefLink,\n} from '@backstage/plugin-catalog-react';\nimport {\n BugReportRatingCard,\n CodeSmellsRatingCard,\n CoverageRatingCard,\n DuplicationsRatingCard,\n HotspotsReviewed,\n LastAnalyzedRatingCard,\n NoSonarQubeCard,\n QualityBadge,\n VulnerabilitiesRatingCard,\n} from '../SonarQubeCard/MetricInsights';\nimport { SonarQubeTableRow } from './types';\nimport { TranslationFunction } from '@backstage/core-plugin-api/alpha';\nimport { sonarqubeTranslationRef } from '../../translation';\n\n/**\n * Sort function for datetime columns.\n *\n * The dates are sorted from oldest to newest.\n * All undefined values are sorted to the end.\n * @internal\n */\nexport function datetimeSort<T = SonarQubeTableRow>(\n dataAccessor: (data: T) => string | undefined,\n) {\n return (data1: T, data2: T, _type: any) => {\n const a: number = Date.parse(dataAccessor(data1) || '');\n const b: number = Date.parse(dataAccessor(data2) || '');\n\n if (isNaN(a) && isNaN(b)) {\n return 0; // both NaN\n } else if (isNaN(a)) {\n return 1; // only first NaN\n } else if (isNaN(b)) {\n return -1; // only second NaN\n }\n return a - b;\n };\n}\n\n/**\n * Sort function for numeric columns.\n *\n * The numbers are sorted from lowest to highest.\n * All undefined values are sorted to the end.\n * @internal\n */\nexport function numericSort<T = SonarQubeTableRow>(\n dataAccessor: (data: T) => string | undefined,\n) {\n return (data1: T, data2: T, _type: any) => {\n const a: number = Number(dataAccessor(data1));\n const b: number = Number(dataAccessor(data2));\n\n if (isNaN(a) && isNaN(b)) {\n return 0; // both NaN\n } else if (isNaN(a)) {\n return 1; // only first NaN\n } else if (isNaN(b)) {\n return -1; // only second NaN\n }\n return a - b;\n };\n}\n\nexport const getColumns = (\n t: TranslationFunction<typeof sonarqubeTranslationRef.T>,\n): TableColumn<SonarQubeTableRow>[] => {\n return [\n {\n title: t('sonarQubeTable.columnsTitle.name'),\n field: 'resolved.name',\n type: 'string',\n highlight: true,\n render: ({ resolved }) => {\n if (!resolved?.name) {\n return null;\n }\n const entityRef =\n resolved.entityRef || `component:default/${resolved.name}`;\n return (\n <EntityPeekAheadPopover entityRef={entityRef}>\n <EntityRefLink entityRef={entityRef} />\n </EntityPeekAheadPopover>\n );\n },\n },\n {\n title: t('sonarQubeTable.columnsTitle.qualityGate'),\n field: 'resolved.findings.metrics.alert_status',\n type: 'string',\n render: ({ resolved, id }) => {\n if (resolved?.findings?.metrics) {\n return <QualityBadge value={resolved?.findings} compact />;\n }\n return <NoSonarQubeCard value={resolved} sonarQubeComponentKey={id} />;\n },\n },\n {\n title: t('sonarQubeTable.columnsTitle.lastAnalysis'),\n field: 'resolved.findings.lastAnalysis',\n align: 'right',\n type: 'datetime',\n width: '8%',\n customSort: datetimeSort(data => data.resolved.findings?.lastAnalysis),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <LastAnalyzedRatingCard value={resolved?.findings} />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.bugs'),\n field: 'resolved.findings.metrics.bugs',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(data => data.resolved.findings?.metrics?.bugs),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <BugReportRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.vulnerabilities'),\n field: 'resolved.findings.metrics.vulnerabilities',\n align: 'center',\n width: '7%',\n type: 'numeric',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.vulnerabilities,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <VulnerabilitiesRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.codeSmells'),\n field: 'resolved.findings.metrics.code_smells',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.code_smells,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <CodeSmellsRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.hotspotsReviewed'),\n field: 'resolved.findings.metrics.security_hotspots_reviewed',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.security_hotspots_reviewed,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <HotspotsReviewed value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.coverage'),\n field: 'resolved.findings.metrics.coverage',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.coverage,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <CoverageRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.duplications'),\n field: 'resolved.findings.metrics.duplicated_lines_density',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.duplicated_lines_density,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <DuplicationsRatingCard value={resolved?.findings} compact />\n ),\n },\n ];\n};\n"],"names":[],"mappings":";;;;AA0CO,SAAS,aACd,YACA,EAAA;AACA,EAAO,OAAA,CAAC,KAAU,EAAA,KAAA,EAAU,KAAe,KAAA;AACzC,IAAA,MAAM,IAAY,IAAK,CAAA,KAAA,CAAM,YAAa,CAAA,KAAK,KAAK,EAAE,CAAA;AACtD,IAAA,MAAM,IAAY,IAAK,CAAA,KAAA,CAAM,YAAa,CAAA,KAAK,KAAK,EAAE,CAAA;AAEtD,IAAA,IAAI,KAAM,CAAA,CAAC,CAAK,IAAA,KAAA,CAAM,CAAC,CAAG,EAAA;AACxB,MAAO,OAAA,CAAA;AAAA,KACT,MAAA,IAAW,KAAM,CAAA,CAAC,CAAG,EAAA;AACnB,MAAO,OAAA,CAAA;AAAA,KACT,MAAA,IAAW,KAAM,CAAA,CAAC,CAAG,EAAA;AACnB,MAAO,OAAA,CAAA,CAAA;AAAA;AAET,IAAA,OAAO,CAAI,GAAA,CAAA;AAAA,GACb;AACF;AASO,SAAS,YACd,YACA,EAAA;AACA,EAAO,OAAA,CAAC,KAAU,EAAA,KAAA,EAAU,KAAe,KAAA;AACzC,IAAA,MAAM,CAAY,GAAA,MAAA,CAAO,YAAa,CAAA,KAAK,CAAC,CAAA;AAC5C,IAAA,MAAM,CAAY,GAAA,MAAA,CAAO,YAAa,CAAA,KAAK,CAAC,CAAA;AAE5C,IAAA,IAAI,KAAM,CAAA,CAAC,CAAK,IAAA,KAAA,CAAM,CAAC,CAAG,EAAA;AACxB,MAAO,OAAA,CAAA;AAAA,KACT,MAAA,IAAW,KAAM,CAAA,CAAC,CAAG,EAAA;AACnB,MAAO,OAAA,CAAA;AAAA,KACT,MAAA,IAAW,KAAM,CAAA,CAAC,CAAG,EAAA;AACnB,MAAO,OAAA,CAAA,CAAA;AA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AQ,EAAA,CAAC,EAAE,QAAA,OACT,QAAU,EAAA,QAAA,EAAU,OAClB,oBAAA,GAAA,CAAC,kBAAmB,EAAA,EAAA,KAAA,EAAO,QAAU,EAAA,QAAA,EAAU,SAAO,IAAC,EAAA;AAAA,KAE7D;AAAA,IACA;AAAA,MACE,KAAA,EAAO,EAAE,0CAA0C,CAAA;AAAA,MACnD,KAAO,EAAA,oDAAA;AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,IAAM,EAAA,SAAA;AAAA,MACN,KAAO,EAAA,IAAA;AAAA,MACP,UAAY,EAAA,WAAA;AAAA,QACV,CAAQ,IAAA,KAAA,IAAA,CAAK,QAAS,CAAA,QAAA,EAAU,OAAS,EAAA;AAAA,OAC3C;AAAA,MACA,MAAQ,EAAA,CAAC,EAAE,QAAA,OACT,QAAU,EAAA,QAAA,EAAU,OAClB,oBAAA,GAAA,CAAC,sBAAuB,EAAA,EAAA,KAAA,EAAO,QAAU,EAAA,QAAA,EAAU,SAAO,IAAC,EAAA;AAAA;AAEjE,GACF;AACF;;;;"}
1
+ {"version":3,"file":"Columns.esm.js","sources":["../../../src/components/SonarQubeTable/Columns.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { TableColumn } from '@backstage/core-components';\nimport {\n EntityPeekAheadPopover,\n EntityRefLink,\n} from '@backstage/plugin-catalog-react';\nimport {\n BugReportRatingCard,\n CodeSmellsRatingCard,\n CoverageRatingCard,\n DuplicationsRatingCard,\n HotspotsReviewed,\n LastAnalyzedRatingCard,\n NoSonarQubeCard,\n QualityBadge,\n VulnerabilitiesRatingCard,\n} from '../SonarQubeCard/MetricInsights';\nimport { SonarQubeTableRow } from './types';\nimport { TranslationFunction } from '@backstage/core-plugin-api/alpha';\nimport { sonarqubeTranslationRef } from '../../translation';\n\n/**\n * Sort function for datetime columns.\n *\n * The dates are sorted from oldest to newest.\n * All undefined values are sorted to the end.\n * @internal\n */\nexport function datetimeSort<T = SonarQubeTableRow>(\n dataAccessor: (data: T) => string | undefined,\n) {\n return (data1: T, data2: T, _type: any) => {\n const a: number = Date.parse(dataAccessor(data1) || '');\n const b: number = Date.parse(dataAccessor(data2) || '');\n\n if (isNaN(a) && isNaN(b)) {\n return 0; // both NaN\n } else if (isNaN(a)) {\n return 1; // only first NaN\n } else if (isNaN(b)) {\n return -1; // only second NaN\n }\n return a - b;\n };\n}\n\n/**\n * Sort function for numeric columns.\n *\n * The numbers are sorted from lowest to highest.\n * All undefined values are sorted to the end.\n * @internal\n */\nexport function numericSort<T = SonarQubeTableRow>(\n dataAccessor: (data: T) => string | undefined,\n) {\n return (data1: T, data2: T, _type: any) => {\n const a: number = Number(dataAccessor(data1));\n const b: number = Number(dataAccessor(data2));\n\n if (isNaN(a) && isNaN(b)) {\n return 0; // both NaN\n } else if (isNaN(a)) {\n return 1; // only first NaN\n } else if (isNaN(b)) {\n return -1; // only second NaN\n }\n return a - b;\n };\n}\n\nexport const getColumns = (\n t: TranslationFunction<typeof sonarqubeTranslationRef.T>,\n): TableColumn<SonarQubeTableRow>[] => {\n return [\n {\n title: t('sonarQubeTable.columnsTitle.name'),\n field: 'resolved.name',\n type: 'string',\n highlight: true,\n render: ({ resolved }) => {\n if (!resolved?.name) {\n return null;\n }\n const entityRef =\n resolved.entityRef || `component:default/${resolved.name}`;\n return (\n <EntityPeekAheadPopover entityRef={entityRef}>\n <EntityRefLink entityRef={entityRef} />\n </EntityPeekAheadPopover>\n );\n },\n },\n {\n title: t('sonarQubeTable.columnsTitle.qualityGate'),\n field: 'resolved.findings.metrics.alert_status',\n type: 'string',\n render: ({ resolved, id }) => {\n if (resolved?.findings?.metrics) {\n return <QualityBadge value={resolved?.findings} compact />;\n }\n return <NoSonarQubeCard value={resolved} sonarQubeComponentKey={id} />;\n },\n },\n {\n title: t('sonarQubeTable.columnsTitle.lastAnalysis'),\n field: 'resolved.findings.lastAnalysis',\n align: 'right',\n type: 'datetime',\n width: '8%',\n customSort: datetimeSort(data => data.resolved.findings?.lastAnalysis),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <LastAnalyzedRatingCard value={resolved?.findings} />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.bugs'),\n field: 'resolved.findings.metrics.bugs',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(data => data.resolved.findings?.metrics?.bugs),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <BugReportRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.vulnerabilities'),\n field: 'resolved.findings.metrics.vulnerabilities',\n align: 'center',\n width: '7%',\n type: 'numeric',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.vulnerabilities,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <VulnerabilitiesRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.codeSmells'),\n field: 'resolved.findings.metrics.code_smells',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.code_smells,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <CodeSmellsRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.hotspotsReviewed'),\n field: 'resolved.findings.metrics.security_hotspots_reviewed',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.security_hotspots_reviewed,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <HotspotsReviewed value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.coverage'),\n field: 'resolved.findings.metrics.coverage',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.coverage,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <CoverageRatingCard value={resolved?.findings} compact />\n ),\n },\n {\n title: t('sonarQubeTable.columnsTitle.duplications'),\n field: 'resolved.findings.metrics.duplicated_lines_density',\n align: 'center',\n type: 'numeric',\n width: '7%',\n customSort: numericSort(\n data => data.resolved.findings?.metrics?.duplicated_lines_density,\n ),\n render: ({ resolved }) =>\n resolved?.findings?.metrics && (\n <DuplicationsRatingCard value={resolved?.findings} compact />\n ),\n },\n ];\n};\n"],"names":[],"mappings":";;;;AA0CO,SAAS,aACd,YAAA,EACA;AACA,EAAA,OAAO,CAAC,KAAA,EAAU,KAAA,EAAU,KAAA,KAAe;AACzC,IAAA,MAAM,IAAY,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,KAAK,KAAK,EAAE,CAAA;AACtD,IAAA,MAAM,IAAY,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,KAAK,KAAK,EAAE,CAAA;AAEtD,IAAA,IAAI,KAAA,CAAM,CAAC,CAAA,IAAK,KAAA,CAAM,CAAC,CAAA,EAAG;AACxB,MAAA,OAAO,CAAA;AAAA,IACT,CAAA,MAAA,IAAW,KAAA,CAAM,CAAC,CAAA,EAAG;AACnB,MAAA,OAAO,CAAA;AAAA,IACT,CAAA,MAAA,IAAW,KAAA,CAAM,CAAC,CAAA,EAAG;AACnB,MAAA,OAAO,EAAA;AAAA,IACT;AACA,IAAA,OAAO,CAAA,GAAI,CAAA;AAAA,EACb,CAAA;AACF;AASO,SAAS,YACd,YAAA,EACA;AACA,EAAA,OAAO,CAAC,KAAA,EAAU,KAAA,EAAU,KAAA,KAAe;AACzC,IAAA,MAAM,CAAA,GAAY,MAAA,CAAO,YAAA,CAAa,KAAK,CAAC,C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,EAAiB,KAAA,EAAO,QAAA,EAAU,QAAA,EAAU,SAAO,IAAA,EAAC;AAAA,KAE3D;AAAA,IACA;AAAA,MACE,KAAA,EAAO,EAAE,sCAAsC,CAAA;AAAA,MAC/C,KAAA,EAAO,oCAAA;AAAA,MACP,KAAA,EAAO,QAAA;AAAA,MACP,IAAA,EAAM,SAAA;AAAA,MACN,KAAA,EAAO,IAAA;AAAA,MACP,UAAA,EAAY,WAAA;AAAA,QACV,CAAA,IAAA,KAAQ,IAAA,CAAK,QAAA,CAAS,QAAA,EAAU,OAAA,EAAS;AAAA,OAC3C;AAAA,MACA,MAAA,EAAQ,CAAC,EAAE,QAAA,OACT,QAAA,EAAU,QAAA,EAAU,OAAA,oBAClB,GAAA,CAAC,kBAAA,EAAA,EAAmB,KAAA,EAAO,QAAA,EAAU,QAAA,EAAU,SAAO,IAAA,EAAC;AAAA,KAE7D;AAAA,IACA;AAAA,MACE,KAAA,EAAO,EAAE,0CAA0C,CAAA;AAAA,MACnD,KAAA,EAAO,oDAAA;AAAA,MACP,KAAA,EAAO,QAAA;AAAA,MACP,IAAA,EAAM,SAAA;AAAA,MACN,KAAA,EAAO,IAAA;AAAA,MACP,UAAA,EAAY,WAAA;AAAA,QACV,CAAA,IAAA,KAAQ,IAAA,CAAK,QAAA,CAAS,QAAA,EAAU,OAAA,EAAS;AAAA,OAC3C;AAAA,MACA,MAAA,EAAQ,CAAC,EAAE,QAAA,OACT,QAAA,EAAU,QAAA,EAAU,OAAA,oBAClB,GAAA,CAAC,sBAAA,EAAA,EAAuB,KAAA,EAAO,QAAA,EAAU,QAAA,EAAU,SAAO,IAAA,EAAC;AAAA;AAEjE,GACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SonarQubeTable.esm.js","sources":["../../../src/components/SonarQubeTable/SonarQubeTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { ReactNode } from 'react';\nimport { ErrorPanel, Table } from '@backstage/core-components';\nimport { getColumns } from './Columns';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport type SonarQubeTableProps = {\n tableContent: any[] | undefined;\n title?: string;\n options?: any | undefined;\n emptyContent?: ReactNode;\n localization?: any;\n};\n/**\n * @public\n */\nexport const SonarQubeTable = ({\n tableContent,\n title,\n options,\n emptyContent,\n localization,\n}: SonarQubeTableProps) => {\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n if (!tableContent) {\n return <ErrorPanel error={Error('Table could not be rendered')} />;\n }\n const pageSize = options?.pageSize || 20;\n const showPagination = tableContent?.length > pageSize;\n return (\n <Table\n title={\n <div>{`${title ?? t('sonarQubeCard.title')} (${\n tableContent.length\n })`}</div>\n }\n options={{\n padding: 'dense',\n paging: showPagination,\n pageSize: pageSize,\n pageSizeOptions: [10, 20, 50, 100],\n ...options,\n }}\n data={tableContent || []}\n columns={getColumns(t)}\n emptyContent={emptyContent}\n localization={localization}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAkCO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,YAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAA2B,KAAA;AACzB,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,uBAAuB,CAAA;AACvD,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAA,uBAAQ,GAAA,CAAA,UAAA,EAAA,EAAW,KAAO,EAAA,KAAA,CAAM,6BAA6B,CAAG,EAAA,CAAA;AAAA;AAElE,EAAM,MAAA,QAAA,GAAW,SAAS,QAAY,IAAA,EAAA;AACtC,EAAM,MAAA,cAAA,GAAiB,cAAc,MAAS,GAAA,QAAA;AAC9C,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,kBACG,GAAA,CAAA,KAAA,EAAA,EAAK,QAAG,EAAA,CAAA,EAAA,KAAA,IAAS,CAAE,CAAA,qBAAqB,CAAC,CAAA,EAAA,EACxC,YAAa,CAAA,MACf,CAAI,CAAA,CAAA,EAAA,CAAA;AAAA,MAEN,OAAS,EAAA;AAAA,QACP,OAAS,EAAA,OAAA;AAAA,QACT,MAAQ,EAAA,cAAA;AAAA,QACR,QAAA;AAAA,QACA,eAAiB,EAAA,CAAC,EAAI,EAAA,EAAA,EAAI,IAAI,GAAG,CAAA;AAAA,QACjC,GAAG;AAAA,OACL;AAAA,MACA,IAAA,EAAM,gBAAgB,EAAC;AAAA,MACvB,OAAA,EAAS,WAAW,CAAC,CAAA;AAAA,MACrB,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"SonarQubeTable.esm.js","sources":["../../../src/components/SonarQubeTable/SonarQubeTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { ReactNode } from 'react';\nimport { ErrorPanel, Table } from '@backstage/core-components';\nimport { getColumns } from './Columns';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\n/**\n * @public\n */\nexport type SonarQubeTableProps = {\n tableContent: any[] | undefined;\n title?: string;\n options?: any | undefined;\n emptyContent?: ReactNode;\n localization?: any;\n};\n/**\n * @public\n */\nexport const SonarQubeTable = ({\n tableContent,\n title,\n options,\n emptyContent,\n localization,\n}: SonarQubeTableProps) => {\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n if (!tableContent) {\n return <ErrorPanel error={Error('Table could not be rendered')} />;\n }\n const pageSize = options?.pageSize || 20;\n const showPagination = tableContent?.length > pageSize;\n return (\n <Table\n title={\n <div>{`${title ?? t('sonarQubeCard.title')} (${\n tableContent.length\n })`}</div>\n }\n options={{\n padding: 'dense',\n paging: showPagination,\n pageSize: pageSize,\n pageSizeOptions: [10, 20, 50, 100],\n ...options,\n }}\n data={tableContent || []}\n columns={getColumns(t)}\n emptyContent={emptyContent}\n localization={localization}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAkCO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,YAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,KAA2B;AACzB,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,uBAAuB,CAAA;AACvD,EAAA,IAAI,CAAC,YAAA,EAAc;AACjB,IAAA,uBAAO,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAO,KAAA,CAAM,6BAA6B,CAAA,EAAG,CAAA;AAAA,EAClE;AACA,EAAA,MAAM,QAAA,GAAW,SAAS,QAAA,IAAY,EAAA;AACtC,EAAA,MAAM,cAAA,GAAiB,cAAc,MAAA,GAAS,QAAA;AAC9C,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,kBACE,GAAA,CAAC,KAAA,EAAA,EAAK,QAAA,EAAA,CAAA,EAAG,KAAA,IAAS,CAAA,CAAE,qBAAqB,CAAC,CAAA,EAAA,EACxC,YAAA,CAAa,MACf,CAAA,CAAA,CAAA,EAAI,CAAA;AAAA,MAEN,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,OAAA;AAAA,QACT,MAAA,EAAQ,cAAA;AAAA,QACR,QAAA;AAAA,QACA,eAAA,EAAiB,CAAC,EAAA,EAAI,EAAA,EAAI,IAAI,GAAG,CAAA;AAAA,QACjC,GAAG;AAAA,OACL;AAAA,MACA,IAAA,EAAM,gBAAgB,EAAC;AAAA,MACvB,OAAA,EAAS,WAAW,CAAC,CAAA;AAAA,MACrB,YAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.esm.js","sources":["../../../src/components/SonarQubeTable/types.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { FindingSummary } from '@backstage-community/plugin-sonarqube-react';\n\nexport interface SonarQubeTableRow {\n resolved: {\n name: string;\n entityRef?: string;\n isSonarQubeAnnotationEnabled?: boolean;\n findings?: FindingSummary;\n };\n id: string;\n}\n\n/** @public */\nexport type DuplicationRating = {\n greaterThan: number;\n rating: '1.0' | '2.0' | '3.0' | '4.0' | '5.0';\n};\n\nexport const defaultDuplicationRatings: DuplicationRating[] = [\n { greaterThan: 0, rating: '1.0' },\n { greaterThan: 3, rating: '2.0' },\n { greaterThan: 5, rating: '3.0' },\n { greaterThan: 10, rating: '4.0' },\n { greaterThan: 20, rating: '5.0' },\n];\n"],"names":[],"mappings":"AAiCO,MAAM,yBAAiD,GAAA;AAAA,EAC5D,EAAE,WAAA,EAAa,CAAG,EAAA,MAAA,EAAQ,KAAM,EAAA;AAAA,EAChC,EAAE,WAAA,EAAa,CAAG,EAAA,MAAA,EAAQ,KAAM,EAAA;AAAA,EAChC,EAAE,WAAA,EAAa,CAAG,EAAA,MAAA,EAAQ,KAAM,EAAA;AAAA,EAChC,EAAE,WAAA,EAAa,EAAI,EAAA,MAAA,EAAQ,KAAM,EAAA;AAAA,EACjC,EAAE,WAAA,EAAa,EAAI,EAAA,MAAA,EAAQ,KAAM;AACnC;;;;"}
1
+ {"version":3,"file":"types.esm.js","sources":["../../../src/components/SonarQubeTable/types.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { FindingSummary } from '@backstage-community/plugin-sonarqube-react';\n\nexport interface SonarQubeTableRow {\n resolved: {\n name: string;\n entityRef?: string;\n isSonarQubeAnnotationEnabled?: boolean;\n findings?: FindingSummary;\n };\n id: string;\n}\n\n/** @public */\nexport type DuplicationRating = {\n greaterThan: number;\n rating: '1.0' | '2.0' | '3.0' | '4.0' | '5.0';\n};\n\nexport const defaultDuplicationRatings: DuplicationRating[] = [\n { greaterThan: 0, rating: '1.0' },\n { greaterThan: 3, rating: '2.0' },\n { greaterThan: 5, rating: '3.0' },\n { greaterThan: 10, rating: '4.0' },\n { greaterThan: 20, rating: '5.0' },\n];\n"],"names":[],"mappings":"AAiCO,MAAM,yBAAA,GAAiD;AAAA,EAC5D,EAAE,WAAA,EAAa,CAAA,EAAG,MAAA,EAAQ,KAAA,EAAM;AAAA,EAChC,EAAE,WAAA,EAAa,CAAA,EAAG,MAAA,EAAQ,KAAA,EAAM;AAAA,EAChC,EAAE,WAAA,EAAa,CAAA,EAAG,MAAA,EAAQ,KAAA,EAAM;AAAA,EAChC,EAAE,WAAA,EAAa,EAAA,EAAI,MAAA,EAAQ,KAAA,EAAM;AAAA,EACjC,EAAE,WAAA,EAAa,EAAA,EAAI,MAAA,EAAQ,KAAA;AAC7B;;;;"}
@@ -1,4 +1,4 @@
1
- import { isSonarQubeAvailable as isSonarQubeAvailable$1, SONARQUBE_PROJECT_KEY_ANNOTATION as SONARQUBE_PROJECT_KEY_ANNOTATION$1 } from '@backstage-community/plugin-sonarqube-react';
1
+ import { SONARQUBE_PROJECT_KEY_ANNOTATION as SONARQUBE_PROJECT_KEY_ANNOTATION$1, isSonarQubeAvailable as isSonarQubeAvailable$1 } from '@backstage-community/plugin-sonarqube-react';
2
2
  export { SonarQubeCard } from './SonarQubeCard/SonarQubeCard.esm.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react-use/esm/useAsync';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/components/index.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 isSonarQubeAvailable as NonDeprecatedIsSonarQubeAvailable,\n SONARQUBE_PROJECT_KEY_ANNOTATION as NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION,\n} from '@backstage-community/plugin-sonarqube-react';\n\nexport { SonarQubeCard } from './SonarQubeCard';\nexport type { DuplicationRating } from './SonarQubeCard';\nexport type { SonarQubeContentPageProps } from './SonarQubeContentPage';\nexport * from './SonarQubeRelatedEntitiesOverview';\nexport * from './SonarQubeTable';\n/**\n * @public\n *\n * @deprecated use the same type from `@backstage-community/plugin-sonarqube-react` instead\n */\nexport const isSonarQubeAvailable = NonDeprecatedIsSonarQubeAvailable;\n\n/**\n * @public\n *\n * @deprecated use the same type from `@backstage-community/plugin-sonarqube-react` instead\n */\nexport const SONARQUBE_PROJECT_KEY_ANNOTATION =\n NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION;\n"],"names":["NonDeprecatedIsSonarQubeAvailable","NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION"],"mappings":";;;;;;;;;;;;AA+BO,MAAM,oBAAuB,GAAAA;AAO7B,MAAM,gCACX,GAAAC;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/components/index.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 isSonarQubeAvailable as NonDeprecatedIsSonarQubeAvailable,\n SONARQUBE_PROJECT_KEY_ANNOTATION as NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION,\n} from '@backstage-community/plugin-sonarqube-react';\n\nexport { SonarQubeCard } from './SonarQubeCard';\nexport type { DuplicationRating } from './SonarQubeCard';\nexport type { SonarQubeContentPageProps } from './SonarQubeContentPage';\nexport * from './SonarQubeRelatedEntitiesOverview';\nexport * from './SonarQubeTable';\n/**\n * @public\n *\n * @deprecated use the same type from `@backstage-community/plugin-sonarqube-react` instead\n */\nexport const isSonarQubeAvailable = NonDeprecatedIsSonarQubeAvailable;\n\n/**\n * @public\n *\n * @deprecated use the same type from `@backstage-community/plugin-sonarqube-react` instead\n */\nexport const SONARQUBE_PROJECT_KEY_ANNOTATION =\n NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION;\n"],"names":["NonDeprecatedIsSonarQubeAvailable","NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION"],"mappings":";;;;;;;;;;;;AA+BO,MAAM,oBAAA,GAAuBA;AAO7B,MAAM,gCAAA,GACXC;;;;"}
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
- getFindingSummary({ componentKey, projectInstance, }?: {
21
- componentKey?: string;
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 */
@@ -92,9 +86,9 @@ declare const SONARQUBE_PROJECT_KEY_ANNOTATION = "sonarqube.org/project-key";
92
86
  declare const sonarQubePlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
93
87
  /** @public */
94
88
  declare const EntitySonarQubeCard: (props: {
95
- variant?: _backstage_core_components.InfoCardVariants | undefined;
96
- duplicationRatings?: DuplicationRating[] | undefined;
97
- missingAnnotationReadMoreUrl?: string | undefined;
89
+ variant?: _backstage_core_components.InfoCardVariants;
90
+ duplicationRatings?: DuplicationRating[];
91
+ missingAnnotationReadMoreUrl?: string;
98
92
  }) => react_jsx_runtime.JSX.Element;
99
93
  /** @public */
100
94
  declare const EntitySonarQubeContentPage: (props: SonarQubeContentPageProps) => react_jsx_runtime.JSX.Element;
@@ -105,6 +99,8 @@ declare const EntitySonarQubeContentPage: (props: SonarQubeContentPageProps) =>
105
99
  declare const sonarqubeTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"sonarqube", {
106
100
  readonly title: "SonarQube Dashboard";
107
101
  readonly "sonarQubeCard.title": "Code Quality";
102
+ readonly "sonarQubeCard.emptyState.title": "No information to display";
103
+ readonly "sonarQubeCard.emptyState.description": "There is no SonarQube project with key '{{ projectTitle }}', check that project exists and permissions.";
108
104
  readonly "sonarQubeCard.deepLinkTitle": "View more";
109
105
  readonly "sonarQubeCard.bugReportRatingCardTitle": "Bugs";
110
106
  readonly "sonarQubeCard.vulnerabilitiesRatingCardTitle": "Vulnerabilities";
@@ -113,8 +109,12 @@ declare const sonarqubeTranslationRef: _backstage_frontend_plugin_api.Translatio
113
109
  readonly "sonarQubeCard.coverageRatingCardTitle": "Coverage";
114
110
  readonly "sonarQubeCard.duplicationsRatingCard": "Duplications";
115
111
  readonly "sonarQubeCard.qualityBadgeTooltip": "View SonarQube Dashboard";
116
- readonly "sonarQubeCard.emptyState.title": "No information to display";
117
- 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";
@@ -1,5 +1,5 @@
1
1
  import { SonarQubeClient } from './api/SonarQubeClient.esm.js';
2
- import { createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createComponentExtension } from '@backstage/core-plugin-api';
2
+ import { createPlugin, createApiFactory, fetchApiRef, discoveryApiRef, createComponentExtension } from '@backstage/core-plugin-api';
3
3
  import { sonarQubeApiRef } from '@backstage-community/plugin-sonarqube-react';
4
4
 
5
5
  const sonarQubePlugin = createPlugin({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 { SonarQubeClient } from './api';\nimport {\n createApiFactory,\n createComponentExtension,\n createPlugin,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { sonarQubeApiRef } from '@backstage-community/plugin-sonarqube-react';\n\n/** @public */\nexport const sonarQubePlugin = createPlugin({\n id: 'sonarqube',\n apis: [\n createApiFactory({\n api: sonarQubeApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new SonarQubeClient({\n discoveryApi,\n fetchApi,\n }),\n }),\n ],\n});\n\n/** @public */\nexport const EntitySonarQubeCard = sonarQubePlugin.provide(\n createComponentExtension({\n name: 'EntitySonarQubeCard',\n component: {\n lazy: () =>\n import('./components/SonarQubeCard').then(m => m.SonarQubeCard),\n },\n }),\n);\n\n/** @public */\nexport const EntitySonarQubeContentPage = sonarQubePlugin.provide(\n createComponentExtension({\n name: 'EntitySonarQubeContentPage',\n component: {\n lazy: () =>\n import('./components/SonarQubeContentPage').then(\n m => m.SonarQubeContentPage,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;AA2BO,MAAM,kBAAkB,YAAa,CAAA;AAAA,EAC1C,EAAI,EAAA,WAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,eAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA;AAAA,OACZ;AAAA,MACA,SAAS,CAAC,EAAE,cAAc,QAAS,EAAA,KACjC,IAAI,eAAgB,CAAA;AAAA,QAClB,YAAA;AAAA,QACA;AAAA,OACD;AAAA,KACJ;AAAA;AAEL,CAAC;AAGM,MAAM,sBAAsB,eAAgB,CAAA,OAAA;AAAA,EACjD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,qBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,yCAA4B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAClE,GACD;AACH;AAGO,MAAM,6BAA6B,eAAgB,CAAA,OAAA;AAAA,EACxD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,4BAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,gDAAmC,CAAE,CAAA,IAAA;AAAA,QAC1C,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 { SonarQubeClient } from './api';\nimport {\n createApiFactory,\n createComponentExtension,\n createPlugin,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { sonarQubeApiRef } from '@backstage-community/plugin-sonarqube-react';\n\n/** @public */\nexport const sonarQubePlugin = createPlugin({\n id: 'sonarqube',\n apis: [\n createApiFactory({\n api: sonarQubeApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new SonarQubeClient({\n discoveryApi,\n fetchApi,\n }),\n }),\n ],\n});\n\n/** @public */\nexport const EntitySonarQubeCard = sonarQubePlugin.provide(\n createComponentExtension({\n name: 'EntitySonarQubeCard',\n component: {\n lazy: () =>\n import('./components/SonarQubeCard').then(m => m.SonarQubeCard),\n },\n }),\n);\n\n/** @public */\nexport const EntitySonarQubeContentPage = sonarQubePlugin.provide(\n createComponentExtension({\n name: 'EntitySonarQubeContentPage',\n component: {\n lazy: () =>\n import('./components/SonarQubeContentPage').then(\n m => m.SonarQubeContentPage,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;AA2BO,MAAM,kBAAkB,YAAA,CAAa;AAAA,EAC1C,EAAA,EAAI,WAAA;AAAA,EACJ,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,eAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,YAAA,EAAc,eAAA;AAAA,QACd,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,SAAS,CAAC,EAAE,cAAc,QAAA,EAAS,KACjC,IAAI,eAAA,CAAgB;AAAA,QAClB,YAAA;AAAA,QACA;AAAA,OACD;AAAA,KACJ;AAAA;AAEL,CAAC;AAGM,MAAM,sBAAsB,eAAA,CAAgB,OAAA;AAAA,EACjD,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,qBAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,yCAA4B,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAClE,GACD;AACH;AAGO,MAAM,6BAA6B,eAAA,CAAgB,OAAA;AAAA,EACxD,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,4BAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,gDAAmC,CAAA,CAAE,IAAA;AAAA,QAC1C,OAAK,CAAA,CAAE;AAAA;AACT;AACJ,GACD;AACH;;;;"}
@@ -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,oBAAA,CAAqB;AAAA,EAC1D,EAAA,EAAI,WAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,KAAA,EAAO,qBAAA;AAAA,IACP,aAAA,EAAe;AAAA,MACb,KAAA,EAAO,cAAA;AAAA,MACP,aAAA,EAAe,WAAA;AAAA,MACf,UAAA,EAAY;AAAA,QACV,KAAA,EAAO,2BAAA;AAAA,QACP,WAAA,EACE;AAAA,OACJ;AAAA,MACA,iBAAA,EAAmB;AAAA,QACjB,KAAA,EAAO,cAAA;AAAA,QACP,WAAA,EACE;AAAA,OACJ;AAAA,MACA,aAAA,EAAe;AAAA,QACb,KAAA,EAAO,6BAAA;AAAA,QACP,WAAA,EACE;AAAA,OACJ;AAAA,MACA,cAAA,EAAgB;AAAA,QACd,KAAA,EAAO,eAAA;AAAA,QACP,WAAA,EACE;AAAA,OACJ;AAAA,MACA,gBAAA,EAAkB;AAAA,QAChB,aAAA,EAAe,sDAAA;AAAA,QACf,YAAA,EAAc;AAAA,OAChB;AAAA,MACA,wBAAA,EAA0B,MAAA;AAAA,MAC1B,8BAAA,EAAgC,iBAAA;AAAA,MAChC,yBAAA,EAA2B,aAAA;AAAA,MAC3B,qBAAA,EAAuB,mBAAA;AAAA,MACvB,uBAAA,EAAyB,UAAA;AAAA,MACzB,sBAAA,EAAwB,cAAA;AAAA,MACxB,iBAAA,EAAmB;AAAA,QACjB,WAAA,EAAa,cAAA;AAAA,QACb,UAAA,EAAY,aAAA;AAAA,QACZ,UAAA,EAAY;AAAA,OACd;AAAA,MACA,mBAAA,EAAqB;AAAA,KACvB;AAAA,IACA,cAAA,EAAgB;AAAA,MACd,YAAA,EAAc;AAAA,QACZ,IAAA,EAAM,MAAA;AAAA,QACN,WAAA,EAAa,cAAA;AAAA,QACb,YAAA,EAAc,eAAA;AAAA,QACd,IAAA,EAAM,MAAA;AAAA,QACN,eAAA,EAAiB,iBAAA;AAAA,QACjB,UAAA,EAAY,aAAA;AAAA,QACZ,gBAAA,EAAkB,mBAAA;AAAA,QAClB,QAAA,EAAU,UAAA;AAAA,QACV,YAAA,EAAc;AAAA;AAChB;AACF;AAEJ,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-sonarqube",
3
- "version": "0.23.0",
3
+ "version": "1.1.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.15.0",
75
- "@backstage/catalog-model": "^1.7.6",
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/frontend-app-api": "^0.14.1",
80
- "@backstage/frontend-plugin-api": "^0.13.4",
81
- "@backstage/plugin-catalog-react": "^1.21.6",
74
+ "@backstage-community/plugin-sonarqube-react": "^1.1.0",
75
+ "@backstage/catalog-model": "^1.7.7",
76
+ "@backstage/core-compat-api": "^0.5.9",
77
+ "@backstage/core-components": "^0.18.8",
78
+ "@backstage/core-plugin-api": "^1.12.4",
79
+ "@backstage/errors": "^1.2.7",
80
+ "@backstage/frontend-app-api": "^0.16.1",
81
+ "@backstage/frontend-plugin-api": "^0.15.1",
82
+ "@backstage/plugin-catalog-react": "^2.1.1",
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,11 +90,11 @@
89
90
  "react-use": "^17.2.4"
90
91
  },
91
92
  "devDependencies": {
92
- "@backstage/cli": "^0.35.3",
93
- "@backstage/core-app-api": "^1.19.4",
94
- "@backstage/dev-utils": "^1.1.19",
95
- "@backstage/frontend-test-utils": "^0.4.5",
96
- "@backstage/test-utils": "^1.7.14",
93
+ "@backstage/cli": "^0.36.0",
94
+ "@backstage/core-app-api": "^1.19.6",
95
+ "@backstage/dev-utils": "^1.1.21",
96
+ "@backstage/frontend-test-utils": "^0.5.1",
97
+ "@backstage/test-utils": "^1.7.16",
97
98
  "@testing-library/dom": "^10.0.0",
98
99
  "@testing-library/jest-dom": "^6.0.0",
99
100
  "@testing-library/react": "^15.0.0",