@backstage/plugin-catalog-graph 0.4.8-next.1 → 0.4.8-next.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 +15 -0
- package/alpha/package.json +1 -1
- package/dist/components/EntityRelationsGraph/DefaultRenderNode.esm.js +10 -15
- package/dist/components/EntityRelationsGraph/DefaultRenderNode.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/EntityIcon.esm.js +13 -0
- package/dist/components/EntityRelationsGraph/EntityIcon.esm.js.map +1 -0
- package/package.json +2 -2
- package/dist/components/EntityRelationsGraph/EntityKindIcon.esm.js +0 -15
- package/dist/components/EntityRelationsGraph/EntityKindIcon.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-graph
|
|
2
2
|
|
|
3
|
+
## 0.4.8-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4a529c2: Use `entityPresentationApi` for the node title and the icon.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/catalog-client@1.6.5
|
|
10
|
+
- @backstage/catalog-model@1.5.0
|
|
11
|
+
- @backstage/core-compat-api@0.2.8-next.1
|
|
12
|
+
- @backstage/core-components@0.14.10-next.0
|
|
13
|
+
- @backstage/core-plugin-api@1.9.3
|
|
14
|
+
- @backstage/frontend-plugin-api@0.6.8-next.1
|
|
15
|
+
- @backstage/types@1.1.1
|
|
16
|
+
- @backstage/plugin-catalog-react@1.12.3-next.1
|
|
17
|
+
|
|
3
18
|
## 0.4.8-next.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/alpha/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
1
|
+
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
3
2
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import React, { useState, useRef, useLayoutEffect } from 'react';
|
|
6
|
-
import {
|
|
5
|
+
import { EntityIcon } from './EntityIcon.esm.js';
|
|
7
6
|
import { DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
8
7
|
|
|
9
8
|
const useStyles = makeStyles(
|
|
@@ -44,8 +43,10 @@ function DefaultRenderNode({
|
|
|
44
43
|
const classes = useStyles();
|
|
45
44
|
const [width, setWidth] = useState(0);
|
|
46
45
|
const [height, setHeight] = useState(0);
|
|
47
|
-
const app = useApp();
|
|
48
46
|
const idRef = useRef(null);
|
|
47
|
+
const entityRefPresentationSnapshot = useEntityPresentation(entity, {
|
|
48
|
+
defaultNamespace: DEFAULT_NAMESPACE
|
|
49
|
+
});
|
|
49
50
|
useLayoutEffect(() => {
|
|
50
51
|
if (idRef.current) {
|
|
51
52
|
let { height: renderedHeight, width: renderedWidth } = idRef.current.getBBox();
|
|
@@ -57,19 +58,13 @@ function DefaultRenderNode({
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
}, [width, height]);
|
|
60
|
-
const
|
|
61
|
-
kind,
|
|
62
|
-
metadata: { name, namespace = DEFAULT_NAMESPACE, title }
|
|
63
|
-
} = entity;
|
|
64
|
-
const hasKindIcon = app.getSystemIcon(
|
|
65
|
-
`kind:${kind.toLocaleLowerCase("en-US")}`
|
|
66
|
-
);
|
|
61
|
+
const hasKindIcon = !!entityRefPresentationSnapshot.Icon;
|
|
67
62
|
const padding = 10;
|
|
68
63
|
const iconSize = height;
|
|
69
64
|
const paddedIconWidth = hasKindIcon ? iconSize + padding : 0;
|
|
70
65
|
const paddedWidth = paddedIconWidth + width + padding * 2;
|
|
71
66
|
const paddedHeight = height + padding * 2;
|
|
72
|
-
const displayTitle =
|
|
67
|
+
const displayTitle = entityRefPresentationSnapshot.primaryTitle ?? id;
|
|
73
68
|
return /* @__PURE__ */ React.createElement("g", { onClick, className: classNames(onClick && classes.clickable) }, /* @__PURE__ */ React.createElement(
|
|
74
69
|
"rect",
|
|
75
70
|
{
|
|
@@ -83,9 +78,9 @@ function DefaultRenderNode({
|
|
|
83
78
|
rx: 10
|
|
84
79
|
}
|
|
85
80
|
), hasKindIcon && /* @__PURE__ */ React.createElement(
|
|
86
|
-
|
|
81
|
+
EntityIcon,
|
|
87
82
|
{
|
|
88
|
-
|
|
83
|
+
icon: entityRefPresentationSnapshot.Icon,
|
|
89
84
|
y: padding,
|
|
90
85
|
x: padding,
|
|
91
86
|
width: iconSize,
|
|
@@ -113,7 +108,7 @@ function DefaultRenderNode({
|
|
|
113
108
|
alignmentBaseline: "middle"
|
|
114
109
|
},
|
|
115
110
|
displayTitle
|
|
116
|
-
));
|
|
111
|
+
), /* @__PURE__ */ React.createElement("title", null, entityRefPresentationSnapshot.entityRef));
|
|
117
112
|
}
|
|
118
113
|
|
|
119
114
|
export { DefaultRenderNode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRenderNode.esm.js","sources":["../../../src/components/EntityRelationsGraph/DefaultRenderNode.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { DependencyGraphTypes } from '@backstage/core-components';\nimport {
|
|
1
|
+
{"version":3,"file":"DefaultRenderNode.esm.js","sources":["../../../src/components/EntityRelationsGraph/DefaultRenderNode.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { DependencyGraphTypes } from '@backstage/core-components';\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport { EntityIcon } from './EntityIcon';\nimport { EntityNodeData } from './types';\nimport { DEFAULT_NAMESPACE } from '@backstage/catalog-model';\n\nconst useStyles = makeStyles(\n theme => ({\n node: {\n fill: theme.palette.grey[300],\n stroke: theme.palette.grey[300],\n\n '&.primary': {\n fill: theme.palette.primary.light,\n stroke: theme.palette.primary.light,\n },\n '&.secondary': {\n fill: theme.palette.secondary.light,\n stroke: theme.palette.secondary.light,\n },\n },\n text: {\n fill: theme.palette.getContrastText(theme.palette.grey[300]),\n\n '&.primary': {\n fill: theme.palette.primary.contrastText,\n },\n '&.secondary': {\n fill: theme.palette.secondary.contrastText,\n },\n '&.focused': {\n fontWeight: 'bold',\n },\n },\n clickable: {\n cursor: 'pointer',\n },\n }),\n { name: 'PluginCatalogGraphCustomNode' },\n);\n\nexport function DefaultRenderNode({\n node: { id, entity, color = 'default', focused, onClick },\n}: DependencyGraphTypes.RenderNodeProps<EntityNodeData>) {\n const classes = useStyles();\n const [width, setWidth] = useState(0);\n const [height, setHeight] = useState(0);\n const idRef = useRef<SVGTextElement | null>(null);\n const entityRefPresentationSnapshot = useEntityPresentation(entity, {\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n\n useLayoutEffect(() => {\n // set the width to the length of the ID\n if (idRef.current) {\n let { height: renderedHeight, width: renderedWidth } =\n idRef.current.getBBox();\n renderedHeight = Math.round(renderedHeight);\n renderedWidth = Math.round(renderedWidth);\n\n if (renderedHeight !== height || renderedWidth !== width) {\n setWidth(renderedWidth);\n setHeight(renderedHeight);\n }\n }\n }, [width, height]);\n\n const hasKindIcon = !!entityRefPresentationSnapshot.Icon;\n const padding = 10;\n const iconSize = height;\n const paddedIconWidth = hasKindIcon ? iconSize + padding : 0;\n const paddedWidth = paddedIconWidth + width + padding * 2;\n const paddedHeight = height + padding * 2;\n\n const displayTitle = entityRefPresentationSnapshot.primaryTitle ?? id;\n\n return (\n <g onClick={onClick} className={classNames(onClick && classes.clickable)}>\n <rect\n className={classNames(\n classes.node,\n color === 'primary' && 'primary',\n color === 'secondary' && 'secondary',\n )}\n width={paddedWidth}\n height={paddedHeight}\n rx={10}\n />\n {hasKindIcon && (\n <EntityIcon\n icon={entityRefPresentationSnapshot.Icon as IconComponent}\n y={padding}\n x={padding}\n width={iconSize}\n height={iconSize}\n className={classNames(\n classes.text,\n focused && 'focused',\n color === 'primary' && 'primary',\n color === 'secondary' && 'secondary',\n )}\n />\n )}\n <text\n ref={idRef}\n className={classNames(\n classes.text,\n focused && 'focused',\n color === 'primary' && 'primary',\n color === 'secondary' && 'secondary',\n )}\n y={paddedHeight / 2}\n x={paddedIconWidth + (width + padding * 2) / 2}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n >\n {displayTitle}\n </text>\n <title>{entityRefPresentationSnapshot.entityRef}</title>\n </g>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAyBA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,IAAM,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG,CAAA;AAAA,MAC5B,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG,CAAA;AAAA,MAE9B,WAAa,EAAA;AAAA,QACX,IAAA,EAAM,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA,KAAA;AAAA,Q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A,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SvgIcon from '@material-ui/core/SvgIcon';
|
|
3
|
+
|
|
4
|
+
function EntityIcon({
|
|
5
|
+
icon,
|
|
6
|
+
...props
|
|
7
|
+
}) {
|
|
8
|
+
const Icon = icon ?? SvgIcon;
|
|
9
|
+
return /* @__PURE__ */ React.createElement(Icon, { ...props });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { EntityIcon };
|
|
13
|
+
//# sourceMappingURL=EntityIcon.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityIcon.esm.js","sources":["../../../src/components/EntityRelationsGraph/EntityIcon.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React from 'react';\nimport SvgIcon from '@material-ui/core/SvgIcon';\nimport { OverridableComponent } from '@material-ui/core/OverridableComponent';\nimport { SvgIconTypeMap } from '@material-ui/core/SvgIcon/SvgIcon';\nimport { IconComponent } from '@backstage/core-plugin-api';\n\nexport function EntityIcon({\n icon,\n ...props\n}: {\n icon: IconComponent | undefined;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n className?: string;\n}) {\n const Icon = (icon as OverridableComponent<SvgIconTypeMap>) ?? SvgIcon;\n return <Icon {...props} />;\n}\n"],"names":[],"mappings":";;;AAqBO,SAAS,UAAW,CAAA;AAAA,EACzB,IAAA;AAAA,EACA,GAAG,KAAA;AACL,CAOG,EAAA;AACD,EAAA,MAAM,OAAQ,IAAiD,IAAA,OAAA,CAAA;AAC/D,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAM,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AAC1B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-graph",
|
|
3
|
-
"version": "0.4.8-next.
|
|
3
|
+
"version": "0.4.8-next.2",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "catalog-graph",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"react-use": "^17.2.4"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@backstage/cli": "^0.27.0-next.
|
|
70
|
+
"@backstage/cli": "^0.27.0-next.2",
|
|
71
71
|
"@backstage/core-app-api": "^1.14.2-next.0",
|
|
72
72
|
"@backstage/dev-utils": "^1.0.37-next.1",
|
|
73
73
|
"@backstage/plugin-catalog": "^1.21.2-next.1",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useApp } from '@backstage/core-plugin-api';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import SvgIcon from '@material-ui/core/SvgIcon';
|
|
4
|
-
|
|
5
|
-
function EntityKindIcon({
|
|
6
|
-
kind,
|
|
7
|
-
...props
|
|
8
|
-
}) {
|
|
9
|
-
const app = useApp();
|
|
10
|
-
const Icon = app.getSystemIcon(`kind:${kind.toLocaleLowerCase("en-US")}`) ?? SvgIcon;
|
|
11
|
-
return /* @__PURE__ */ React.createElement(Icon, { ...props });
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { EntityKindIcon };
|
|
15
|
-
//# sourceMappingURL=EntityKindIcon.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EntityKindIcon.esm.js","sources":["../../../src/components/EntityRelationsGraph/EntityKindIcon.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useApp } from '@backstage/core-plugin-api';\nimport React from 'react';\nimport SvgIcon from '@material-ui/core/SvgIcon';\n\nexport function EntityKindIcon({\n kind,\n ...props\n}: {\n kind: string;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n className?: string;\n}) {\n const app = useApp();\n const Icon =\n app.getSystemIcon(`kind:${kind.toLocaleLowerCase('en-US')}`) ?? SvgIcon;\n return <Icon {...props} />;\n}\n"],"names":[],"mappings":";;;;AAmBO,SAAS,cAAe,CAAA;AAAA,EAC7B,IAAA;AAAA,EACA,GAAG,KAAA;AACL,CAOG,EAAA;AACD,EAAA,MAAM,MAAM,MAAO,EAAA,CAAA;AACnB,EAAM,MAAA,IAAA,GACJ,IAAI,aAAc,CAAA,CAAA,KAAA,EAAQ,KAAK,iBAAkB,CAAA,OAAO,CAAC,CAAA,CAAE,CAAK,IAAA,OAAA,CAAA;AAClE,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAM,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AAC1B;;;;"}
|