@red-hat-developer-hub/backstage-plugin-scorecard 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @red-hat-developer-hub/backstage-plugin-scorecard
2
2
 
3
+ ## 2.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 501e099: Removed Backstage registration requirement for default Scorecard icons
8
+ - @red-hat-developer-hub/backstage-plugin-scorecard-common@2.5.2
9
+
3
10
  ## 2.5.1
4
11
 
5
12
  ### Patch Changes
@@ -2,7 +2,15 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { useApp } from '@backstage/core-plugin-api';
3
3
  import Box from '@mui/material/Box';
4
4
  import MuiIcon from '@mui/material/Icon';
5
+ import ScorecardErrorStatusIcon from '@mui/icons-material/DangerousOutlined';
6
+ import ScorecardWarningStatusIcon from '@mui/icons-material/WarningAmber';
7
+ import ScorecardSuccessStatusIcon from '@mui/icons-material/CheckCircleOutline';
5
8
 
9
+ const builtInIcons = {
10
+ scorecardSuccessStatusIcon: ScorecardSuccessStatusIcon,
11
+ scorecardWarningStatusIcon: ScorecardWarningStatusIcon,
12
+ scorecardErrorStatusIcon: ScorecardErrorStatusIcon
13
+ };
6
14
  const ScorecardIcon = ({
7
15
  icon,
8
16
  size = "small",
@@ -12,7 +20,7 @@ const ScorecardIcon = ({
12
20
  if (!icon) {
13
21
  return null;
14
22
  }
15
- const SystemIcon = app.getSystemIcon(icon);
23
+ const SystemIcon = app.getSystemIcon(icon) ?? builtInIcons[icon];
16
24
  if (SystemIcon) {
17
25
  return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", ...sx }, children: /* @__PURE__ */ jsx(SystemIcon, { fontSize: size }) });
18
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ScorecardIcon.esm.js","sources":["../../../src/components/ScorecardIcon/ScorecardIcon.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useApp } from '@backstage/core-plugin-api';\nimport Box from '@mui/material/Box';\nimport MuiIcon from '@mui/material/Icon';\nimport type { SxProps, Theme } from '@mui/material/styles';\n\n/**\n * @public\n */\nexport interface ScorecardIconProps {\n icon: string;\n size?: 'small' | 'medium' | 'large';\n sx?: SxProps<Theme>;\n}\n\n/**\n * @public\n */\nexport const ScorecardIcon = ({\n icon,\n size = 'small',\n sx,\n}: ScorecardIconProps) => {\n const app = useApp();\n if (!icon) {\n return null;\n }\n\n const SystemIcon = app.getSystemIcon(icon);\n if (SystemIcon) {\n return (\n <Box sx={{ display: 'flex', alignItems: 'center', ...sx }}>\n <SystemIcon fontSize={size} />\n </Box>\n );\n }\n\n if (icon.startsWith('<svg')) {\n const svgDataUri = `data:image/svg+xml;base64,${btoa(icon)}`;\n return (\n <MuiIcon fontSize={size} sx={sx}>\n <img src={svgDataUri} alt=\"\" />\n </MuiIcon>\n );\n }\n\n if (\n icon.startsWith('data:') ||\n icon.startsWith('https://') ||\n icon.startsWith('http://') ||\n icon.startsWith('/')\n ) {\n return (\n <MuiIcon fontSize={size} baseClassName=\"material-icons-outlined\" sx={sx}>\n <img src={icon} alt=\"\" height=\"100%\" width=\"100%\" />\n </MuiIcon>\n );\n }\n\n return (\n <MuiIcon fontSize={size} baseClassName=\"material-icons-outlined\" sx={sx}>\n {icon}\n </MuiIcon>\n );\n};\n"],"names":[],"mappings":";;;;;AAgCO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,IAAA;AAAA,EACA,IAAO,GAAA,OAA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Q,EAAA,EAAA,QAAA,EAAU,MAAM,aAAc,EAAA,yBAAA,EAA0B,IAC9D,QACH,EAAA,IAAA,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardIcon.esm.js","sources":["../../../src/components/ScorecardIcon/ScorecardIcon.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useApp } from '@backstage/core-plugin-api';\nimport Box from '@mui/material/Box';\nimport MuiIcon from '@mui/material/Icon';\nimport type { SvgIconComponent } from '@mui/icons-material';\nimport type { SxProps, Theme } from '@mui/material/styles';\nimport {\n ScorecardSuccessStatusIcon,\n ScorecardWarningStatusIcon,\n ScorecardErrorStatusIcon,\n} from '../..';\n\nconst builtInIcons: Record<string, SvgIconComponent> = {\n scorecardSuccessStatusIcon: ScorecardSuccessStatusIcon,\n scorecardWarningStatusIcon: ScorecardWarningStatusIcon,\n scorecardErrorStatusIcon: ScorecardErrorStatusIcon,\n};\n\n/**\n * @public\n */\nexport interface ScorecardIconProps {\n icon: string;\n size?: 'small' | 'medium' | 'large';\n sx?: SxProps<Theme>;\n}\n\n/**\n * @public\n */\nexport const ScorecardIcon = ({\n icon,\n size = 'small',\n sx,\n}: ScorecardIconProps) => {\n const app = useApp();\n if (!icon) {\n return null;\n }\n\n const SystemIcon = app.getSystemIcon(icon) ?? builtInIcons[icon];\n if (SystemIcon) {\n return (\n <Box sx={{ display: 'flex', alignItems: 'center', ...sx }}>\n <SystemIcon fontSize={size} />\n </Box>\n );\n }\n\n if (icon.startsWith('<svg')) {\n const svgDataUri = `data:image/svg+xml;base64,${btoa(icon)}`;\n return (\n <MuiIcon fontSize={size} sx={sx}>\n <img src={svgDataUri} alt=\"\" />\n </MuiIcon>\n );\n }\n\n if (\n icon.startsWith('data:') ||\n icon.startsWith('https://') ||\n icon.startsWith('http://') ||\n icon.startsWith('/')\n ) {\n return (\n <MuiIcon fontSize={size} baseClassName=\"material-icons-outlined\" sx={sx}>\n <img src={icon} alt=\"\" height=\"100%\" width=\"100%\" />\n </MuiIcon>\n );\n }\n\n return (\n <MuiIcon fontSize={size} baseClassName=\"material-icons-outlined\" sx={sx}>\n {icon}\n </MuiIcon>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA0BA,MAAM,YAAiD,GAAA;AAAA,EACrD,0BAA4B,EAAA,0BAAA;AAAA,EAC5B,0BAA4B,EAAA,0BAAA;AAAA,EAC5B,wBAA0B,EAAA;AAC5B,CAAA;AAcO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,IAAA;AAAA,EACA,IAAO,GAAA,OAAA;AAAA,EACP;AACF,CAA0B,KAAA;AACxB,EAAA,MAAM,MAAM,MAAO,EAAA;AACnB,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,MAAM,aAAa,GAAI,CAAA,aAAA,CAAc,IAAI,CAAA,IAAK,aAAa,IAAI,CAAA;AAC/D,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,uBACG,GAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,EAAE,SAAS,MAAQ,EAAA,UAAA,EAAY,QAAU,EAAA,GAAG,IACnD,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,QAAA,EAAU,MAAM,CAC9B,EAAA,CAAA;AAAA;AAIJ,EAAI,IAAA,IAAA,CAAK,UAAW,CAAA,MAAM,CAAG,EAAA;AAC3B,IAAA,MAAM,UAAa,GAAA,CAAA,0BAAA,EAA6B,IAAK,CAAA,IAAI,CAAC,CAAA,CAAA;AAC1D,IACE,uBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,QAAA,EAAU,IAAM,EAAA,EAAA,EACvB,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,GAAK,EAAA,UAAA,EAAY,GAAI,EAAA,EAAA,EAAG,CAC/B,EAAA,CAAA;AAAA;AAIJ,EAAA,IACE,IAAK,CAAA,UAAA,CAAW,OAAO,CAAA,IACvB,KAAK,UAAW,CAAA,UAAU,CAC1B,IAAA,IAAA,CAAK,WAAW,SAAS,CAAA,IACzB,IAAK,CAAA,UAAA,CAAW,GAAG,CACnB,EAAA;AACA,IAAA,2BACG,OAAQ,EAAA,EAAA,QAAA,EAAU,IAAM,EAAA,aAAA,EAAc,2BAA0B,EAC/D,EAAA,QAAA,kBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,GAAA,EAAK,MAAM,GAAI,EAAA,EAAA,EAAG,QAAO,MAAO,EAAA,KAAA,EAAM,QAAO,CACpD,EAAA,CAAA;AAAA;AAIJ,EAAA,2BACG,OAAQ,EAAA,EAAA,QAAA,EAAU,MAAM,aAAc,EAAA,yBAAA,EAA0B,IAC9D,QACH,EAAA,IAAA,EAAA,CAAA;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-scorecard",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -75,7 +75,7 @@
75
75
  "@backstage/theme": "^0.7.2",
76
76
  "@mui/icons-material": "5.18.0",
77
77
  "@mui/material": "5.18.0",
78
- "@red-hat-developer-hub/backstage-plugin-scorecard-common": "^2.5.1",
78
+ "@red-hat-developer-hub/backstage-plugin-scorecard-common": "^2.5.2",
79
79
  "@tanstack/react-query": "^5.95.2",
80
80
  "date-fns": "^4.1.0",
81
81
  "react-use": "^17.2.4",