@backstage-community/plugin-sonarqube 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/config.schema.json +51 -0
- package/dist/alpha/apis.esm.js +1 -1
- package/dist/alpha/apis.esm.js.map +1 -1
- package/dist/alpha/entityCard.esm.js.map +1 -1
- package/dist/alpha/entityContent.esm.js.map +1 -1
- package/dist/alpha/plugin.esm.js.map +1 -1
- package/dist/alpha.d.ts +25 -22
- package/dist/api/SonarQubeClient.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/MetricInsights.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/Percentage.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/Rating.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/RatingCard.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/SonarQubeCard.esm.js +1 -1
- package/dist/components/SonarQubeCard/SonarQubeCard.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/Value.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/index.esm.js +5 -1
- package/dist/components/SonarQubeCard/index.esm.js.map +1 -1
- package/dist/components/SonarQubeContentPage/SonarQubeContentPage.esm.js.map +1 -1
- package/dist/components/SonarQubeContentPage/index.esm.js +5 -1
- package/dist/components/SonarQubeContentPage/index.esm.js.map +1 -1
- package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js.map +1 -1
- package/dist/components/SonarQubeTable/Columns.esm.js.map +1 -1
- package/dist/components/SonarQubeTable/SonarQubeTable.esm.js.map +1 -1
- package/dist/components/SonarQubeTable/types.esm.js.map +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.esm.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/translation.esm.js.map +1 -1
- package/package.json +17 -17
- package/config.d.ts +0 -58
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @backstage-community/plugin-sonarqube
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 65ec51e: Backstage version bump to v1.50.2
|
|
8
|
+
- 70c356d: Backstage version bump to v1.54.5
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [65ec51e]
|
|
13
|
+
- Updated dependencies [70c356d]
|
|
14
|
+
- @backstage-community/plugin-sonarqube-react@1.2.0
|
|
15
|
+
|
|
16
|
+
## 1.1.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 188e3e6: Backstage version bump to v1.49.3
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [188e3e6]
|
|
25
|
+
- @backstage-community/plugin-sonarqube-react@1.1.0
|
|
26
|
+
|
|
3
27
|
## 1.0.0
|
|
4
28
|
|
|
5
29
|
### Major Changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"sonarqube": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"baseUrl": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The base url of the sonarqube installation. Defaults to https://sonarcloud.io.",
|
|
11
|
+
"visibility": "frontend"
|
|
12
|
+
},
|
|
13
|
+
"externalBaseUrl": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The external url of the sonarqube installation. Use this if you want to use a different url for the frontend than the backend.",
|
|
16
|
+
"visibility": "frontend"
|
|
17
|
+
},
|
|
18
|
+
"instances": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"name": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "The name of the sonarqube instance.",
|
|
26
|
+
"visibility": "frontend"
|
|
27
|
+
},
|
|
28
|
+
"baseUrl": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "The base url of the sonarqube instance.",
|
|
31
|
+
"visibility": "frontend"
|
|
32
|
+
},
|
|
33
|
+
"externalBaseUrl": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "The external url of the sonarqube instance. Use this if you want to use a different url for the frontend than the backend.",
|
|
36
|
+
"visibility": "frontend"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": [
|
|
40
|
+
"name",
|
|
41
|
+
"baseUrl"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"description": "The optional sonarqube instances.",
|
|
45
|
+
"visibility": "frontend"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"description": "Optional configurations for the SonarQube plugin"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
package/dist/alpha/apis.esm.js
CHANGED
|
@@ -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 {
|
|
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":";;;;;
|
|
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":";;;;;
|
|
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":";;;;
|
|
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,
|
|
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
|
-
|
|
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
|
|
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:
|
|
27
|
-
type: "content" | "
|
|
24
|
+
filter: _backstage_filter_predicates.FilterPredicate | undefined;
|
|
25
|
+
type: "content" | "info" | undefined;
|
|
28
26
|
};
|
|
29
27
|
configInput: {
|
|
30
|
-
filter?:
|
|
31
|
-
type?: "content" | "
|
|
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?:
|
|
44
|
-
type?: _backstage_plugin_catalog_react_alpha.EntityCardType
|
|
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:
|
|
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;
|
|
58
|
-
title?: string | undefined;
|
|
59
56
|
path?: string | undefined;
|
|
57
|
+
title?: string | undefined;
|
|
58
|
+
filter?: _backstage_filter_predicates.FilterPredicate | 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-
|
|
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:
|
|
75
|
+
defaultPath?: [Error: `Use the 'path' param instead`];
|
|
74
76
|
path: string;
|
|
75
|
-
defaultTitle?: [Error:
|
|
77
|
+
defaultTitle?: [Error: `Use the 'title' param instead`];
|
|
76
78
|
title: string;
|
|
77
|
-
defaultGroup?: [Error:
|
|
78
|
-
group?: (
|
|
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
|
|
81
|
-
filter?:
|
|
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 +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 { 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,
|
|
1
|
+
{"version":3,"file":"SonarQubeClient.esm.js","sources":["../../src/api/SonarQubeClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport {\n FindingSummary,\n Metrics,\n SonarQubeApi,\n} from '@backstage-community/plugin-sonarqube-react';\nimport { SummaryWrapper } from './types';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\n\n/** @public */\nexport class SonarQubeClient implements SonarQubeApi {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n private async callApi<T>(\n path: string,\n query: { [key in string]: string },\n ): Promise<T | undefined> {\n const response = await this.fetchApi.fetch(\n `${await this.discoveryApi.getBaseUrl(\n 'sonarqube',\n )}/${path}?${new URLSearchParams(query).toString()}`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.ok) {\n return (await response.json()) as T;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n private async fetchSummary(\n entity: Entity,\n ): Promise<FindingSummary | undefined> {\n const kind = entity.kind;\n const namespace = entity.metadata.namespace ?? 'default';\n const name = entity.metadata.name;\n const summary = await this.callApi<SummaryWrapper>(\n `entities/${encodeURIComponent(kind)}/${encodeURIComponent(\n namespace,\n )}/${encodeURIComponent(name)}/summary`,\n {},\n );\n\n if (!summary || !summary.findings) {\n return undefined;\n }\n\n const { componentKey, instanceUrl: rawUrl, findings } = summary;\n let baseUrl = rawUrl;\n if (!baseUrl.endsWith('/')) {\n baseUrl += '/';\n }\n\n const metrics: Metrics = {\n alert_status: undefined,\n bugs: undefined,\n reliability_rating: undefined,\n vulnerabilities: undefined,\n security_rating: undefined,\n security_hotspots_reviewed: undefined,\n security_review_rating: undefined,\n code_smells: undefined,\n sqale_rating: undefined,\n coverage: undefined,\n duplicated_lines_density: undefined,\n };\n\n findings.measures.forEach(m => {\n metrics[m.metric] = m.value;\n });\n\n return {\n title: componentKey,\n lastAnalysis: findings.analysisDate,\n metrics,\n projectUrl: `${baseUrl}dashboard?id=${encodeURIComponent(componentKey)}`,\n getIssuesUrl: identifier =>\n `${baseUrl}project/issues?id=${encodeURIComponent(\n componentKey,\n )}&types=${identifier.toLocaleUpperCase('en-US')}&resolved=false`,\n getComponentMeasuresUrl: identifier =>\n `${baseUrl}component_measures?id=${encodeURIComponent(\n componentKey,\n )}&metric=${identifier.toLocaleLowerCase(\n 'en-US',\n )}&resolved=false&view=list`,\n getSecurityHotspotsUrl: () =>\n `${baseUrl}${\n baseUrl === 'https://sonarcloud.io/' ? 'project/' : ''\n }security_hotspots?id=${encodeURIComponent(componentKey)}`,\n };\n }\n\n async getSummaries(\n entities: Entity[],\n ): Promise<(FindingSummary | undefined)[]> {\n if (entities.length === 0) {\n return [];\n }\n const results = await Promise.allSettled(\n entities.map(e => this.fetchSummary(e)),\n );\n return results.map(result =>\n result.status === 'fulfilled' ? result.value : undefined,\n );\n }\n}\n"],"names":[],"mappings":";;AA2BO,MAAM,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,QAAA,GAAW,MAAM,IAAA,CAAK,QAAA,CAAS,KAAA;AAAA,MACnC,CAAA,EAAG,MAAM,IAAA,CAAK,YAAA,CAAa,UAAA;AAAA,QACzB;AAAA,OACD,IAAI,IAAI,CAAA,CAAA,EAAI,IAAI,eAAA,CAAgB,KAAK,CAAA,CAAE,QAAA,EAAU,CAAA,CAAA;AAAA,MAClD;AAAA,QACE,OAAA,EAAS;AAAA,UACP,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AACA,IAAA,IAAI,SAAS,EAAA,EAAI;AACf,MAAA,OAAQ,MAAM,SAAS,IAAA,EAAK;AAAA,IAC9B;AACA,IAAA,MAAM,MAAM,aAAA,CAAc,YAAA,CAAa,QAAQ,CAAA;AAAA,EACjD;AAAA,EAEA,MAAc,aACZ,MAAA,EACqC;AACrC,IAAA,MAAM,OAAO,MAAA,CAAO,IAAA;AACpB,IAAA,MAAM,SAAA,GAAY,MAAA,CAAO,QAAA,CAAS,SAAA,IAAa,SAAA;AAC/C,IAAA,MAAM,IAAA,GAAO,OAAO,QAAA,CAAS,IAAA;AAC7B,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,OAAA;AAAA,MACzB,CAAA,SAAA,EAAY,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA,EAAI,kBAAA;AAAA,QACtC;AAAA,OACD,CAAA,CAAA,EAAI,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D,CAAA,OAAA,EAAU,UAAA,CAAW,iBAAA,CAAkB,OAAO,CAAC,CAAA,eAAA,CAAA;AAAA,MAClD,uBAAA,EAAyB,CAAA,UAAA,KACvB,CAAA,EAAG,OAAO,CAAA,sBAAA,EAAyB,kBAAA;AAAA,QACjC;AAAA,OACD,WAAW,UAAA,CAAW,iBAAA;AAAA,QACrB;AAAA,OACD,CAAA,yBAAA,CAAA;AAAA,MACH,sBAAA,EAAwB,MACtB,CAAA,EAAG,OAAO,CAAA,EACR,OAAA,KAAY,wBAAA,GAA2B,UAAA,GAAa,EACtD,CAAA,qBAAA,EAAwB,kBAAA,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;AAAA,IACZ,MAAQ,EAAA,CAAA;AAAA,IACR,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,UAAY,EAAA;AAAA,IACV,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,KAAM,CAAA;AAAA,GACvC;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA;AAAA,GACzC;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,eAAiB,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG;AAAA;AAE3C,CAAE,CAAA,CAAA;AAEW,MAAA,YAAA,GAAe,CAAC,KAA+B,KAAA;AAC1D,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,uBAAuB,CAAA;AAEvD,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA;AAClB,EAAI,IAAA,SAAA,GAAoB,EAAE,6CAA6C,CAAA;AACvE,EAAA,IAAI,YAAY,OAAQ,CAAA,YAAA;AACxB,EAAA,IAAI,eAAkB,GAAA,EAAA;AACtB,EAAI,IAAA,KAAA,EAAO,QAAQ,YAAc,EAAA;AAC/B,IAAM,MAAA,UAAA,GAAa,KAAO,EAAA,OAAA,CAAQ,YAAiB,KAAA,I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"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,CAAA,KAAA,MAAU;AAAA,EACrC,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,GAC9B;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,MAAA,EAAQ,CAAA;AAAA,IACR,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY;AAAA,IACV,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,KAAA,CAAM;AAAA,GACvC;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ;AAAA,GACzC;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,GAAG;AAAA;AAE3C,CAAA,CAAE,CAAA;AAEK,MAAM,YAAA,GAAe,CAAC,KAAA,KAA+B;AAC1D,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,uBAAuB,CAAA;AAEvD,EAAA,MAAM,EAAE,OAA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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,
|
|
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,
|
|
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;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,"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,
|
|
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 </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AA,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;;;;"}
|
|
@@ -6,7 +6,7 @@ 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 {
|
|
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
|
|
|
@@ -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 SONARQUBE_PROJECT_KEY_ANNOTATION,\n isSonarQubeAvailable,\n} from '@backstage-community/plugin-sonarqube-react';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n EmptyState,\n InfoCard,\n InfoCardVariants,\n Progress,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n BugReportRatingCard,\n CodeSmellsRatingCard,\n CoverageRatingCard,\n DuplicationsRatingCard,\n HotspotsReviewed,\n LastAnalyzedRatingCard,\n QualityBadge,\n VulnerabilitiesRatingCard,\n} from './MetricInsights';\nimport { DuplicationRating } from '../SonarQubeTable/types';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n action: {\n margin: 0,\n },\n lastAnalyzed: {\n color: theme.palette.text.secondary,\n },\n}));\n\n/** @public */\nexport const SonarQubeCard = (props: {\n variant?: InfoCardVariants;\n duplicationRatings?: DuplicationRating[];\n missingAnnotationReadMoreUrl?: string;\n}) => {\n const { variant = 'gridItem', missingAnnotationReadMoreUrl } = props;\n const { entity } = useEntity();\n const sonarQubeApi = useApi(sonarQubeApiRef);\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n\n const {\n value: summaryFinding,\n error,\n loading,\n } = useAsync(\n async () => sonarQubeApi.getSummaries([entity]).then(r => r[0]),\n [sonarQubeApi, entity],\n );\n\n const deepLink =\n !loading && summaryFinding?.metrics\n ? {\n title: t('sonarQubeCard.deepLinkTitle'),\n link: `${summaryFinding.projectUrl}&codeScope=overall`,\n }\n : undefined;\n\n const classes = useStyles();\n return (\n <InfoCard\n title={t('sonarQubeCard.title')}\n deepLink={deepLink}\n variant={variant}\n headerProps={{\n action: !loading && summaryFinding?.metrics && (\n <QualityBadge value={summaryFinding} />\n ),\n classes: {\n root: classes.header,\n action: classes.action,\n },\n }}\n >\n {loading && <Progress />}\n\n {!loading && !isSonarQubeAvailable(entity) && (\n <MissingAnnotationEmptyState\n annotation={SONARQUBE_PROJECT_KEY_ANNOTATION}\n readMoreUrl={missingAnnotationReadMoreUrl}\n />\n )}\n\n {!loading && error && <ErrorMessage error={error} />}\n\n {!loading && summaryFinding?.metrics && (\n <>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n style={{ height: '100%' }}\n spacing={0}\n >\n <Grid item container justifyContent=\"space-around\">\n <BugReportRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.bugReportRatingCardTitle')}\n />\n <VulnerabilitiesRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.vulnerabilitiesRatingCardTitle')}\n />\n <CodeSmellsRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.codeSmellsRatingCardTitle')}\n />\n <HotspotsReviewed\n value={summaryFinding}\n title={t('sonarQubeCard.hotspotsReviewedTitle')}\n />\n <div style={{ width: '100%' }} />\n <CoverageRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.coverageRatingCardTitle')}\n />\n <DuplicationsRatingCard\n value={summaryFinding}\n title={t('sonarQubeCard.duplicationsRatingCard')}\n />\n </Grid>\n <Grid item className={classes.lastAnalyzed}>\n <LastAnalyzedRatingCard value={summaryFinding} />\n </Grid>\n </Grid>\n </>\n )}\n </InfoCard>\n );\n};\n\nfunction ErrorMessage({ error }: { error: Error }) {\n const { t } = useTranslationRef(sonarqubeTranslationRef);\n const statusCode = isResponseError(error) ? error.statusCode : undefined;\n\n if (statusCode === 401) {\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.unauthorizedError.title')}\n description={t('sonarQubeCard.unauthorizedError.description')}\n />\n );\n }\n\n if (statusCode === 403) {\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.forbiddenError.title')}\n description={t('sonarQubeCard.forbiddenError.description')}\n />\n );\n }\n\n if (statusCode === 404) {\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.notFoundError.title')}\n description={t('sonarQubeCard.notFoundError.description')}\n />\n );\n }\n\n return (\n <EmptyState\n missing=\"info\"\n title={t('sonarQubeCard.emptyState.title')}\n description={\n error.cause instanceof Error ? error.cause.message : error.message\n }\n />\n );\n}\n\nfunction isResponseError(\n error: Error,\n): error is Error & { statusCode: number } {\n return 'statusCode' in error;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAiDA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,GAAG;AAAA,GACrC;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA;AAE9B,CAAE,CAAA,CAAA;AAGW,MAAA,aAAA,GAAgB,CAAC,KAIxB,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,GAAU,UAAY,EAAA,4BAAA,EAAiC,GAAA,KAAA;AAC/D,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,uBAAuB,CAAA;AAEvD,EAAM,MAAA;AAAA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A;AAAA,QACR,KAAA,EAAO,EAAE,mCAAmC,CAAA;AAAA,QAC5C,WAAA,EAAa,EAAE,yCAAyC;AAAA;AAAA,KAC1D;AAAA;AAIJ,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,KAAA,EAAO,EAAE,gCAAgC,CAAA;AAAA,MACzC,aACE,KAAM,CAAA,KAAA,YAAiB,QAAQ,KAAM,CAAA,KAAA,CAAM,UAAU,KAAM,CAAA;AAAA;AAAA,GAE/D;AAEJ;AAEA,SAAS,gBACP,KACyC,EAAA;AACzC,EAAA,OAAO,YAAgB,IAAA,KAAA;AACzB;;;;"}
|
|
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,C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GAAI,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,
|
|
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 +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":";;;;;;;;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SonarQubeRelatedEntitiesOverview.esm.js","sources":["../../../src/components/SonarQubeRelatedEntitiesOverview/SonarQubeRelatedEntitiesOverview.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/esm/useAsync';\nimport { useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n sonarQubeApiRef,\n 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":";;;;;;;;;;
|
|
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,g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AAY,mBAAmB,MAAM,CAAA;AAC3C,IAAA,OAAO;AAAA,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,IAA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K,QAAS,CAAA,QAAA,EAAU,OAAS,EAAA;AAAA,OAC3C;AAAA,MACA,MAAQ,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,K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["/*\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,
|
|
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,
|
|
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 {
|
|
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,
|
|
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
|
@@ -86,9 +86,9 @@ declare const SONARQUBE_PROJECT_KEY_ANNOTATION = "sonarqube.org/project-key";
|
|
|
86
86
|
declare const sonarQubePlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
|
|
87
87
|
/** @public */
|
|
88
88
|
declare const EntitySonarQubeCard: (props: {
|
|
89
|
-
variant?: _backstage_core_components.InfoCardVariants
|
|
90
|
-
duplicationRatings?: DuplicationRating[]
|
|
91
|
-
missingAnnotationReadMoreUrl?: string
|
|
89
|
+
variant?: _backstage_core_components.InfoCardVariants;
|
|
90
|
+
duplicationRatings?: DuplicationRating[];
|
|
91
|
+
missingAnnotationReadMoreUrl?: string;
|
|
92
92
|
}) => react_jsx_runtime.JSX.Element;
|
|
93
93
|
/** @public */
|
|
94
94
|
declare const EntitySonarQubeContentPage: (props: SonarQubeContentPageProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -99,6 +99,8 @@ declare const EntitySonarQubeContentPage: (props: SonarQubeContentPageProps) =>
|
|
|
99
99
|
declare const sonarqubeTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"sonarqube", {
|
|
100
100
|
readonly title: "SonarQube Dashboard";
|
|
101
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.";
|
|
102
104
|
readonly "sonarQubeCard.deepLinkTitle": "View more";
|
|
103
105
|
readonly "sonarQubeCard.bugReportRatingCardTitle": "Bugs";
|
|
104
106
|
readonly "sonarQubeCard.vulnerabilitiesRatingCardTitle": "Vulnerabilities";
|
|
@@ -107,8 +109,6 @@ declare const sonarqubeTranslationRef: _backstage_frontend_plugin_api.Translatio
|
|
|
107
109
|
readonly "sonarQubeCard.coverageRatingCardTitle": "Coverage";
|
|
108
110
|
readonly "sonarQubeCard.duplicationsRatingCard": "Duplications";
|
|
109
111
|
readonly "sonarQubeCard.qualityBadgeTooltip": "View SonarQube Dashboard";
|
|
110
|
-
readonly "sonarQubeCard.emptyState.title": "No information to display";
|
|
111
|
-
readonly "sonarQubeCard.emptyState.description": "There is no SonarQube project with key '{{ projectTitle }}', check that project exists and permissions.";
|
|
112
112
|
readonly "sonarQubeCard.unauthorizedError.title": "Unauthorized";
|
|
113
113
|
readonly "sonarQubeCard.unauthorizedError.description": "Your authentication token for SonarQube is missing or invalid. Please verify your SonarQube token configuration.";
|
|
114
114
|
readonly "sonarQubeCard.notFoundError.title": "SonarQube project not found";
|
package/dist/plugin.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SonarQubeClient } from './api/SonarQubeClient.esm.js';
|
|
2
|
-
import { createPlugin, createApiFactory,
|
|
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({
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -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,
|
|
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;;;;"}
|
|
@@ -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 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,
|
|
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": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"files": [
|
|
60
60
|
"dist",
|
|
61
61
|
"alpha",
|
|
62
|
-
"config.
|
|
62
|
+
"config.schema.json"
|
|
63
63
|
],
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "backstage-cli package build",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
"test": "backstage-cli package test"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@backstage-community/plugin-sonarqube-react": "^1.
|
|
75
|
-
"@backstage/catalog-model": "^1.
|
|
76
|
-
"@backstage/core-compat-api": "^0.5.
|
|
77
|
-
"@backstage/core-components": "^0.18.
|
|
78
|
-
"@backstage/core-plugin-api": "^1.12.
|
|
79
|
-
"@backstage/errors": "^1.
|
|
80
|
-
"@backstage/frontend-app-api": "^0.
|
|
81
|
-
"@backstage/frontend-plugin-api": "^0.
|
|
82
|
-
"@backstage/plugin-catalog-react": "^
|
|
74
|
+
"@backstage-community/plugin-sonarqube-react": "^1.2.0",
|
|
75
|
+
"@backstage/catalog-model": "^1.10.0",
|
|
76
|
+
"@backstage/core-compat-api": "^0.5.14",
|
|
77
|
+
"@backstage/core-components": "^0.18.13",
|
|
78
|
+
"@backstage/core-plugin-api": "^1.12.9",
|
|
79
|
+
"@backstage/errors": "^1.3.1",
|
|
80
|
+
"@backstage/frontend-app-api": "^0.16.7",
|
|
81
|
+
"@backstage/frontend-plugin-api": "^0.18.0",
|
|
82
|
+
"@backstage/plugin-catalog-react": "^3.2.2",
|
|
83
83
|
"@material-ui/core": "^4.12.2",
|
|
84
84
|
"@material-ui/icons": "^4.9.1",
|
|
85
85
|
"@material-ui/styles": "^4.10.0",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"react-use": "^17.2.4"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@backstage/cli": "^0.
|
|
94
|
-
"@backstage/core-app-api": "^1.
|
|
95
|
-
"@backstage/dev-utils": "^1.1.
|
|
96
|
-
"@backstage/frontend-test-utils": "^0.
|
|
97
|
-
"@backstage/test-utils": "^1.7.
|
|
93
|
+
"@backstage/cli": "^0.36.5",
|
|
94
|
+
"@backstage/core-app-api": "^1.20.4",
|
|
95
|
+
"@backstage/dev-utils": "^1.1.26",
|
|
96
|
+
"@backstage/frontend-test-utils": "^0.6.3",
|
|
97
|
+
"@backstage/test-utils": "^1.7.21",
|
|
98
98
|
"@testing-library/dom": "^10.0.0",
|
|
99
99
|
"@testing-library/jest-dom": "^6.0.0",
|
|
100
100
|
"@testing-library/react": "^15.0.0",
|
|
@@ -109,6 +109,6 @@
|
|
|
109
109
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
110
110
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
111
111
|
},
|
|
112
|
-
"configSchema": "config.
|
|
112
|
+
"configSchema": "config.schema.json",
|
|
113
113
|
"module": "./dist/index.esm.js"
|
|
114
114
|
}
|
package/config.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 The Backstage Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export interface Config {
|
|
18
|
-
/** Optional configurations for the SonarQube plugin */
|
|
19
|
-
sonarqube?: {
|
|
20
|
-
/**
|
|
21
|
-
* The base url of the sonarqube installation. Defaults to https://sonarcloud.io.
|
|
22
|
-
* @visibility frontend
|
|
23
|
-
*/
|
|
24
|
-
baseUrl?: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The external url of the sonarqube installation.
|
|
28
|
-
* Use this if you want to use a different url for the frontend than the backend.
|
|
29
|
-
* @visibility frontend
|
|
30
|
-
*/
|
|
31
|
-
externalBaseUrl?: string;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The optional sonarqube instances.
|
|
35
|
-
* @visibility frontend
|
|
36
|
-
*/
|
|
37
|
-
instances?: Array<{
|
|
38
|
-
/**
|
|
39
|
-
* The name of the sonarqube instance.
|
|
40
|
-
* @visibility frontend
|
|
41
|
-
*/
|
|
42
|
-
name: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The base url of the sonarqube instance.
|
|
46
|
-
* @visibility frontend
|
|
47
|
-
*/
|
|
48
|
-
baseUrl: string;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The external url of the sonarqube instance.
|
|
52
|
-
* Use this if you want to use a different url for the frontend than the backend.
|
|
53
|
-
* @visibility frontend
|
|
54
|
-
*/
|
|
55
|
-
externalBaseUrl?: string;
|
|
56
|
-
}>;
|
|
57
|
-
};
|
|
58
|
-
}
|