@backstage-community/plugin-tech-insights 0.3.40 → 0.3.42
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,18 @@
|
|
|
1
1
|
# @backstage-community/plugin-tech-insights
|
|
2
2
|
|
|
3
|
+
## 0.3.42
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [5289c38]
|
|
8
|
+
- @backstage-community/plugin-tech-insights-common@0.3.0
|
|
9
|
+
|
|
10
|
+
## 0.3.41
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 9a09c39: Remove use of react 18 `useId` hook to maintain compatibility with react 17.
|
|
15
|
+
|
|
3
16
|
## 0.3.40
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo,
|
|
1
|
+
import React, { useMemo, useEffect, useCallback } from 'react';
|
|
2
2
|
import { useApi } from '@backstage/core-plugin-api';
|
|
3
3
|
import Menu from '@material-ui/core/Menu';
|
|
4
4
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
@@ -6,6 +6,7 @@ import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
|
|
|
6
6
|
import '@backstage-community/plugin-tech-insights-common/client';
|
|
7
7
|
import '@material-ui/icons/CheckCircleOutline';
|
|
8
8
|
import '@material-ui/icons/ErrorOutline';
|
|
9
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
9
10
|
|
|
10
11
|
const ResultLinksMenu = (props) => {
|
|
11
12
|
const { result, entity, setMenu } = props;
|
|
@@ -16,7 +17,7 @@ const ResultLinksMenu = (props) => {
|
|
|
16
17
|
}) : result.check.links ?? [],
|
|
17
18
|
[api, result, entity]
|
|
18
19
|
);
|
|
19
|
-
const menuId = `menu-${
|
|
20
|
+
const menuId = `menu-${result.check.id}-${entity ? stringifyEntityRef(entity) : "unknown"}`;
|
|
20
21
|
const [anchorEl, setAnchorEl] = React.useState(
|
|
21
22
|
void 0
|
|
22
23
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultLinksMenu.esm.js","sources":["../../../src/components/ResultLinksMenu/ResultLinksMenu.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 */\n\nimport React, {\n PropsWithChildren,\n useCallback,\n useEffect,\n
|
|
1
|
+
{"version":3,"file":"ResultLinksMenu.esm.js","sources":["../../../src/components/ResultLinksMenu/ResultLinksMenu.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 */\n\nimport React, {\n PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n} from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * TechInsightsLinksMenu setMenu receiver.\n *\n * This object contains an {@link ResultLinksMenuInfo.open | open} function,\n * which can be used to open the popup menu. It closes automatically on\n * click-away.\n *\n * @public\n */\nexport type ResultLinksMenuInfo = {\n /**\n * Call this function to open the popup menu. The element argument should be\n * an element which is used as an anchor for the menu - where to display it.\n */\n open: (element: Element) => void;\n};\n\nexport const ResultLinksMenu = (\n props: PropsWithChildren<{\n result: CheckResult;\n entity?: Entity;\n setMenu(opener: ResultLinksMenuInfo | undefined): void;\n }>,\n) => {\n const { result, entity, setMenu } = props;\n\n const api = useApi(techInsightsApiRef);\n\n const links = useMemo(\n () =>\n entity\n ? api.getLinksForEntity(result, entity, {\n includeStaticLinks: true,\n })\n : result.check.links ?? [],\n [api, result, entity],\n );\n\n const menuId = `menu-${result.check.id}-${\n entity ? stringifyEntityRef(entity) : 'unknown'\n }`;\n\n const [anchorEl, setAnchorEl] = React.useState<Element | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (links.length === 0) {\n setMenu(undefined);\n return;\n }\n setMenu({\n open: (elem: Element) => {\n setAnchorEl(elem);\n },\n });\n }, [setMenu, links]);\n\n const handleClose = useCallback(() => {\n setAnchorEl(undefined);\n }, [setAnchorEl]);\n\n if (links.length === 0) {\n return null;\n }\n\n return (\n <Menu\n id={menuId}\n anchorEl={anchorEl ?? null}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleClose}\n >\n {links.map((link, i) => (\n <MenuItem\n key={`${i}-${link.url}`}\n button\n component=\"a\"\n href={link.url}\n target={link.url.startsWith('/') ? undefined : '_blank'}\n onClick={handleClose}\n >\n {link.title}\n </MenuItem>\n ))}\n </Menu>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA8Ca,MAAA,eAAA,GAAkB,CAC7B,KAKG,KAAA;AACH,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA,CAAA;AAEpC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AAErC,EAAA,MAAM,KAAQ,GAAA,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AAAA,MACtB,WAAW,EAAA,IAAA;AAAA,MACX,IAAA,EAAM,QAAQ,QAAQ,CAAA;AAAA,MACtB,OAAS,EAAA,WAAA;AAAA,KAAA;AAAA,IAER,KAAM,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,CAChB,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,KAAK,GAAG,CAAA,CAAA;AAAA,QACrB,MAAM,EAAA,IAAA;AAAA,QACN,SAAU,EAAA,GAAA;AAAA,QACV,MAAM,IAAK,CAAA,GAAA;AAAA,QACX,QAAQ,IAAK,CAAA,GAAA,CAAI,UAAW,CAAA,GAAG,IAAI,KAAY,CAAA,GAAA,QAAA;AAAA,QAC/C,OAAS,EAAA,WAAA;AAAA,OAAA;AAAA,MAER,IAAK,CAAA,KAAA;AAAA,KAET,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-tech-insights",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.42",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "tech-insights",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test": "backstage-cli package test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@backstage-community/plugin-tech-insights-common": "^0.
|
|
42
|
+
"@backstage-community/plugin-tech-insights-common": "^0.3.0",
|
|
43
43
|
"@backstage/catalog-model": "^1.7.0",
|
|
44
44
|
"@backstage/core-components": "^0.15.1",
|
|
45
45
|
"@backstage/core-plugin-api": "^1.10.0",
|