@backstage-community/plugin-sonarqube 0.11.1 → 0.12.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 +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/components/SonarQubeCard/MetricInsights.esm.js +46 -30
- 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 +89 -60
- 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 +13 -7
- package/dist/components/SonarQubeContentPage/SonarQubeContentPage.esm.js.map +1 -1
- package/dist/components/SonarQubeTable/Columns.esm.js +54 -48
- package/dist/components/SonarQubeTable/Columns.esm.js.map +1 -1
- package/dist/components/SonarQubeTable/SonarQubeTable.esm.js +19 -16
- package/dist/components/SonarQubeTable/SonarQubeTable.esm.js.map +1 -1
- package/dist/components/index.esm.js +3 -1
- package/dist/components/index.esm.js.map +1 -1
- package/dist/index.d.ts +42 -11
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/translation.esm.js +47 -0
- package/dist/translation.esm.js.map +1 -0
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage-community/plugin-sonarqube
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8be1894: Upgraded to Backstage release 1.38
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [8be1894]
|
|
12
|
+
- @backstage-community/plugin-sonarqube-react@0.6.0
|
|
13
|
+
|
|
14
|
+
## 0.11.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 4cb6cb9: sonarqube plugin support i18n
|
|
19
|
+
|
|
3
20
|
## 0.11.1
|
|
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;;;;"}
|
|
@@ -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';
|
|
@@ -14,6 +15,8 @@ import { Percentage } from './Percentage.esm.js';
|
|
|
14
15
|
import { Rating } from './Rating.esm.js';
|
|
15
16
|
import { RatingCard } from './RatingCard.esm.js';
|
|
16
17
|
import { Value } from './Value.esm.js';
|
|
18
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
19
|
+
import { sonarqubeTranslationRef } from '../../translation.esm.js';
|
|
17
20
|
|
|
18
21
|
const useStyles = makeStyles((theme) => ({
|
|
19
22
|
badgeLabel: {
|
|
@@ -32,12 +35,13 @@ const useStyles = makeStyles((theme) => ({
|
|
|
32
35
|
}));
|
|
33
36
|
const QualityBadge = (props) => {
|
|
34
37
|
const classes = useStyles();
|
|
38
|
+
const { t } = useTranslationRef(sonarqubeTranslationRef);
|
|
35
39
|
const { value } = props;
|
|
36
|
-
let gateLabel = "
|
|
40
|
+
let gateLabel = t("sonarQubeCard.qualityBadgeLabel.notComputed");
|
|
37
41
|
let gateColor = classes.badgeUnknown;
|
|
38
42
|
if (value?.metrics.alert_status) {
|
|
39
43
|
const gatePassed = value?.metrics.alert_status === "OK";
|
|
40
|
-
gateLabel = gatePassed ? "
|
|
44
|
+
gateLabel = gatePassed ? t("sonarQubeCard.qualityBadgeLabel.gatePassed") : t("sonarQubeCard.qualityBadgeLabel.gateFailed");
|
|
41
45
|
gateColor = gatePassed ? classes.badgeSuccess : classes.badgeError;
|
|
42
46
|
}
|
|
43
47
|
let clickableAttrs = {};
|
|
@@ -48,7 +52,7 @@ const QualityBadge = (props) => {
|
|
|
48
52
|
clickable: true
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
|
-
const qualityBadge = /* @__PURE__ */
|
|
55
|
+
const qualityBadge = /* @__PURE__ */ jsx(
|
|
52
56
|
Chip,
|
|
53
57
|
{
|
|
54
58
|
label: gateLabel,
|
|
@@ -60,70 +64,70 @@ const QualityBadge = (props) => {
|
|
|
60
64
|
};
|
|
61
65
|
const BugReportRatingCard = (props) => {
|
|
62
66
|
const { value, title } = props;
|
|
63
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
64
68
|
RatingCard,
|
|
65
69
|
{
|
|
66
|
-
titleIcon: /* @__PURE__ */
|
|
70
|
+
titleIcon: /* @__PURE__ */ jsx(BugReport, {}),
|
|
67
71
|
title,
|
|
68
72
|
link: value.getIssuesUrl("BUG"),
|
|
69
|
-
leftSlot: /* @__PURE__ */
|
|
70
|
-
rightSlot: /* @__PURE__ */
|
|
73
|
+
leftSlot: /* @__PURE__ */ jsx(Value, { value: value.metrics.bugs }),
|
|
74
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.reliability_rating })
|
|
71
75
|
}
|
|
72
76
|
);
|
|
73
77
|
};
|
|
74
78
|
const VulnerabilitiesRatingCard = (props) => {
|
|
75
79
|
const { value, title } = props;
|
|
76
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
77
81
|
RatingCard,
|
|
78
82
|
{
|
|
79
|
-
titleIcon: value.metrics.vulnerabilities === "0" ? /* @__PURE__ */
|
|
83
|
+
titleIcon: value.metrics.vulnerabilities === "0" ? /* @__PURE__ */ jsx(Lock, {}) : /* @__PURE__ */ jsx(LockOpen, {}),
|
|
80
84
|
title,
|
|
81
85
|
link: value.getIssuesUrl("VULNERABILITY"),
|
|
82
|
-
leftSlot: /* @__PURE__ */
|
|
83
|
-
rightSlot: /* @__PURE__ */
|
|
86
|
+
leftSlot: /* @__PURE__ */ jsx(Value, { value: value.metrics.vulnerabilities }),
|
|
87
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.security_rating })
|
|
84
88
|
}
|
|
85
89
|
);
|
|
86
90
|
};
|
|
87
91
|
const CodeSmellsRatingCard = (props) => {
|
|
88
92
|
const { value, title } = props;
|
|
89
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ jsx(
|
|
90
94
|
RatingCard,
|
|
91
95
|
{
|
|
92
|
-
titleIcon: value.metrics.code_smells === "0" ? /* @__PURE__ */
|
|
96
|
+
titleIcon: value.metrics.code_smells === "0" ? /* @__PURE__ */ jsx(SentimentVerySatisfied, {}) : /* @__PURE__ */ jsx(SentimentVeryDissatisfied, {}),
|
|
93
97
|
title,
|
|
94
98
|
link: value.getIssuesUrl("CODE_SMELL"),
|
|
95
|
-
leftSlot: /* @__PURE__ */
|
|
96
|
-
rightSlot: /* @__PURE__ */
|
|
99
|
+
leftSlot: /* @__PURE__ */ jsx(Value, { value: value.metrics.code_smells }),
|
|
100
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.sqale_rating })
|
|
97
101
|
}
|
|
98
102
|
);
|
|
99
103
|
};
|
|
100
104
|
const HotspotsReviewed = (props) => {
|
|
101
105
|
const { value, title } = props;
|
|
102
|
-
return value.metrics.security_review_rating && /* @__PURE__ */
|
|
106
|
+
return value.metrics.security_review_rating && /* @__PURE__ */ jsx(
|
|
103
107
|
RatingCard,
|
|
104
108
|
{
|
|
105
|
-
titleIcon: /* @__PURE__ */
|
|
109
|
+
titleIcon: /* @__PURE__ */ jsx(Security, {}),
|
|
106
110
|
title,
|
|
107
111
|
link: value.getSecurityHotspotsUrl(),
|
|
108
|
-
leftSlot: /* @__PURE__ */
|
|
112
|
+
leftSlot: /* @__PURE__ */ jsx(
|
|
109
113
|
Value,
|
|
110
114
|
{
|
|
111
115
|
value: value.metrics.security_hotspots_reviewed ? `${value.metrics.security_hotspots_reviewed}%` : "\u2014"
|
|
112
116
|
}
|
|
113
117
|
),
|
|
114
|
-
rightSlot: /* @__PURE__ */
|
|
118
|
+
rightSlot: /* @__PURE__ */ jsx(Rating, { rating: value.metrics.security_review_rating })
|
|
115
119
|
}
|
|
116
120
|
);
|
|
117
121
|
};
|
|
118
122
|
const CoverageRatingCard = (props) => {
|
|
119
123
|
const { value, title } = props;
|
|
120
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
121
125
|
RatingCard,
|
|
122
126
|
{
|
|
123
127
|
link: value.getComponentMeasuresUrl("COVERAGE"),
|
|
124
128
|
title,
|
|
125
|
-
leftSlot: /* @__PURE__ */
|
|
126
|
-
rightSlot: /* @__PURE__ */
|
|
129
|
+
leftSlot: /* @__PURE__ */ jsx(Percentage, { value: value.metrics.coverage }),
|
|
130
|
+
rightSlot: /* @__PURE__ */ jsx(
|
|
127
131
|
Value,
|
|
128
132
|
{
|
|
129
133
|
value: value.metrics.coverage ? `${value.metrics.coverage}%` : "\u2014"
|
|
@@ -146,25 +150,37 @@ const DuplicationsRatingCard = (props) => {
|
|
|
146
150
|
}
|
|
147
151
|
return rating;
|
|
148
152
|
}, [value]);
|
|
149
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ jsx(
|
|
150
154
|
RatingCard,
|
|
151
155
|
{
|
|
152
156
|
title,
|
|
153
157
|
link: value.getComponentMeasuresUrl("DUPLICATED_LINES_DENSITY"),
|
|
154
|
-
leftSlot: /* @__PURE__ */
|
|
155
|
-
rightSlot: /* @__PURE__ */
|
|
158
|
+
leftSlot: /* @__PURE__ */ jsx(Rating, { rating: duplicationRating, hideValue: true }),
|
|
159
|
+
rightSlot: /* @__PURE__ */ jsx(Value, { value: `${value.metrics.duplicated_lines_density}%` })
|
|
156
160
|
}
|
|
157
161
|
);
|
|
158
162
|
};
|
|
159
163
|
const LastAnalyzedRatingCard = (props) => {
|
|
160
164
|
const { value } = props;
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
|
|
163
|
-
|
|
165
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
166
|
+
"Last analyzed on",
|
|
167
|
+
" ",
|
|
168
|
+
DateTime.fromISO(value.lastAnalysis).toLocaleString(
|
|
169
|
+
DateTime.DATETIME_MED
|
|
170
|
+
)
|
|
171
|
+
] });
|
|
164
172
|
};
|
|
165
173
|
const NoSonarQubeCard = (props) => {
|
|
166
174
|
const { value, sonarQubeComponentKey } = props;
|
|
167
|
-
|
|
175
|
+
const { t } = useTranslationRef(sonarqubeTranslationRef);
|
|
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
|
+
] });
|
|
168
184
|
};
|
|
169
185
|
|
|
170
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';\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\n const { value } = props;\n let gateLabel = 'Not computed';\n let gateColor = classes.badgeUnknown;\n if (value?.metrics.alert_status) {\n const gatePassed = value?.metrics.alert_status === 'OK';\n gateLabel = gatePassed ? 'Gate passed' : 'Gate failed';\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 return (\n <Typography color=\"error\" variant=\"subtitle2\">\n {value?.isSonarQubeAnnotationEnabled &&\n `Unable to access SonarQube project \"${sonarQubeComponentKey}\": Check project exists and permissions`}\n {!value?.isSonarQubeAnnotationEnabled &&\n `${value?.name} has no DX-Hub annotation for SonarQube`}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;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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';\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 );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AO,EAAA;AAAA,KACd;AAAA,GACL,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
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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ACrB;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,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,QA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