@backstage/plugin-catalog-graph 0.4.4-next.1 → 0.4.5-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 +30 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.esm.js +5 -13
- package/dist/alpha.esm.js.map +1 -1
- package/dist/{esm/index-Dy8_Ufah.esm.js → components/CatalogGraphCard/CatalogGraphCard.esm.js} +5 -8
- package/dist/components/CatalogGraphCard/CatalogGraphCard.esm.js.map +1 -0
- package/dist/components/CatalogGraphCard/index.esm.js +2 -0
- package/dist/components/CatalogGraphCard/index.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/CatalogGraphPage.esm.js +209 -0
- package/dist/components/CatalogGraphPage/CatalogGraphPage.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/CurveFilter.esm.js +30 -0
- package/dist/components/CatalogGraphPage/CurveFilter.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/DirectionFilter.esm.js +34 -0
- package/dist/components/CatalogGraphPage/DirectionFilter.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/MaxDepthFilter.esm.js +68 -0
- package/dist/components/CatalogGraphPage/MaxDepthFilter.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/SelectedKindsFilter.esm.js +101 -0
- package/dist/components/CatalogGraphPage/SelectedKindsFilter.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/SelectedRelationsFilter.esm.js +71 -0
- package/dist/components/CatalogGraphPage/SelectedRelationsFilter.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/SwitchFilter.esm.js +43 -0
- package/dist/components/CatalogGraphPage/SwitchFilter.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/index.esm.js +2 -0
- package/dist/components/CatalogGraphPage/index.esm.js.map +1 -0
- package/dist/components/CatalogGraphPage/useCatalogGraphPage.esm.js +175 -0
- package/dist/components/CatalogGraphPage/useCatalogGraphPage.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/DefaultRenderLabel.esm.js +24 -0
- package/dist/components/EntityRelationsGraph/DefaultRenderLabel.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/DefaultRenderNode.esm.js +120 -0
- package/dist/components/EntityRelationsGraph/DefaultRenderNode.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/EntityKindIcon.esm.js +16 -0
- package/dist/components/EntityRelationsGraph/EntityKindIcon.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/EntityRelationsGraph.esm.js +108 -0
- package/dist/components/EntityRelationsGraph/EntityRelationsGraph.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/relations.esm.js +14 -0
- package/dist/components/EntityRelationsGraph/relations.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/types.esm.js +10 -0
- package/dist/components/EntityRelationsGraph/types.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/useEntityRelationGraph.esm.js +48 -0
- package/dist/components/EntityRelationsGraph/useEntityRelationGraph.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.esm.js +123 -0
- package/dist/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.esm.js.map +1 -0
- package/dist/components/EntityRelationsGraph/useEntityStore.esm.js +66 -0
- package/dist/components/EntityRelationsGraph/useEntityStore.esm.js.map +1 -0
- package/dist/extensions.esm.js +22 -0
- package/dist/extensions.esm.js.map +1 -0
- package/dist/index.esm.js +6 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +15 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/routes.esm.js +13 -0
- package/dist/routes.esm.js.map +1 -0
- package/package.json +15 -15
- package/dist/esm/index-CyVoUbSq.esm.js +0 -670
- package/dist/esm/index-CyVoUbSq.esm.js.map +0 -1
- package/dist/esm/index-Dy8_Ufah.esm.js.map +0 -1
- package/dist/esm/routes-B7pnW8AZ.esm.js +0 -489
- package/dist/esm/routes-B7pnW8AZ.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-graph
|
|
2
2
|
|
|
3
|
+
## 0.4.5-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-compat-api@0.2.5-next.0
|
|
9
|
+
- @backstage/catalog-model@1.5.0-next.0
|
|
10
|
+
- @backstage/core-components@0.14.5-next.0
|
|
11
|
+
- @backstage/catalog-client@1.6.5-next.0
|
|
12
|
+
- @backstage/plugin-catalog-react@1.11.4-next.0
|
|
13
|
+
- @backstage/core-plugin-api@1.9.2
|
|
14
|
+
- @backstage/frontend-plugin-api@0.6.5-next.0
|
|
15
|
+
- @backstage/types@1.1.1
|
|
16
|
+
|
|
17
|
+
## 0.4.4
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- abfbcfc: Updated dependency `@testing-library/react` to `^15.0.0`.
|
|
22
|
+
- cb1e3b0: Updated dependency `@testing-library/dom` to `^10.0.0`.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @backstage/plugin-catalog-react@1.11.3
|
|
25
|
+
- @backstage/core-compat-api@0.2.4
|
|
26
|
+
- @backstage/core-components@0.14.4
|
|
27
|
+
- @backstage/core-plugin-api@1.9.2
|
|
28
|
+
- @backstage/frontend-plugin-api@0.6.4
|
|
29
|
+
- @backstage/catalog-client@1.6.4
|
|
30
|
+
- @backstage/catalog-model@1.4.5
|
|
31
|
+
- @backstage/types@1.1.1
|
|
32
|
+
|
|
3
33
|
## 0.4.4-next.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.esm.js
CHANGED
|
@@ -2,18 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { createSchemaFromZod, createPageExtension, createPlugin } from '@backstage/frontend-plugin-api';
|
|
3
3
|
import { compatWrapper, convertLegacyRouteRef } from '@backstage/core-compat-api';
|
|
4
4
|
import { createEntityCardExtension } from '@backstage/plugin-catalog-react/alpha';
|
|
5
|
-
import {
|
|
5
|
+
import { catalogGraphRouteRef, catalogEntityRouteRef } from './routes.esm.js';
|
|
6
|
+
import './components/EntityRelationsGraph/EntityRelationsGraph.esm.js';
|
|
6
7
|
import '@backstage/catalog-model';
|
|
7
|
-
import '
|
|
8
|
-
import '@backstage/core-plugin-api';
|
|
9
|
-
import '@material-ui/core/CircularProgress';
|
|
10
|
-
import '@material-ui/core/styles';
|
|
11
|
-
import 'classnames';
|
|
12
|
-
import '@material-ui/core/styles/makeStyles';
|
|
13
|
-
import '@backstage/plugin-catalog-react';
|
|
14
|
-
import '@material-ui/core/SvgIcon';
|
|
15
|
-
import 'react-use/esm/useDebounce';
|
|
16
|
-
import 'react-use/esm/useAsyncFn';
|
|
8
|
+
import { Direction } from './components/EntityRelationsGraph/types.esm.js';
|
|
17
9
|
|
|
18
10
|
function getEntityGraphRelationsConfigSchema(z) {
|
|
19
11
|
return z.object({
|
|
@@ -40,7 +32,7 @@ const CatalogGraphEntityCard = createEntityCardExtension({
|
|
|
40
32
|
// For more details, see this comment: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
41
33
|
}).merge(getEntityGraphRelationsConfigSchema(z))
|
|
42
34
|
),
|
|
43
|
-
loader: async ({ config: { filter, ...props } }) => import('./
|
|
35
|
+
loader: async ({ config: { filter, ...props } }) => import('./components/CatalogGraphCard/index.esm.js').then(
|
|
44
36
|
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.CatalogGraphCard, { ...props }))
|
|
45
37
|
)
|
|
46
38
|
});
|
|
@@ -65,7 +57,7 @@ const CatalogGraphPage = createPageExtension({
|
|
|
65
57
|
}).merge(getEntityGraphRelationsConfigSchema(z)).optional()
|
|
66
58
|
})
|
|
67
59
|
),
|
|
68
|
-
loader: ({ config: { path, ...props } }) => import('./
|
|
60
|
+
loader: ({ config: { path, ...props } }) => import('./components/CatalogGraphPage/index.esm.js').then(
|
|
69
61
|
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.CatalogGraphPage, { ...props }))
|
|
70
62
|
)
|
|
71
63
|
});
|
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 React from 'react';\nimport {\n createPageExtension,\n createPlugin,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport { createEntityCardExtension } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogGraphRouteRef, catalogEntityRouteRef } from './routes';\nimport { Direction } from './components';\n\nfunction getEntityGraphRelationsConfigSchema(\n z: Parameters<Parameters<typeof createSchemaFromZod>[0]>[0],\n) {\n // Mapping EntityRelationsGraphProps to config\n // The classname and render functions are configurable only via extension overrides\n return z.object({\n kinds: z.array(z.string()).optional(),\n relations: z.array(z.string()).optional(),\n maxDepth: z.number().optional(),\n unidirectional: z.boolean().optional(),\n mergeRelations: z.boolean().optional(),\n direction: z.nativeEnum(Direction).optional(),\n relationPairs: z.array(z.tuple([z.string(), z.string()])).optional(),\n zoom: z.enum(['enabled', 'disabled', 'enable-on-click']).optional(),\n curve: z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n });\n}\n\nconst CatalogGraphEntityCard = createEntityCardExtension({\n name: 'relations',\n configSchema: createSchemaFromZod(z =>\n z\n .object({\n // Filter is a config required to all entity cards\n filter: z.string().optional(),\n title: z.string().optional(),\n height: z.number().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 })\n .merge(getEntityGraphRelationsConfigSchema(z)),\n ),\n loader: async ({ config: { filter, ...props } }) =>\n import('./components/CatalogGraphCard').then(m =>\n compatWrapper(<m.CatalogGraphCard {...props} />),\n ),\n});\n\nconst CatalogGraphPage = createPageExtension({\n defaultPath: '/catalog-graph',\n routeRef: convertLegacyRouteRef(catalogGraphRouteRef),\n configSchema: createSchemaFromZod(z =>\n z.object({\n // Path is a default config required to all pages\n path: z.string().default('/catalog-graph'),\n // Mapping intialState prop to config, these are the initial filter values, as opposed to configuration of the available filter values\n initialState: z\n .object({\n selectedKinds: z.array(z.string()).optional(),\n selectedRelations: z.array(z.string()).optional(),\n rootEntityRefs: z.array(z.string()).optional(),\n maxDepth: z.number().optional(),\n unidirectional: z.boolean().optional(),\n mergeRelations: z.boolean().optional(),\n direction: z.nativeEnum(Direction).optional(),\n showFilters: z.boolean().optional(),\n curve: z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n })\n .merge(getEntityGraphRelationsConfigSchema(z))\n .optional(),\n }),\n ),\n loader: ({ config: { path, ...props } }) =>\n import('./components/CatalogGraphPage').then(m =>\n compatWrapper(<m.CatalogGraphPage {...props} />),\n ),\n});\n\nexport default createPlugin({\n id: 'catalog-graph',\n routes: {\n catalogGraph: convertLegacyRouteRef(catalogGraphRouteRef),\n },\n externalRoutes: {\n catalogEntity: convertLegacyRouteRef(catalogEntityRouteRef),\n },\n extensions: [CatalogGraphPage, CatalogGraphEntityCard],\n});\n"],"names":[],"mappings":"
|
|
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 React from 'react';\nimport {\n createPageExtension,\n createPlugin,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport { createEntityCardExtension } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogGraphRouteRef, catalogEntityRouteRef } from './routes';\nimport { Direction } from './components';\n\nfunction getEntityGraphRelationsConfigSchema(\n z: Parameters<Parameters<typeof createSchemaFromZod>[0]>[0],\n) {\n // Mapping EntityRelationsGraphProps to config\n // The classname and render functions are configurable only via extension overrides\n return z.object({\n kinds: z.array(z.string()).optional(),\n relations: z.array(z.string()).optional(),\n maxDepth: z.number().optional(),\n unidirectional: z.boolean().optional(),\n mergeRelations: z.boolean().optional(),\n direction: z.nativeEnum(Direction).optional(),\n relationPairs: z.array(z.tuple([z.string(), z.string()])).optional(),\n zoom: z.enum(['enabled', 'disabled', 'enable-on-click']).optional(),\n curve: z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n });\n}\n\nconst CatalogGraphEntityCard = createEntityCardExtension({\n name: 'relations',\n configSchema: createSchemaFromZod(z =>\n z\n .object({\n // Filter is a config required to all entity cards\n filter: z.string().optional(),\n title: z.string().optional(),\n height: z.number().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 })\n .merge(getEntityGraphRelationsConfigSchema(z)),\n ),\n loader: async ({ config: { filter, ...props } }) =>\n import('./components/CatalogGraphCard').then(m =>\n compatWrapper(<m.CatalogGraphCard {...props} />),\n ),\n});\n\nconst CatalogGraphPage = createPageExtension({\n defaultPath: '/catalog-graph',\n routeRef: convertLegacyRouteRef(catalogGraphRouteRef),\n configSchema: createSchemaFromZod(z =>\n z.object({\n // Path is a default config required to all pages\n path: z.string().default('/catalog-graph'),\n // Mapping intialState prop to config, these are the initial filter values, as opposed to configuration of the available filter values\n initialState: z\n .object({\n selectedKinds: z.array(z.string()).optional(),\n selectedRelations: z.array(z.string()).optional(),\n rootEntityRefs: z.array(z.string()).optional(),\n maxDepth: z.number().optional(),\n unidirectional: z.boolean().optional(),\n mergeRelations: z.boolean().optional(),\n direction: z.nativeEnum(Direction).optional(),\n showFilters: z.boolean().optional(),\n curve: z.enum(['curveStepBefore', 'curveMonotoneX']).optional(),\n })\n .merge(getEntityGraphRelationsConfigSchema(z))\n .optional(),\n }),\n ),\n loader: ({ config: { path, ...props } }) =>\n import('./components/CatalogGraphPage').then(m =>\n compatWrapper(<m.CatalogGraphPage {...props} />),\n ),\n});\n\nexport default createPlugin({\n id: 'catalog-graph',\n routes: {\n catalogGraph: convertLegacyRouteRef(catalogGraphRouteRef),\n },\n externalRoutes: {\n catalogEntity: convertLegacyRouteRef(catalogEntityRouteRef),\n },\n extensions: [CatalogGraphPage, CatalogGraphEntityCard],\n});\n"],"names":[],"mappings":";;;;;;;;;AA8BA,SAAS,oCACP,CACA,EAAA;AAGA,EAAA,OAAO,EAAE,MAAO,CAAA;AAAA,IACd,OAAO,CAAE,CAAA,KAAA,CAAM,EAAE,MAAO,EAAC,EAAE,QAAS,EAAA;AAAA,IACpC,WAAW,CAAE,CAAA,KAAA,CAAM,EAAE,MAAO,EAAC,EAAE,QAAS,EAAA;AAAA,IACxC,QAAU,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAS,EAAA;AAAA,IAC9B,cAAgB,EAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAS,EAAA;AAAA,IACrC,cAAgB,EAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAS,EAAA;AAAA,IACrC,SAAW,EAAA,CA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AAF,EAAoB,GAAG,OAAO,CAAE,CAAA;AAAA,GACjD;AACJ,CAAC,CAAA,CAAA;AAED,YAAe,YAAa,CAAA;AAAA,EAC1B,EAAI,EAAA,eAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,YAAA,EAAc,sBAAsB,oBAAoB,CAAA;AAAA,GAC1D;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,aAAA,EAAe,sBAAsB,qBAAqB,CAAA;AAAA,GAC5D;AAAA,EACA,UAAA,EAAY,CAAC,gBAAA,EAAkB,sBAAsB,CAAA;AACvD,CAAC,CAAA;;;;"}
|
package/dist/{esm/index-Dy8_Ufah.esm.js → components/CatalogGraphCard/CatalogGraphCard.esm.js}
RENAMED
|
@@ -6,13 +6,10 @@ import { makeStyles } from '@material-ui/core/styles';
|
|
|
6
6
|
import qs from 'qs';
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
8
|
import { useNavigate } from 'react-router-dom';
|
|
9
|
-
import {
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
13
|
-
import '@material-ui/core/SvgIcon';
|
|
14
|
-
import 'react-use/esm/useDebounce';
|
|
15
|
-
import 'react-use/esm/useAsyncFn';
|
|
9
|
+
import { catalogGraphRouteRef } from '../../routes.esm.js';
|
|
10
|
+
import { EntityRelationsGraph } from '../EntityRelationsGraph/EntityRelationsGraph.esm.js';
|
|
11
|
+
import { ALL_RELATION_PAIRS } from '../EntityRelationsGraph/relations.esm.js';
|
|
12
|
+
import { Direction } from '../EntityRelationsGraph/types.esm.js';
|
|
16
13
|
|
|
17
14
|
const useStyles = makeStyles(
|
|
18
15
|
{
|
|
@@ -115,4 +112,4 @@ const CatalogGraphCard = (props) => {
|
|
|
115
112
|
};
|
|
116
113
|
|
|
117
114
|
export { CatalogGraphCard };
|
|
118
|
-
//# sourceMappingURL=
|
|
115
|
+
//# sourceMappingURL=CatalogGraphCard.esm.js.map
|
|
@@ -0,0 +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 React, { MouseEvent, useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { catalogGraphRouteRef } from '../../routes';\nimport {\n ALL_RELATION_PAIRS,\n Direction,\n EntityNode,\n EntityRelationsGraph,\n} from '../EntityRelationsGraph';\nimport { EntityRelationsGraphProps } from '../EntityRelationsGraph';\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 },\n) => {\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 height,\n className,\n rootEntityNames,\n onNodeClick,\n title = 'Relations',\n zoom = 'enable-on-click',\n } = props;\n\n const { entity } = useEntity();\n const entityName = getCompoundEntityRef(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 cardClassName={classes.card}\n variant={variant}\n noPadding\n deepLink={{\n title: 'View graph',\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 zoom={zoom}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,IAAM,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,MACrB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IAAA;AAAA,MACvB,OAAA;AAAA,MACA,SAAS,EAAA,IAAA;AAAA,MACT,QAAU,EAAA;AAAA,QACR,KAAO,EAAA,YAAA;AAAA,QACP,IAAM,EAAA,eAAA;AAAA,OACR;AAAA,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,iBAAiB,eAAmB,IAAA,UAAA;AAAA,QACpC,aAAa,WAAe,IAAA,kBAAA;AAAA,QAC5B,SAAA,EAAW,aAAa,OAAQ,CAAA,KAAA;AAAA,QAChC,QAAA;AAAA,QACA,cAAA;AAAA,QACA,cAAA;AAAA,QACA,SAAA;AAAA,QACA,aAAA;AAAA,QACA,IAAA;AAAA,OAAA;AAAA,KACF;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { parseEntityRef } from '@backstage/catalog-model';
|
|
2
|
+
import { Page, Header, Content, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
3
|
+
import { useRouteRef, useAnalytics } from '@backstage/core-plugin-api';
|
|
4
|
+
import { entityRouteRef, humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
5
|
+
import Grid from '@material-ui/core/Grid';
|
|
6
|
+
import Paper from '@material-ui/core/Paper';
|
|
7
|
+
import Typography from '@material-ui/core/Typography';
|
|
8
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
9
|
+
import FilterListIcon from '@material-ui/icons/FilterList';
|
|
10
|
+
import ZoomOutMap from '@material-ui/icons/ZoomOutMap';
|
|
11
|
+
import ToggleButton from '@material-ui/lab/ToggleButton';
|
|
12
|
+
import React, { useCallback } from 'react';
|
|
13
|
+
import { useNavigate } from 'react-router-dom';
|
|
14
|
+
import { EntityRelationsGraph } from '../EntityRelationsGraph/EntityRelationsGraph.esm.js';
|
|
15
|
+
import { ALL_RELATION_PAIRS } from '../EntityRelationsGraph/relations.esm.js';
|
|
16
|
+
import { CurveFilter } from './CurveFilter.esm.js';
|
|
17
|
+
import { DirectionFilter } from './DirectionFilter.esm.js';
|
|
18
|
+
import { MaxDepthFilter } from './MaxDepthFilter.esm.js';
|
|
19
|
+
import { SelectedKindsFilter } from './SelectedKindsFilter.esm.js';
|
|
20
|
+
import { SelectedRelationsFilter } from './SelectedRelationsFilter.esm.js';
|
|
21
|
+
import { SwitchFilter } from './SwitchFilter.esm.js';
|
|
22
|
+
import { useCatalogGraphPage } from './useCatalogGraphPage.esm.js';
|
|
23
|
+
|
|
24
|
+
const useStyles = makeStyles(
|
|
25
|
+
(theme) => ({
|
|
26
|
+
content: {
|
|
27
|
+
minHeight: 0
|
|
28
|
+
},
|
|
29
|
+
container: {
|
|
30
|
+
height: "100%",
|
|
31
|
+
maxHeight: "100%",
|
|
32
|
+
minHeight: 0
|
|
33
|
+
},
|
|
34
|
+
fullHeight: {
|
|
35
|
+
maxHeight: "100%",
|
|
36
|
+
display: "flex",
|
|
37
|
+
minHeight: 0
|
|
38
|
+
},
|
|
39
|
+
graphWrapper: {
|
|
40
|
+
position: "relative",
|
|
41
|
+
flex: 1,
|
|
42
|
+
minHeight: 0,
|
|
43
|
+
display: "flex"
|
|
44
|
+
},
|
|
45
|
+
graph: {
|
|
46
|
+
flex: 1,
|
|
47
|
+
minHeight: 0
|
|
48
|
+
},
|
|
49
|
+
legend: {
|
|
50
|
+
position: "absolute",
|
|
51
|
+
bottom: 0,
|
|
52
|
+
right: 0,
|
|
53
|
+
padding: theme.spacing(1),
|
|
54
|
+
"& .icon": {
|
|
55
|
+
verticalAlign: "bottom"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
filters: {
|
|
59
|
+
display: "grid",
|
|
60
|
+
gridGap: theme.spacing(1),
|
|
61
|
+
gridAutoRows: "auto",
|
|
62
|
+
[theme.breakpoints.up("lg")]: {
|
|
63
|
+
display: "block"
|
|
64
|
+
},
|
|
65
|
+
[theme.breakpoints.only("md")]: {
|
|
66
|
+
gridTemplateColumns: "repeat(3, 1fr)"
|
|
67
|
+
},
|
|
68
|
+
[theme.breakpoints.only("sm")]: {
|
|
69
|
+
gridTemplateColumns: "repeat(2, 1fr)"
|
|
70
|
+
},
|
|
71
|
+
[theme.breakpoints.down("xs")]: {
|
|
72
|
+
gridTemplateColumns: "repeat(1, 1fr)"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
{ name: "PluginCatalogGraphCatalogGraphPage" }
|
|
77
|
+
);
|
|
78
|
+
const CatalogGraphPage = (props) => {
|
|
79
|
+
const { relationPairs = ALL_RELATION_PAIRS, initialState } = props;
|
|
80
|
+
const navigate = useNavigate();
|
|
81
|
+
const classes = useStyles();
|
|
82
|
+
const catalogEntityRoute = useRouteRef(entityRouteRef);
|
|
83
|
+
const {
|
|
84
|
+
maxDepth,
|
|
85
|
+
setMaxDepth,
|
|
86
|
+
selectedKinds,
|
|
87
|
+
setSelectedKinds,
|
|
88
|
+
selectedRelations,
|
|
89
|
+
setSelectedRelations,
|
|
90
|
+
unidirectional,
|
|
91
|
+
setUnidirectional,
|
|
92
|
+
mergeRelations,
|
|
93
|
+
setMergeRelations,
|
|
94
|
+
direction,
|
|
95
|
+
setDirection,
|
|
96
|
+
curve,
|
|
97
|
+
setCurve,
|
|
98
|
+
rootEntityNames,
|
|
99
|
+
setRootEntityNames,
|
|
100
|
+
showFilters,
|
|
101
|
+
toggleShowFilters
|
|
102
|
+
} = useCatalogGraphPage({ initialState });
|
|
103
|
+
const analytics = useAnalytics();
|
|
104
|
+
const onNodeClick = useCallback(
|
|
105
|
+
(node, event) => {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
const nodeEntityName = parseEntityRef(node.id);
|
|
108
|
+
if (event.shiftKey) {
|
|
109
|
+
const path = catalogEntityRoute({
|
|
110
|
+
kind: nodeEntityName.kind.toLocaleLowerCase("en-US"),
|
|
111
|
+
namespace: nodeEntityName.namespace.toLocaleLowerCase("en-US"),
|
|
112
|
+
name: nodeEntityName.name
|
|
113
|
+
});
|
|
114
|
+
analytics.captureEvent(
|
|
115
|
+
"click",
|
|
116
|
+
(_a = node.entity.metadata.title) != null ? _a : humanizeEntityRef(nodeEntityName),
|
|
117
|
+
{ attributes: { to: path } }
|
|
118
|
+
);
|
|
119
|
+
navigate(path);
|
|
120
|
+
} else {
|
|
121
|
+
analytics.captureEvent(
|
|
122
|
+
"click",
|
|
123
|
+
(_b = node.entity.metadata.title) != null ? _b : humanizeEntityRef(nodeEntityName)
|
|
124
|
+
);
|
|
125
|
+
setRootEntityNames([nodeEntityName]);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
[catalogEntityRoute, navigate, setRootEntityNames, analytics]
|
|
129
|
+
);
|
|
130
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
|
|
131
|
+
Header,
|
|
132
|
+
{
|
|
133
|
+
title: "Catalog Graph",
|
|
134
|
+
subtitle: rootEntityNames.map((e) => humanizeEntityRef(e)).join(", ")
|
|
135
|
+
}
|
|
136
|
+
), /* @__PURE__ */ React.createElement(Content, { stretch: true, className: classes.content }, /* @__PURE__ */ React.createElement(
|
|
137
|
+
ContentHeader,
|
|
138
|
+
{
|
|
139
|
+
titleComponent: /* @__PURE__ */ React.createElement(
|
|
140
|
+
ToggleButton,
|
|
141
|
+
{
|
|
142
|
+
value: "show filters",
|
|
143
|
+
selected: showFilters,
|
|
144
|
+
onChange: () => toggleShowFilters()
|
|
145
|
+
},
|
|
146
|
+
/* @__PURE__ */ React.createElement(FilterListIcon, null),
|
|
147
|
+
" Filters"
|
|
148
|
+
)
|
|
149
|
+
},
|
|
150
|
+
/* @__PURE__ */ React.createElement(SupportButton, null, "Start tracking your component in by adding it to the software catalog.")
|
|
151
|
+
), /* @__PURE__ */ React.createElement(Grid, { container: true, alignItems: "stretch", className: classes.container }, showFilters && /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, lg: 2, className: classes.filters }, /* @__PURE__ */ React.createElement(MaxDepthFilter, { value: maxDepth, onChange: setMaxDepth }), /* @__PURE__ */ React.createElement(
|
|
152
|
+
SelectedKindsFilter,
|
|
153
|
+
{
|
|
154
|
+
value: selectedKinds,
|
|
155
|
+
onChange: setSelectedKinds
|
|
156
|
+
}
|
|
157
|
+
), /* @__PURE__ */ React.createElement(
|
|
158
|
+
SelectedRelationsFilter,
|
|
159
|
+
{
|
|
160
|
+
value: selectedRelations,
|
|
161
|
+
onChange: setSelectedRelations,
|
|
162
|
+
relationPairs
|
|
163
|
+
}
|
|
164
|
+
), /* @__PURE__ */ React.createElement(DirectionFilter, { value: direction, onChange: setDirection }), /* @__PURE__ */ React.createElement(CurveFilter, { value: curve, onChange: setCurve }), /* @__PURE__ */ React.createElement(
|
|
165
|
+
SwitchFilter,
|
|
166
|
+
{
|
|
167
|
+
value: unidirectional,
|
|
168
|
+
onChange: setUnidirectional,
|
|
169
|
+
label: "Simplified"
|
|
170
|
+
}
|
|
171
|
+
), /* @__PURE__ */ React.createElement(
|
|
172
|
+
SwitchFilter,
|
|
173
|
+
{
|
|
174
|
+
value: mergeRelations,
|
|
175
|
+
onChange: setMergeRelations,
|
|
176
|
+
label: "Merge Relations"
|
|
177
|
+
}
|
|
178
|
+
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true, className: classes.fullHeight }, /* @__PURE__ */ React.createElement(Paper, { className: classes.graphWrapper }, /* @__PURE__ */ React.createElement(
|
|
179
|
+
Typography,
|
|
180
|
+
{
|
|
181
|
+
variant: "caption",
|
|
182
|
+
color: "textSecondary",
|
|
183
|
+
display: "block",
|
|
184
|
+
className: classes.legend
|
|
185
|
+
},
|
|
186
|
+
/* @__PURE__ */ React.createElement(ZoomOutMap, { className: "icon" }),
|
|
187
|
+
" Use pinch & zoom to move around the diagram. Click to change active node, shift click to navigate to entity."
|
|
188
|
+
), /* @__PURE__ */ React.createElement(
|
|
189
|
+
EntityRelationsGraph,
|
|
190
|
+
{
|
|
191
|
+
...props,
|
|
192
|
+
rootEntityNames,
|
|
193
|
+
maxDepth,
|
|
194
|
+
kinds: selectedKinds && selectedKinds.length > 0 ? selectedKinds : void 0,
|
|
195
|
+
relations: selectedRelations && selectedRelations.length > 0 ? selectedRelations : void 0,
|
|
196
|
+
mergeRelations,
|
|
197
|
+
unidirectional,
|
|
198
|
+
onNodeClick,
|
|
199
|
+
direction,
|
|
200
|
+
relationPairs,
|
|
201
|
+
className: classes.graph,
|
|
202
|
+
zoom: "enabled",
|
|
203
|
+
curve
|
|
204
|
+
}
|
|
205
|
+
))))));
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export { CatalogGraphPage };
|
|
209
|
+
//# sourceMappingURL=CatalogGraphPage.esm.js.map
|
|
@@ -0,0 +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 React, { 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';\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 { relationPairs = ALL_RELATION_PAIRS, initialState } = props;\n\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=\"Catalog Graph\"\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 /> Filters\n </ToggleButton>\n }\n >\n <SupportButton>\n Start tracking your component in by adding it to the software\n catalog.\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=\"Simplified\"\n />\n <SwitchFilter\n value={mergeRelations}\n onChange={setMergeRelations}\n label=\"Merge Relations\"\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\" /> Use pinch & zoom to move\n around the diagram. Click to change active node, shift click to\n navigate to entity.\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 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":";;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,SAAW,EAAA,CAAA;AAAA,KACb;AAAA,IACA,SAAW,EAAA;AAAA,MACT,MAAQ,EAAA,MAAA;AAAA,MACR,SAAW,EAAA,MAAA;AAAA,MACX,SAAW,EAAA,CAAA;AAAA,KACb;AAAA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CACF,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Select } from '@backstage/core-components';
|
|
2
|
+
import Box from '@material-ui/core/Box';
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
const CURVE_DISPLAY_NAMES = {
|
|
6
|
+
curveMonotoneX: "Monotone X",
|
|
7
|
+
curveStepBefore: "Step Before"
|
|
8
|
+
};
|
|
9
|
+
const curves = ["curveMonotoneX", "curveStepBefore"];
|
|
10
|
+
const CurveFilter = ({ value, onChange }) => {
|
|
11
|
+
const handleChange = useCallback(
|
|
12
|
+
(v) => onChange(v),
|
|
13
|
+
[onChange]
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(
|
|
16
|
+
Select,
|
|
17
|
+
{
|
|
18
|
+
label: "Curve",
|
|
19
|
+
selected: value,
|
|
20
|
+
items: curves.map((v) => ({
|
|
21
|
+
label: CURVE_DISPLAY_NAMES[v],
|
|
22
|
+
value: v
|
|
23
|
+
})),
|
|
24
|
+
onChange: handleChange
|
|
25
|
+
}
|
|
26
|
+
));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { CurveFilter };
|
|
30
|
+
//# sourceMappingURL=CurveFilter.esm.js.map
|
|
@@ -0,0 +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 React, { useCallback } from 'react';\n\ntype Curve = 'curveStepBefore' | 'curveMonotoneX';\nconst CURVE_DISPLAY_NAMES: Record<Curve, string> = {\n curveMonotoneX: 'Monotone X',\n curveStepBefore: 'Step Before',\n};\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 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=\"Curve\"\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":";;;;AAoBA,MAAM,mBAA6C,GAAA;AAAA,EACjD,cAAgB,EAAA,YAAA;AAAA,EAChB,eAAiB,EAAA,aAAA;AACnB,CAAA,CAAA;AAOA,MAAM,MAAA,GAAuB,CAAC,gBAAA,EAAkB,iBAAiB,CAAA,CAAA;AAE1D,MAAM,WAAc,GAAA,CAAC,EAAE,KAAA,EAAO,UAAsB,KAAA;AACzD,EAAA,MAAM,YAAe,GAAA,WAAA;AAAA,IACnB,CAAC,CAAqB,KAAA,QAAA,CAAS,CAAU,CAAA;AAAA,IACzC,CAAC,QAAQ,CAAA;AAAA,GACX,CAAA;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CACd,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,OAAA;AAAA,MACN,QAAU,EAAA,KAAA;AAAA,MACV,KAAA,EAAO,MAAO,CAAA,GAAA,CAAI,CAAM,CAAA,MAAA;AAAA,QACtB,KAAA,EAAO,oBAAoB,CAAC,CAAA;AAAA,QAC5B,KAAO,EAAA,CAAA;AAAA,OACP,CAAA,CAAA;AAAA,MACF,QAAU,EAAA,YAAA;AAAA,KAAA;AAAA,GAEd,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Select } from '@backstage/core-components';
|
|
2
|
+
import Box from '@material-ui/core/Box';
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
import '../EntityRelationsGraph/EntityRelationsGraph.esm.js';
|
|
5
|
+
import '@backstage/catalog-model';
|
|
6
|
+
import { Direction } from '../EntityRelationsGraph/types.esm.js';
|
|
7
|
+
|
|
8
|
+
const DIRECTION_DISPLAY_NAMES = {
|
|
9
|
+
[Direction.LEFT_RIGHT]: "Left to right",
|
|
10
|
+
[Direction.RIGHT_LEFT]: "Right to left",
|
|
11
|
+
[Direction.TOP_BOTTOM]: "Top to bottom",
|
|
12
|
+
[Direction.BOTTOM_TOP]: "Bottom to top"
|
|
13
|
+
};
|
|
14
|
+
const DirectionFilter = ({ value, onChange }) => {
|
|
15
|
+
const handleChange = useCallback(
|
|
16
|
+
(v) => onChange(v),
|
|
17
|
+
[onChange]
|
|
18
|
+
);
|
|
19
|
+
return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(
|
|
20
|
+
Select,
|
|
21
|
+
{
|
|
22
|
+
label: "Direction",
|
|
23
|
+
selected: value,
|
|
24
|
+
items: Object.values(Direction).map((v) => ({
|
|
25
|
+
label: DIRECTION_DISPLAY_NAMES[v],
|
|
26
|
+
value: v
|
|
27
|
+
})),
|
|
28
|
+
onChange: handleChange
|
|
29
|
+
}
|
|
30
|
+
));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { DirectionFilter };
|
|
34
|
+
//# sourceMappingURL=DirectionFilter.esm.js.map
|
|
@@ -0,0 +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 React, { useCallback } from 'react';\nimport { Direction } from '../EntityRelationsGraph';\n\nconst DIRECTION_DISPLAY_NAMES = {\n [Direction.LEFT_RIGHT]: 'Left to right',\n [Direction.RIGHT_LEFT]: 'Right to left',\n [Direction.TOP_BOTTOM]: 'Top to bottom',\n [Direction.BOTTOM_TOP]: 'Bottom to top',\n};\n\nexport type Props = {\n value: Direction;\n onChange: (value: Direction) => void;\n};\n\nexport const DirectionFilter = ({ value, onChange }: Props) => {\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=\"Direction\"\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":";;;;;;;AAoBA,MAAM,uBAA0B,GAAA;AAAA,EAC9B,CAAC,SAAU,CAAA,UAAU,GAAG,eAAA;AAAA,EACxB,CAAC,SAAU,CAAA,UAAU,GAAG,eAAA;AAAA,EACxB,CAAC,SAAU,CAAA,UAAU,GAAG,eAAA;AAAA,EACxB,CAAC,SAAU,CAAA,UAAU,GAAG,eAAA;AAC1B,CAAA,CAAA;AAOO,MAAM,eAAkB,GAAA,CAAC,EAAE,KAAA,EAAO,UAAsB,KAAA;AAC7D,EAAA,MAAM,YAAe,GAAA,WAAA;AAAA,IACnB,CAAC,CAAqB,KAAA,QAAA,CAAS,CAAc,CAAA;AAAA,IAC7C,CAAC,QAAQ,CAAA;AAAA,GACX,CAAA;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CACd,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,QAAU,EAAA,KAAA;AAAA,MACV,OAAO,MAAO,CAAA,MAAA,CAAO,SAAS,CAAA,CAAE,IAAI,CAAM,CAAA,MAAA;AAAA,QACxC,KAAA,EAAO,wBAAwB,CAAC,CAAA;AAAA,QAChC,KAAO,EAAA,CAAA;AAAA,OACP,CAAA,CAAA;AAAA,MACF,QAAU,EAAA,YAAA;AAAA,KAAA;AAAA,GAEd,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import Box from '@material-ui/core/Box';
|
|
2
|
+
import FormControl from '@material-ui/core/FormControl';
|
|
3
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
4
|
+
import InputAdornment from '@material-ui/core/InputAdornment';
|
|
5
|
+
import OutlinedInput from '@material-ui/core/OutlinedInput';
|
|
6
|
+
import Typography from '@material-ui/core/Typography';
|
|
7
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
8
|
+
import ClearIcon from '@material-ui/icons/Clear';
|
|
9
|
+
import React, { useRef, useState, useEffect, useCallback } from 'react';
|
|
10
|
+
|
|
11
|
+
const useStyles = makeStyles(
|
|
12
|
+
{
|
|
13
|
+
formControl: {
|
|
14
|
+
width: "100%",
|
|
15
|
+
maxWidth: 300
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{ name: "PluginCatalogGraphMaxDepthFilter" }
|
|
19
|
+
);
|
|
20
|
+
const MaxDepthFilter = ({ value, onChange }) => {
|
|
21
|
+
const classes = useStyles();
|
|
22
|
+
const onChangeRef = useRef(onChange);
|
|
23
|
+
const [currentValue, setCurrentValue] = useState(value);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
onChangeRef.current = onChange;
|
|
26
|
+
}, [onChange]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setCurrentValue(value);
|
|
29
|
+
}, [value]);
|
|
30
|
+
const handleChange = useCallback(
|
|
31
|
+
(event) => {
|
|
32
|
+
const newValueNumeric = Number(event.target.value);
|
|
33
|
+
const newValue = Number.isFinite(newValueNumeric) && newValueNumeric > 0 ? newValueNumeric : Number.POSITIVE_INFINITY;
|
|
34
|
+
setCurrentValue(newValue);
|
|
35
|
+
onChangeRef.current(newValue);
|
|
36
|
+
},
|
|
37
|
+
[]
|
|
38
|
+
);
|
|
39
|
+
const reset = useCallback(() => {
|
|
40
|
+
setCurrentValue(Number.POSITIVE_INFINITY);
|
|
41
|
+
onChangeRef.current(Number.POSITIVE_INFINITY);
|
|
42
|
+
}, [onChangeRef]);
|
|
43
|
+
return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(FormControl, { variant: "outlined", className: classes.formControl }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, "Max Depth"), /* @__PURE__ */ React.createElement(
|
|
44
|
+
OutlinedInput,
|
|
45
|
+
{
|
|
46
|
+
type: "number",
|
|
47
|
+
placeholder: "\u221E Infinite",
|
|
48
|
+
value: Number.isFinite(currentValue) ? String(currentValue) : "",
|
|
49
|
+
onChange: handleChange,
|
|
50
|
+
endAdornment: /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(
|
|
51
|
+
IconButton,
|
|
52
|
+
{
|
|
53
|
+
"aria-label": "clear max depth",
|
|
54
|
+
onClick: reset,
|
|
55
|
+
edge: "end"
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement(ClearIcon, null)
|
|
58
|
+
)),
|
|
59
|
+
inputProps: {
|
|
60
|
+
"aria-label": "maxp"
|
|
61
|
+
},
|
|
62
|
+
labelWidth: 0
|
|
63
|
+
}
|
|
64
|
+
)));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { MaxDepthFilter };
|
|
68
|
+
//# sourceMappingURL=MaxDepthFilter.esm.js.map
|
|
@@ -0,0 +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 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 React, { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type Props = {\n value: number;\n onChange: (value: number) => void;\n};\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\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(\n (event: React.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 );\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\">Max Depth</Typography>\n <OutlinedInput\n type=\"number\"\n placeholder=\"∞ Infinite\"\n value={Number.isFinite(currentValue) ? String(currentValue) : ''}\n onChange={handleChange}\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"clear max depth\"\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":";;;;;;;;;;AA8BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,WAAa,EAAA;AAAA,MACX,KAAO,EAAA,MAAA;AAAA,MACP,QAAU,EAAA,GAAA;AAAA,KACZ;AAAA,GACF;AAAA,EACA,EAAE,MAAM,kCAAmC,EAAA;AAC7C,CAAA,CAAA;AAEO,MAAM,cAAiB,GAAA,CAAC,EAAE,KAAA,EAAO,UAAsB,KAAA;AAC5D,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,WAAA,GAAc,OAAO,QAAQ,CAAA,CAAA;AACnC,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAGtD,EAAA,SAAA,CAAU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