@backstage-community/plugin-sonarqube 0.11.2 → 0.12.1
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 +17 -0
- package/README.md +9 -4
- package/dist/alpha/entityCard.esm.js +2 -2
- package/dist/alpha/entityCard.esm.js.map +1 -1
- package/dist/alpha/entityContent.esm.js +2 -2
- package/dist/alpha/entityContent.esm.js.map +1 -1
- package/dist/api/SonarQubeClient.esm.js +1 -1
- package/dist/api/SonarQubeClient.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/MetricInsights.esm.js +40 -32
- package/dist/components/SonarQubeCard/MetricInsights.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/Percentage.esm.js +2 -2
- package/dist/components/SonarQubeCard/Percentage.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/Rating.esm.js +3 -2
- package/dist/components/SonarQubeCard/Rating.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/RatingCard.esm.js +12 -2
- package/dist/components/SonarQubeCard/RatingCard.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/SonarQubeCard.esm.js +84 -72
- package/dist/components/SonarQubeCard/SonarQubeCard.esm.js.map +1 -1
- package/dist/components/SonarQubeCard/Value.esm.js +2 -2
- package/dist/components/SonarQubeCard/Value.esm.js.map +1 -1
- package/dist/components/SonarQubeContentPage/SonarQubeContentPage.esm.js +10 -7
- package/dist/components/SonarQubeContentPage/SonarQubeContentPage.esm.js.map +1 -1
- package/dist/components/SonarQubeTable/Columns.esm.js +44 -38
- package/dist/components/SonarQubeTable/Columns.esm.js.map +1 -1
- package/dist/components/SonarQubeTable/SonarQubeTable.esm.js +16 -16
- package/dist/components/SonarQubeTable/SonarQubeTable.esm.js.map +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/index.d.ts +10 -11
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage-community/plugin-sonarqube
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f737a01: Fixed handling of wrong component keys in getFindingSummaries
|
|
8
|
+
|
|
9
|
+
## 0.12.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8be1894: Upgraded to Backstage release 1.38
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [8be1894]
|
|
18
|
+
- @backstage-community/plugin-sonarqube-react@0.6.0
|
|
19
|
+
|
|
3
20
|
## 0.11.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The SonarQube Plugin displays code statistics from [SonarCloud](https://sonarclo
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# From your Backstage root directory
|
|
13
|
-
yarn --cwd packages/app add @backstage-community/plugin-sonarqube
|
|
13
|
+
yarn --cwd packages/app add @backstage-community/plugin-sonarqube @backstage-community/plugin-sonarqube-react
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
2. Add the `EntitySonarQubeCard` to the EntityPage:
|
|
@@ -18,6 +18,7 @@ yarn --cwd packages/app add @backstage-community/plugin-sonarqube
|
|
|
18
18
|
```diff
|
|
19
19
|
// packages/app/src/components/catalog/EntityPage.tsx
|
|
20
20
|
+ import { EntitySonarQubeCard } from '@backstage-community/plugin-sonarqube';
|
|
21
|
+
+ import { isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';
|
|
21
22
|
|
|
22
23
|
...
|
|
23
24
|
|
|
@@ -26,9 +27,13 @@ yarn --cwd packages/app add @backstage-community/plugin-sonarqube
|
|
|
26
27
|
<Grid item md={6}>
|
|
27
28
|
<EntityAboutCard variant="gridItem" />
|
|
28
29
|
</Grid>
|
|
29
|
-
+ <
|
|
30
|
-
+ <
|
|
31
|
-
+
|
|
30
|
+
+ <EntitySwitch>
|
|
31
|
+
+ <EntitySwitch.Case if={isSonarQubeAvailable}>
|
|
32
|
+
+ <Grid item md={6}>
|
|
33
|
+
+ <EntitySonarQubeCard variant="gridItem" />
|
|
34
|
+
+ </Grid>
|
|
35
|
+
+ </EntitySwitch.Case>
|
|
36
|
+
+ </EntitySwitch>
|
|
32
37
|
</Grid>
|
|
33
38
|
);
|
|
34
39
|
```
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { compatWrapper } from '@backstage/core-compat-api';
|
|
2
3
|
import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
3
4
|
import { isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';
|
|
4
|
-
import React from 'react';
|
|
5
5
|
|
|
6
6
|
const entitySonarQubeCard = EntityCardBlueprint.make({
|
|
7
7
|
name: "card",
|
|
8
8
|
params: {
|
|
9
9
|
filter: isSonarQubeAvailable,
|
|
10
10
|
loader: () => import('../components/SonarQubeCard/index.esm.js').then(
|
|
11
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
11
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.SonarQubeCard, {}))
|
|
12
12
|
)
|
|
13
13
|
}
|
|
14
14
|
});
|
|
@@ -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';\
|
|
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: any = EntityCardBlueprint.make({\n name: 'card',\n params: {\n filter: isSonarQubeAvailable,\n loader: () =>\n import('../components/SonarQubeCard').then(m =>\n compatWrapper(<m.SonarQubeCard />),\n ),\n },\n});\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,mBAAA,GAA2B,oBAAoB,IAAK,CAAA;AAAA,EAC/D,IAAM,EAAA,MAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,oBAAA;AAAA,IACR,MAAQ,EAAA,MACN,OAAO,0CAA6B,CAAE,CAAA,IAAA;AAAA,MAAK,OACzC,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,aAAA,EAAF,EAAgB,CAAE;AAAA;AACnC;AAEN,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
3
3
|
import { isSonarQubeAvailable } from '@backstage-community/plugin-sonarqube-react';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ const entitySonarQubeContent = EntityContentBlueprint.make({
|
|
|
8
8
|
defaultPath: "sonarqube",
|
|
9
9
|
defaultTitle: "SonarQube",
|
|
10
10
|
filter: isSonarQubeAvailable,
|
|
11
|
-
loader: () => import('../components/SonarQubeContentPage/index.esm.js').then((m) => /* @__PURE__ */
|
|
11
|
+
loader: () => import('../components/SonarQubeContentPage/index.esm.js').then((m) => /* @__PURE__ */ jsx(m.SonarQubeContentPage, {}))
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -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
|
|
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 defaultPath: 'sonarqube',\n defaultTitle: 'SonarQube',\n filter: isSonarQubeAvailable,\n loader: () =>\n import('../components/SonarQubeContentPage').then(m => (\n <m.SonarQubeContentPage />\n )),\n },\n});\n"],"names":[],"mappings":";;;;AAqBa,MAAA,sBAAA,GAAyB,uBAAuB,IAAK,CAAA;AAAA,EAChE,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,WAAA;AAAA,IACb,YAAc,EAAA,WAAA;AAAA,IACd,MAAQ,EAAA,oBAAA;AAAA,IACR,MAAA,EAAQ,MACN,OAAO,iDAAoC,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,qBAC/C,GAAA,CAAA,CAAA,CAAE,oBAAF,EAAA,EAAuB,CACzB;AAAA;AAEP,CAAC;;;;"}
|
|
@@ -98,7 +98,7 @@ class SonarQubeClient {
|
|
|
98
98
|
return results.map((result) => result).map((result) => result.value);
|
|
99
99
|
});
|
|
100
100
|
for await (const summary of summaries) {
|
|
101
|
-
if (!map.has(summary.title)) {
|
|
101
|
+
if (summary?.title && !map.has(summary.title)) {
|
|
102
102
|
map.set(summary.title, summary);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SonarQubeClient.esm.js","sources":["../../src/api/SonarQubeClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FindingSummary,\n Metrics,\n SonarQubeApi,\n} from '@backstage-community/plugin-sonarqube-react';\nimport { InstanceUrlWrapper, FindingsWrapper } from './types';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\n\n/** @public */\nexport class SonarQubeClient implements SonarQubeApi {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n private async callApi<T>(\n path: string,\n query: { [key in string]: any },\n ): Promise<T | undefined> {\n const response = await this.fetchApi.fetch(\n `${await this.discoveryApi.getBaseUrl(\n 'sonarqube',\n )}/${path}?${new URLSearchParams(query).toString()}`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.status === 200) {\n return (await response.json()) as T;\n }\n return undefined;\n }\n\n async getFindingSummary({\n componentKey,\n projectInstance,\n }: {\n componentKey?: string;\n projectInstance?: string;\n } = {}): Promise<FindingSummary | undefined> {\n if (!componentKey) {\n return undefined;\n }\n\n const instanceKey = projectInstance || '';\n\n const metrics: Metrics = {\n alert_status: undefined,\n bugs: undefined,\n reliability_rating: undefined,\n vulnerabilities: undefined,\n security_rating: undefined,\n security_hotspots_reviewed: undefined,\n security_review_rating: undefined,\n code_smells: undefined,\n sqale_rating: undefined,\n coverage: undefined,\n duplicated_lines_density: undefined,\n };\n\n const baseUrlWrapper = await this.callApi<InstanceUrlWrapper>(\n 'instanceUrl',\n {\n instanceKey,\n },\n );\n let baseUrl = baseUrlWrapper?.instanceUrl;\n if (!baseUrl) {\n return undefined;\n }\n // ensure trailing slash for later on\n if (!baseUrl.endsWith('/')) {\n baseUrl += '/';\n }\n\n const findings = await this.callApi<FindingsWrapper>('findings', {\n componentKey,\n instanceKey,\n });\n if (!findings) {\n return undefined;\n }\n\n findings.measures.forEach(m => {\n metrics[m.metric] = m.value;\n });\n\n return {\n title: componentKey,\n lastAnalysis: findings.analysisDate,\n metrics,\n projectUrl: `${baseUrl}dashboard?id=${encodeURIComponent(componentKey)}`,\n getIssuesUrl: identifier =>\n `${baseUrl}project/issues?id=${encodeURIComponent(\n componentKey,\n )}&types=${identifier.toLocaleUpperCase('en-US')}&resolved=false`,\n getComponentMeasuresUrl: identifier =>\n `${baseUrl}component_measures?id=${encodeURIComponent(\n componentKey,\n )}&metric=${identifier.toLocaleLowerCase(\n 'en-US',\n )}&resolved=false&view=list`,\n getSecurityHotspotsUrl: () =>\n `${baseUrl}${\n baseUrl === 'https://sonarcloud.io/' ? 'project/' : ''\n }security_hotspots?id=${encodeURIComponent(componentKey)}`,\n };\n }\n settledResponseOf(responses: PromiseSettledResult<any>[]): Array<any> {\n return responses.map(response =>\n response.status === 'fulfilled' ? response.value : null,\n );\n }\n\n async getFindingSummaries(\n components: Array<{\n projectInstance: string | undefined;\n componentKey: string;\n }>,\n ): Promise<Map<string, FindingSummary>> {\n const map = new Map<string, FindingSummary>();\n if (components.length === 0) {\n return map;\n }\n const promises = components.map(({ projectInstance, componentKey }) =>\n this.getFindingSummary({ componentKey, projectInstance }),\n );\n const summaries: any = await Promise.allSettled(promises).then(results => {\n return results\n .map(result => result as PromiseFulfilledResult<FindingSummary>)\n .map(result => result.value);\n });\n\n for await (const summary of summaries) {\n if (!map.has(summary.title)) {\n map.set(summary.title, summary);\n }\n }\n return map;\n }\n}\n"],"names":[],"mappings":"AAyBO,MAAM,eAAwC,CAAA;AAAA,EACnD,YAAA;AAAA,EACA,QAAA;AAAA,EAEA,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA;AAAA;AAC1B,EAEA,MAAc,OACZ,CAAA,IAAA,EACA,KACwB,EAAA;AACxB,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MACnC,CAAA,EAAG,MAAM,IAAA,CAAK,YAAa,CAAA,UAAA;AAAA,QACzB;AAAA,OACD,IAAI,IAAI,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,MAAW,KAAA,WAAA,GAAc,SAAS,KAAQ,GAAA;AAAA,KACrD;AAAA;AACF,EAEA,MAAM,oBACJ,UAIsC,EAAA;AACtC,IAAM,MAAA,GAAA,uBAAU,GAA4B,EAAA;AAC5C,IAAI,IAAA,UAAA,CAAW,WAAW,CAAG,EAAA;AAC3B,MAAO,OAAA,GAAA;AAAA;AAET,IAAA,MAAM,WAAW,UAAW,CAAA,GAAA;AAAA,MAAI,CAAC,EAAE,eAAA,EAAiB,YAAa,EAAA,KAC/D,KAAK,iBAAkB,CAAA,EAAE,YAAc,EAAA,eAAA,EAAiB;AAAA,KAC1D;AACA,IAAA,MAAM,YAAiB,MAAM,OAAA,CAAQ,WAAW,QAAQ,CAAA,CAAE,KAAK,CAAW,OAAA,KAAA;AACxE,MAAO,OAAA,OAAA,CACJ,IAAI,CAAU,MAAA,KAAA,MAAgD,EAC9D,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,KAAK,CAAA;AAAA,KAC9B,CAAA;AAED,IAAA,WAAA,MAAiB,WAAW,SAAW,EAAA;AACrC,MAAA,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"SonarQubeClient.esm.js","sources":["../../src/api/SonarQubeClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FindingSummary,\n Metrics,\n SonarQubeApi,\n} from '@backstage-community/plugin-sonarqube-react';\nimport { InstanceUrlWrapper, FindingsWrapper } from './types';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\n\n/** @public */\nexport class SonarQubeClient implements SonarQubeApi {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n private async callApi<T>(\n path: string,\n query: { [key in string]: any },\n ): Promise<T | undefined> {\n const response = await this.fetchApi.fetch(\n `${await this.discoveryApi.getBaseUrl(\n 'sonarqube',\n )}/${path}?${new URLSearchParams(query).toString()}`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.status === 200) {\n return (await response.json()) as T;\n }\n return undefined;\n }\n\n async getFindingSummary({\n componentKey,\n projectInstance,\n }: {\n componentKey?: string;\n projectInstance?: string;\n } = {}): Promise<FindingSummary | undefined> {\n if (!componentKey) {\n return undefined;\n }\n\n const instanceKey = projectInstance || '';\n\n const metrics: Metrics = {\n alert_status: undefined,\n bugs: undefined,\n reliability_rating: undefined,\n vulnerabilities: undefined,\n security_rating: undefined,\n security_hotspots_reviewed: undefined,\n security_review_rating: undefined,\n code_smells: undefined,\n sqale_rating: undefined,\n coverage: undefined,\n duplicated_lines_density: undefined,\n };\n\n const baseUrlWrapper = await this.callApi<InstanceUrlWrapper>(\n 'instanceUrl',\n {\n instanceKey,\n },\n );\n let baseUrl = baseUrlWrapper?.instanceUrl;\n if (!baseUrl) {\n return undefined;\n }\n // ensure trailing slash for later on\n if (!baseUrl.endsWith('/')) {\n baseUrl += '/';\n }\n\n const findings = await this.callApi<FindingsWrapper>('findings', {\n componentKey,\n instanceKey,\n });\n if (!findings) {\n return undefined;\n }\n\n findings.measures.forEach(m => {\n metrics[m.metric] = m.value;\n });\n\n return {\n title: componentKey,\n lastAnalysis: findings.analysisDate,\n metrics,\n projectUrl: `${baseUrl}dashboard?id=${encodeURIComponent(componentKey)}`,\n getIssuesUrl: identifier =>\n `${baseUrl}project/issues?id=${encodeURIComponent(\n componentKey,\n )}&types=${identifier.toLocaleUpperCase('en-US')}&resolved=false`,\n getComponentMeasuresUrl: identifier =>\n `${baseUrl}component_measures?id=${encodeURIComponent(\n componentKey,\n )}&metric=${identifier.toLocaleLowerCase(\n 'en-US',\n )}&resolved=false&view=list`,\n getSecurityHotspotsUrl: () =>\n `${baseUrl}${\n baseUrl === 'https://sonarcloud.io/' ? 'project/' : ''\n }security_hotspots?id=${encodeURIComponent(componentKey)}`,\n };\n }\n settledResponseOf(responses: PromiseSettledResult<any>[]): Array<any> {\n return responses.map(response =>\n response.status === 'fulfilled' ? response.value : null,\n );\n }\n\n async getFindingSummaries(\n components: Array<{\n projectInstance: string | undefined;\n componentKey: string;\n }>,\n ): Promise<Map<string, FindingSummary>> {\n const map = new Map<string, FindingSummary>();\n if (components.length === 0) {\n return map;\n }\n const promises = components.map(({ projectInstance, componentKey }) =>\n this.getFindingSummary({ componentKey, projectInstance }),\n );\n const summaries: any = await Promise.allSettled(promises).then(results => {\n return results\n .map(result => result as PromiseFulfilledResult<FindingSummary>)\n .map(result => result.value);\n });\n\n for await (const summary of summaries) {\n if (summary?.title && !map.has(summary.title)) {\n map.set(summary.title, summary);\n }\n }\n return map;\n }\n}\n"],"names":[],"mappings":"AAyBO,MAAM,eAAwC,CAAA;AAAA,EACnD,YAAA;AAAA,EACA,QAAA;AAAA,EAEA,YAAY,OAA6D,EAAA;AACvE,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA;AAAA;AAC1B,EAEA,MAAc,OACZ,CAAA,IAAA,EACA,KACwB,EAAA;AACxB,IAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,QAAS,CAAA,KAAA;AAAA,MACnC,CAAA,EAAG,MAAM,IAAA,CAAK,YAAa,CAAA,UAAA;AAAA,QACzB;AAAA,OACD,IAAI,IAAI,CAAA,CAAA,EAAI,IAAI,eAAgB,CAAA,KAAK,CAAE,CAAA,QAAA,EAAU,CAAA,CAAA;AAAA,MAClD;AAAA,QACE,OAAS,EA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,MAAA,GAAA,uBAAU,GAA4B,EAAA;AAC5C,IAAI,IAAA,UAAA,CAAW,WAAW,CAAG,EAAA;AAC3B,MAAO,OAAA,GAAA;AAAA;AAET,IAAA,MAAM,WAAW,UAAW,CAAA,GAAA;AAAA,MAAI,CAAC,EAAE,eAAA,EAAiB,YAAa,EAAA,KAC/D,KAAK,iBAAkB,CAAA,EAAE,YAAc,EAAA,eAAA,EAAiB;AAAA,KAC1D;AACA,IAAA,MAAM,YAAiB,MAAM,OAAA,CAAQ,WAAW,QAAQ,CAAA,CAAE,KAAK,CAAW,OAAA,KAAA;AACxE,MAAO,OAAA,OAAA,CACJ,IAAI,CAAU,MAAA,KAAA,MAAgD,EAC9D,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,KAAK,CAAA;AAAA,KAC9B,CAAA;AAED,IAAA,WAAA,MAAiB,WAAW,SAAW,EAAA;AACrC,MAAA,IAAI,SAAS,KAAS,IAAA,CAAC,IAAI,GAAI,CAAA,OAAA,CAAQ,KAAK,CAAG,EAAA;AAC7C,QAAI,GAAA,CAAA,GAAA,CAAI,OAAQ,CAAA,KAAA,EAAO,OAAO,CAAA;AAAA;AAChC;AAEF,IAAO,OAAA,GAAA;AAAA;AAEX;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import Chip from '@material-ui/core/Chip';
|
|
3
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
5
|
import { defaultDuplicationRatings } from '../SonarQubeTable/types.esm.js';
|
|
@@ -51,7 +52,7 @@ const QualityBadge = (props) => {
|
|
|
51
52
|
clickable: true
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
const qualityBadge = /* @__PURE__ */
|
|
55
|
+
const qualityBadge = /* @__PURE__ */ jsx(
|
|
55
56
|
Chip,
|
|
56
57
|
{
|
|
57
58
|
label: gateLabel,
|
|
@@ -63,70 +64,70 @@ const QualityBadge = (props) => {
|
|
|
63
64
|
};
|
|
64
65
|
const BugReportRatingCard = (props) => {
|
|
65
66
|
const { value, title } = props;
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
67
68
|
RatingCard,
|
|
68
69
|
{
|
|
69
|
-
titleIcon: /* @__PURE__ */
|
|
70
|
+
titleIcon: /* @__PURE__ */ jsx(BugReport, {}),
|
|
70
71
|
title,
|
|
71
72
|
link: value.getIssuesUrl("BUG"),
|
|
72
|
-
leftSlot: /* @__PURE__ */
|
|
73
|
-
rightSlot: /* @__PURE__ */
|
|
73
|
+
leftSlot: /* @__PURE__ */ jsx(Value, { value: value.metrics.bugs }),
|
|
74
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.reliability_rating })
|
|
74
75
|
}
|
|
75
76
|
);
|
|
76
77
|
};
|
|
77
78
|
const VulnerabilitiesRatingCard = (props) => {
|
|
78
79
|
const { value, title } = props;
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
80
81
|
RatingCard,
|
|
81
82
|
{
|
|
82
|
-
titleIcon: value.metrics.vulnerabilities === "0" ? /* @__PURE__ */
|
|
83
|
+
titleIcon: value.metrics.vulnerabilities === "0" ? /* @__PURE__ */ jsx(Lock, {}) : /* @__PURE__ */ jsx(LockOpen, {}),
|
|
83
84
|
title,
|
|
84
85
|
link: value.getIssuesUrl("VULNERABILITY"),
|
|
85
|
-
leftSlot: /* @__PURE__ */
|
|
86
|
-
rightSlot: /* @__PURE__ */
|
|
86
|
+
leftSlot: /* @__PURE__ */ jsx(Value, { value: value.metrics.vulnerabilities }),
|
|
87
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.security_rating })
|
|
87
88
|
}
|
|
88
89
|
);
|
|
89
90
|
};
|
|
90
91
|
const CodeSmellsRatingCard = (props) => {
|
|
91
92
|
const { value, title } = props;
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ jsx(
|
|
93
94
|
RatingCard,
|
|
94
95
|
{
|
|
95
|
-
titleIcon: value.metrics.code_smells === "0" ? /* @__PURE__ */
|
|
96
|
+
titleIcon: value.metrics.code_smells === "0" ? /* @__PURE__ */ jsx(SentimentVerySatisfied, {}) : /* @__PURE__ */ jsx(SentimentVeryDissatisfied, {}),
|
|
96
97
|
title,
|
|
97
98
|
link: value.getIssuesUrl("CODE_SMELL"),
|
|
98
|
-
leftSlot: /* @__PURE__ */
|
|
99
|
-
rightSlot: /* @__PURE__ */
|
|
99
|
+
leftSlot: /* @__PURE__ */ jsx(Value, { value: value.metrics.code_smells }),
|
|
100
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.sqale_rating })
|
|
100
101
|
}
|
|
101
102
|
);
|
|
102
103
|
};
|
|
103
104
|
const HotspotsReviewed = (props) => {
|
|
104
105
|
const { value, title } = props;
|
|
105
|
-
return value.metrics.security_review_rating && /* @__PURE__ */
|
|
106
|
+
return value.metrics.security_review_rating && /* @__PURE__ */ jsx(
|
|
106
107
|
RatingCard,
|
|
107
108
|
{
|
|
108
|
-
titleIcon: /* @__PURE__ */
|
|
109
|
+
titleIcon: /* @__PURE__ */ jsx(Security, {}),
|
|
109
110
|
title,
|
|
110
111
|
link: value.getSecurityHotspotsUrl(),
|
|
111
|
-
leftSlot: /* @__PURE__ */
|
|
112
|
+
leftSlot: /* @__PURE__ */ jsx(
|
|
112
113
|
Value,
|
|
113
114
|
{
|
|
114
115
|
value: value.metrics.security_hotspots_reviewed ? `${value.metrics.security_hotspots_reviewed}%` : "\u2014"
|
|
115
116
|
}
|
|
116
117
|
),
|
|
117
|
-
rightSlot: /* @__PURE__ */
|
|
118
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.security_review_rating })
|
|
118
119
|
}
|
|
119
120
|
);
|
|
120
121
|
};
|
|
121
122
|
const CoverageRatingCard = (props) => {
|
|
122
123
|
const { value, title } = props;
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
124
125
|
RatingCard,
|
|
125
126
|
{
|
|
126
127
|
link: value.getComponentMeasuresUrl("COVERAGE"),
|
|
127
128
|
title,
|
|
128
|
-
leftSlot: /* @__PURE__ */
|
|
129
|
-
rightSlot: /* @__PURE__ */
|
|
129
|
+
leftSlot: /* @__PURE__ */ jsx(Percentage, { value: value.metrics.coverage }),
|
|
130
|
+
rightSlot: /* @__PURE__ */ jsx(
|
|
130
131
|
Value,
|
|
131
132
|
{
|
|
132
133
|
value: value.metrics.coverage ? `${value.metrics.coverage}%` : "\u2014"
|
|
@@ -149,30 +150,37 @@ const DuplicationsRatingCard = (props) => {
|
|
|
149
150
|
}
|
|
150
151
|
return rating;
|
|
151
152
|
}, [value]);
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ jsx(
|
|
153
154
|
RatingCard,
|
|
154
155
|
{
|
|
155
156
|
title,
|
|
156
157
|
link: value.getComponentMeasuresUrl("DUPLICATED_LINES_DENSITY"),
|
|
157
|
-
leftSlot: /* @__PURE__ */
|
|
158
|
-
rightSlot: /* @__PURE__ */
|
|
158
|
+
leftSlot: /* @__PURE__ */ jsx(Rating, { rating: duplicationRating, hideValue: true }),
|
|
159
|
+
rightSlot: /* @__PURE__ */ jsx(Value, { value: `${value.metrics.duplicated_lines_density}%` })
|
|
159
160
|
}
|
|
160
161
|
);
|
|
161
162
|
};
|
|
162
163
|
const LastAnalyzedRatingCard = (props) => {
|
|
163
164
|
const { value } = props;
|
|
164
|
-
return /* @__PURE__ */
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
166
|
+
"Last analyzed on",
|
|
167
|
+
" ",
|
|
168
|
+
DateTime.fromISO(value.lastAnalysis).toLocaleString(
|
|
169
|
+
DateTime.DATETIME_MED
|
|
170
|
+
)
|
|
171
|
+
] });
|
|
167
172
|
};
|
|
168
173
|
const NoSonarQubeCard = (props) => {
|
|
169
174
|
const { value, sonarQubeComponentKey } = props;
|
|
170
175
|
const { t } = useTranslationRef(sonarqubeTranslationRef);
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
return /* @__PURE__ */ jsxs(Typography, { color: "error", variant: "subtitle2", children: [
|
|
177
|
+
value?.isSonarQubeAnnotationEnabled && t("sonarQubeCard.noSonarQubeError.hasAnnotation", {
|
|
178
|
+
project: sonarQubeComponentKey || ""
|
|
179
|
+
}),
|
|
180
|
+
!value?.isSonarQubeAnnotationEnabled && t("sonarQubeCard.noSonarQubeError.noAnnotation", {
|
|
181
|
+
name: value?.name
|
|
182
|
+
})
|
|
183
|
+
] });
|
|
176
184
|
};
|
|
177
185
|
|
|
178
186
|
export { BugReportRatingCard, CodeSmellsRatingCard, CoverageRatingCard, DuplicationsRatingCard, HotspotsReviewed, LastAnalyzedRatingCard, NoSonarQubeCard, QualityBadge, VulnerabilitiesRatingCard };
|
|
@@ -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 React from 'react';\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';\n\ntype MetricInsightsProps = {\n value: FindingSummary | any;\n title?: string;\n sonarQubeComponentKey?: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n badgeLabel: {\n color: theme.palette.common.white,\n },\n badgeError: {\n margin: 0,\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 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 clickableAttrs = {\n component: 'a',\n href: value.projectUrl,\n clickable: true,\n };\n }\n const qualityBadge = (\n <Chip\n label={gateLabel}\n {...clickableAttrs}\n classes={{ root: gateColor, label: classes.badgeLabel }}\n />\n );\n return qualityBadge;\n};\n\nexport const BugReportRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n titleIcon={<BugReport />}\n title={title}\n link={value.getIssuesUrl('BUG')}\n leftSlot={<Value value={value.metrics.bugs} />}\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 titleIcon={\n value.metrics.vulnerabilities === '0' ? <Lock /> : <LockOpen />\n }\n title={title}\n link={value.getIssuesUrl('VULNERABILITY')}\n leftSlot={<Value value={value.metrics.vulnerabilities} />}\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 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={<Value value={value.metrics.code_smells} />}\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 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 />\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 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 />\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 title={title}\n link={value.getComponentMeasuresUrl('DUPLICATED_LINES_DENSITY')}\n leftSlot={<Rating rating={duplicationRating} hideValue />}\n rightSlot={<Value value={`${value.metrics.duplicated_lines_density}%`} />}\n />\n );\n};\n\nexport const LastAnalyzedRatingCard = (props: MetricInsightsProps) => {\n const { value } = props;\n return (\n <div>\n Last analyzed on{' '}\n {DateTime.fromISO(value.lastAnalysis).toLocaleString(\n DateTime.DATETIME_MED,\n )}\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=\"error\" variant=\"subtitle2\">\n {value?.isSonarQubeAnnotationEnabled &&\n t('sonarQubeCard.noSonarQubeError.hasAnnotation', {\n project: sonarQubeComponentKey || '',\n })}\n {!value?.isSonarQubeAnnotationEnabled &&\n t('sonarQubeCard.noSonarQubeError.noAnnotation', {\n name: value?.name,\n })}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA0CA,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,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,CAAA;AAAA,IACR,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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B,CAAA;AAAA,MAC9D,0BAAW,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,MAAQ,EAAA,iBAAA,EAAmB,WAAS,IAAC,EAAA,CAAA;AAAA,MACvD,SAAA,sCAAY,KAAM,EAAA,EAAA,KAAA,EAAO,GAAG,KAAM,CAAA,OAAA,CAAQ,wBAAwB,CAAK,CAAA,CAAA,EAAA;AAAA;AAAA,GACzE;AAEJ;AAEa,MAAA,sBAAA,GAAyB,CAAC,KAA+B,KAAA;AACpE,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA;AAClB,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,aAAI,kBACc,EAAA,GAAA,EAChB,SAAS,OAAQ,CAAA,KAAA,CAAM,YAAY,CAAE,CAAA,cAAA;AAAA,IACpC,QAAS,CAAA;AAAA,GAEb,CAAA;AAEJ;AAEa,MAAA,eAAA,GAAkB,CAAC,KAA+B,KAAA;AAC7D,EAAM,MAAA,EAAE,KAAO,EAAA,qBAAA,EAA0B,GAAA,KAAA;AACzC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,uBAAuB,CAAA;AACvD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAM,EAAA,OAAA,EAAQ,SAAQ,WAC/B,EAAA,EAAA,KAAA,EAAO,4BACN,IAAA,CAAA,CAAE,8CAAgD,EAAA;AAAA,IAChD,SAAS,qBAAyB,IAAA;AAAA,GACnC,CACF,EAAA,CAAC,KAAO,EAAA,4BAAA,IACP,EAAE,6CAA+C,EAAA;AAAA,IAC/C,MAAM,KAAO,EAAA;AAAA,GACd,CACL,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"MetricInsights.esm.js","sources":["../../../src/components/SonarQubeCard/MetricInsights.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useMemo } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { defaultDuplicationRatings } from '../SonarQubeTable/types';\nimport BugReport from '@material-ui/icons/BugReport';\nimport Lock from '@material-ui/icons/Lock';\nimport Typography from '@material-ui/core/Typography';\nimport LockOpen from '@material-ui/icons/LockOpen';\nimport SentimentVeryDissatisfied from '@material-ui/icons/SentimentVeryDissatisfied';\nimport SentimentVerySatisfied from '@material-ui/icons/SentimentVerySatisfied';\nimport Security from '@material-ui/icons/Security';\nimport { DateTime } from 'luxon';\nimport { Percentage } from './Percentage';\nimport { Rating } from './Rating';\nimport { RatingCard } from './RatingCard';\nimport { Value } from './Value';\nimport { FindingSummary } from '@backstage-community/plugin-sonarqube-react';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { sonarqubeTranslationRef } from '../../translation';\n\ntype MetricInsightsProps = {\n value: FindingSummary | any;\n title?: string;\n sonarQubeComponentKey?: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n badgeLabel: {\n color: theme.palette.common.white,\n },\n badgeError: {\n margin: 0,\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 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 clickableAttrs = {\n component: 'a',\n href: value.projectUrl,\n clickable: true,\n };\n }\n const qualityBadge = (\n <Chip\n label={gateLabel}\n {...clickableAttrs}\n classes={{ root: gateColor, label: classes.badgeLabel }}\n />\n );\n return qualityBadge;\n};\n\nexport const BugReportRatingCard = (props: MetricInsightsProps) => {\n const { value, title } = props;\n return (\n <RatingCard\n titleIcon={<BugReport />}\n title={title}\n link={value.getIssuesUrl('BUG')}\n leftSlot={<Value value={value.metrics.bugs} />}\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 titleIcon={\n value.metrics.vulnerabilities === '0' ? <Lock /> : <LockOpen />\n }\n title={title}\n link={value.getIssuesUrl('VULNERABILITY')}\n leftSlot={<Value value={value.metrics.vulnerabilities} />}\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 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={<Value value={value.metrics.code_smells} />}\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 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 />\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 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 />\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 title={title}\n link={value.getComponentMeasuresUrl('DUPLICATED_LINES_DENSITY')}\n leftSlot={<Rating rating={duplicationRating} hideValue />}\n rightSlot={<Value value={`${value.metrics.duplicated_lines_density}%`} />}\n />\n );\n};\n\nexport const LastAnalyzedRatingCard = (props: MetricInsightsProps) => {\n const { value } = props;\n return (\n <div>\n Last analyzed on{' '}\n {DateTime.fromISO(value.lastAnalysis).toLocaleString(\n DateTime.DATETIME_MED,\n )}\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=\"error\" variant=\"subtitle2\">\n {value?.isSonarQubeAnnotationEnabled &&\n t('sonarQubeCard.noSonarQubeError.hasAnnotation', {\n project: sonarQubeComponentKey || '',\n })}\n {!value?.isSonarQubeAnnotationEnabled &&\n t('sonarQubeCard.noSonarQubeError.noAnnotation', {\n name: value?.name,\n })}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,UAAY,EAAA;AAA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
|
1
2
|
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
2
3
|
import { Circle } from 'rc-progress';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
|
|
5
5
|
const useStyles = makeStyles((theme) => ({
|
|
6
6
|
root: {
|
|
@@ -11,7 +11,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
11
11
|
const Percentage = ({ value }) => {
|
|
12
12
|
const classes = useStyles();
|
|
13
13
|
const theme = useTheme();
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
15
|
Circle,
|
|
16
16
|
{
|
|
17
17
|
strokeLinecap: "butt",
|
|
@@ -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';\
|
|
1
|
+
{"version":3,"file":"Percentage.esm.js","sources":["../../../src/components/SonarQubeCard/Percentage.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useTheme } from '@material-ui/core/styles';\nimport { Circle } from 'rc-progress';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n height: theme.spacing(3),\n width: theme.spacing(3),\n },\n}));\n\nexport const Percentage = ({ value }: { value?: string }) => {\n const classes = useStyles();\n const theme = useTheme();\n\n return (\n <Circle\n strokeLinecap=\"butt\"\n percent={+(value || 0)}\n strokeWidth={16}\n strokeColor={theme.palette.status.ok}\n trailColor={theme.palette.status.error}\n trailWidth={16}\n className={classes.root}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAoBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACvB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAE1B,CAAE,CAAA,CAAA;AAEK,MAAM,UAAa,GAAA,CAAC,EAAE,KAAA,EAAgC,KAAA;AAC3D,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EACE,uBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,aAAc,EAAA,MAAA;AAAA,MACd,OAAA,EAAS,EAAE,KAAS,IAAA,CAAA,CAAA;AAAA,MACpB,WAAa,EAAA,EAAA;AAAA,MACb,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,EAAA;AAAA,MAClC,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,MACjC,UAAY,EAAA,EAAA;AAAA,MACZ,WAAW,OAAQ,CAAA;AAAA;AAAA,GACrB;AAEJ;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import Avatar from '@material-ui/core/Avatar';
|
|
2
3
|
import { makeStyles, lighten } from '@material-ui/core/styles';
|
|
3
|
-
import
|
|
4
|
+
import { useMemo } from 'react';
|
|
4
5
|
|
|
5
6
|
const useStyles = makeStyles((theme) => {
|
|
6
7
|
const commonCardRating = {
|
|
@@ -74,7 +75,7 @@ const Rating = ({
|
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
}, [classes, rating]);
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ jsx(Avatar, { className: ratingProp.className, children: !hideValue && ratingProp.name });
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
export { Rating };
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"Rating.esm.js","sources":["../../../src/components/SonarQubeCard/Rating.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Avatar from '@material-ui/core/Avatar';\nimport { lighten, makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport { useMemo } from 'react';\n\nconst useStyles = makeStyles(theme => {\n const commonCardRating: CSSProperties = {\n height: theme.spacing(3),\n width: theme.spacing(3),\n color: theme.palette.common.white,\n };\n\n return {\n ratingDefault: {\n ...commonCardRating,\n background: theme.palette.status.aborted,\n },\n ratingA: {\n ...commonCardRating,\n background: theme.palette.status.ok,\n },\n ratingB: {\n ...commonCardRating,\n background: lighten(theme.palette.status.ok, 0.5),\n },\n ratingC: {\n ...commonCardRating,\n background: theme.palette.status.pending,\n },\n ratingD: {\n ...commonCardRating,\n background: theme.palette.status.warning,\n },\n ratingE: {\n ...commonCardRating,\n background: theme.palette.error.main,\n },\n };\n});\n\nexport const Rating = ({\n rating,\n hideValue,\n}: {\n rating?: string;\n hideValue?: boolean;\n}) => {\n const classes = useStyles();\n\n const ratingProp = useMemo(() => {\n switch (rating) {\n case '1.0':\n return {\n name: 'A',\n className: classes.ratingA,\n };\n\n case '2.0':\n return {\n name: 'B',\n className: classes.ratingB,\n };\n\n case '3.0':\n return {\n name: 'C',\n className: classes.ratingC,\n };\n\n case '4.0':\n return {\n name: 'D',\n className: classes.ratingD,\n };\n\n case '5.0':\n return {\n name: 'E',\n className: classes.ratingE,\n };\n\n default:\n return {\n name: '',\n className: classes.ratingDefault,\n };\n }\n }, [classes, rating]);\n\n return (\n <Avatar className={ratingProp.className}>\n {!hideValue && ratingProp.name}\n </Avatar>\n );\n};\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,SAAA,GAAY,WAAW,CAAS,KAAA,KAAA;AACpC,EAAA,MAAM,gBAAkC,GAAA;AAAA,IACtC,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACvB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACtB,KAAA,EAA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,MAEF,KAAK,KAAA;AACH,QAAO,OAAA;AAAA,UACL,IAAM,EAAA,GAAA;AAAA,UACN,WAAW,OAAQ,CAAA;AAAA,SACrB;AAAA,MAEF,KAAK,KAAA;AACH,QAAO,OAAA;AAAA,UACL,IAAM,EAAA,GAAA;AAAA,UACN,WAAW,OAAQ,CAAA;AAAA,SACrB;AAAA,MAEF,KAAK,KAAA;AACH,QAAO,OAAA;AAAA,UACL,IAAM,EAAA,GAAA;AAAA,UACN,WAAW,OAAQ,CAAA;AAAA,SACrB;AAAA,MAEF;AACE,QAAO,OAAA;AAAA,UACL,IAAM,EAAA,EAAA;AAAA,UACN,WAAW,OAAQ,CAAA;AAAA,SACrB;AAAA;AACJ,GACC,EAAA,CAAC,OAAS,EAAA,MAAM,CAAC,CAAA;AAEpB,EACE,uBAAA,GAAA,CAAC,UAAO,SAAW,EAAA,UAAA,CAAW,WAC3B,QAAC,EAAA,CAAA,SAAA,IAAa,WAAW,IAC5B,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { Link } from '@backstage/core-components';
|
|
2
3
|
import Grid from '@material-ui/core/Grid';
|
|
3
4
|
import Typography from '@material-ui/core/Typography';
|
|
4
5
|
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
-
import React from 'react';
|
|
6
6
|
|
|
7
7
|
const useStyles = makeStyles((theme) => {
|
|
8
8
|
return {
|
|
@@ -39,7 +39,17 @@ const RatingCard = ({
|
|
|
39
39
|
link
|
|
40
40
|
}) => {
|
|
41
41
|
const classes = useStyles();
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsx(Link, { to: link, color: "inherit", underline: "none", children: /* @__PURE__ */ jsxs(Grid, { item: true, className: classes.root, children: [
|
|
43
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, className: classes.upper, children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Grid, { item: true, className: classes.left, children: leftSlot }),
|
|
45
|
+
/* @__PURE__ */ jsx(Grid, { item: true, className: classes.right, children: rightSlot })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsx(Grid, { item: true, className: classes.cardTitle, children: /* @__PURE__ */ jsxs(Typography, { variant: "body1", className: classes.wrapIcon, children: [
|
|
48
|
+
titleIcon,
|
|
49
|
+
" ",
|
|
50
|
+
title
|
|
51
|
+
] }) })
|
|
52
|
+
] }) });
|
|
43
53
|
};
|
|
44
54
|
|
|
45
55
|
export { RatingCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatingCard.esm.js","sources":["../../../src/components/SonarQubeCard/RatingCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Link } from '@backstage/core-components';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport
|
|
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}: {\n leftSlot: ReactNode;\n rightSlot: ReactNode;\n title?: string;\n titleIcon?: ReactNode;\n link: string;\n}) => {\n const classes = useStyles();\n\n return (\n <Link to={link} color=\"inherit\" underline=\"none\">\n <Grid item className={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 <Grid item className={classes.cardTitle}>\n <Typography variant=\"body1\" className={classes.wrapIcon}>\n {titleIcon} {title}\n </Typography>\n </Grid>\n </Grid>\n </Link>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAS,KAAA,KAAA;AACpC,EAAO,OAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,MAC1B,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,KAAO,EAAA;AAAA,MACL,OAAS,EAAA,MAAA;AAAA,MACT,cAAgB,EAAA,QAAA;AAAA,MAChB,UAAY,EAAA;AAAA,KACd;AAAA,IACA,SAAW,EAAA;AAAA,MACT,SAAW,EAAA;AAAA,KACb;AAAA,IACA,QAAU,EAAA;AAA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