@backstage/plugin-catalog-graph 0.4.22-next.3 → 0.4.23-next.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 +27 -0
- package/dist/alpha.d.ts +1 -1
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/CatalogGraphCard/CatalogGraphCard.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/CatalogGraphPage.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/CurveFilter.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/DirectionFilter.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/MaxDepthFilter.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/SelectedKindsFilter.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/SelectedRelationsFilter.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/SwitchFilter.esm.js.map +1 -1
- package/dist/components/CatalogGraphPage/useCatalogGraphPage.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/DefaultRenderLabel.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/DefaultRenderNode.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/EntityIcon.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/EntityRelationsGraph.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/relations.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/types.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/useEntityRelationGraph.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.esm.js.map +1 -1
- package/dist/components/EntityRelationsGraph/useEntityStore.esm.js.map +1 -1
- package/dist/extensions.esm.js.map +1 -1
- package/dist/package.json.esm.js +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/dist/translation.esm.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-graph
|
|
2
2
|
|
|
3
|
+
## 0.4.23-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-compat-api@0.5.2-next.0
|
|
9
|
+
- @backstage/plugin-catalog-react@1.20.2-next.0
|
|
10
|
+
- @backstage/catalog-client@1.11.0
|
|
11
|
+
- @backstage/catalog-model@1.7.5
|
|
12
|
+
- @backstage/core-components@0.17.5
|
|
13
|
+
- @backstage/core-plugin-api@1.10.9
|
|
14
|
+
- @backstage/frontend-plugin-api@0.11.0
|
|
15
|
+
- @backstage/types@1.2.1
|
|
16
|
+
|
|
17
|
+
## 0.4.22
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- e4ddf22: Internal update to align with new blueprint parameter naming in the new frontend system.
|
|
22
|
+
- 8b1bf6e: Updated README instructions for the new frontend system
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @backstage/core-components@0.17.5
|
|
25
|
+
- @backstage/frontend-plugin-api@0.11.0
|
|
26
|
+
- @backstage/core-compat-api@0.5.0
|
|
27
|
+
- @backstage/plugin-catalog-react@1.20.0
|
|
28
|
+
- @backstage/catalog-client@1.11.0
|
|
29
|
+
|
|
3
30
|
## 0.4.22-next.3
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare const catalogGraphTranslationRef: _backstage_frontend_plugin_api.Transla
|
|
|
29
29
|
readonly "catalogGraphPage.selectedRelationsFilter.title": "Relations";
|
|
30
30
|
}>;
|
|
31
31
|
|
|
32
|
-
declare const _default: _backstage_frontend_plugin_api.
|
|
32
|
+
declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{
|
|
33
33
|
catalogGraph: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
34
34
|
}, {
|
|
35
35
|
catalogEntity: _backstage_frontend_plugin_api.ExternalRouteRef<{
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.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 {\n createFrontendPlugin,\n PageBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogGraphRouteRef, catalogEntityRouteRef } from './routes';\nimport { Direction } from '@backstage/plugin-catalog-graph';\n\nconst CatalogGraphEntityCard = EntityCardBlueprint.makeWithOverrides({\n name: 'relations',\n config: {\n schema: {\n kinds: z => z.array(z.string()).optional(),\n relations: z => z.array(z.string()).optional(),\n maxDepth: z => z.number().optional(),\n unidirectional: z => z.boolean().optional(),\n mergeRelations: z => z.boolean().optional(),\n direction: z => z.nativeEnum(Direction).optional(),\n relationPairs: z => z.array(z.tuple([z.string(), z.string()])).optional(),\n zoom: z => z.enum(['enabled', 'disabled', 'enable-on-click']).optional(),\n curve: z => z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n // Skipping a \"variant\" config for now, defaulting to \"gridItem\" in the component\n // For more details, see this comment: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n title: z => z.string().optional(),\n height: z => z.number().optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n loader: async () =>\n import('./components/CatalogGraphCard').then(m =>\n compatWrapper(<m.CatalogGraphCard {...config} />),\n ),\n });\n },\n});\n\nconst CatalogGraphPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n selectedKinds: z => z.array(z.string()).optional(),\n selectedRelations: z => z.array(z.string()).optional(),\n rootEntityRefs: z => z.array(z.string()).optional(),\n maxDepth: z => z.number().optional(),\n unidirectional: z => z.boolean().optional(),\n mergeRelations: z => z.boolean().optional(),\n direction: z => z.nativeEnum(Direction).optional(),\n showFilters: z => z.boolean().optional(),\n curve: z => z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n kinds: z => z.array(z.string()).optional(),\n relations: z => z.array(z.string()).optional(),\n relationPairs: z => z.array(z.tuple([z.string(), z.string()])).optional(),\n zoom: z => z.enum(['enabled', 'disabled', 'enable-on-click']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n path: '/catalog-graph',\n routeRef: convertLegacyRouteRef(catalogGraphRouteRef),\n loader: () =>\n import('./components/CatalogGraphPage').then(m =>\n compatWrapper(<m.CatalogGraphPage {...config} />),\n ),\n });\n },\n});\n\nexport default createFrontendPlugin({\n pluginId: 'catalog-graph',\n info: { packageJson: () => import('../package.json') },\n routes: {\n catalogGraph: convertLegacyRouteRef(catalogGraphRouteRef),\n },\n externalRoutes: {\n catalogEntity: convertLegacyRouteRef(catalogEntityRouteRef),\n },\n extensions: [CatalogGraphPage, CatalogGraphEntityCard],\n});\n\nexport { catalogGraphTranslationRef } from './translation';\n"],"names":[],"mappings":";;;;;;;;AA4BA,MAAM,sBAAA,GAAyB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.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 {\n createFrontendPlugin,\n PageBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogGraphRouteRef, catalogEntityRouteRef } from './routes';\nimport { Direction } from '@backstage/plugin-catalog-graph';\n\nconst CatalogGraphEntityCard = EntityCardBlueprint.makeWithOverrides({\n name: 'relations',\n config: {\n schema: {\n kinds: z => z.array(z.string()).optional(),\n relations: z => z.array(z.string()).optional(),\n maxDepth: z => z.number().optional(),\n unidirectional: z => z.boolean().optional(),\n mergeRelations: z => z.boolean().optional(),\n direction: z => z.nativeEnum(Direction).optional(),\n relationPairs: z => z.array(z.tuple([z.string(), z.string()])).optional(),\n zoom: z => z.enum(['enabled', 'disabled', 'enable-on-click']).optional(),\n curve: z => z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n // Skipping a \"variant\" config for now, defaulting to \"gridItem\" in the component\n // For more details, see this comment: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n title: z => z.string().optional(),\n height: z => z.number().optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n loader: async () =>\n import('./components/CatalogGraphCard').then(m =>\n compatWrapper(<m.CatalogGraphCard {...config} />),\n ),\n });\n },\n});\n\nconst CatalogGraphPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n selectedKinds: z => z.array(z.string()).optional(),\n selectedRelations: z => z.array(z.string()).optional(),\n rootEntityRefs: z => z.array(z.string()).optional(),\n maxDepth: z => z.number().optional(),\n unidirectional: z => z.boolean().optional(),\n mergeRelations: z => z.boolean().optional(),\n direction: z => z.nativeEnum(Direction).optional(),\n showFilters: z => z.boolean().optional(),\n curve: z => z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n kinds: z => z.array(z.string()).optional(),\n relations: z => z.array(z.string()).optional(),\n relationPairs: z => z.array(z.tuple([z.string(), z.string()])).optional(),\n zoom: z => z.enum(['enabled', 'disabled', 'enable-on-click']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n path: '/catalog-graph',\n routeRef: convertLegacyRouteRef(catalogGraphRouteRef),\n loader: () =>\n import('./components/CatalogGraphPage').then(m =>\n compatWrapper(<m.CatalogGraphPage {...config} />),\n ),\n });\n },\n});\n\nexport default createFrontendPlugin({\n pluginId: 'catalog-graph',\n info: { packageJson: () => import('../package.json') },\n routes: {\n catalogGraph: convertLegacyRouteRef(catalogGraphRouteRef),\n },\n externalRoutes: {\n catalogEntity: convertLegacyRouteRef(catalogEntityRouteRef),\n },\n extensions: [CatalogGraphPage, CatalogGraphEntityCard],\n});\n\nexport { catalogGraphTranslationRef } from './translation';\n"],"names":[],"mappings":";;;;;;;;AA4BA,MAAM,sBAAA,GAAyB,oBAAoB,iBAAA,CAAkB;AAAA,EACnE,IAAA,EAAM,WAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO,OAAK,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA,EAAS;AAAA,MACzC,SAAA,EAAW,OAAK,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA,EAAS;AAAA,MAC7C,QAAA,EAAU,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS;AAAA,MACnC,cAAA,EAAgB,CAAA,CAAA,KAAK,CAAA,CAAE,OAAA,GAAU,QAAA,EAAS;AAAA,MAC1C,cAAA,EAAgB,CAAA,CAAA,KAAK,CAAA,CAAE,OAAA,GAAU,QAAA,EAAS;AAAA,MAC1C,WAAW,CAAA,CAAA,KAAK,CAAA,CAAE,UAAA,CAAW,SAAS,EAAE,QAAA,EAAS;AAAA,MAC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A+B,CAAA,CAAE,IAAA;AAAA,QAAK,CAAA,CAAA,KAC3C,8BAAc,GAAA,CAAC,CAAA,CAAE,kBAAF,EAAoB,GAAG,QAAQ,CAAE;AAAA;AAClD,KACH,CAAA;AAAA,EACH;AACF,CAAC,CAAA;AAED,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,eAAA;AAAA,EACV,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,uBAAiB,CAAA,EAAE;AAAA,EACrD,MAAA,EAAQ;AAAA,IACN,YAAA,EAAc,sBAAsB,oBAAoB;AAAA,GAC1D;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,aAAA,EAAe,sBAAsB,qBAAqB;AAAA,GAC5D;AAAA,EACA,UAAA,EAAY,CAAC,gBAAA,EAAkB,sBAAsB;AACvD,CAAC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogGraphCard.esm.js","sources":["../../../src/components/CatalogGraphCard/CatalogGraphCard.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 */\n\nimport {\n getCompoundEntityRef,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\nimport { useAnalytics, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n humanizeEntityRef,\n useEntity,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport qs from 'qs';\nimport { MouseEvent, ReactNode, useCallback, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { catalogGraphRouteRef } from '../../routes';\nimport {\n ALL_RELATION_PAIRS,\n Direction,\n EntityNode,\n EntityRelationsGraph,\n EntityRelationsGraphProps,\n} from '../EntityRelationsGraph';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\n/** @public */\nexport type CatalogGraphCardClassKey = 'card' | 'graph';\n\nconst useStyles = makeStyles<Theme, { height: number | undefined }>(\n {\n card: ({ height }) => ({\n display: 'flex',\n flexDirection: 'column',\n maxHeight: height,\n minHeight: height,\n }),\n graph: {\n flex: 1,\n minHeight: 0,\n },\n },\n { name: 'PluginCatalogGraphCatalogGraphCard' },\n);\n\nexport const CatalogGraphCard = (\n props: Partial<EntityRelationsGraphProps> & {\n variant?: InfoCardVariants;\n height?: number;\n title?: string;\n action?: ReactNode;\n },\n) => {\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const {\n variant = 'gridItem',\n relationPairs = ALL_RELATION_PAIRS,\n maxDepth = 1,\n unidirectional = true,\n mergeRelations = true,\n direction = Direction.LEFT_RIGHT,\n kinds,\n relations,\n entityFilter,\n height,\n className,\n action,\n rootEntityNames,\n onNodeClick,\n title = t('catalogGraphCard.title'),\n zoom = 'enable-on-click',\n } = props;\n\n const { entity } = useEntity();\n const entityName = useMemo(() => getCompoundEntityRef(entity), [entity]);\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const catalogGraphRoute = useRouteRef(catalogGraphRouteRef);\n const navigate = useNavigate();\n const classes = useStyles({ height });\n const analytics = useAnalytics();\n\n const defaultOnNodeClick = useCallback(\n (node: EntityNode, _: MouseEvent<unknown>) => {\n const nodeEntityName = parseEntityRef(node.id);\n const path = catalogEntityRoute({\n kind: nodeEntityName.kind.toLocaleLowerCase('en-US'),\n namespace: nodeEntityName.namespace.toLocaleLowerCase('en-US'),\n name: nodeEntityName.name,\n });\n analytics.captureEvent(\n 'click',\n node.entity.metadata.title ?? humanizeEntityRef(nodeEntityName),\n { attributes: { to: path } },\n );\n navigate(path);\n },\n [catalogEntityRoute, navigate, analytics],\n );\n\n const catalogGraphParams = qs.stringify(\n {\n rootEntityRefs: [stringifyEntityRef(entity)],\n maxDepth: maxDepth,\n unidirectional,\n mergeRelations,\n selectedKinds: kinds,\n selectedRelations: relations,\n direction,\n },\n { arrayFormat: 'brackets', addQueryPrefix: true },\n );\n const catalogGraphUrl = `${catalogGraphRoute()}${catalogGraphParams}`;\n\n return (\n <InfoCard\n title={title}\n action={action}\n cardClassName={classes.card}\n variant={variant}\n noPadding\n deepLink={{\n title: t('catalogGraphCard.deepLinkTitle'),\n link: catalogGraphUrl,\n }}\n >\n <EntityRelationsGraph\n {...props}\n rootEntityNames={rootEntityNames || entityName}\n onNodeClick={onNodeClick || defaultOnNodeClick}\n className={className || classes.graph}\n maxDepth={maxDepth}\n unidirectional={unidirectional}\n mergeRelations={mergeRelations}\n direction={direction}\n relationPairs={relationPairs}\n entityFilter={entityFilter}\n zoom={zoom}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8CA,MAAM,
|
|
1
|
+
{"version":3,"file":"CatalogGraphCard.esm.js","sources":["../../../src/components/CatalogGraphCard/CatalogGraphCard.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 */\n\nimport {\n getCompoundEntityRef,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\nimport { useAnalytics, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n humanizeEntityRef,\n useEntity,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport qs from 'qs';\nimport { MouseEvent, ReactNode, useCallback, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { catalogGraphRouteRef } from '../../routes';\nimport {\n ALL_RELATION_PAIRS,\n Direction,\n EntityNode,\n EntityRelationsGraph,\n EntityRelationsGraphProps,\n} from '../EntityRelationsGraph';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\n/** @public */\nexport type CatalogGraphCardClassKey = 'card' | 'graph';\n\nconst useStyles = makeStyles<Theme, { height: number | undefined }>(\n {\n card: ({ height }) => ({\n display: 'flex',\n flexDirection: 'column',\n maxHeight: height,\n minHeight: height,\n }),\n graph: {\n flex: 1,\n minHeight: 0,\n },\n },\n { name: 'PluginCatalogGraphCatalogGraphCard' },\n);\n\nexport const CatalogGraphCard = (\n props: Partial<EntityRelationsGraphProps> & {\n variant?: InfoCardVariants;\n height?: number;\n title?: string;\n action?: ReactNode;\n },\n) => {\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const {\n variant = 'gridItem',\n relationPairs = ALL_RELATION_PAIRS,\n maxDepth = 1,\n unidirectional = true,\n mergeRelations = true,\n direction = Direction.LEFT_RIGHT,\n kinds,\n relations,\n entityFilter,\n height,\n className,\n action,\n rootEntityNames,\n onNodeClick,\n title = t('catalogGraphCard.title'),\n zoom = 'enable-on-click',\n } = props;\n\n const { entity } = useEntity();\n const entityName = useMemo(() => getCompoundEntityRef(entity), [entity]);\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const catalogGraphRoute = useRouteRef(catalogGraphRouteRef);\n const navigate = useNavigate();\n const classes = useStyles({ height });\n const analytics = useAnalytics();\n\n const defaultOnNodeClick = useCallback(\n (node: EntityNode, _: MouseEvent<unknown>) => {\n const nodeEntityName = parseEntityRef(node.id);\n const path = catalogEntityRoute({\n kind: nodeEntityName.kind.toLocaleLowerCase('en-US'),\n namespace: nodeEntityName.namespace.toLocaleLowerCase('en-US'),\n name: nodeEntityName.name,\n });\n analytics.captureEvent(\n 'click',\n node.entity.metadata.title ?? humanizeEntityRef(nodeEntityName),\n { attributes: { to: path } },\n );\n navigate(path);\n },\n [catalogEntityRoute, navigate, analytics],\n );\n\n const catalogGraphParams = qs.stringify(\n {\n rootEntityRefs: [stringifyEntityRef(entity)],\n maxDepth: maxDepth,\n unidirectional,\n mergeRelations,\n selectedKinds: kinds,\n selectedRelations: relations,\n direction,\n },\n { arrayFormat: 'brackets', addQueryPrefix: true },\n );\n const catalogGraphUrl = `${catalogGraphRoute()}${catalogGraphParams}`;\n\n return (\n <InfoCard\n title={title}\n action={action}\n cardClassName={classes.card}\n variant={variant}\n noPadding\n deepLink={{\n title: t('catalogGraphCard.deepLinkTitle'),\n link: catalogGraphUrl,\n }}\n >\n <EntityRelationsGraph\n {...props}\n rootEntityNames={rootEntityNames || entityName}\n onNodeClick={onNodeClick || defaultOnNodeClick}\n className={className || classes.graph}\n maxDepth={maxDepth}\n unidirectional={unidirectional}\n mergeRelations={mergeRelations}\n direction={direction}\n relationPairs={relationPairs}\n entityFilter={entityFilter}\n zoom={zoom}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8CA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB;AAAA,IACE,IAAA,EAAM,CAAC,EAAE,MAAA,EAAO,MAAO;AAAA,MACrB,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,QAAA;AAAA,MACf,SAAA,EAAW,MAAA;AAAA,MACX,SAAA,EAAW;AAAA,KACb,CAAA;AAAA,IACA,KAAA,EAAO;AAAA,MACL,IAAA,EAAM,CAAA;AAAA,MACN,SAAA,EAAW;AAAA;AACb,GACF;AAAA,EACA,EAAE,MAAM,oCAAA;AACV,CAAA;AAEO,MAAM,gBAAA,GAAmB,CAC9B,KAAA,KA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,SAAA,EAAW,aAAa,OAAA,CAAQ,KAAA;AAAA,UAChC,QAAA;AAAA,UACA,cAAA;AAAA,UACA,cAAA;AAAA,UACA,SAAA;AAAA,UACA,aAAA;AAAA,UACA,YAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogGraphPage.esm.js","sources":["../../../src/components/CatalogGraphPage/CatalogGraphPage.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 */\n\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport { useAnalytics, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n entityRouteRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport Grid from '@material-ui/core/Grid';\nimport Paper from '@material-ui/core/Paper';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport ZoomOutMap from '@material-ui/icons/ZoomOutMap';\nimport ToggleButton from '@material-ui/lab/ToggleButton';\nimport { MouseEvent, useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n ALL_RELATION_PAIRS,\n Direction,\n EntityNode,\n EntityRelationsGraph,\n EntityRelationsGraphProps,\n} from '../EntityRelationsGraph';\nimport { CurveFilter } from './CurveFilter';\nimport { DirectionFilter } from './DirectionFilter';\nimport { MaxDepthFilter } from './MaxDepthFilter';\nimport { SelectedKindsFilter } from './SelectedKindsFilter';\nimport { SelectedRelationsFilter } from './SelectedRelationsFilter';\nimport { SwitchFilter } from './SwitchFilter';\nimport { useCatalogGraphPage } from './useCatalogGraphPage';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\n/** @public */\nexport type CatalogGraphPageClassKey =\n | 'content'\n | 'container'\n | 'fullHeight'\n | 'graphWrapper'\n | 'graph'\n | 'legend'\n | 'filters';\n\nconst useStyles = makeStyles(\n theme => ({\n content: {\n minHeight: 0,\n },\n container: {\n height: '100%',\n maxHeight: '100%',\n minHeight: 0,\n },\n fullHeight: {\n maxHeight: '100%',\n display: 'flex',\n minHeight: 0,\n },\n graphWrapper: {\n position: 'relative',\n flex: 1,\n minHeight: 0,\n display: 'flex',\n },\n graph: {\n flex: 1,\n minHeight: 0,\n },\n legend: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n padding: theme.spacing(1),\n '& .icon': {\n verticalAlign: 'bottom',\n },\n },\n filters: {\n display: 'grid',\n gridGap: theme.spacing(1),\n gridAutoRows: 'auto',\n [theme.breakpoints.up('lg')]: {\n display: 'block',\n },\n [theme.breakpoints.only('md')]: {\n gridTemplateColumns: 'repeat(3, 1fr)',\n },\n [theme.breakpoints.only('sm')]: {\n gridTemplateColumns: 'repeat(2, 1fr)',\n },\n [theme.breakpoints.down('xs')]: {\n gridTemplateColumns: 'repeat(1, 1fr)',\n },\n },\n }),\n { name: 'PluginCatalogGraphCatalogGraphPage' },\n);\n\nexport const CatalogGraphPage = (\n props: {\n initialState?: {\n selectedRelations?: string[];\n selectedKinds?: string[];\n rootEntityRefs?: string[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n direction?: Direction;\n showFilters?: boolean;\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n };\n } & Partial<EntityRelationsGraphProps>,\n) => {\n const {\n relationPairs = ALL_RELATION_PAIRS,\n initialState,\n entityFilter,\n } = props;\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const navigate = useNavigate();\n const classes = useStyles();\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const {\n maxDepth,\n setMaxDepth,\n selectedKinds,\n setSelectedKinds,\n selectedRelations,\n setSelectedRelations,\n unidirectional,\n setUnidirectional,\n mergeRelations,\n setMergeRelations,\n direction,\n setDirection,\n curve,\n setCurve,\n rootEntityNames,\n setRootEntityNames,\n showFilters,\n toggleShowFilters,\n } = useCatalogGraphPage({ initialState });\n const analytics = useAnalytics();\n const onNodeClick = useCallback(\n (node: EntityNode, event: MouseEvent<unknown>) => {\n const nodeEntityName = parseEntityRef(node.id);\n\n if (event.shiftKey) {\n const path = catalogEntityRoute({\n kind: nodeEntityName.kind.toLocaleLowerCase('en-US'),\n namespace: nodeEntityName.namespace.toLocaleLowerCase('en-US'),\n name: nodeEntityName.name,\n });\n\n analytics.captureEvent(\n 'click',\n node.entity.metadata.title ?? humanizeEntityRef(nodeEntityName),\n { attributes: { to: path } },\n );\n navigate(path);\n } else {\n analytics.captureEvent(\n 'click',\n node.entity.metadata.title ?? humanizeEntityRef(nodeEntityName),\n );\n setRootEntityNames([nodeEntityName]);\n }\n },\n [catalogEntityRoute, navigate, setRootEntityNames, analytics],\n );\n\n return (\n <Page themeId=\"home\">\n <Header\n title={t('catalogGraphPage.title')}\n subtitle={rootEntityNames.map(e => humanizeEntityRef(e)).join(', ')}\n />\n <Content stretch className={classes.content}>\n <ContentHeader\n titleComponent={\n <ToggleButton\n value=\"show filters\"\n selected={showFilters}\n onChange={() => toggleShowFilters()}\n >\n <FilterListIcon /> {t('catalogGraphPage.filterToggleButtonTitle')}\n </ToggleButton>\n }\n >\n <SupportButton>\n {t('catalogGraphPage.supportButtonDescription')}\n </SupportButton>\n </ContentHeader>\n <Grid container alignItems=\"stretch\" className={classes.container}>\n {showFilters && (\n <Grid item xs={12} lg={2} className={classes.filters}>\n <MaxDepthFilter value={maxDepth} onChange={setMaxDepth} />\n <SelectedKindsFilter\n value={selectedKinds}\n onChange={setSelectedKinds}\n />\n <SelectedRelationsFilter\n value={selectedRelations}\n onChange={setSelectedRelations}\n relationPairs={relationPairs}\n />\n <DirectionFilter value={direction} onChange={setDirection} />\n <CurveFilter value={curve} onChange={setCurve} />\n <SwitchFilter\n value={unidirectional}\n onChange={setUnidirectional}\n label={t('catalogGraphPage.simplifiedSwitchLabel')}\n />\n <SwitchFilter\n value={mergeRelations}\n onChange={setMergeRelations}\n label={t('catalogGraphPage.mergeRelationsSwitchLabel')}\n />\n </Grid>\n )}\n <Grid item xs className={classes.fullHeight}>\n <Paper className={classes.graphWrapper}>\n <Typography\n variant=\"caption\"\n color=\"textSecondary\"\n display=\"block\"\n className={classes.legend}\n >\n <ZoomOutMap className=\"icon\" />{' '}\n {t('catalogGraphPage.zoomOutDescription')}\n </Typography>\n <EntityRelationsGraph\n {...props}\n rootEntityNames={rootEntityNames}\n maxDepth={maxDepth}\n kinds={\n selectedKinds && selectedKinds.length > 0\n ? selectedKinds\n : undefined\n }\n relations={\n selectedRelations && selectedRelations.length > 0\n ? selectedRelations\n : undefined\n }\n mergeRelations={mergeRelations}\n unidirectional={unidirectional}\n onNodeClick={onNodeClick}\n direction={direction}\n relationPairs={relationPairs}\n entityFilter={entityFilter}\n className={classes.graph}\n zoom=\"enabled\"\n curve={curve}\n />\n </Paper>\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,SAAW,EAAA;AAAA,KACb;AAAA,IACA,SAAW,EAAA;AAAA,MACT,MAAQ,EAAA,MAAA;AAAA,MACR,SAAW,EAAA,MAAA;AAAA,MACX,SAAW,EAAA;AAAA,KACb;AAAA,IACA,UAAY,EAAA;AAAA,MACV,SAAW,EAAA,MAAA;AAAA,MACX,OAAS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EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAE,EAAA,IAAA,EAAC,SAAW,EAAA,OAAA,CAAQ,UAC/B,EAAA,QAAA,kBAAA,IAAA,CAAC,KAAM,EAAA,EAAA,SAAA,EAAW,QAAQ,YACxB,EAAA,QAAA,EAAA;AAAA,0BAAA,IAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,OAAQ,EAAA,SAAA;AAAA,cACR,KAAM,EAAA,eAAA;AAAA,cACN,OAAQ,EAAA,OAAA;AAAA,cACR,WAAW,OAAQ,CAAA,MAAA;AAAA,cAEnB,QAAA,EAAA;AAAA,gCAAC,GAAA,CAAA,UAAA,EAAA,EAAW,WAAU,MAAO,EAAA,CAAA;AAAA,gBAAG,GAAA;AAAA,gBAC/B,EAAE,qCAAqC;AAAA;AAAA;AAAA,WAC1C;AAAA,0BACA,GAAA;AAAA,YAAC,oBAAA;AAAA,YAAA;AAAA,cACE,GAAG,KAAA;AAAA,cACJ,eAAA;AAAA,cACA,QAAA;AAAA,cACA,KACE,EAAA,aAAA,IAAiB,aAAc,CAAA,MAAA,GAAS,IACpC,aACA,GAAA,KAAA,CAAA;AAAA,cAEN,SACE,EAAA,iBAAA,IAAqB,iBAAkB,CAAA,MAAA,GAAS,IAC5C,iBACA,GAAA,KAAA,CAAA;AAAA,cAEN,cAAA;AAAA,cACA,cAAA;AAAA,cACA,WAAA;AAAA,cACA,SAAA;AAAA,cACA,aAAA;AAAA,cACA,YAAA;AAAA,cACA,WAAW,OAAQ,CAAA,KAAA;AAAA,cACnB,IAAK,EAAA,SAAA;AAAA,cACL;AAAA;AAAA;AACF,SAAA,EACF,CACF,EAAA;AAAA,OACF,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"CatalogGraphPage.esm.js","sources":["../../../src/components/CatalogGraphPage/CatalogGraphPage.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 */\n\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport { useAnalytics, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n entityRouteRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport Grid from '@material-ui/core/Grid';\nimport Paper from '@material-ui/core/Paper';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport ZoomOutMap from '@material-ui/icons/ZoomOutMap';\nimport ToggleButton from '@material-ui/lab/ToggleButton';\nimport { MouseEvent, useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n ALL_RELATION_PAIRS,\n Direction,\n EntityNode,\n EntityRelationsGraph,\n EntityRelationsGraphProps,\n} from '../EntityRelationsGraph';\nimport { CurveFilter } from './CurveFilter';\nimport { DirectionFilter } from './DirectionFilter';\nimport { MaxDepthFilter } from './MaxDepthFilter';\nimport { SelectedKindsFilter } from './SelectedKindsFilter';\nimport { SelectedRelationsFilter } from './SelectedRelationsFilter';\nimport { SwitchFilter } from './SwitchFilter';\nimport { useCatalogGraphPage } from './useCatalogGraphPage';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\n/** @public */\nexport type CatalogGraphPageClassKey =\n | 'content'\n | 'container'\n | 'fullHeight'\n | 'graphWrapper'\n | 'graph'\n | 'legend'\n | 'filters';\n\nconst useStyles = makeStyles(\n theme => ({\n content: {\n minHeight: 0,\n },\n container: {\n height: '100%',\n maxHeight: '100%',\n minHeight: 0,\n },\n fullHeight: {\n maxHeight: '100%',\n display: 'flex',\n minHeight: 0,\n },\n graphWrapper: {\n position: 'relative',\n flex: 1,\n minHeight: 0,\n display: 'flex',\n },\n graph: {\n flex: 1,\n minHeight: 0,\n },\n legend: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n padding: theme.spacing(1),\n '& .icon': {\n verticalAlign: 'bottom',\n },\n },\n filters: {\n display: 'grid',\n gridGap: theme.spacing(1),\n gridAutoRows: 'auto',\n [theme.breakpoints.up('lg')]: {\n display: 'block',\n },\n [theme.breakpoints.only('md')]: {\n gridTemplateColumns: 'repeat(3, 1fr)',\n },\n [theme.breakpoints.only('sm')]: {\n gridTemplateColumns: 'repeat(2, 1fr)',\n },\n [theme.breakpoints.down('xs')]: {\n gridTemplateColumns: 'repeat(1, 1fr)',\n },\n },\n }),\n { name: 'PluginCatalogGraphCatalogGraphPage' },\n);\n\nexport const CatalogGraphPage = (\n props: {\n initialState?: {\n selectedRelations?: string[];\n selectedKinds?: string[];\n rootEntityRefs?: string[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n direction?: Direction;\n showFilters?: boolean;\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n };\n } & Partial<EntityRelationsGraphProps>,\n) => {\n const {\n relationPairs = ALL_RELATION_PAIRS,\n initialState,\n entityFilter,\n } = props;\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const navigate = useNavigate();\n const classes = useStyles();\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const {\n maxDepth,\n setMaxDepth,\n selectedKinds,\n setSelectedKinds,\n selectedRelations,\n setSelectedRelations,\n unidirectional,\n setUnidirectional,\n mergeRelations,\n setMergeRelations,\n direction,\n setDirection,\n curve,\n setCurve,\n rootEntityNames,\n setRootEntityNames,\n showFilters,\n toggleShowFilters,\n } = useCatalogGraphPage({ initialState });\n const analytics = useAnalytics();\n const onNodeClick = useCallback(\n (node: EntityNode, event: MouseEvent<unknown>) => {\n const nodeEntityName = parseEntityRef(node.id);\n\n if (event.shiftKey) {\n const path = catalogEntityRoute({\n kind: nodeEntityName.kind.toLocaleLowerCase('en-US'),\n namespace: nodeEntityName.namespace.toLocaleLowerCase('en-US'),\n name: nodeEntityName.name,\n });\n\n analytics.captureEvent(\n 'click',\n node.entity.metadata.title ?? humanizeEntityRef(nodeEntityName),\n { attributes: { to: path } },\n );\n navigate(path);\n } else {\n analytics.captureEvent(\n 'click',\n node.entity.metadata.title ?? humanizeEntityRef(nodeEntityName),\n );\n setRootEntityNames([nodeEntityName]);\n }\n },\n [catalogEntityRoute, navigate, setRootEntityNames, analytics],\n );\n\n return (\n <Page themeId=\"home\">\n <Header\n title={t('catalogGraphPage.title')}\n subtitle={rootEntityNames.map(e => humanizeEntityRef(e)).join(', ')}\n />\n <Content stretch className={classes.content}>\n <ContentHeader\n titleComponent={\n <ToggleButton\n value=\"show filters\"\n selected={showFilters}\n onChange={() => toggleShowFilters()}\n >\n <FilterListIcon /> {t('catalogGraphPage.filterToggleButtonTitle')}\n </ToggleButton>\n }\n >\n <SupportButton>\n {t('catalogGraphPage.supportButtonDescription')}\n </SupportButton>\n </ContentHeader>\n <Grid container alignItems=\"stretch\" className={classes.container}>\n {showFilters && (\n <Grid item xs={12} lg={2} className={classes.filters}>\n <MaxDepthFilter value={maxDepth} onChange={setMaxDepth} />\n <SelectedKindsFilter\n value={selectedKinds}\n onChange={setSelectedKinds}\n />\n <SelectedRelationsFilter\n value={selectedRelations}\n onChange={setSelectedRelations}\n relationPairs={relationPairs}\n />\n <DirectionFilter value={direction} onChange={setDirection} />\n <CurveFilter value={curve} onChange={setCurve} />\n <SwitchFilter\n value={unidirectional}\n onChange={setUnidirectional}\n label={t('catalogGraphPage.simplifiedSwitchLabel')}\n />\n <SwitchFilter\n value={mergeRelations}\n onChange={setMergeRelations}\n label={t('catalogGraphPage.mergeRelationsSwitchLabel')}\n />\n </Grid>\n )}\n <Grid item xs className={classes.fullHeight}>\n <Paper className={classes.graphWrapper}>\n <Typography\n variant=\"caption\"\n color=\"textSecondary\"\n display=\"block\"\n className={classes.legend}\n >\n <ZoomOutMap className=\"icon\" />{' '}\n {t('catalogGraphPage.zoomOutDescription')}\n </Typography>\n <EntityRelationsGraph\n {...props}\n rootEntityNames={rootEntityNames}\n maxDepth={maxDepth}\n kinds={\n selectedKinds && selectedKinds.length > 0\n ? selectedKinds\n : undefined\n }\n relations={\n selectedRelations && selectedRelations.length > 0\n ? selectedRelations\n : undefined\n }\n mergeRelations={mergeRelations}\n unidirectional={unidirectional}\n onNodeClick={onNodeClick}\n direction={direction}\n relationPairs={relationPairs}\n entityFilter={entityFilter}\n className={classes.graph}\n zoom=\"enabled\"\n curve={curve}\n />\n </Paper>\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,SAAA,EAAW;AAAA,KACb;AAAA,IACA,SAAA,EAAW;AAAA,MACT,MAAA,EAAQ,MAAA;AAAA,MACR,SAAA,EAAW,MAAA;AAAA,MACX,SAAA,EAAW;AAAA,KACb;AAAA,IACA,UAAA,EAAY;AAAA,MACV,SAAA,EAAW,MAAA;AAAA,MACX,OAAA,EAAS,MAAA;AAAA,MACT,SAAA,EAAW;AAAA,KACb;AAAA,IACA,YAAA,EAAc;AAAA,MACZ,QAAA,EAAU,UAAA;AAAA,MACV,IAAA,EAAM,CAAA;AAAA,MACN,SAAA,EAAW,CAAA;AAAA,MACX,OAAA,EAAS;AAAA,KACX;AAAA,IACA,KAAA,EAAO;AAAA,MACL,IAAA,EAAM,CAAA;AAAA,MACN,SAAA,EAAW;AAAA,KACb;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,QAAA,EAAU,UAAA;AAAA,MACV,MA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A,cACR,WAAW,OAAA,CAAQ,MAAA;AAAA,cAEnB,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,UAAA,EAAA,EAAW,WAAU,MAAA,EAAO,CAAA;AAAA,gBAAG,GAAA;AAAA,gBAC/B,EAAE,qCAAqC;AAAA;AAAA;AAAA,WAC1C;AAAA,0BACA,GAAA;AAAA,YAAC,oBAAA;AAAA,YAAA;AAAA,cACE,GAAG,KAAA;AAAA,cACJ,eAAA;AAAA,cACA,QAAA;AAAA,cACA,KAAA,EACE,aAAA,IAAiB,aAAA,CAAc,MAAA,GAAS,IACpC,aAAA,GACA,MAAA;AAAA,cAEN,SAAA,EACE,iBAAA,IAAqB,iBAAA,CAAkB,MAAA,GAAS,IAC5C,iBAAA,GACA,MAAA;AAAA,cAEN,cAAA;AAAA,cACA,cAAA;AAAA,cACA,WAAA;AAAA,cACA,SAAA;AAAA,cACA,aAAA;AAAA,cACA,YAAA;AAAA,cACA,WAAW,OAAA,CAAQ,KAAA;AAAA,cACnB,IAAA,EAAK,SAAA;AAAA,cACL;AAAA;AAAA;AACF,SAAA,EACF,CAAA,EACF;AAAA,OAAA,EACF;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/CurveFilter.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 { Select, SelectedItems } from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport { useCallback } from 'react';\nimport { catalogGraphTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\ntype Curve = 'curveStepBefore' | 'curveMonotoneX';\n\nexport type Props = {\n value: Curve;\n onChange: (value: 'curveStepBefore' | 'curveMonotoneX') => void;\n};\n\nconst curves: Array<Curve> = ['curveMonotoneX', 'curveStepBefore'];\n\nexport const CurveFilter = ({ value, onChange }: Props) => {\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const CURVE_DISPLAY_NAMES: Record<Curve, string> = {\n curveMonotoneX: t('catalogGraphPage.curveFilter.curveMonotoneX'),\n curveStepBefore: t('catalogGraphPage.curveFilter.curveStepBefore'),\n };\n\n const handleChange = useCallback(\n (v: SelectedItems) => onChange(v as Curve),\n [onChange],\n );\n\n return (\n <Box pb={1} pt={1}>\n <Select\n label={t('catalogGraphPage.curveFilter.title')}\n selected={value}\n items={curves.map(v => ({\n label: CURVE_DISPLAY_NAMES[v],\n value: v,\n }))}\n onChange={handleChange}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA4BA,MAAM,MAAA,GAAuB,CAAC,gBAAA,EAAkB,iBAAiB,CAAA;AAE1D,MAAM,
|
|
1
|
+
{"version":3,"file":"CurveFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/CurveFilter.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 { Select, SelectedItems } from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport { useCallback } from 'react';\nimport { catalogGraphTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\ntype Curve = 'curveStepBefore' | 'curveMonotoneX';\n\nexport type Props = {\n value: Curve;\n onChange: (value: 'curveStepBefore' | 'curveMonotoneX') => void;\n};\n\nconst curves: Array<Curve> = ['curveMonotoneX', 'curveStepBefore'];\n\nexport const CurveFilter = ({ value, onChange }: Props) => {\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const CURVE_DISPLAY_NAMES: Record<Curve, string> = {\n curveMonotoneX: t('catalogGraphPage.curveFilter.curveMonotoneX'),\n curveStepBefore: t('catalogGraphPage.curveFilter.curveStepBefore'),\n };\n\n const handleChange = useCallback(\n (v: SelectedItems) => onChange(v as Curve),\n [onChange],\n );\n\n return (\n <Box pb={1} pt={1}>\n <Select\n label={t('catalogGraphPage.curveFilter.title')}\n selected={value}\n items={curves.map(v => ({\n label: CURVE_DISPLAY_NAMES[v],\n value: v,\n }))}\n onChange={handleChange}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA4BA,MAAM,MAAA,GAAuB,CAAC,gBAAA,EAAkB,iBAAiB,CAAA;AAE1D,MAAM,WAAA,GAAc,CAAC,EAAE,KAAA,EAAO,UAAS,KAAa;AACzD,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,0BAA0B,CAAA;AAC1D,EAAA,MAAM,mBAAA,GAA6C;AAAA,IACjD,cAAA,EAAgB,EAAE,6CAA6C,CAAA;AAAA,IAC/D,eAAA,EAAiB,EAAE,8CAA8C;AAAA,GACnE;AAEA,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,CAAA,KAAqB,QAAA,CAAS,CAAU,CAAA;AAAA,IACzC,CAAC,QAAQ;AAAA,GACX;AAEA,EAAA,uBACE,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EAAG,IAAI,CAAA,EACd,QAAA,kBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,oCAAoC,CAAA;AAAA,MAC7C,QAAA,EAAU,KAAA;AAAA,MACV,KAAA,EAAO,MAAA,CAAO,GAAA,CAAI,CAAA,CAAA,MAAM;AAAA,QACtB,KAAA,EAAO,oBAAoB,CAAC,CAAA;AAAA,QAC5B,KAAA,EAAO;AAAA,OACT,CAAE,CAAA;AAAA,MACF,QAAA,EAAU;AAAA;AAAA,GACZ,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/DirectionFilter.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 { Select, SelectedItems } from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport { useCallback } from 'react';\nimport { Direction } from '../EntityRelationsGraph';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\nexport type Props = {\n value: Direction;\n onChange: (value: Direction) => void;\n};\n\nexport const DirectionFilter = ({ value, onChange }: Props) => {\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const DIRECTION_DISPLAY_NAMES = {\n [Direction.LEFT_RIGHT]: t('catalogGraphPage.directionFilter.leftToRight'),\n [Direction.RIGHT_LEFT]: t('catalogGraphPage.directionFilter.rightToLeft'),\n [Direction.TOP_BOTTOM]: t('catalogGraphPage.directionFilter.topToBottom'),\n [Direction.BOTTOM_TOP]: t('catalogGraphPage.directionFilter.bottomToTop'),\n };\n const handleChange = useCallback(\n (v: SelectedItems) => onChange(v as Direction),\n [onChange],\n );\n\n return (\n <Box pb={1} pt={1}>\n <Select\n label={t('catalogGraphPage.directionFilter.title')}\n selected={value}\n items={Object.values(Direction).map(v => ({\n label: DIRECTION_DISPLAY_NAMES[v],\n value: v,\n }))}\n onChange={handleChange}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA2BO,MAAM,
|
|
1
|
+
{"version":3,"file":"DirectionFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/DirectionFilter.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 { Select, SelectedItems } from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport { useCallback } from 'react';\nimport { Direction } from '../EntityRelationsGraph';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\nexport type Props = {\n value: Direction;\n onChange: (value: Direction) => void;\n};\n\nexport const DirectionFilter = ({ value, onChange }: Props) => {\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n const DIRECTION_DISPLAY_NAMES = {\n [Direction.LEFT_RIGHT]: t('catalogGraphPage.directionFilter.leftToRight'),\n [Direction.RIGHT_LEFT]: t('catalogGraphPage.directionFilter.rightToLeft'),\n [Direction.TOP_BOTTOM]: t('catalogGraphPage.directionFilter.topToBottom'),\n [Direction.BOTTOM_TOP]: t('catalogGraphPage.directionFilter.bottomToTop'),\n };\n const handleChange = useCallback(\n (v: SelectedItems) => onChange(v as Direction),\n [onChange],\n );\n\n return (\n <Box pb={1} pt={1}>\n <Select\n label={t('catalogGraphPage.directionFilter.title')}\n selected={value}\n items={Object.values(Direction).map(v => ({\n label: DIRECTION_DISPLAY_NAMES[v],\n value: v,\n }))}\n onChange={handleChange}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA2BO,MAAM,eAAA,GAAkB,CAAC,EAAE,KAAA,EAAO,UAAS,KAAa;AAC7D,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,0BAA0B,CAAA;AAC1D,EAAA,MAAM,uBAAA,GAA0B;AAAA,IAC9B,CAAC,SAAA,CAAU,UAAU,GAAG,EAAE,8CAA8C,CAAA;AAAA,IACxE,CAAC,SAAA,CAAU,UAAU,GAAG,EAAE,8CAA8C,CAAA;AAAA,IACxE,CAAC,SAAA,CAAU,UAAU,GAAG,EAAE,8CAA8C,CAAA;AAAA,IACxE,CAAC,SAAA,CAAU,UAAU,GAAG,EAAE,8CAA8C;AAAA,GAC1E;AACA,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,CAAA,KAAqB,QAAA,CAAS,CAAc,CAAA;AAAA,IAC7C,CAAC,QAAQ;AAAA,GACX;AAEA,EAAA,uBACE,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EAAG,IAAI,CAAA,EACd,QAAA,kBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,wCAAwC,CAAA;AAAA,MACjD,QAAA,EAAU,KAAA;AAAA,MACV,OAAO,MAAA,CAAO,MAAA,CAAO,SAAS,CAAA,CAAE,IAAI,CAAA,CAAA,MAAM;AAAA,QACxC,KAAA,EAAO,wBAAwB,CAAC,CAAA;AAAA,QAChC,KAAA,EAAO;AAAA,OACT,CAAE,CAAA;AAAA,MACF,QAAA,EAAU;AAAA;AAAA,GACZ,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaxDepthFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/MaxDepthFilter.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 { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ClearIcon from '@material-ui/icons/Clear';\nimport { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport { catalogGraphTranslationRef } from '../../translation';\n\nexport type Props = {\n value: number;\n onChange: (value: number) => void;\n};\n\n/** @public */\nexport type MaxDepthFilterClassKey = 'formControl';\n\nconst useStyles = makeStyles(\n {\n formControl: {\n width: '100%',\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphMaxDepthFilter' },\n);\n\nexport const MaxDepthFilter = ({ value, onChange }: Props) => {\n const classes = useStyles();\n const onChangeRef = useRef(onChange);\n const [currentValue, setCurrentValue] = useState(value);\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n\n // Keep a fresh reference to the latest callback\n useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n // If the value changes externally, update ourselves\n useEffect(() => {\n setCurrentValue(value);\n }, [value]);\n\n // When the entered text changes, update ourselves and communicate externally\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n const newValueNumeric = Number(event.target.value);\n const newValue =\n Number.isFinite(newValueNumeric) && newValueNumeric > 0\n ? newValueNumeric\n : Number.POSITIVE_INFINITY;\n setCurrentValue(newValue);\n onChangeRef.current(newValue);\n }, []);\n\n const reset = useCallback(() => {\n setCurrentValue(Number.POSITIVE_INFINITY);\n onChangeRef.current(Number.POSITIVE_INFINITY);\n }, [onChangeRef]);\n\n return (\n <Box pb={1} pt={1}>\n <FormControl variant=\"outlined\" className={classes.formControl}>\n <Typography variant=\"button\">\n {t('catalogGraphPage.maxDepthFilter.title')}\n </Typography>\n <OutlinedInput\n type=\"number\"\n placeholder={t('catalogGraphPage.maxDepthFilter.inputPlaceholder')}\n value={Number.isFinite(currentValue) ? String(currentValue) : ''}\n onChange={handleChange}\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label={t(\n 'catalogGraphPage.maxDepthFilter.clearButtonAriaLabel',\n )}\n onClick={reset}\n edge=\"end\"\n >\n <ClearIcon />\n </IconButton>\n </InputAdornment>\n }\n inputProps={{\n 'aria-label': 'maxp',\n }}\n labelWidth={0}\n />\n </FormControl>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAmCA,MAAM,
|
|
1
|
+
{"version":3,"file":"MaxDepthFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/MaxDepthFilter.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 { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ClearIcon from '@material-ui/icons/Clear';\nimport { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport { catalogGraphTranslationRef } from '../../translation';\n\nexport type Props = {\n value: number;\n onChange: (value: number) => void;\n};\n\n/** @public */\nexport type MaxDepthFilterClassKey = 'formControl';\n\nconst useStyles = makeStyles(\n {\n formControl: {\n width: '100%',\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphMaxDepthFilter' },\n);\n\nexport const MaxDepthFilter = ({ value, onChange }: Props) => {\n const classes = useStyles();\n const onChangeRef = useRef(onChange);\n const [currentValue, setCurrentValue] = useState(value);\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n\n // Keep a fresh reference to the latest callback\n useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n // If the value changes externally, update ourselves\n useEffect(() => {\n setCurrentValue(value);\n }, [value]);\n\n // When the entered text changes, update ourselves and communicate externally\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n const newValueNumeric = Number(event.target.value);\n const newValue =\n Number.isFinite(newValueNumeric) && newValueNumeric > 0\n ? newValueNumeric\n : Number.POSITIVE_INFINITY;\n setCurrentValue(newValue);\n onChangeRef.current(newValue);\n }, []);\n\n const reset = useCallback(() => {\n setCurrentValue(Number.POSITIVE_INFINITY);\n onChangeRef.current(Number.POSITIVE_INFINITY);\n }, [onChangeRef]);\n\n return (\n <Box pb={1} pt={1}>\n <FormControl variant=\"outlined\" className={classes.formControl}>\n <Typography variant=\"button\">\n {t('catalogGraphPage.maxDepthFilter.title')}\n </Typography>\n <OutlinedInput\n type=\"number\"\n placeholder={t('catalogGraphPage.maxDepthFilter.inputPlaceholder')}\n value={Number.isFinite(currentValue) ? String(currentValue) : ''}\n onChange={handleChange}\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label={t(\n 'catalogGraphPage.maxDepthFilter.clearButtonAriaLabel',\n )}\n onClick={reset}\n edge=\"end\"\n >\n <ClearIcon />\n </IconButton>\n </InputAdornment>\n }\n inputProps={{\n 'aria-label': 'maxp',\n }}\n labelWidth={0}\n />\n </FormControl>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAmCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB;AAAA,IACE,WAAA,EAAa;AAAA,MACX,KAAA,EAAO,MAAA;AAAA,MACP,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,EAAE,MAAM,kCAAA;AACV,CAAA;AAEO,MAAM,cAAA,GAAiB,CAAC,EAAE,KAAA,EAAO,UAAS,KAAa;AAC5D,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,WAAA,GAAc,OAAO,QAAQ,CAAA;AACnC,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAS,KAAK,CAAA;AACtD,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,0BAA0B,CAAA;AAG1D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,WAAA,CAAY,OAAA,GAAU,QAAA;AAAA,EACxB,CAAA,EAAG,CAAC,QAAQ,CAAC,CAAA;AAGb,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,eAAA,CAAgB,KAAK,CAAA;AAAA,EACvB,CAAA,EAAG,CAAC,KAAK,CAAC,CAAA;AAGV,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,CAAC,KAAA,KAAyC;AACzE,IAAA,MAAM,eAAA,GAAkB,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAK,CAAA;AACjD,IAAA,MAAM,QAAA,GACJ,OAAO,QAAA,CAAS,eAAe,KAAK,eAAA,GAAkB,CAAA,GAClD,kBACA,MAAA,CAAO,iBAAA;AACb,IAAA,eAAA,CAAgB,QAAQ,CAAA;AACxB,IAAA,WAAA,CAAY,QAAQ,QAAQ,CAAA;AAAA,EAC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;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectedKindsFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/SelectedKindsFilter.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 { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { useCallback, useEffect, useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { catalogGraphTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\n/** @public */\nexport type SelectedKindsFilterClassKey = 'formControl';\n\nconst useStyles = makeStyles(\n {\n formControl: {\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphSelectedKindsFilter' },\n);\n\nexport type Props = {\n value: string[] | undefined;\n onChange: (value: string[] | undefined) => void;\n};\n\nexport const SelectedKindsFilter = ({ value, onChange }: Props) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n\n const { error, value: kinds } = useAsync(async () => {\n return await catalogApi\n .getEntityFacets({ facets: ['kind'] })\n .then(response => response.facets.kind?.map(f => f.value).sort() || []);\n });\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load entity kinds`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n const normalizedKinds = useMemo(\n () => (kinds ? kinds.map(k => k.toLocaleLowerCase('en-US')) : kinds),\n [kinds],\n );\n\n const handleChange = useCallback(\n (_: unknown, v: string[]) => {\n onChange(\n normalizedKinds && normalizedKinds.every(r => v.includes(r))\n ? undefined\n : v,\n );\n },\n [normalizedKinds, onChange],\n );\n\n const handleEmpty = useCallback(() => {\n onChange(value?.length ? value : undefined);\n }, [value, onChange]);\n\n if (!kinds?.length || !normalizedKinds?.length || error) {\n return <></>;\n }\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\">\n {t('catalogGraphPage.selectedKindsFilter.title')}\n </Typography>\n <Autocomplete\n className={classes.formControl}\n multiple\n limitTags={4}\n disableCloseOnSelect\n aria-label={t('catalogGraphPage.selectedKindsFilter.title')}\n options={normalizedKinds}\n value={value ?? normalizedKinds}\n getOptionLabel={k => kinds[normalizedKinds.indexOf(k)] ?? k}\n onChange={handleChange}\n onBlur={handleEmpty}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={<CheckBoxOutlineBlankIcon fontSize=\"small\" />}\n checkedIcon={<CheckBoxIcon fontSize=\"small\" />}\n checked={selected}\n />\n }\n label={kinds[normalizedKinds.indexOf(option)] ?? option}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon data-testid=\"selected-kinds-expand\" />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAM,
|
|
1
|
+
{"version":3,"file":"SelectedKindsFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/SelectedKindsFilter.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 { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { useCallback, useEffect, useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { catalogGraphTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\n/** @public */\nexport type SelectedKindsFilterClassKey = 'formControl';\n\nconst useStyles = makeStyles(\n {\n formControl: {\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphSelectedKindsFilter' },\n);\n\nexport type Props = {\n value: string[] | undefined;\n onChange: (value: string[] | undefined) => void;\n};\n\nexport const SelectedKindsFilter = ({ value, onChange }: Props) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n\n const { error, value: kinds } = useAsync(async () => {\n return await catalogApi\n .getEntityFacets({ facets: ['kind'] })\n .then(response => response.facets.kind?.map(f => f.value).sort() || []);\n });\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load entity kinds`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n const normalizedKinds = useMemo(\n () => (kinds ? kinds.map(k => k.toLocaleLowerCase('en-US')) : kinds),\n [kinds],\n );\n\n const handleChange = useCallback(\n (_: unknown, v: string[]) => {\n onChange(\n normalizedKinds && normalizedKinds.every(r => v.includes(r))\n ? undefined\n : v,\n );\n },\n [normalizedKinds, onChange],\n );\n\n const handleEmpty = useCallback(() => {\n onChange(value?.length ? value : undefined);\n }, [value, onChange]);\n\n if (!kinds?.length || !normalizedKinds?.length || error) {\n return <></>;\n }\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\">\n {t('catalogGraphPage.selectedKindsFilter.title')}\n </Typography>\n <Autocomplete\n className={classes.formControl}\n multiple\n limitTags={4}\n disableCloseOnSelect\n aria-label={t('catalogGraphPage.selectedKindsFilter.title')}\n options={normalizedKinds}\n value={value ?? normalizedKinds}\n getOptionLabel={k => kinds[normalizedKinds.indexOf(k)] ?? k}\n onChange={handleChange}\n onBlur={handleEmpty}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={<CheckBoxOutlineBlankIcon fontSize=\"small\" />}\n checkedIcon={<CheckBoxIcon fontSize=\"small\" />}\n checked={selected}\n />\n }\n label={kinds[normalizedKinds.indexOf(option)] ?? option}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon data-testid=\"selected-kinds-expand\" />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB;AAAA,IACE,WAAA,EAAa;AAAA,MACX,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,EAAE,MAAM,uCAAA;AACV,CAAA;AAOO,MA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A,cAAA;AAAA,gBACC,IAAA,kBAAM,GAAA,CAAC,wBAAA,EAAA,EAAyB,QAAA,EAAS,OAAA,EAAQ,CAAA;AAAA,gBACjD,WAAA,kBAAa,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAS,OAAA,EAAQ,CAAA;AAAA,gBAC5C,OAAA,EAAS;AAAA;AAAA,aACX;AAAA,YAEF,OAAO,KAAA,CAAM,eAAA,CAAgB,OAAA,CAAQ,MAAM,CAAC,CAAA,IAAK;AAAA;AAAA,SACnD;AAAA,QAEF,IAAA,EAAK,OAAA;AAAA,QACL,SAAA,kBAAW,GAAA,CAAC,cAAA,EAAA,EAAe,aAAA,EAAY,uBAAA,EAAwB,CAAA;AAAA,QAC/D,aAAa,CAAA,MAAA,qBAAU,GAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAA,EAAW;AAAA;AAAA;AACnE,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectedRelationsFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/SelectedRelationsFilter.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 Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { useCallback, useMemo } from 'react';\nimport { RelationPairs } from '../EntityRelationsGraph';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\n/** @public */\nexport type SelectedRelationsFilterClassKey = 'formControl';\n\nconst useStyles = makeStyles(\n {\n formControl: {\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphSelectedRelationsFilter' },\n);\n\nexport type Props = {\n relationPairs: RelationPairs;\n value: string[] | undefined;\n onChange: (value: string[] | undefined) => void;\n};\n\nexport const SelectedRelationsFilter = ({\n relationPairs,\n value,\n onChange,\n}: Props) => {\n const classes = useStyles();\n const relations = useMemo(() => relationPairs.flat(), [relationPairs]);\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n\n const handleChange = useCallback(\n (_: unknown, v: string[]) => {\n onChange(relations.every(r => v.includes(r)) ? undefined : v);\n },\n [relations, onChange],\n );\n\n const handleEmpty = useCallback(() => {\n onChange(value?.length ? value : undefined);\n }, [value, onChange]);\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\">\n {t('catalogGraphPage.selectedRelationsFilter.title')}\n </Typography>\n <Autocomplete\n className={classes.formControl}\n multiple\n limitTags={4}\n disableCloseOnSelect\n aria-label={t('catalogGraphPage.selectedRelationsFilter.title')}\n options={relations}\n value={value ?? relations}\n onChange={handleChange}\n onBlur={handleEmpty}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={<CheckBoxOutlineBlankIcon fontSize=\"small\" />}\n checkedIcon={<CheckBoxIcon fontSize=\"small\" />}\n checked={selected}\n />\n }\n label={option}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon data-testid=\"selected-relations-expand\" />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAM,
|
|
1
|
+
{"version":3,"file":"SelectedRelationsFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/SelectedRelationsFilter.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 Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { useCallback, useMemo } from 'react';\nimport { RelationPairs } from '../EntityRelationsGraph';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { catalogGraphTranslationRef } from '../../translation';\n\n/** @public */\nexport type SelectedRelationsFilterClassKey = 'formControl';\n\nconst useStyles = makeStyles(\n {\n formControl: {\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphSelectedRelationsFilter' },\n);\n\nexport type Props = {\n relationPairs: RelationPairs;\n value: string[] | undefined;\n onChange: (value: string[] | undefined) => void;\n};\n\nexport const SelectedRelationsFilter = ({\n relationPairs,\n value,\n onChange,\n}: Props) => {\n const classes = useStyles();\n const relations = useMemo(() => relationPairs.flat(), [relationPairs]);\n const { t } = useTranslationRef(catalogGraphTranslationRef);\n\n const handleChange = useCallback(\n (_: unknown, v: string[]) => {\n onChange(relations.every(r => v.includes(r)) ? undefined : v);\n },\n [relations, onChange],\n );\n\n const handleEmpty = useCallback(() => {\n onChange(value?.length ? value : undefined);\n }, [value, onChange]);\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\">\n {t('catalogGraphPage.selectedRelationsFilter.title')}\n </Typography>\n <Autocomplete\n className={classes.formControl}\n multiple\n limitTags={4}\n disableCloseOnSelect\n aria-label={t('catalogGraphPage.selectedRelationsFilter.title')}\n options={relations}\n value={value ?? relations}\n onChange={handleChange}\n onBlur={handleEmpty}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={<CheckBoxOutlineBlankIcon fontSize=\"small\" />}\n checkedIcon={<CheckBoxIcon fontSize=\"small\" />}\n checked={selected}\n />\n }\n label={option}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon data-testid=\"selected-relations-expand\" />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB;AAAA,IACE,WAAA,EAAa;AAAA,MACX,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,EAAE,MAAM,2CAAA;AACV,CAAA;AAQO,MAAM,0BAA0B,CAAC;AAAA,EACtC,aAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,KAAa;AACX,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,SAAA,GAAY,QAAQ,MAAM,aAAA,CAAc,MAAK,EAAG,CAAC,aAAa,CAAC,CAAA;AACrE,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,0BAA0B,CAAA;AAE1D,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,GAAY,CAAA,KAAgB;AAC3B,MAAA,QAAA,CAAS,SAAA,CAAU,MAAM,CAAA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5C,OAAA,EAAS;AAAA;AAAA,aACX;AAAA,YAEF,KAAA,EAAO;AAAA;AAAA,SACT;AAAA,QAEF,IAAA,EAAK,OAAA;AAAA,QACL,SAAA,kBAAW,GAAA,CAAC,cAAA,EAAA,EAAe,aAAA,EAAY,2BAAA,EAA4B,CAAA;AAAA,QACnE,aAAa,CAAA,MAAA,qBAAU,GAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAA,EAAW;AAAA;AAAA;AACnE,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/SwitchFilter.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 Box from '@material-ui/core/Box';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Switch from '@material-ui/core/Switch';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ChangeEvent, useCallback } from 'react';\n\nexport type Props = {\n label: string;\n value: boolean;\n onChange: (value: boolean) => void;\n};\n\n/** @public */\nexport type SwitchFilterClassKey = 'root';\n\nconst useStyles = makeStyles(\n {\n root: {\n width: '100%',\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphSwitchFilter' },\n);\n\nexport const SwitchFilter = ({ label, value, onChange }: Props) => {\n const classes = useStyles();\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onChange(event.target.checked);\n },\n [onChange],\n );\n\n return (\n <Box pb={1} pt={1}>\n <FormControlLabel\n control={\n <Switch\n checked={value}\n onChange={handleChange}\n name={label}\n color=\"primary\"\n />\n }\n label={label}\n className={classes.root}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA8BA,MAAM,
|
|
1
|
+
{"version":3,"file":"SwitchFilter.esm.js","sources":["../../../src/components/CatalogGraphPage/SwitchFilter.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 Box from '@material-ui/core/Box';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Switch from '@material-ui/core/Switch';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ChangeEvent, useCallback } from 'react';\n\nexport type Props = {\n label: string;\n value: boolean;\n onChange: (value: boolean) => void;\n};\n\n/** @public */\nexport type SwitchFilterClassKey = 'root';\n\nconst useStyles = makeStyles(\n {\n root: {\n width: '100%',\n maxWidth: 300,\n },\n },\n { name: 'PluginCatalogGraphSwitchFilter' },\n);\n\nexport const SwitchFilter = ({ label, value, onChange }: Props) => {\n const classes = useStyles();\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onChange(event.target.checked);\n },\n [onChange],\n );\n\n return (\n <Box pb={1} pt={1}>\n <FormControlLabel\n control={\n <Switch\n checked={value}\n onChange={handleChange}\n name={label}\n color=\"primary\"\n />\n }\n label={label}\n className={classes.root}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA8BA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB;AAAA,IACE,IAAA,EAAM;AAAA,MACJ,KAAA,EAAO,MAAA;AAAA,MACP,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,EAAE,MAAM,gCAAA;AACV,CAAA;AAEO,MAAM,eAAe,CAAC,EAAE,KAAA,EAAO,KAAA,EAAO,UAAS,KAAa;AACjE,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,KAAA,KAAyC;AACxC,MAAA,QAAA,CAAS,KAAA,CAAM,OAAO,OAAO,CAAA;AAAA,IAC/B,CAAA;AAAA,IACA,CAAC,QAAQ;AAAA,GACX;AAEA,EAAA,uBACE,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EAAG,IAAI,CAAA,EACd,QAAA,kBAAA,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,OAAA,kBACE,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAS,KAAA;AAAA,UACT,QAAA,EAAU,YAAA;AAAA,UACV,IAAA,EAAM,KAAA;AAAA,UACN,KAAA,EAAM;AAAA;AAAA,OACR;AAAA,MAEF,KAAA;AAAA,MACA,WAAW,OAAA,CAAQ;AAAA;AAAA,GACrB,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCatalogGraphPage.esm.js","sources":["../../../src/components/CatalogGraphPage/useCatalogGraphPage.ts"],"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 {\n CompoundEntityRef,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport qs from 'qs';\nimport {\n Dispatch,\n DispatchWithoutAction,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { Direction } from '../EntityRelationsGraph';\n\nexport type CatalogGraphPageValue = {\n rootEntityNames: CompoundEntityRef[];\n setRootEntityNames: (value: CompoundEntityRef[]) => void;\n maxDepth: number;\n setMaxDepth: Dispatch<React.SetStateAction<number>>;\n selectedRelations: string[] | undefined;\n setSelectedRelations: Dispatch<React.SetStateAction<string[] | undefined>>;\n selectedKinds: string[] | undefined;\n setSelectedKinds: Dispatch<React.SetStateAction<string[] | undefined>>;\n unidirectional: boolean;\n setUnidirectional: Dispatch<React.SetStateAction<boolean>>;\n mergeRelations: boolean;\n setMergeRelations: Dispatch<React.SetStateAction<boolean>>;\n direction: Direction;\n setDirection: Dispatch<React.SetStateAction<Direction>>;\n curve: 'curveStepBefore' | 'curveMonotoneX';\n setCurve: Dispatch<\n React.SetStateAction<'curveStepBefore' | 'curveMonotoneX'>\n >;\n showFilters: boolean;\n toggleShowFilters: DispatchWithoutAction;\n};\n\nexport function useCatalogGraphPage({\n initialState = {},\n}: {\n initialState?: {\n selectedRelations?: string[] | undefined;\n selectedKinds?: string[] | undefined;\n rootEntityRefs?: string[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n direction?: Direction;\n showFilters?: boolean;\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n };\n}): CatalogGraphPageValue {\n const location = useLocation();\n const navigate = useNavigate();\n\n const query = useMemo(\n () =>\n (qs.parse(location.search, { arrayLimit: 0, ignoreQueryPrefix: true }) ||\n {}) as {\n selectedRelations?: string[] | string;\n selectedKinds?: string[] | string;\n rootEntityRefs?: string[] | string;\n maxDepth?: string[] | string;\n unidirectional?: string[] | string;\n mergeRelations?: string[] | string;\n direction?: string[] | Direction;\n showFilters?: string[] | string;\n curve?: string[] | 'curveStepBefore' | 'curveMonotoneX';\n },\n [location.search],\n );\n\n const rootEntityNames = useMemo(\n () =>\n (Array.isArray(query.rootEntityRefs)\n ? query.rootEntityRefs\n : initialState?.rootEntityRefs ?? []\n ).map(r => parseEntityRef(r)),\n [initialState?.rootEntityRefs, query.rootEntityRefs],\n );\n\n const setRootEntityNames = useCallback(\n (value: CompoundEntityRef[]) => {\n const areSame =\n rootEntityNames.length === value.length &&\n rootEntityNames.every(\n (r, i) => stringifyEntityRef(r) === stringifyEntityRef(value[i]),\n );\n\n if (areSame) {\n return;\n }\n\n const newSearch = qs.stringify(\n {\n ...query,\n rootEntityRefs: value.map(r => stringifyEntityRef(r)),\n },\n { arrayFormat: 'brackets', addQueryPrefix: true },\n );\n\n navigate(newSearch);\n },\n [rootEntityNames, navigate, query],\n );\n\n const [maxDepth, setMaxDepth] = useState<number>(() =>\n typeof query.maxDepth === 'string'\n ? parseMaxDepth(query.maxDepth)\n : initialState?.maxDepth ?? Number.POSITIVE_INFINITY,\n );\n\n const [selectedRelations, setSelectedRelations] = useState<\n string[] | undefined\n >(() =>\n Array.isArray(query.selectedRelations)\n ? query.selectedRelations\n : initialState?.selectedRelations,\n );\n\n const [selectedKinds, setSelectedKinds] = useState<string[] | undefined>(() =>\n (Array.isArray(query.selectedKinds)\n ? query.selectedKinds\n : initialState?.selectedKinds\n )?.map(k => k.toLocaleLowerCase('en-US')),\n );\n\n const [unidirectional, setUnidirectional] = useState<boolean>(() =>\n typeof query.unidirectional === 'string'\n ? query.unidirectional === 'true'\n : initialState?.unidirectional ?? true,\n );\n\n const [mergeRelations, setMergeRelations] = useState<boolean>(() =>\n typeof query.mergeRelations === 'string'\n ? query.mergeRelations === 'true'\n : initialState?.mergeRelations ?? true,\n );\n\n const [direction, setDirection] = useState<Direction>(() =>\n typeof query.direction === 'string'\n ? query.direction\n : initialState?.direction ?? Direction.LEFT_RIGHT,\n );\n\n const [curve, setCurve] = useState<'curveStepBefore' | 'curveMonotoneX'>(() =>\n typeof query.curve === 'string'\n ? query.curve\n : initialState?.curve ?? 'curveMonotoneX',\n );\n\n const [showFilters, setShowFilters] = useState<boolean>(() =>\n typeof query.showFilters === 'string'\n ? query.showFilters === 'true'\n : initialState?.showFilters ?? true,\n );\n\n const toggleShowFilters = useCallback(\n () => setShowFilters(s => !s),\n [setShowFilters],\n );\n\n useEffect(() => {\n const newParams = qs.stringify(\n {\n rootEntityRefs: rootEntityNames.map(stringifyEntityRef),\n maxDepth: isFinite(maxDepth) ? maxDepth : '∞',\n selectedKinds,\n selectedRelations,\n unidirectional,\n mergeRelations,\n direction,\n showFilters,\n curve,\n },\n { arrayFormat: 'brackets', addQueryPrefix: true },\n );\n\n navigate(newParams, { replace: true });\n }, [\n maxDepth,\n curve,\n selectedKinds,\n selectedRelations,\n unidirectional,\n mergeRelations,\n direction,\n showFilters,\n rootEntityNames,\n navigate,\n ]);\n\n return {\n rootEntityNames,\n setRootEntityNames,\n maxDepth,\n setMaxDepth,\n selectedRelations,\n setSelectedRelations,\n selectedKinds,\n setSelectedKinds,\n unidirectional,\n setUnidirectional,\n mergeRelations,\n setMergeRelations,\n direction,\n setDirection,\n curve,\n setCurve,\n showFilters,\n toggleShowFilters,\n };\n}\n\nfunction parseMaxDepth(value: string): number {\n return value === '∞' ? Number.POSITIVE_INFINITY : Number(value);\n}\n"],"names":[],"mappings":";;;;;;;AAuDO,SAAS,mBAAoB,CAAA;AAAA,EAClC,eAAe;AACjB,CAY0B,EAAA;AACxB,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAA,MAAM,WAAW,WAAY,EAAA;AAE7B,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MACG,EAAA,CAAG,KAAM,CAAA,QAAA,CAAS,MAAQ,EAAA,EAAE,UAAY,EAAA,CAAA,EAAG,iBAAmB,EAAA,IAAA,EAAM,CAAA,IACnE,EAAC;AAAA,IAWL,CAAC,SAAS,MAAM;AAAA,GAClB;AAEA,EAAA,MAAM,eAAkB,GAAA,OAAA;AAAA,IACtB,OACG,KAAM,CAAA,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SAAS,cAAc,KAAuB,EAAA;AAC5C,EAAA,OAAO,KAAU,KAAA,QAAA,GAAM,MAAO,CAAA,iBAAA,GAAoB,OAAO,KAAK,CAAA;AAChE;;;;"}
|
|
1
|
+
{"version":3,"file":"useCatalogGraphPage.esm.js","sources":["../../../src/components/CatalogGraphPage/useCatalogGraphPage.ts"],"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 {\n CompoundEntityRef,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport qs from 'qs';\nimport {\n Dispatch,\n DispatchWithoutAction,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { Direction } from '../EntityRelationsGraph';\n\nexport type CatalogGraphPageValue = {\n rootEntityNames: CompoundEntityRef[];\n setRootEntityNames: (value: CompoundEntityRef[]) => void;\n maxDepth: number;\n setMaxDepth: Dispatch<React.SetStateAction<number>>;\n selectedRelations: string[] | undefined;\n setSelectedRelations: Dispatch<React.SetStateAction<string[] | undefined>>;\n selectedKinds: string[] | undefined;\n setSelectedKinds: Dispatch<React.SetStateAction<string[] | undefined>>;\n unidirectional: boolean;\n setUnidirectional: Dispatch<React.SetStateAction<boolean>>;\n mergeRelations: boolean;\n setMergeRelations: Dispatch<React.SetStateAction<boolean>>;\n direction: Direction;\n setDirection: Dispatch<React.SetStateAction<Direction>>;\n curve: 'curveStepBefore' | 'curveMonotoneX';\n setCurve: Dispatch<\n React.SetStateAction<'curveStepBefore' | 'curveMonotoneX'>\n >;\n showFilters: boolean;\n toggleShowFilters: DispatchWithoutAction;\n};\n\nexport function useCatalogGraphPage({\n initialState = {},\n}: {\n initialState?: {\n selectedRelations?: string[] | undefined;\n selectedKinds?: string[] | undefined;\n rootEntityRefs?: string[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n direction?: Direction;\n showFilters?: boolean;\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n };\n}): CatalogGraphPageValue {\n const location = useLocation();\n const navigate = useNavigate();\n\n const query = useMemo(\n () =>\n (qs.parse(location.search, { arrayLimit: 0, ignoreQueryPrefix: true }) ||\n {}) as {\n selectedRelations?: string[] | string;\n selectedKinds?: string[] | string;\n rootEntityRefs?: string[] | string;\n maxDepth?: string[] | string;\n unidirectional?: string[] | string;\n mergeRelations?: string[] | string;\n direction?: string[] | Direction;\n showFilters?: string[] | string;\n curve?: string[] | 'curveStepBefore' | 'curveMonotoneX';\n },\n [location.search],\n );\n\n const rootEntityNames = useMemo(\n () =>\n (Array.isArray(query.rootEntityRefs)\n ? query.rootEntityRefs\n : initialState?.rootEntityRefs ?? []\n ).map(r => parseEntityRef(r)),\n [initialState?.rootEntityRefs, query.rootEntityRefs],\n );\n\n const setRootEntityNames = useCallback(\n (value: CompoundEntityRef[]) => {\n const areSame =\n rootEntityNames.length === value.length &&\n rootEntityNames.every(\n (r, i) => stringifyEntityRef(r) === stringifyEntityRef(value[i]),\n );\n\n if (areSame) {\n return;\n }\n\n const newSearch = qs.stringify(\n {\n ...query,\n rootEntityRefs: value.map(r => stringifyEntityRef(r)),\n },\n { arrayFormat: 'brackets', addQueryPrefix: true },\n );\n\n navigate(newSearch);\n },\n [rootEntityNames, navigate, query],\n );\n\n const [maxDepth, setMaxDepth] = useState<number>(() =>\n typeof query.maxDepth === 'string'\n ? parseMaxDepth(query.maxDepth)\n : initialState?.maxDepth ?? Number.POSITIVE_INFINITY,\n );\n\n const [selectedRelations, setSelectedRelations] = useState<\n string[] | undefined\n >(() =>\n Array.isArray(query.selectedRelations)\n ? query.selectedRelations\n : initialState?.selectedRelations,\n );\n\n const [selectedKinds, setSelectedKinds] = useState<string[] | undefined>(() =>\n (Array.isArray(query.selectedKinds)\n ? query.selectedKinds\n : initialState?.selectedKinds\n )?.map(k => k.toLocaleLowerCase('en-US')),\n );\n\n const [unidirectional, setUnidirectional] = useState<boolean>(() =>\n typeof query.unidirectional === 'string'\n ? query.unidirectional === 'true'\n : initialState?.unidirectional ?? true,\n );\n\n const [mergeRelations, setMergeRelations] = useState<boolean>(() =>\n typeof query.mergeRelations === 'string'\n ? query.mergeRelations === 'true'\n : initialState?.mergeRelations ?? true,\n );\n\n const [direction, setDirection] = useState<Direction>(() =>\n typeof query.direction === 'string'\n ? query.direction\n : initialState?.direction ?? Direction.LEFT_RIGHT,\n );\n\n const [curve, setCurve] = useState<'curveStepBefore' | 'curveMonotoneX'>(() =>\n typeof query.curve === 'string'\n ? query.curve\n : initialState?.curve ?? 'curveMonotoneX',\n );\n\n const [showFilters, setShowFilters] = useState<boolean>(() =>\n typeof query.showFilters === 'string'\n ? query.showFilters === 'true'\n : initialState?.showFilters ?? true,\n );\n\n const toggleShowFilters = useCallback(\n () => setShowFilters(s => !s),\n [setShowFilters],\n );\n\n useEffect(() => {\n const newParams = qs.stringify(\n {\n rootEntityRefs: rootEntityNames.map(stringifyEntityRef),\n maxDepth: isFinite(maxDepth) ? maxDepth : '∞',\n selectedKinds,\n selectedRelations,\n unidirectional,\n mergeRelations,\n direction,\n showFilters,\n curve,\n },\n { arrayFormat: 'brackets', addQueryPrefix: true },\n );\n\n navigate(newParams, { replace: true });\n }, [\n maxDepth,\n curve,\n selectedKinds,\n selectedRelations,\n unidirectional,\n mergeRelations,\n direction,\n showFilters,\n rootEntityNames,\n navigate,\n ]);\n\n return {\n rootEntityNames,\n setRootEntityNames,\n maxDepth,\n setMaxDepth,\n selectedRelations,\n setSelectedRelations,\n selectedKinds,\n setSelectedKinds,\n unidirectional,\n setUnidirectional,\n mergeRelations,\n setMergeRelations,\n direction,\n setDirection,\n curve,\n setCurve,\n showFilters,\n toggleShowFilters,\n };\n}\n\nfunction parseMaxDepth(value: string): number {\n return value === '∞' ? Number.POSITIVE_INFINITY : Number(value);\n}\n"],"names":[],"mappings":";;;;;;;AAuDO,SAAS,mBAAA,CAAoB;AAAA,EAClC,eAAe;AACjB,CAAA,EAY0B;AACxB,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,WAAW,WAAA,EAAY;AAE7B,EAAA,MAAM,KAAA,GAAQ,OAAA;AAAA,IACZ,MACG,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,MAAA,EAAQ,EAAE,UAAA,EAAY,CAAA,EAAG,iBAAA,EAAmB,IAAA,EAAM,CAAA,IACnE,EAAC;AAAA,IAWL,CAAC,SAAS,MAAM;AAAA,GAClB;AAEA,EAAA,MAAM,eAAA,GAAkB,OAAA;AAAA,IACtB,OACG,KAAA,CAAM,OAAA,CAAQ,KAAA,CAAM,cAAc,IAC/B,KAAA,CAAM,cAAA,GACN,YAAA,EAAc,cAAA,IAAkB,EAAC,EACnC,GAAA,CAAI,CAAA,CAAA,KAAK,cAAA,CAAe,CAAC,CAAC,CAAA;AAAA,IAC9B,CAAC,YAAA,EAAc,cAAA,EAAgB,KAAA,CAAM,cAAc;AAAA,GACrD;AAEA,EAAA,MAAM,kBAAA,GAAqB,WAAA;AAAA,IACzB,CAAC,KAAA,KAA+B;AAC9B,MAAA,MAAM,OAAA,GACJ,eAAA,CAAgB,MAAA,KAAW,KAAA,CAAM,UACjC,eAAA,CAAgB,KAAA;AAAA,QACd,CAAC,GAAG,CAAA,KAAM,kBAAA,CAAmB,CAAC,CAAA,KAAM,kBAAA,CAAmB,KAAA,CAAM,CAAC,CAAC;AAAA,OACjE;AAEF,MAAA,IAAI,OAAA,EAAS;AACX,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,YAAY,EAAA,CAAG,SAAA;AAAA,QACnB;AAAA,UACE,GAAG,KAAA;AAAA,UACH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SAAA,EAAW,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA;AAAA,EACvC,CAAA,EAAG;AAAA,IACD,QAAA;AAAA,IACA,KAAA;AAAA,IACA,aAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,OAAO;AAAA,IACL,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,oBAAA;AAAA,IACA,aAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,SAAS,cAAc,KAAA,EAAuB;AAC5C,EAAA,OAAO,KAAA,KAAU,QAAA,GAAM,MAAA,CAAO,iBAAA,GAAoB,OAAO,KAAK,CAAA;AAChE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRenderLabel.esm.js","sources":["../../../src/components/EntityRelationsGraph/DefaultRenderLabel.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 makeStyles from '@material-ui/core/styles/makeStyles';\nimport { EntityEdgeData } from './types';\nimport classNames from 'classnames';\n\n/** @public */\nexport type CustomLabelClassKey = 'text' | 'secondary';\n\nconst useStyles = makeStyles(\n theme => ({\n text: {\n fill: theme.palette.textContrast,\n },\n secondary: {\n fill: theme.palette.textSubtle,\n },\n }),\n { name: 'PluginCatalogGraphCustomLabel' },\n);\n\nexport function DefaultRenderLabel({\n edge: { relations },\n}: DependencyGraphTypes.RenderLabelProps<EntityEdgeData>) {\n const classes = useStyles();\n return (\n <text className={classes.text} textAnchor=\"middle\">\n {relations.map((r, i) => (\n <tspan key={r} className={classNames(i % 2 !== 0 && classes.secondary)}>\n {i > 0 && <tspan> / </tspan>}\n {r}\n </tspan>\n ))}\n </text>\n );\n}\n"],"names":[],"mappings":";;;;AAuBA,MAAM,
|
|
1
|
+
{"version":3,"file":"DefaultRenderLabel.esm.js","sources":["../../../src/components/EntityRelationsGraph/DefaultRenderLabel.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 makeStyles from '@material-ui/core/styles/makeStyles';\nimport { EntityEdgeData } from './types';\nimport classNames from 'classnames';\n\n/** @public */\nexport type CustomLabelClassKey = 'text' | 'secondary';\n\nconst useStyles = makeStyles(\n theme => ({\n text: {\n fill: theme.palette.textContrast,\n },\n secondary: {\n fill: theme.palette.textSubtle,\n },\n }),\n { name: 'PluginCatalogGraphCustomLabel' },\n);\n\nexport function DefaultRenderLabel({\n edge: { relations },\n}: DependencyGraphTypes.RenderLabelProps<EntityEdgeData>) {\n const classes = useStyles();\n return (\n <text className={classes.text} textAnchor=\"middle\">\n {relations.map((r, i) => (\n <tspan key={r} className={classNames(i % 2 !== 0 && classes.secondary)}>\n {i > 0 && <tspan> / </tspan>}\n {r}\n </tspan>\n ))}\n </text>\n );\n}\n"],"names":[],"mappings":";;;;AAuBA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,MAAM,OAAA,CAAQ;AAAA,KACtB;AAAA,IACA,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MAAM,OAAA,CAAQ;AAAA;AACtB,GACF,CAAA;AAAA,EACA,EAAE,MAAM,+BAAA;AACV,CAAA;AAEO,SAAS,kBAAA,CAAmB;AAAA,EACjC,IAAA,EAAM,EAAE,SAAA;AACV,CAAA,EAA0D;AACxD,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,uBACE,GAAA,CAAC,UAAK,SAAA,EAAW,OAAA,CAAQ,MAAM,UAAA,EAAW,QAAA,EACvC,oBAAU,GAAA,CAAI,CAAC,GAAG,CAAA,qBACjB,IAAA,CAAC,WAAc,SAAA,EAAW,UAAA,CAAW,IAAI,CAAA,KAAM,CAAA,IAAK,OAAA,CAAQ,SAAS,CAAA,EAClE,QAAA,EAAA;AAAA,IAAA,CAAA,GAAI,CAAA,oBAAK,GAAA,CAAC,OAAA,EAAA,EAAM,QAAA,EAAA,KAAA,EAAG,CAAA;AAAA,IACnB;AAAA,GAAA,EAAA,EAFS,CAGZ,CACD,CAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -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 { 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 { useLayoutEffect, useRef, useState } from 'react';\nimport { EntityIcon } from './EntityIcon';\nimport { EntityNodeData } from './types';\nimport { DEFAULT_NAMESPACE } from '@backstage/catalog-model';\n\n/** @public */\nexport type CustomNodeClassKey = 'node' | 'text' | 'clickable';\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":";;;;;;;;AA4BA,MAAM,
|
|
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 { useLayoutEffect, useRef, useState } from 'react';\nimport { EntityIcon } from './EntityIcon';\nimport { EntityNodeData } from './types';\nimport { DEFAULT_NAMESPACE } from '@backstage/catalog-model';\n\n/** @public */\nexport type CustomNodeClassKey = 'node' | 'text' | 'clickable';\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":";;;;;;;;AA4BA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,GAAG,CAAA;AAAA,MAC5B,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,GAAG,CAAA;AAAA,MAE9B,WAAA,EAAa;AAAA,QACX,IAAA,EAAM,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ,KAAA;AAAA,QAC5B,MAAA,EAAQ,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ;AAAA,OAChC;AAAA,MACA,aAAA,EAAe;AAA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;AAAA,QACC,MAAM,6BAAA,CAA8B,IAAA;AAAA,QACpC,CAAA,EAAG,OAAA;AAAA,QACH,CAAA,EAAG,OAAA;AAAA,QACH,KAAA,EAAO,QAAA;AAAA,QACP,MAAA,EAAQ,QAAA;AAAA,QACR,SAAA,EAAW,UAAA;AAAA,UACT,OAAA,CAAQ,IAAA;AAAA,UACR,OAAA,IAAW,SAAA;AAAA,UACX,UAAU,SAAA,IAAa,SAAA;AAAA,UACvB,UAAU,WAAA,IAAe;AAAA;AAC3B;AAAA,KACF;AAAA,oBAEF,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,KAAA;AAAA,QACL,SAAA,EAAW,UAAA;AAAA,UACT,OAAA,CAAQ,IAAA;AAAA,UACR,OAAA,IAAW,SAAA;AAAA,UACX,UAAU,SAAA,IAAa,SAAA;AAAA,UACvB,UAAU,WAAA,IAAe;AAAA,SAC3B;AAAA,QACA,GAAG,YAAA,GAAe,CAAA;AAAA,QAClB,CAAA,EAAG,eAAA,GAAA,CAAmB,KAAA,GAAQ,OAAA,GAAU,CAAA,IAAK,CAAA;AAAA,QAC7C,UAAA,EAAW,QAAA;AAAA,QACX,iBAAA,EAAkB,QAAA;AAAA,QAEjB,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,oBACA,GAAA,CAAC,OAAA,EAAA,EAAO,QAAA,EAAA,6BAAA,CAA8B,SAAA,EAAU;AAAA,GAAA,EAClD,CAAA;AAEJ;;;;"}
|
|
@@ -1 +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 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":";;;AAoBO,SAAS,
|
|
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 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":";;;AAoBO,SAAS,UAAA,CAAW;AAAA,EACzB,IAAA;AAAA,EACA,GAAG;AACL,CAAA,EAOG;AACD,EAAA,MAAM,OAAQ,IAAA,IAAiD,OAAA;AAC/D,EAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAM,GAAG,KAAA,EAAO,CAAA;AAC1B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityRelationsGraph.esm.js","sources":["../../../src/components/EntityRelationsGraph/EntityRelationsGraph.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 */\n\nimport {\n CompoundEntityRef,\n Entity,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n DependencyGraph,\n DependencyGraphTypes,\n} from '@backstage/core-components';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { makeStyles, useTheme } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { MouseEvent, useEffect, useMemo } from 'react';\nimport { DefaultRenderLabel } from './DefaultRenderLabel';\nimport { DefaultRenderNode } from './DefaultRenderNode';\nimport { ALL_RELATION_PAIRS, RelationPairs } from './relations';\nimport { Direction, EntityEdge, EntityNode } from './types';\nimport { useEntityRelationNodesAndEdges } from './useEntityRelationNodesAndEdges';\n\n/** @public */\nexport type EntityRelationsGraphClassKey = 'progress' | 'container' | 'graph';\n\nconst useStyles = makeStyles(\n theme => ({\n progress: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n marginLeft: '-20px',\n marginTop: '-20px',\n },\n container: {\n position: 'relative',\n width: '100%',\n display: 'flex',\n flexDirection: 'column',\n },\n graph: {\n width: '100%',\n flex: 1,\n // Right now there is no good way to style edges between nodes, we have to\n // fall back to these hacks:\n '& path[marker-end]': {\n transition: 'filter 0.1s ease-in-out',\n },\n '& path[marker-end]:hover': {\n filter: `drop-shadow(2px 2px 4px ${theme.palette.primary.dark});`,\n },\n '& g[data-testid=label]': {\n transition: 'transform 0s',\n },\n },\n }),\n { name: 'PluginCatalogGraphEntityRelationsGraph' },\n);\n\n/**\n * @public\n */\nexport type EntityRelationsGraphProps = {\n rootEntityNames: CompoundEntityRef | CompoundEntityRef[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n kinds?: string[];\n relations?: string[];\n entityFilter?: (entity: Entity) => boolean;\n direction?: Direction;\n onNodeClick?: (value: EntityNode, event: MouseEvent<unknown>) => void;\n relationPairs?: RelationPairs;\n className?: string;\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n renderNode?: DependencyGraphTypes.RenderNodeFunction<EntityNode>;\n renderLabel?: DependencyGraphTypes.RenderLabelFunction<EntityEdge>;\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n showArrowHeads?: boolean;\n};\n\n/**\n * Core building block for custom entity relations diagrams.\n *\n * @public\n */\nexport const EntityRelationsGraph = (props: EntityRelationsGraphProps) => {\n const {\n rootEntityNames,\n maxDepth = 2,\n unidirectional = true,\n mergeRelations = true,\n kinds,\n relations,\n entityFilter,\n direction = Direction.LEFT_RIGHT,\n onNodeClick,\n relationPairs = ALL_RELATION_PAIRS,\n className,\n zoom = 'enabled',\n renderNode,\n renderLabel,\n curve,\n showArrowHeads,\n } = props;\n\n const theme = useTheme();\n const classes = useStyles();\n const rootEntityRefs = useMemo(\n () =>\n (Array.isArray(rootEntityNames)\n ? rootEntityNames\n : [rootEntityNames]\n ).map(e => stringifyEntityRef(e)),\n [rootEntityNames],\n );\n const errorApi = useApi(errorApiRef);\n const { loading, error, nodes, edges } = useEntityRelationNodesAndEdges({\n rootEntityRefs,\n maxDepth,\n unidirectional,\n mergeRelations,\n kinds,\n relations,\n entityFilter,\n onNodeClick,\n relationPairs,\n });\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [errorApi, error]);\n\n return (\n <div className={classNames(classes.container, className)}>\n {loading && <CircularProgress className={classes.progress} />}\n {nodes && edges && (\n <DependencyGraph\n nodes={nodes}\n edges={edges}\n renderNode={renderNode || DefaultRenderNode}\n renderLabel={renderLabel || DefaultRenderLabel}\n direction={direction}\n className={classes.graph}\n paddingX={theme.spacing(4)}\n paddingY={theme.spacing(4)}\n labelPosition={DependencyGraphTypes.LabelPosition.RIGHT}\n labelOffset={theme.spacing(1)}\n zoom={zoom}\n curve={curve}\n showArrowHeads={showArrowHeads}\n />\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAuCA,MAAM,
|
|
1
|
+
{"version":3,"file":"EntityRelationsGraph.esm.js","sources":["../../../src/components/EntityRelationsGraph/EntityRelationsGraph.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 */\n\nimport {\n CompoundEntityRef,\n Entity,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n DependencyGraph,\n DependencyGraphTypes,\n} from '@backstage/core-components';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { makeStyles, useTheme } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { MouseEvent, useEffect, useMemo } from 'react';\nimport { DefaultRenderLabel } from './DefaultRenderLabel';\nimport { DefaultRenderNode } from './DefaultRenderNode';\nimport { ALL_RELATION_PAIRS, RelationPairs } from './relations';\nimport { Direction, EntityEdge, EntityNode } from './types';\nimport { useEntityRelationNodesAndEdges } from './useEntityRelationNodesAndEdges';\n\n/** @public */\nexport type EntityRelationsGraphClassKey = 'progress' | 'container' | 'graph';\n\nconst useStyles = makeStyles(\n theme => ({\n progress: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n marginLeft: '-20px',\n marginTop: '-20px',\n },\n container: {\n position: 'relative',\n width: '100%',\n display: 'flex',\n flexDirection: 'column',\n },\n graph: {\n width: '100%',\n flex: 1,\n // Right now there is no good way to style edges between nodes, we have to\n // fall back to these hacks:\n '& path[marker-end]': {\n transition: 'filter 0.1s ease-in-out',\n },\n '& path[marker-end]:hover': {\n filter: `drop-shadow(2px 2px 4px ${theme.palette.primary.dark});`,\n },\n '& g[data-testid=label]': {\n transition: 'transform 0s',\n },\n },\n }),\n { name: 'PluginCatalogGraphEntityRelationsGraph' },\n);\n\n/**\n * @public\n */\nexport type EntityRelationsGraphProps = {\n rootEntityNames: CompoundEntityRef | CompoundEntityRef[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n kinds?: string[];\n relations?: string[];\n entityFilter?: (entity: Entity) => boolean;\n direction?: Direction;\n onNodeClick?: (value: EntityNode, event: MouseEvent<unknown>) => void;\n relationPairs?: RelationPairs;\n className?: string;\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n renderNode?: DependencyGraphTypes.RenderNodeFunction<EntityNode>;\n renderLabel?: DependencyGraphTypes.RenderLabelFunction<EntityEdge>;\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n showArrowHeads?: boolean;\n};\n\n/**\n * Core building block for custom entity relations diagrams.\n *\n * @public\n */\nexport const EntityRelationsGraph = (props: EntityRelationsGraphProps) => {\n const {\n rootEntityNames,\n maxDepth = 2,\n unidirectional = true,\n mergeRelations = true,\n kinds,\n relations,\n entityFilter,\n direction = Direction.LEFT_RIGHT,\n onNodeClick,\n relationPairs = ALL_RELATION_PAIRS,\n className,\n zoom = 'enabled',\n renderNode,\n renderLabel,\n curve,\n showArrowHeads,\n } = props;\n\n const theme = useTheme();\n const classes = useStyles();\n const rootEntityRefs = useMemo(\n () =>\n (Array.isArray(rootEntityNames)\n ? rootEntityNames\n : [rootEntityNames]\n ).map(e => stringifyEntityRef(e)),\n [rootEntityNames],\n );\n const errorApi = useApi(errorApiRef);\n const { loading, error, nodes, edges } = useEntityRelationNodesAndEdges({\n rootEntityRefs,\n maxDepth,\n unidirectional,\n mergeRelations,\n kinds,\n relations,\n entityFilter,\n onNodeClick,\n relationPairs,\n });\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [errorApi, error]);\n\n return (\n <div className={classNames(classes.container, className)}>\n {loading && <CircularProgress className={classes.progress} />}\n {nodes && edges && (\n <DependencyGraph\n nodes={nodes}\n edges={edges}\n renderNode={renderNode || DefaultRenderNode}\n renderLabel={renderLabel || DefaultRenderLabel}\n direction={direction}\n className={classes.graph}\n paddingX={theme.spacing(4)}\n paddingY={theme.spacing(4)}\n labelPosition={DependencyGraphTypes.LabelPosition.RIGHT}\n labelOffset={theme.spacing(1)}\n zoom={zoom}\n curve={curve}\n showArrowHeads={showArrowHeads}\n />\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAuCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,QAAA,EAAU;AAAA,MACR,QAAA,EAAU,UAAA;AAAA,MACV,IAAA,EAAM,KAAA;AAAA,MACN,GAAA,EAAK,KAAA;AAAA,MACL,UAAA,EAAY,OAAA;AAAA,MACZ,SAAA,EAAW;AAAA,KACb;AAAA,IACA,SAAA,EAAW;AAAA,MACT,QAAA,EAAU,UAAA;AAAA,MACV,KAAA,EAAO,MAAA;AAAA,MACP,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe;AAAA,KACjB;AAAA,IACA,KAAA,EAAO;AAAA,MACL,KAAA,EAAO,MAAA;AAAA,MACP,IAAA,E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ACtE,cAAA;AAAA,IACA,QAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,QAAA,CAAS,KAAK,KAAK,CAAA;AAAA,IACrB;AAAA,EACF,CAAA,EAAG,CAAC,QAAA,EAAU,KAAK,CAAC,CAAA;AAEpB,EAAA,4BACG,KAAA,EAAA,EAAI,SAAA,EAAW,WAAW,OAAA,CAAQ,SAAA,EAAW,SAAS,CAAA,EACpD,QAAA,EAAA;AAAA,IAAA,OAAA,oBAAW,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAW,OAAA,CAAQ,QAAA,EAAU,CAAA;AAAA,IAC1D,SAAS,KAAA,oBACR,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,KAAA;AAAA,QACA,KAAA;AAAA,QACA,YAAY,UAAA,IAAc,iBAAA;AAAA,QAC1B,aAAa,WAAA,IAAe,kBAAA;AAAA,QAC5B,SAAA;AAAA,QACA,WAAW,OAAA,CAAQ,KAAA;AAAA,QACnB,QAAA,EAAU,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,QACzB,QAAA,EAAU,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,QACzB,aAAA,EAAe,qBAAqB,aAAA,CAAc,KAAA;AAAA,QAClD,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,QAC5B,IAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA;AAAA;AACF,GAAA,EAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relations.esm.js","sources":["../../../src/components/EntityRelationsGraph/relations.ts"],"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 {\n RELATION_API_CONSUMED_BY,\n RELATION_API_PROVIDED_BY,\n RELATION_CHILD_OF,\n RELATION_CONSUMES_API,\n RELATION_DEPENDENCY_OF,\n RELATION_DEPENDS_ON,\n RELATION_HAS_MEMBER,\n RELATION_HAS_PART,\n RELATION_MEMBER_OF,\n RELATION_OWNED_BY,\n RELATION_OWNER_OF,\n RELATION_PARENT_OF,\n RELATION_PART_OF,\n RELATION_PROVIDES_API,\n} from '@backstage/catalog-model';\n\n/**\n * A pair of two relations that describe the opposite of each other. The first\n * relation is considered as the primary relation.\n *\n * @public\n */\nexport type RelationPairs = [string, string][];\n\n// TODO: This file only contains the pairs for the built-in relations.\n// How to implement this when custom relations are used? Right now you can pass\n// the relations everywhere.\n// Another option is to move this into @backstage/catalog-model\n\n/**\n * A list of pairs of entity relations, used to define which relations are\n * merged together and which the primary relation is.\n *\n * @public\n */\nexport const ALL_RELATION_PAIRS: RelationPairs = [\n [RELATION_OWNER_OF, RELATION_OWNED_BY],\n [RELATION_CONSUMES_API, RELATION_API_CONSUMED_BY],\n [RELATION_API_PROVIDED_BY, RELATION_PROVIDES_API],\n [RELATION_HAS_PART, RELATION_PART_OF],\n [RELATION_PARENT_OF, RELATION_CHILD_OF],\n [RELATION_HAS_MEMBER, RELATION_MEMBER_OF],\n [RELATION_DEPENDS_ON, RELATION_DEPENDENCY_OF],\n];\n"],"names":[],"mappings":";;AAmDO,MAAM,
|
|
1
|
+
{"version":3,"file":"relations.esm.js","sources":["../../../src/components/EntityRelationsGraph/relations.ts"],"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 {\n RELATION_API_CONSUMED_BY,\n RELATION_API_PROVIDED_BY,\n RELATION_CHILD_OF,\n RELATION_CONSUMES_API,\n RELATION_DEPENDENCY_OF,\n RELATION_DEPENDS_ON,\n RELATION_HAS_MEMBER,\n RELATION_HAS_PART,\n RELATION_MEMBER_OF,\n RELATION_OWNED_BY,\n RELATION_OWNER_OF,\n RELATION_PARENT_OF,\n RELATION_PART_OF,\n RELATION_PROVIDES_API,\n} from '@backstage/catalog-model';\n\n/**\n * A pair of two relations that describe the opposite of each other. The first\n * relation is considered as the primary relation.\n *\n * @public\n */\nexport type RelationPairs = [string, string][];\n\n// TODO: This file only contains the pairs for the built-in relations.\n// How to implement this when custom relations are used? Right now you can pass\n// the relations everywhere.\n// Another option is to move this into @backstage/catalog-model\n\n/**\n * A list of pairs of entity relations, used to define which relations are\n * merged together and which the primary relation is.\n *\n * @public\n */\nexport const ALL_RELATION_PAIRS: RelationPairs = [\n [RELATION_OWNER_OF, RELATION_OWNED_BY],\n [RELATION_CONSUMES_API, RELATION_API_CONSUMED_BY],\n [RELATION_API_PROVIDED_BY, RELATION_PROVIDES_API],\n [RELATION_HAS_PART, RELATION_PART_OF],\n [RELATION_PARENT_OF, RELATION_CHILD_OF],\n [RELATION_HAS_MEMBER, RELATION_MEMBER_OF],\n [RELATION_DEPENDS_ON, RELATION_DEPENDENCY_OF],\n];\n"],"names":[],"mappings":";;AAmDO,MAAM,kBAAA,GAAoC;AAAA,EAC/C,CAAC,mBAAmB,iBAAiB,CAAA;AAAA,EACrC,CAAC,uBAAuB,wBAAwB,CAAA;AAAA,EAChD,CAAC,0BAA0B,qBAAqB,CAAA;AAAA,EAChD,CAAC,mBAAmB,gBAAgB,CAAA;AAAA,EACpC,CAAC,oBAAoB,iBAAiB,CAAA;AAAA,EACtC,CAAC,qBAAqB,kBAAkB,CAAA;AAAA,EACxC,CAAC,qBAAqB,sBAAsB;AAC9C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.esm.js","sources":["../../../src/components/EntityRelationsGraph/types.ts"],"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 */\n\nimport { DependencyGraphTypes } from '@backstage/core-components';\nimport { MouseEventHandler } from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport { JsonObject } from '@backstage/types';\n\n/**\n * Additional Data for entities.\n *\n * @public\n */\nexport type EntityEdgeData = {\n /**\n * Up to two relations that are connecting an entity.\n */\n relations: string[];\n /**\n * Whether the entity is visible or not.\n */\n // Not used, but has to be non-empty to draw a label at all!\n label: 'visible';\n};\n\n/**\n * Edge between two entities.\n *\n * @public\n */\nexport type EntityEdge = DependencyGraphTypes.DependencyEdge<EntityEdgeData>;\n\n/**\n * Additional data for Entity Node\n *\n * @public\n */\nexport type EntityNodeData = {\n /**\n * The Entity\n */\n entity: Entity;\n /**\n * Whether the entity is focused, optional, defaults to false. Focused\n * entities are highlighted in the graph.\n */\n focused?: boolean;\n /**\n * Optional color of the entity, defaults to 'default'.\n */\n color?: 'primary' | 'secondary' | 'default';\n /**\n * Optional click handler.\n */\n onClick?: MouseEventHandler<unknown>;\n\n /**\n * Name of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n name: string;\n /**\n * Optional kind of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n kind?: string;\n /**\n * Optional title of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n title?: string;\n /**\n * Namespace of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n * The Entity\n */\n namespace: string;\n /**\n * Optional spec of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n spec?: JsonObject;\n};\n\n/**\n * Node representing an entity.\n *\n * @public\n */\nexport type EntityNode = DependencyGraphTypes.DependencyNode<EntityNodeData>;\n\n/**\n * Render direction of the graph.\n *\n * @public\n */\nexport enum Direction {\n /**\n * Top to bottom.\n */\n TOP_BOTTOM = 'TB',\n /**\n * Bottom to top.\n */\n BOTTOM_TOP = 'BT',\n /**\n * Left to right.\n */\n LEFT_RIGHT = 'LR',\n /**\n * Right to left.\n */\n RIGHT_LEFT = 'RL',\n}\n"],"names":["Direction"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../../../src/components/EntityRelationsGraph/types.ts"],"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 */\n\nimport { DependencyGraphTypes } from '@backstage/core-components';\nimport { MouseEventHandler } from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport { JsonObject } from '@backstage/types';\n\n/**\n * Additional Data for entities.\n *\n * @public\n */\nexport type EntityEdgeData = {\n /**\n * Up to two relations that are connecting an entity.\n */\n relations: string[];\n /**\n * Whether the entity is visible or not.\n */\n // Not used, but has to be non-empty to draw a label at all!\n label: 'visible';\n};\n\n/**\n * Edge between two entities.\n *\n * @public\n */\nexport type EntityEdge = DependencyGraphTypes.DependencyEdge<EntityEdgeData>;\n\n/**\n * Additional data for Entity Node\n *\n * @public\n */\nexport type EntityNodeData = {\n /**\n * The Entity\n */\n entity: Entity;\n /**\n * Whether the entity is focused, optional, defaults to false. Focused\n * entities are highlighted in the graph.\n */\n focused?: boolean;\n /**\n * Optional color of the entity, defaults to 'default'.\n */\n color?: 'primary' | 'secondary' | 'default';\n /**\n * Optional click handler.\n */\n onClick?: MouseEventHandler<unknown>;\n\n /**\n * Name of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n name: string;\n /**\n * Optional kind of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n kind?: string;\n /**\n * Optional title of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n title?: string;\n /**\n * Namespace of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n * The Entity\n */\n namespace: string;\n /**\n * Optional spec of the entity.\n * @deprecated use {@link EntityNodeData#entity} instead\n */\n spec?: JsonObject;\n};\n\n/**\n * Node representing an entity.\n *\n * @public\n */\nexport type EntityNode = DependencyGraphTypes.DependencyNode<EntityNodeData>;\n\n/**\n * Render direction of the graph.\n *\n * @public\n */\nexport enum Direction {\n /**\n * Top to bottom.\n */\n TOP_BOTTOM = 'TB',\n /**\n * Bottom to top.\n */\n BOTTOM_TOP = 'BT',\n /**\n * Left to right.\n */\n LEFT_RIGHT = 'LR',\n /**\n * Right to left.\n */\n RIGHT_LEFT = 'RL',\n}\n"],"names":["Direction"],"mappings":"AA6GO,IAAK,SAAA,qBAAAA,UAAAA,KAAL;AAIL,EAAAA,WAAA,YAAA,CAAA,GAAa,IAAA;AAIb,EAAAA,WAAA,YAAA,CAAA,GAAa,IAAA;AAIb,EAAAA,WAAA,YAAA,CAAA,GAAa,IAAA;AAIb,EAAAA,WAAA,YAAA,CAAA,GAAa,IAAA;AAhBH,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityRelationGraph.esm.js","sources":["../../../src/components/EntityRelationsGraph/useEntityRelationGraph.ts"],"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 { Entity } from '@backstage/catalog-model';\nimport { useEffect, useMemo } from 'react';\nimport { useEntityStore } from './useEntityStore';\nimport { pickBy } from 'lodash';\n\n/**\n * Discover the graph of entities connected by relations, starting from a set of\n * root entities. Filters are used to select which relations to includes.\n * Returns all discovered entities once they are loaded.\n */\nexport function useEntityRelationGraph({\n rootEntityRefs,\n filter: {\n maxDepth = Number.POSITIVE_INFINITY,\n relations,\n kinds,\n entityFilter,\n } = {},\n}: {\n rootEntityRefs: string[];\n filter?: {\n maxDepth?: number;\n relations?: string[];\n kinds?: string[];\n entityFilter?: (entity: Entity) => boolean;\n };\n}): {\n entities?: { [ref: string]: Entity };\n loading: boolean;\n error?: Error;\n} {\n const { entities, loading, error, requestEntities } = useEntityStore();\n\n useEffect(() => {\n const expectedEntities = new Set([...rootEntityRefs]);\n const processedEntityRefs = new Set<string>();\n\n let nextDepthRefQueue = [...rootEntityRefs];\n let depth = 0;\n\n while (\n nextDepthRefQueue.length > 0 &&\n (!isFinite(maxDepth) || depth < maxDepth)\n ) {\n const entityRefQueue = nextDepthRefQueue;\n nextDepthRefQueue = [];\n\n while (entityRefQueue.length > 0) {\n const entityRef = entityRefQueue.shift()!;\n const entity = entities[entityRef];\n\n processedEntityRefs.add(entityRef);\n\n if (entity && entity.relations) {\n // If the entity is filtered out then no need to check any\n // of its outgoing relationships to other entities\n if (entityFilter && !entityFilter(entity)) {\n continue;\n }\n for (const rel of entity.relations) {\n if (\n (!relations || relations.includes(rel.type)) &&\n (!kinds ||\n kinds.some(kind =>\n rel.targetRef.startsWith(\n `${kind.toLocaleLowerCase('en-US')}:`,\n ),\n ))\n ) {\n if (!processedEntityRefs.has(rel.targetRef)) {\n nextDepthRefQueue.push(rel.targetRef);\n expectedEntities.add(rel.targetRef);\n }\n }\n }\n }\n }\n\n ++depth;\n }\n requestEntities([...expectedEntities]);\n }, [\n entities,\n rootEntityRefs,\n maxDepth,\n relations,\n kinds,\n entityFilter,\n requestEntities,\n ]);\n\n const filteredEntities = useMemo(\n () =>\n entityFilter\n ? pickBy(entities, (value, _key) => entityFilter(value))\n : entities,\n [entities, entityFilter],\n );\n\n return {\n entities: filteredEntities,\n loading,\n error,\n };\n}\n"],"names":[],"mappings":";;;;AAyBO,SAAS,
|
|
1
|
+
{"version":3,"file":"useEntityRelationGraph.esm.js","sources":["../../../src/components/EntityRelationsGraph/useEntityRelationGraph.ts"],"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 { Entity } from '@backstage/catalog-model';\nimport { useEffect, useMemo } from 'react';\nimport { useEntityStore } from './useEntityStore';\nimport { pickBy } from 'lodash';\n\n/**\n * Discover the graph of entities connected by relations, starting from a set of\n * root entities. Filters are used to select which relations to includes.\n * Returns all discovered entities once they are loaded.\n */\nexport function useEntityRelationGraph({\n rootEntityRefs,\n filter: {\n maxDepth = Number.POSITIVE_INFINITY,\n relations,\n kinds,\n entityFilter,\n } = {},\n}: {\n rootEntityRefs: string[];\n filter?: {\n maxDepth?: number;\n relations?: string[];\n kinds?: string[];\n entityFilter?: (entity: Entity) => boolean;\n };\n}): {\n entities?: { [ref: string]: Entity };\n loading: boolean;\n error?: Error;\n} {\n const { entities, loading, error, requestEntities } = useEntityStore();\n\n useEffect(() => {\n const expectedEntities = new Set([...rootEntityRefs]);\n const processedEntityRefs = new Set<string>();\n\n let nextDepthRefQueue = [...rootEntityRefs];\n let depth = 0;\n\n while (\n nextDepthRefQueue.length > 0 &&\n (!isFinite(maxDepth) || depth < maxDepth)\n ) {\n const entityRefQueue = nextDepthRefQueue;\n nextDepthRefQueue = [];\n\n while (entityRefQueue.length > 0) {\n const entityRef = entityRefQueue.shift()!;\n const entity = entities[entityRef];\n\n processedEntityRefs.add(entityRef);\n\n if (entity && entity.relations) {\n // If the entity is filtered out then no need to check any\n // of its outgoing relationships to other entities\n if (entityFilter && !entityFilter(entity)) {\n continue;\n }\n for (const rel of entity.relations) {\n if (\n (!relations || relations.includes(rel.type)) &&\n (!kinds ||\n kinds.some(kind =>\n rel.targetRef.startsWith(\n `${kind.toLocaleLowerCase('en-US')}:`,\n ),\n ))\n ) {\n if (!processedEntityRefs.has(rel.targetRef)) {\n nextDepthRefQueue.push(rel.targetRef);\n expectedEntities.add(rel.targetRef);\n }\n }\n }\n }\n }\n\n ++depth;\n }\n requestEntities([...expectedEntities]);\n }, [\n entities,\n rootEntityRefs,\n maxDepth,\n relations,\n kinds,\n entityFilter,\n requestEntities,\n ]);\n\n const filteredEntities = useMemo(\n () =>\n entityFilter\n ? pickBy(entities, (value, _key) => entityFilter(value))\n : entities,\n [entities, entityFilter],\n );\n\n return {\n entities: filteredEntities,\n loading,\n error,\n };\n}\n"],"names":[],"mappings":";;;;AAyBO,SAAS,sBAAA,CAAuB;AAAA,EACrC,cAAA;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,W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AA;AAAA;AACpC,aACF,CAAA,EACF;AACA,cAAA,IAAI,CAAC,mBAAA,CAAoB,GAAA,CAAI,GAAA,CAAI,SAAS,CAAA,EAAG;AAC3C,gBAAA,iBAAA,CAAkB,IAAA,CAAK,IAAI,SAAS,CAAA;AACpC,gBAAA,gBAAA,CAAiB,GAAA,CAAI,IAAI,SAAS,CAAA;AAAA,cACpC;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,MAAA,EAAE,KAAA;AAAA,IACJ;AACA,IAAA,eAAA,CAAgB,CAAC,GAAG,gBAAgB,CAAC,CAAA;AAAA,EACvC,CAAA,EAAG;AAAA,IACD,QAAA;AAAA,IACA,cAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,MAAM,gBAAA,GAAmB,OAAA;AAAA,IACvB,MACE,YAAA,GACI,MAAA,CAAO,QAAA,EAAU,CAAC,OAAO,IAAA,KAAS,YAAA,CAAa,KAAK,CAAC,CAAA,GACrD,QAAA;AAAA,IACN,CAAC,UAAU,YAAY;AAAA,GACzB;AAEA,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,gBAAA;AAAA,IACV,OAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityRelationNodesAndEdges.esm.js","sources":["../../../src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.ts"],"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 { MouseEvent, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { RelationPairs, ALL_RELATION_PAIRS } from './relations';\nimport { EntityEdge, EntityNode } from './types';\nimport { useEntityRelationGraph } from './useEntityRelationGraph';\nimport { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';\n\n/**\n * Generate nodes and edges to render the entity graph.\n */\nexport function useEntityRelationNodesAndEdges({\n rootEntityRefs,\n maxDepth = Number.POSITIVE_INFINITY,\n unidirectional = true,\n mergeRelations = true,\n kinds,\n relations,\n entityFilter,\n onNodeClick,\n relationPairs = ALL_RELATION_PAIRS,\n}: {\n rootEntityRefs: string[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n kinds?: string[];\n relations?: string[];\n entityFilter?: (entity: Entity) => boolean;\n onNodeClick?: (value: EntityNode, event: MouseEvent<unknown>) => void;\n relationPairs?: RelationPairs;\n}): {\n loading: boolean;\n nodes?: EntityNode[];\n edges?: EntityEdge[];\n error?: Error;\n} {\n const [nodesAndEdges, setNodesAndEdges] = useState<{\n nodes?: EntityNode[];\n edges?: EntityEdge[];\n }>({});\n const { entities, loading, error } = useEntityRelationGraph({\n rootEntityRefs,\n filter: {\n maxDepth,\n kinds,\n relations,\n entityFilter,\n },\n });\n\n useDebounce(\n () => {\n if (!entities || Object.keys(entities).length === 0) {\n setNodesAndEdges({});\n return;\n }\n\n const nodes = Object.entries(entities).map(([entityRef, entity]) => {\n const focused = rootEntityRefs.includes(entityRef);\n const node: EntityNode = {\n id: entityRef,\n entity,\n focused,\n color: focused ? 'secondary' : 'primary',\n // @deprecated\n kind: entity.kind,\n name: entity.metadata.name,\n namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,\n title: entity.metadata.title,\n spec: entity.spec,\n };\n\n if (onNodeClick) {\n node.onClick = event => onNodeClick(node, event);\n }\n\n return node;\n });\n\n const edges: EntityEdge[] = [];\n const visitedNodes = new Set<string>();\n const nodeQueue = [...rootEntityRefs];\n\n const hasEdge = (\n fromRef: string,\n toRef: string,\n relation: [string, string?],\n ): boolean => {\n return edges.some(\n edge =>\n fromRef === edge.from &&\n toRef === edge.to &&\n edge.relations.some(\n rel => rel[0] === relation[0] && rel[1] === relation[1],\n ),\n );\n };\n\n while (nodeQueue.length > 0) {\n const entityRef = nodeQueue.pop()!;\n const entity = entities[entityRef];\n visitedNodes.add(entityRef);\n\n if (entity) {\n entity?.relations?.forEach(rel => {\n // Check if the related entity should be displayed, if not, ignore\n // the relation too\n if (!entities[rel.targetRef]) {\n return;\n }\n\n if (relations && !relations.includes(rel.type)) {\n return;\n }\n\n if (\n kinds &&\n !kinds.some(kind =>\n rel.targetRef.startsWith(`${kind.toLocaleLowerCase('en-US')}:`),\n )\n ) {\n return;\n }\n\n if (mergeRelations) {\n const pair = relationPairs.find(\n ([l, r]) => l === rel.type || r === rel.type,\n ) ?? [rel.type];\n const [left] = pair;\n const from = left === rel.type ? entityRef : rel.targetRef;\n const to = left === rel.type ? rel.targetRef : entityRef;\n if (!unidirectional || !hasEdge(from, to, pair)) {\n edges.push({\n from,\n to,\n relations: pair,\n label: 'visible',\n });\n }\n } else {\n if (\n !unidirectional ||\n !hasEdge(entityRef, rel.targetRef, [rel.type])\n ) {\n edges.push({\n from: entityRef,\n to: rel.targetRef,\n relations: [rel.type],\n label: 'visible',\n });\n }\n }\n\n if (!visitedNodes.has(rel.targetRef)) {\n nodeQueue.push(rel.targetRef);\n visitedNodes.add(rel.targetRef);\n }\n\n // if unidirectional add missing relations as entities are only visited once\n if (unidirectional) {\n const findIndex = edges.findIndex(\n edge =>\n entityRef === edge.from &&\n rel.targetRef === edge.to &&\n !edge.relations.includes(rel.type),\n );\n if (findIndex >= 0) {\n if (mergeRelations) {\n const pair = relationPairs.find(\n ([l, r]) => l === rel.type || r === rel.type,\n ) ?? [rel.type];\n edges[findIndex].relations = [\n ...edges[findIndex].relations,\n ...pair,\n ];\n } else {\n edges[findIndex].relations = [\n ...edges[findIndex].relations,\n rel.type,\n ];\n }\n }\n }\n });\n }\n }\n\n // Reduce edges as the dependency graph anyway ignores duplicated edges regarding from / to\n // Additionally, this will improve rendering speed for the dependency graph\n const finalEdges = edges.reduce((previousEdges, currentEdge) => {\n const indexFound = previousEdges.findIndex(\n previousEdge =>\n previousEdge.from === currentEdge.from &&\n previousEdge.to === currentEdge.to,\n );\n if (indexFound >= 0) {\n previousEdges[indexFound] = {\n ...previousEdges[indexFound],\n relations: Array.from(\n new Set([\n ...previousEdges[indexFound].relations,\n ...currentEdge.relations,\n ]),\n ),\n };\n return previousEdges;\n }\n return [...previousEdges, currentEdge];\n }, [] as EntityEdge[]);\n\n setNodesAndEdges({ nodes, edges: finalEdges });\n },\n 100,\n [\n entities,\n rootEntityRefs,\n kinds,\n relations,\n unidirectional,\n mergeRelations,\n onNodeClick,\n relationPairs,\n ],\n );\n\n return {\n loading,\n error,\n ...nodesAndEdges,\n };\n}\n"],"names":[],"mappings":";;;;;;AAyBO,SAAS,8BAA+B,CAAA;AAAA,EAC7C,cAAA;AAAA,EACA,WAAW,MAAO,CAAA,iBAAA;AAAA,EAClB,cAAiB,GAAA,IAAA;AAAA,EACjB,cAAiB,GAAA,IAAA;AAAA,EACjB,KAAA;AAAA,EACA,SAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAgB,GAAA;AAClB,CAeE,EAAA;AACA,EAAA,MAAM,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,QAAA,CAGvC,EAAE,CAAA;AACL,EAAA,MAAM,EAAE,QAAA,EAAU,OAAS,EAAA,KAAA,KAAU,sBAAuB,CAAA;AAAA,IAC1D,cAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,QAAA;AAAA,MACA,KAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA;AACF,GACD,CAAA;AAED,EAAA,WAAA;AAAA,IACE,MAAM;AACJ,MAAA,IAAI,CAAC,QAAY,IAAA,MAAA,CAAO,KAAK,QAAQ,C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AA,MACA,KAAA;AAAA,MACA,SAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAO,OAAA;AAAA,IACL,OAAA;AAAA,IACA,KAAA;AAAA,IACA,GAAG;AAAA,GACL;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"useEntityRelationNodesAndEdges.esm.js","sources":["../../../src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.ts"],"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 { MouseEvent, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { RelationPairs, ALL_RELATION_PAIRS } from './relations';\nimport { EntityEdge, EntityNode } from './types';\nimport { useEntityRelationGraph } from './useEntityRelationGraph';\nimport { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';\n\n/**\n * Generate nodes and edges to render the entity graph.\n */\nexport function useEntityRelationNodesAndEdges({\n rootEntityRefs,\n maxDepth = Number.POSITIVE_INFINITY,\n unidirectional = true,\n mergeRelations = true,\n kinds,\n relations,\n entityFilter,\n onNodeClick,\n relationPairs = ALL_RELATION_PAIRS,\n}: {\n rootEntityRefs: string[];\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n kinds?: string[];\n relations?: string[];\n entityFilter?: (entity: Entity) => boolean;\n onNodeClick?: (value: EntityNode, event: MouseEvent<unknown>) => void;\n relationPairs?: RelationPairs;\n}): {\n loading: boolean;\n nodes?: EntityNode[];\n edges?: EntityEdge[];\n error?: Error;\n} {\n const [nodesAndEdges, setNodesAndEdges] = useState<{\n nodes?: EntityNode[];\n edges?: EntityEdge[];\n }>({});\n const { entities, loading, error } = useEntityRelationGraph({\n rootEntityRefs,\n filter: {\n maxDepth,\n kinds,\n relations,\n entityFilter,\n },\n });\n\n useDebounce(\n () => {\n if (!entities || Object.keys(entities).length === 0) {\n setNodesAndEdges({});\n return;\n }\n\n const nodes = Object.entries(entities).map(([entityRef, entity]) => {\n const focused = rootEntityRefs.includes(entityRef);\n const node: EntityNode = {\n id: entityRef,\n entity,\n focused,\n color: focused ? 'secondary' : 'primary',\n // @deprecated\n kind: entity.kind,\n name: entity.metadata.name,\n namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,\n title: entity.metadata.title,\n spec: entity.spec,\n };\n\n if (onNodeClick) {\n node.onClick = event => onNodeClick(node, event);\n }\n\n return node;\n });\n\n const edges: EntityEdge[] = [];\n const visitedNodes = new Set<string>();\n const nodeQueue = [...rootEntityRefs];\n\n const hasEdge = (\n fromRef: string,\n toRef: string,\n relation: [string, string?],\n ): boolean => {\n return edges.some(\n edge =>\n fromRef === edge.from &&\n toRef === edge.to &&\n edge.relations.some(\n rel => rel[0] === relation[0] && rel[1] === relation[1],\n ),\n );\n };\n\n while (nodeQueue.length > 0) {\n const entityRef = nodeQueue.pop()!;\n const entity = entities[entityRef];\n visitedNodes.add(entityRef);\n\n if (entity) {\n entity?.relations?.forEach(rel => {\n // Check if the related entity should be displayed, if not, ignore\n // the relation too\n if (!entities[rel.targetRef]) {\n return;\n }\n\n if (relations && !relations.includes(rel.type)) {\n return;\n }\n\n if (\n kinds &&\n !kinds.some(kind =>\n rel.targetRef.startsWith(`${kind.toLocaleLowerCase('en-US')}:`),\n )\n ) {\n return;\n }\n\n if (mergeRelations) {\n const pair = relationPairs.find(\n ([l, r]) => l === rel.type || r === rel.type,\n ) ?? [rel.type];\n const [left] = pair;\n const from = left === rel.type ? entityRef : rel.targetRef;\n const to = left === rel.type ? rel.targetRef : entityRef;\n if (!unidirectional || !hasEdge(from, to, pair)) {\n edges.push({\n from,\n to,\n relations: pair,\n label: 'visible',\n });\n }\n } else {\n if (\n !unidirectional ||\n !hasEdge(entityRef, rel.targetRef, [rel.type])\n ) {\n edges.push({\n from: entityRef,\n to: rel.targetRef,\n relations: [rel.type],\n label: 'visible',\n });\n }\n }\n\n if (!visitedNodes.has(rel.targetRef)) {\n nodeQueue.push(rel.targetRef);\n visitedNodes.add(rel.targetRef);\n }\n\n // if unidirectional add missing relations as entities are only visited once\n if (unidirectional) {\n const findIndex = edges.findIndex(\n edge =>\n entityRef === edge.from &&\n rel.targetRef === edge.to &&\n !edge.relations.includes(rel.type),\n );\n if (findIndex >= 0) {\n if (mergeRelations) {\n const pair = relationPairs.find(\n ([l, r]) => l === rel.type || r === rel.type,\n ) ?? [rel.type];\n edges[findIndex].relations = [\n ...edges[findIndex].relations,\n ...pair,\n ];\n } else {\n edges[findIndex].relations = [\n ...edges[findIndex].relations,\n rel.type,\n ];\n }\n }\n }\n });\n }\n }\n\n // Reduce edges as the dependency graph anyway ignores duplicated edges regarding from / to\n // Additionally, this will improve rendering speed for the dependency graph\n const finalEdges = edges.reduce((previousEdges, currentEdge) => {\n const indexFound = previousEdges.findIndex(\n previousEdge =>\n previousEdge.from === currentEdge.from &&\n previousEdge.to === currentEdge.to,\n );\n if (indexFound >= 0) {\n previousEdges[indexFound] = {\n ...previousEdges[indexFound],\n relations: Array.from(\n new Set([\n ...previousEdges[indexFound].relations,\n ...currentEdge.relations,\n ]),\n ),\n };\n return previousEdges;\n }\n return [...previousEdges, currentEdge];\n }, [] as EntityEdge[]);\n\n setNodesAndEdges({ nodes, edges: finalEdges });\n },\n 100,\n [\n entities,\n rootEntityRefs,\n kinds,\n relations,\n unidirectional,\n mergeRelations,\n onNodeClick,\n relationPairs,\n ],\n );\n\n return {\n loading,\n error,\n ...nodesAndEdges,\n };\n}\n"],"names":[],"mappings":";;;;;;AAyBO,SAAS,8BAAA,CAA+B;AAAA,EAC7C,cAAA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A,MAAM,aAAa,aAAA,CAAc,SAAA;AAAA,UAC/B,kBACE,YAAA,CAAa,IAAA,KAAS,YAAY,IAAA,IAClC,YAAA,CAAa,OAAO,WAAA,CAAY;AAAA,SACpC;AACA,QAAA,IAAI,cAAc,CAAA,EAAG;AACnB,UAAA,aAAA,CAAc,UAAU,CAAA,GAAI;AAAA,YAC1B,GAAG,cAAc,UAAU,CAAA;AAAA,YAC3B,WAAW,KAAA,CAAM,IAAA;AAAA,kCACX,GAAA,CAAI;AAAA,gBACN,GAAG,aAAA,CAAc,UAAU,CAAA,CAAE,SAAA;AAAA,gBAC7B,GAAG,WAAA,CAAY;AAAA,eAChB;AAAA;AACH,WACF;AACA,UAAA,OAAO,aAAA;AAAA,QACT;AACA,QAAA,OAAO,CAAC,GAAG,aAAA,EAAe,WAAW,CAAA;AAAA,MACvC,CAAA,EAAG,EAAkB,CAAA;AAErB,MAAA,gBAAA,CAAiB,EAAE,KAAA,EAAO,KAAA,EAAO,UAAA,EAAY,CAAA;AAAA,IAC/C,CAAA;AAAA,IACA,GAAA;AAAA,IACA;AAAA,MACE,QAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAA;AAAA,MACA,SAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,KAAA;AAAA,IACA,GAAG;AAAA,GACL;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityStore.esm.js","sources":["../../../src/components/EntityRelationsGraph/useEntityStore.ts"],"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 { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Dispatch, useCallback, useRef, useState } from 'react';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\n// TODO: This is a good use case for a graphql API, once it is available in the\n// future.\n\n/**\n * Ensures that a set of requested entities is loaded.\n */\nexport function useEntityStore(): {\n entities: { [ref: string]: Entity };\n loading: boolean;\n error?: Error;\n requestEntities: Dispatch<string[]>;\n} {\n const catalogClient = useApi(catalogApiRef);\n const state = useRef({\n requestedEntities: new Set<string>(),\n outstandingEntities: new Map<string, Promise<Entity | undefined>>(),\n cachedEntities: new Map<string, Entity>(),\n });\n const [entities, setEntities] = useState<{\n [ref: string]: Entity;\n }>({});\n\n const updateEntities = useCallback(() => {\n const { cachedEntities, requestedEntities } = state.current;\n const filteredEntities: { [ref: string]: Entity } = {};\n requestedEntities.forEach(entityRef => {\n const entity = cachedEntities.get(entityRef);\n\n if (entity) {\n filteredEntities[entityRef] = entity;\n }\n });\n setEntities(filteredEntities);\n }, [state, setEntities]);\n\n const [asyncState, fetch] = useAsyncFn(async () => {\n const { requestedEntities, cachedEntities } = state.current;\n const entityRefs: string[] = Array.from(requestedEntities).filter(\n entityRef => !cachedEntities.has(entityRef),\n );\n if (entityRefs.length === 0) {\n updateEntities();\n return;\n }\n\n const { items } = await catalogClient.getEntitiesByRefs({ entityRefs });\n items.forEach(ent => {\n if (ent) {\n const entityRef = stringifyEntityRef(ent);\n cachedEntities.set(entityRef, ent);\n }\n });\n\n updateEntities();\n }, [state, updateEntities]);\n const { loading, error } = asyncState;\n\n const requestEntities = useCallback(\n (entityRefs: string[]) => {\n const n = new Set(entityRefs);\n const { requestedEntities } = state.current;\n\n if (\n n.size !== requestedEntities.size ||\n Array.from(n).some(e => !requestedEntities.has(e))\n ) {\n state.current.requestedEntities = n;\n fetch();\n updateEntities();\n }\n },\n [state, fetch, updateEntities],\n );\n\n return {\n entities,\n loading,\n error,\n requestEntities,\n };\n}\n"],"names":[],"mappings":";;;;;;AA2BO,SAAS,
|
|
1
|
+
{"version":3,"file":"useEntityStore.esm.js","sources":["../../../src/components/EntityRelationsGraph/useEntityStore.ts"],"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 { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Dispatch, useCallback, useRef, useState } from 'react';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\n// TODO: This is a good use case for a graphql API, once it is available in the\n// future.\n\n/**\n * Ensures that a set of requested entities is loaded.\n */\nexport function useEntityStore(): {\n entities: { [ref: string]: Entity };\n loading: boolean;\n error?: Error;\n requestEntities: Dispatch<string[]>;\n} {\n const catalogClient = useApi(catalogApiRef);\n const state = useRef({\n requestedEntities: new Set<string>(),\n outstandingEntities: new Map<string, Promise<Entity | undefined>>(),\n cachedEntities: new Map<string, Entity>(),\n });\n const [entities, setEntities] = useState<{\n [ref: string]: Entity;\n }>({});\n\n const updateEntities = useCallback(() => {\n const { cachedEntities, requestedEntities } = state.current;\n const filteredEntities: { [ref: string]: Entity } = {};\n requestedEntities.forEach(entityRef => {\n const entity = cachedEntities.get(entityRef);\n\n if (entity) {\n filteredEntities[entityRef] = entity;\n }\n });\n setEntities(filteredEntities);\n }, [state, setEntities]);\n\n const [asyncState, fetch] = useAsyncFn(async () => {\n const { requestedEntities, cachedEntities } = state.current;\n const entityRefs: string[] = Array.from(requestedEntities).filter(\n entityRef => !cachedEntities.has(entityRef),\n );\n if (entityRefs.length === 0) {\n updateEntities();\n return;\n }\n\n const { items } = await catalogClient.getEntitiesByRefs({ entityRefs });\n items.forEach(ent => {\n if (ent) {\n const entityRef = stringifyEntityRef(ent);\n cachedEntities.set(entityRef, ent);\n }\n });\n\n updateEntities();\n }, [state, updateEntities]);\n const { loading, error } = asyncState;\n\n const requestEntities = useCallback(\n (entityRefs: string[]) => {\n const n = new Set(entityRefs);\n const { requestedEntities } = state.current;\n\n if (\n n.size !== requestedEntities.size ||\n Array.from(n).some(e => !requestedEntities.has(e))\n ) {\n state.current.requestedEntities = n;\n fetch();\n updateEntities();\n }\n },\n [state, fetch, updateEntities],\n );\n\n return {\n entities,\n loading,\n error,\n requestEntities,\n };\n}\n"],"names":[],"mappings":";;;;;;AA2BO,SAAS,cAAA,GAKd;AACA,EAAA,MAAM,aAAA,GAAgB,OAAO,aAAa,CAAA;AAC1C,EAAA,MAAM,QAAQ,MAAA,CAAO;AAAA,IACnB,iBAAA,sBAAuB,GAAA,EAAY;AAAA,IACnC,mBAAA,sBAAyB,GAAA,EAAyC;AAAA,IAClE,cAAA,sBAAoB,GAAA;AAAoB,GACzC,CAAA;AACD,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAAA,CAE7B,EAAE,CAAA;AAEL,EAAA,MAAM,cAAA,GAAiB,YAAY,MAAM;AACvC,IAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAkB,GAAI,KAAA,CAAM,OAAA;AACpD,IAAA,MAAM,mBAA8C,EAAC;AACrD,IAAA,iBAAA,CAAkB,QAAQ,CAAA,SAAA,KAAa;AACrC,MAAA,MAAM,MAAA,GAAS,cAAA,CAAe,GAAA,CAAI,SAAS,CAAA;AAE3C,MAAA,IAAI,MAAA,EAAQ;AACV,QAAA,gBAAA,CAAi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AS,iBAAA,CAAkB,IAAA,IAC7B,MAAM,IAAA,CAAK,CAAC,CAAA,CAAE,IAAA,CAAK,OAAK,CAAC,iBAAA,CAAkB,GAAA,CAAI,CAAC,CAAC,CAAA,EACjD;AACA,QAAA,KAAA,CAAM,QAAQ,iBAAA,GAAoB,CAAA;AAClC,QAAA,KAAA,EAAM;AACN,QAAA,cAAA,EAAe;AAAA,MACjB;AAAA,IACF,CAAA;AAAA,IACA,CAAC,KAAA,EAAO,KAAA,EAAO,cAAc;AAAA,GAC/B;AAEA,EAAA,OAAO;AAAA,IACL,QAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.esm.js","sources":["../src/extensions.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 {\n createComponentExtension,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\nimport { catalogGraphPlugin } from './plugin';\nimport { catalogGraphRouteRef } from './routes';\n\n/**\n * A card that displays the directly related entities to the current entity.\n *\n * @public\n */\nexport const EntityCatalogGraphCard = catalogGraphPlugin.provide(\n createComponentExtension({\n name: 'EntityCatalogGraphCard',\n component: {\n lazy: () =>\n import('./components/CatalogGraphCard').then(m => m.CatalogGraphCard),\n },\n }),\n);\n\n/**\n * A standalone page that can be added to your application providing a viewer\n * for your entities and their relations.\n *\n * @public\n */\nexport const CatalogGraphPage = catalogGraphPlugin.provide(\n createRoutableExtension({\n name: 'CatalogGraphPage',\n component: () =>\n import('./components/CatalogGraphPage').then(m => m.CatalogGraphPage),\n mountPoint: catalogGraphRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;AA2BO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"extensions.esm.js","sources":["../src/extensions.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 {\n createComponentExtension,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\nimport { catalogGraphPlugin } from './plugin';\nimport { catalogGraphRouteRef } from './routes';\n\n/**\n * A card that displays the directly related entities to the current entity.\n *\n * @public\n */\nexport const EntityCatalogGraphCard = catalogGraphPlugin.provide(\n createComponentExtension({\n name: 'EntityCatalogGraphCard',\n component: {\n lazy: () =>\n import('./components/CatalogGraphCard').then(m => m.CatalogGraphCard),\n },\n }),\n);\n\n/**\n * A standalone page that can be added to your application providing a viewer\n * for your entities and their relations.\n *\n * @public\n */\nexport const CatalogGraphPage = catalogGraphPlugin.provide(\n createRoutableExtension({\n name: 'CatalogGraphPage',\n component: () =>\n import('./components/CatalogGraphPage').then(m => m.CatalogGraphPage),\n mountPoint: catalogGraphRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;AA2BO,MAAM,yBAAyB,kBAAA,CAAmB,OAAA;AAAA,EACvD,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,wBAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,4CAA+B,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,gBAAgB;AAAA;AACxE,GACD;AACH;AAQO,MAAM,mBAAmB,kBAAA,CAAmB,OAAA;AAAA,EACjD,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,kBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,4CAA+B,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,gBAAgB,CAAA;AAAA,IACtE,UAAA,EAAY;AAAA,GACb;AACH;;;;"}
|
package/dist/package.json.esm.js
CHANGED
package/dist/plugin.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPlugin } from '@backstage/core-plugin-api';
|
|
2
|
-
import {
|
|
2
|
+
import { catalogEntityRouteRef, catalogGraphRouteRef } from './routes.esm.js';
|
|
3
3
|
|
|
4
4
|
const catalogGraphPlugin = createPlugin({
|
|
5
5
|
id: "catalog-graph",
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 { createPlugin } from '@backstage/core-plugin-api';\nimport { catalogEntityRouteRef, catalogGraphRouteRef } from './routes';\n\n/**\n * Catalog Graph Plugin instance.\n * @public\n */\nexport const catalogGraphPlugin = createPlugin({\n id: 'catalog-graph',\n routes: {\n catalogGraph: catalogGraphRouteRef,\n },\n externalRoutes: {\n catalogEntity: catalogEntityRouteRef,\n },\n});\n"],"names":[],"mappings":";;;AAsBO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 { createPlugin } from '@backstage/core-plugin-api';\nimport { catalogEntityRouteRef, catalogGraphRouteRef } from './routes';\n\n/**\n * Catalog Graph Plugin instance.\n * @public\n */\nexport const catalogGraphPlugin = createPlugin({\n id: 'catalog-graph',\n routes: {\n catalogGraph: catalogGraphRouteRef,\n },\n externalRoutes: {\n catalogEntity: catalogEntityRouteRef,\n },\n});\n"],"names":[],"mappings":";;;AAsBO,MAAM,qBAAqB,YAAA,CAAa;AAAA,EAC7C,EAAA,EAAI,eAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,aAAA,EAAe;AAAA;AAEnB,CAAC;;;;"}
|
package/dist/routes.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 {\n createExternalRouteRef,\n createRouteRef,\n} from '@backstage/core-plugin-api';\n\n/**\n * Route pointing to the standalone catalog graph page.\n *\n * @public\n */\nexport const catalogGraphRouteRef = createRouteRef({\n id: 'catalog-graph',\n});\n\n/**\n * Route pointing to the entity page.\n * Used to navigate from the graph to an entity.\n *\n * @public\n * @deprecated This route is no longer used and can be removed\n */\nexport const catalogEntityRouteRef = createExternalRouteRef({\n id: 'catalog-entity',\n params: ['namespace', 'kind', 'name'],\n optional: true,\n defaultTarget: 'catalog.catalogEntity',\n});\n"],"names":[],"mappings":";;AAyBO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 {\n createExternalRouteRef,\n createRouteRef,\n} from '@backstage/core-plugin-api';\n\n/**\n * Route pointing to the standalone catalog graph page.\n *\n * @public\n */\nexport const catalogGraphRouteRef = createRouteRef({\n id: 'catalog-graph',\n});\n\n/**\n * Route pointing to the entity page.\n * Used to navigate from the graph to an entity.\n *\n * @public\n * @deprecated This route is no longer used and can be removed\n */\nexport const catalogEntityRouteRef = createExternalRouteRef({\n id: 'catalog-entity',\n params: ['namespace', 'kind', 'name'],\n optional: true,\n defaultTarget: 'catalog.catalogEntity',\n});\n"],"names":[],"mappings":";;AAyBO,MAAM,uBAAuB,cAAA,CAAe;AAAA,EACjD,EAAA,EAAI;AACN,CAAC;AASM,MAAM,wBAAwB,sBAAA,CAAuB;AAAA,EAC1D,EAAA,EAAI,gBAAA;AAAA,EACJ,MAAA,EAAQ,CAAC,WAAA,EAAa,MAAA,EAAQ,MAAM,CAAA;AAAA,EACpC,QAAA,EAAU,IAAA;AAAA,EACV,aAAA,EAAe;AACjB,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport const catalogGraphTranslationRef = createTranslationRef({\n id: 'catalog-graph',\n messages: {\n catalogGraphCard: {\n title: 'Relations',\n deepLinkTitle: 'View graph',\n },\n catalogGraphPage: {\n title: 'Catalog Graph',\n filterToggleButtonTitle: 'Filters',\n supportButtonDescription:\n 'Start tracking your component in by adding it to the software catalog.',\n simplifiedSwitchLabel: 'Simplified',\n mergeRelationsSwitchLabel: 'Merge relations',\n zoomOutDescription:\n 'Use pinch & zoom to move around the diagram. Click to change active node, shift click to navigate to entity.',\n curveFilter: {\n title: 'Curve',\n curveMonotoneX: 'Monotone X',\n curveStepBefore: 'Step Before',\n },\n directionFilter: {\n title: 'Direction',\n leftToRight: 'Left to right',\n rightToLeft: 'Right to left',\n topToBottom: 'Top to bottom',\n bottomToTop: 'Bottom to top',\n },\n maxDepthFilter: {\n title: 'Max depth',\n inputPlaceholder: '∞ Infinite',\n clearButtonAriaLabel: 'clear max depth',\n },\n selectedKindsFilter: {\n title: 'Kinds',\n },\n selectedRelationsFilter: {\n title: 'Relations',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/** @alpha */\nexport const catalogGraphTranslationRef = createTranslationRef({\n id: 'catalog-graph',\n messages: {\n catalogGraphCard: {\n title: 'Relations',\n deepLinkTitle: 'View graph',\n },\n catalogGraphPage: {\n title: 'Catalog Graph',\n filterToggleButtonTitle: 'Filters',\n supportButtonDescription:\n 'Start tracking your component in by adding it to the software catalog.',\n simplifiedSwitchLabel: 'Simplified',\n mergeRelationsSwitchLabel: 'Merge relations',\n zoomOutDescription:\n 'Use pinch & zoom to move around the diagram. Click to change active node, shift click to navigate to entity.',\n curveFilter: {\n title: 'Curve',\n curveMonotoneX: 'Monotone X',\n curveStepBefore: 'Step Before',\n },\n directionFilter: {\n title: 'Direction',\n leftToRight: 'Left to right',\n rightToLeft: 'Right to left',\n topToBottom: 'Top to bottom',\n bottomToTop: 'Bottom to top',\n },\n maxDepthFilter: {\n title: 'Max depth',\n inputPlaceholder: '∞ Infinite',\n clearButtonAriaLabel: 'clear max depth',\n },\n selectedKindsFilter: {\n title: 'Kinds',\n },\n selectedRelationsFilter: {\n title: 'Relations',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,6BAA6B,oBAAA,CAAqB;AAAA,EAC7D,EAAA,EAAI,eAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,gBAAA,EAAkB;AAAA,MAChB,KAAA,EAAO,WAAA;AAAA,MACP,aAAA,EAAe;AAAA,KACjB;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,KAAA,EAAO,eAAA;AAAA,MACP,uBAAA,EAAyB,SAAA;AAAA,MACzB,wBAAA,EACE,wEAAA;AAAA,MACF,qBAAA,EAAuB,YAAA;AAAA,MACvB,yBAAA,EAA2B,iBAAA;AAAA,MAC3B,kBAAA,EACE,kHAAA;AAAA,MACF,WAAA,EAAa;AAAA,QACX,KAAA,EAAO,OAAA;AAAA,QACP,cAAA,EAAgB,YAAA;AAAA,QAChB,eAAA,EAAiB;AAAA,OACnB;AAAA,MACA,eAAA,EAAiB;AAAA,QACf,KAAA,EAAO,WAAA;AAAA,QACP,WAAA,EAAa,eAAA;AAAA,QACb,WAAA,EAAa,eAAA;AAAA,QACb,WAAA,EAAa,eAAA;AAAA,QACb,WAAA,EAAa;AAAA,OACf;AAAA,MACA,cAAA,EAAgB;AAAA,QACd,KAAA,EAAO,WAAA;AAAA,QACP,gBAAA,EAAkB,iBAAA;AAAA,QAClB,oBAAA,EAAsB;AAAA,OACxB;AAAA,MACA,mBAAA,EAAqB;AAAA,QACnB,KAAA,EAAO;AAAA,OACT;AAAA,MACA,uBAAA,EAAyB;AAAA,QACvB,KAAA,EAAO;AAAA;AACT;AACF;AAEJ,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-graph",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.23-next.0",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "catalog-graph",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"test": "backstage-cli package test"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@backstage/catalog-client": "1.11.0
|
|
64
|
+
"@backstage/catalog-client": "1.11.0",
|
|
65
65
|
"@backstage/catalog-model": "1.7.5",
|
|
66
|
-
"@backstage/core-compat-api": "0.5.
|
|
67
|
-
"@backstage/core-components": "0.17.5
|
|
66
|
+
"@backstage/core-compat-api": "0.5.2-next.0",
|
|
67
|
+
"@backstage/core-components": "0.17.5",
|
|
68
68
|
"@backstage/core-plugin-api": "1.10.9",
|
|
69
|
-
"@backstage/frontend-plugin-api": "0.11.0
|
|
70
|
-
"@backstage/plugin-catalog-react": "1.20.
|
|
69
|
+
"@backstage/frontend-plugin-api": "0.11.0",
|
|
70
|
+
"@backstage/plugin-catalog-react": "1.20.2-next.0",
|
|
71
71
|
"@backstage/types": "1.2.1",
|
|
72
72
|
"@material-ui/core": "^4.12.2",
|
|
73
73
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
"react-use": "^17.2.4"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@backstage/cli": "0.34.
|
|
82
|
+
"@backstage/cli": "0.34.1-next.0",
|
|
83
83
|
"@backstage/core-app-api": "1.18.0",
|
|
84
|
-
"@backstage/dev-utils": "1.1.
|
|
85
|
-
"@backstage/plugin-catalog": "1.31.
|
|
86
|
-
"@backstage/test-utils": "1.7.11
|
|
84
|
+
"@backstage/dev-utils": "1.1.14-next.0",
|
|
85
|
+
"@backstage/plugin-catalog": "1.31.3-next.0",
|
|
86
|
+
"@backstage/test-utils": "1.7.11",
|
|
87
87
|
"@testing-library/dom": "^10.0.0",
|
|
88
88
|
"@testing-library/jest-dom": "^6.0.0",
|
|
89
89
|
"@testing-library/react": "^16.0.0",
|