@backstage/plugin-catalog-graph 0.2.23 → 0.2.24-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @backstage/plugin-catalog-graph
2
2
 
3
+ ## 0.2.24-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-components@0.12.1-next.1
9
+ - @backstage/core-plugin-api@1.1.1-next.1
10
+ - @backstage/plugin-catalog-react@1.2.2-next.1
11
+ - @backstage/catalog-client@1.2.0-next.1
12
+ - @backstage/catalog-model@1.1.4-next.1
13
+ - @backstage/theme@0.2.16
14
+
15
+ ## 0.2.24-next.0
16
+
17
+ ### Patch Changes
18
+
19
+ - cb716004ef: Internal refactor to improve tests
20
+ - Updated dependencies
21
+ - @backstage/catalog-client@1.2.0-next.0
22
+ - @backstage/core-components@0.12.1-next.0
23
+ - @backstage/core-plugin-api@1.1.1-next.0
24
+ - @backstage/plugin-catalog-react@1.2.2-next.0
25
+ - @backstage/catalog-model@1.1.4-next.0
26
+ - @backstage/theme@0.2.16
27
+
3
28
  ## 0.2.23
4
29
 
5
30
  ### Patch Changes
@@ -82,29 +82,36 @@ const CatalogGraphCard = (props) => {
82
82
  { arrayFormat: "brackets", addQueryPrefix: true }
83
83
  );
84
84
  const catalogGraphUrl = `${catalogGraphRoute()}${catalogGraphParams}`;
85
- return /* @__PURE__ */ React.createElement(InfoCard, {
86
- title,
87
- cardClassName: classes.card,
88
- variant,
89
- noPadding: true,
90
- deepLink: {
91
- title: "View graph",
92
- link: catalogGraphUrl
93
- }
94
- }, /* @__PURE__ */ React.createElement(EntityRelationsGraph, {
95
- rootEntityNames: entityName,
96
- maxDepth,
97
- unidirectional,
98
- mergeRelations,
99
- kinds,
100
- relations,
101
- direction,
102
- onNodeClick,
103
- className: classes.graph,
104
- relationPairs,
105
- zoom
106
- }));
85
+ return /* @__PURE__ */ React.createElement(
86
+ InfoCard,
87
+ {
88
+ title,
89
+ cardClassName: classes.card,
90
+ variant,
91
+ noPadding: true,
92
+ deepLink: {
93
+ title: "View graph",
94
+ link: catalogGraphUrl
95
+ }
96
+ },
97
+ /* @__PURE__ */ React.createElement(
98
+ EntityRelationsGraph,
99
+ {
100
+ rootEntityNames: entityName,
101
+ maxDepth,
102
+ unidirectional,
103
+ mergeRelations,
104
+ kinds,
105
+ relations,
106
+ direction,
107
+ onNodeClick,
108
+ className: classes.graph,
109
+ relationPairs,
110
+ zoom
111
+ }
112
+ )
113
+ );
107
114
  };
108
115
 
109
116
  export { CatalogGraphCard };
110
- //# sourceMappingURL=index-04b3cc7d.esm.js.map
117
+ //# sourceMappingURL=index-3b0f9dff.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-04b3cc7d.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';\nimport qs from 'qs';\nimport React, { MouseEvent, useCallback } from 'react';\nimport { useNavigate } from 'react-router';\nimport { catalogGraphRouteRef } from '../../routes';\nimport {\n ALL_RELATION_PAIRS,\n Direction,\n EntityNode,\n EntityRelationsGraph,\n RelationPairs,\n} 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 = (props: {\n variant?: InfoCardVariants;\n relationPairs?: RelationPairs;\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n kinds?: string[];\n relations?: string[];\n direction?: Direction;\n height?: number;\n title?: string;\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n}) => {\n const {\n variant = 'gridItem',\n relationPairs = ALL_RELATION_PAIRS,\n maxDepth = 1,\n unidirectional = true,\n mergeRelations = true,\n kinds,\n relations,\n direction = Direction.LEFT_RIGHT,\n height,\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 onNodeClick = 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.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 + 1,\n unidirectional,\n mergeRelations,\n kinds,\n 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 rootEntityNames={entityName}\n maxDepth={maxDepth}\n unidirectional={unidirectional}\n mergeRelations={mergeRelations}\n kinds={kinds}\n relations={relations}\n direction={direction}\n onNodeClick={onNodeClick}\n className={classes.graph}\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,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,QAAA;AAAA,MACf,SAAW,EAAA,MAAA;AAAA,MACX,SAAW,EAAA,MAAA;AAAA,KACb,CAAA;AAAA,IACA,KAAO,EAAA;AAAA,MACL,IAAM,EAAA,CAAA;AAAA,MACN,SAAW,EAAA,CAAA;AAAA,KACb;AAAA,GACF;AAAA,EACA,EAAE,MAAM,oCAAqC,EAAA;AAC/C,CAAA,CAAA;AAEa,MAAA,gBAAA,GAAmB,CAAC,KAY3B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,aAAgB,GAAA,kBAAA;AAAA,IAChB,QAAW,GAAA,CAAA;AAAA,IACX,cAAiB,GAAA,IAAA;AAAA,IACjB,cAAiB,GAAA,IAAA;AAAA,IACjB,KAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAY,SAAU,CAAA,UAAA;AAAA,IACtB,MAAA;AAAA,IACA,KAAQ,GAAA,WAAA;AAAA,IACR,IAAO,GAAA,iBAAA;AAAA,GACL,GAAA,KAAA,CAAA;AAEJ,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EA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AAA,MAAM,CAAC,CAAA;AAAA,MAC3C,UAAU,QAAW,GAAA,CAAA;AAAA,MACrB,cAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAA;AAAA,MACA,SAAA;AAAA,MACA,SAAA;AAAA,KACF;AAAA,IACA,EAAE,WAAA,EAAa,UAAY,EAAA,cAAA,EAAgB,IAAK,EAAA;AAAA,GAClD,CAAA;AACA,EAAM,MAAA,eAAA,GAAkB,CAAG,EAAA,iBAAA,EAAsB,CAAA,EAAA,kBAAA,CAAA,CAAA,CAAA;AAEjD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAA,IACC,KAAA;AAAA,IACA,eAAe,OAAQ,CAAA,IAAA;AAAA,IACvB,OAAA;AAAA,IACA,SAAS,EAAA,IAAA;AAAA,IACT,QAAU,EAAA;AAAA,MACR,KAAO,EAAA,YAAA;AAAA,MACP,IAAM,EAAA,eAAA;AAAA,KACR;AAAA,GAAA,kBAEC,KAAA,CAAA,aAAA,CAAA,oBAAA,EAAA;AAAA,IACC,eAAiB,EAAA,UAAA;AAAA,IACjB,QAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAW,OAAQ,CAAA,KAAA;AAAA,IACnB,aAAA;AAAA,IACA,IAAA;AAAA,GACF,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"index-3b0f9dff.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';\nimport qs from 'qs';\nimport React, { MouseEvent, useCallback } from 'react';\nimport { useNavigate } from 'react-router';\nimport { catalogGraphRouteRef } from '../../routes';\nimport {\n ALL_RELATION_PAIRS,\n Direction,\n EntityNode,\n EntityRelationsGraph,\n RelationPairs,\n} 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 = (props: {\n variant?: InfoCardVariants;\n relationPairs?: RelationPairs;\n maxDepth?: number;\n unidirectional?: boolean;\n mergeRelations?: boolean;\n kinds?: string[];\n relations?: string[];\n direction?: Direction;\n height?: number;\n title?: string;\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n}) => {\n const {\n variant = 'gridItem',\n relationPairs = ALL_RELATION_PAIRS,\n maxDepth = 1,\n unidirectional = true,\n mergeRelations = true,\n kinds,\n relations,\n direction = Direction.LEFT_RIGHT,\n height,\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 onNodeClick = 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.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 + 1,\n unidirectional,\n mergeRelations,\n kinds,\n 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 rootEntityNames={entityName}\n maxDepth={maxDepth}\n unidirectional={unidirectional}\n mergeRelations={mergeRelations}\n kinds={kinds}\n relations={relations}\n direction={direction}\n onNodeClick={onNodeClick}\n className={classes.graph}\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,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,QAAA;AAAA,MACf,SAAW,EAAA,MAAA;AAAA,MACX,SAAW,EAAA,MAAA;AAAA,KACb,CAAA;AAAA,IACA,KAAO,EAAA;AAAA,MACL,IAAM,EAAA,CAAA;AAAA,MACN,SAAW,EAAA,CAAA;AAAA,KACb;AAAA,GACF;AAAA,EACA,EAAE,MAAM,oCAAqC,EAAA;AAC/C,CAAA,CAAA;AAEa,MAAA,gBAAA,GAAmB,CAAC,K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A,QACA,WAAW,OAAQ,CAAA,KAAA;AAAA,QACnB,aAAA;AAAA,QACA,IAAA;AAAA,OAAA;AAAA,KACF;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -6,7 +6,7 @@ import { Box, makeStyles, FormControl, Typography, OutlinedInput, InputAdornment
6
6
  import FilterListIcon from '@material-ui/icons/FilterList';
7
7
  import ZoomOutMap from '@material-ui/icons/ZoomOutMap';
8
8
  import { Autocomplete, ToggleButton } from '@material-ui/lab';
9
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
9
+ import React, { useCallback, useRef, useState, useEffect, useMemo } from 'react';
10
10
  import { useLocation, useNavigate } from 'react-router';
11
11
  import { Direction, EntityRelationsGraph, ALL_RELATION_PAIRS } from '../index.esm.js';
12
12
  import ClearIcon from '@material-ui/icons/Clear';
@@ -31,18 +31,18 @@ const CURVE_DISPLAY_NAMES = {
31
31
  const curves = ["curveMonotoneX", "curveStepBefore"];
32
32
  const CurveFilter = ({ value, onChange }) => {
33
33
  const handleChange = useCallback((v) => onChange(v), [onChange]);
34
- return /* @__PURE__ */ React.createElement(Box, {
35
- pb: 1,
36
- pt: 1
37
- }, /* @__PURE__ */ React.createElement(Select, {
38
- label: "Curve",
39
- selected: value,
40
- items: curves.map((v) => ({
41
- label: CURVE_DISPLAY_NAMES[v],
42
- value: v
43
- })),
44
- onChange: handleChange
45
- }));
34
+ return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(
35
+ Select,
36
+ {
37
+ label: "Curve",
38
+ selected: value,
39
+ items: curves.map((v) => ({
40
+ label: CURVE_DISPLAY_NAMES[v],
41
+ value: v
42
+ })),
43
+ onChange: handleChange
44
+ }
45
+ ));
46
46
  };
47
47
 
48
48
  const DIRECTION_DISPLAY_NAMES = {
@@ -53,18 +53,18 @@ const DIRECTION_DISPLAY_NAMES = {
53
53
  };
54
54
  const DirectionFilter = ({ value, onChange }) => {
55
55
  const handleChange = useCallback((v) => onChange(v), [onChange]);
56
- return /* @__PURE__ */ React.createElement(Box, {
57
- pb: 1,
58
- pt: 1
59
- }, /* @__PURE__ */ React.createElement(Select, {
60
- label: "Direction",
61
- selected: value,
62
- items: Object.values(Direction).map((v) => ({
63
- label: DIRECTION_DISPLAY_NAMES[v],
64
- value: v
65
- })),
66
- onChange: handleChange
67
- }));
56
+ return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(
57
+ Select,
58
+ {
59
+ label: "Direction",
60
+ selected: value,
61
+ items: Object.values(Direction).map((v) => ({
62
+ label: DIRECTION_DISPLAY_NAMES[v],
63
+ value: v
64
+ })),
65
+ onChange: handleChange
66
+ }
67
+ ));
68
68
  };
69
69
 
70
70
  const useStyles$4 = makeStyles(
@@ -78,41 +78,49 @@ const useStyles$4 = makeStyles(
78
78
  );
79
79
  const MaxDepthFilter = ({ value, onChange }) => {
80
80
  const classes = useStyles$4();
81
+ const onChangeRef = useRef(onChange);
82
+ const [currentValue, setCurrentValue] = useState(value);
83
+ useEffect(() => {
84
+ onChangeRef.current = onChange;
85
+ }, [onChange]);
86
+ useEffect(() => {
87
+ setCurrentValue(value);
88
+ }, [value]);
81
89
  const handleChange = useCallback(
82
90
  (event) => {
83
- const v = Number(event.target.value);
84
- onChange(v <= 0 ? Number.POSITIVE_INFINITY : v);
91
+ const newValueNumeric = Number(event.target.value);
92
+ const newValue = Number.isFinite(newValueNumeric) && newValueNumeric > 0 ? newValueNumeric : Number.POSITIVE_INFINITY;
93
+ setCurrentValue(newValue);
94
+ onChangeRef.current(newValue);
85
95
  },
86
- [onChange]
96
+ []
87
97
  );
88
98
  const reset = useCallback(() => {
89
- onChange(Number.POSITIVE_INFINITY);
90
- }, [onChange]);
91
- return /* @__PURE__ */ React.createElement(Box, {
92
- pb: 1,
93
- pt: 1
94
- }, /* @__PURE__ */ React.createElement(FormControl, {
95
- variant: "outlined",
96
- className: classes.formControl
97
- }, /* @__PURE__ */ React.createElement(Typography, {
98
- variant: "button"
99
- }, "Max Depth"), /* @__PURE__ */ React.createElement(OutlinedInput, {
100
- type: "number",
101
- placeholder: "\u221E Infinite",
102
- value: isFinite(value) ? value : "",
103
- onChange: handleChange,
104
- endAdornment: /* @__PURE__ */ React.createElement(InputAdornment, {
105
- position: "end"
106
- }, /* @__PURE__ */ React.createElement(IconButton, {
107
- "aria-label": "clear max depth",
108
- onClick: reset,
109
- edge: "end"
110
- }, /* @__PURE__ */ React.createElement(ClearIcon, null))),
111
- inputProps: {
112
- "aria-label": "maxp"
113
- },
114
- labelWidth: 0
115
- })));
99
+ setCurrentValue(Number.POSITIVE_INFINITY);
100
+ onChangeRef.current(Number.POSITIVE_INFINITY);
101
+ }, [onChangeRef]);
102
+ 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(
103
+ OutlinedInput,
104
+ {
105
+ type: "number",
106
+ placeholder: "\u221E Infinite",
107
+ value: Number.isFinite(currentValue) ? String(currentValue) : "",
108
+ onChange: handleChange,
109
+ endAdornment: /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(
110
+ IconButton,
111
+ {
112
+ "aria-label": "clear max depth",
113
+ onClick: reset,
114
+ edge: "end"
115
+ },
116
+ /* @__PURE__ */ React.createElement(ClearIcon, null)
117
+ )),
118
+ inputProps: {
119
+ "aria-label": "maxp"
120
+ },
121
+ labelWidth: 0
122
+ }
123
+ )));
116
124
  };
117
125
 
118
126
  const useStyles$3 = makeStyles(
@@ -159,49 +167,44 @@ const SelectedKindsFilter = ({ value, onChange }) => {
159
167
  if (!(kinds == null ? void 0 : kinds.length) || !(normalizedKinds == null ? void 0 : normalizedKinds.length) || error) {
160
168
  return /* @__PURE__ */ React.createElement(React.Fragment, null);
161
169
  }
162
- return /* @__PURE__ */ React.createElement(Box, {
163
- pb: 1,
164
- pt: 1
165
- }, /* @__PURE__ */ React.createElement(Typography, {
166
- variant: "button"
167
- }, "Kinds"), /* @__PURE__ */ React.createElement(Autocomplete, {
168
- className: classes.formControl,
169
- multiple: true,
170
- limitTags: 4,
171
- disableCloseOnSelect: true,
172
- "aria-label": "Kinds",
173
- options: normalizedKinds,
174
- value: value != null ? value : normalizedKinds,
175
- getOptionLabel: (k) => {
176
- var _a;
177
- return (_a = kinds[normalizedKinds.indexOf(k)]) != null ? _a : k;
178
- },
179
- onChange: handleChange,
180
- onBlur: handleEmpty,
181
- renderOption: (option, { selected }) => {
182
- var _a;
183
- return /* @__PURE__ */ React.createElement(FormControlLabel, {
184
- control: /* @__PURE__ */ React.createElement(Checkbox, {
185
- icon: /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
186
- fontSize: "small"
187
- }),
188
- checkedIcon: /* @__PURE__ */ React.createElement(CheckBoxIcon, {
189
- fontSize: "small"
190
- }),
191
- checked: selected
192
- }),
193
- label: (_a = kinds[normalizedKinds.indexOf(option)]) != null ? _a : option
194
- });
195
- },
196
- size: "small",
197
- popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, {
198
- "data-testid": "selected-kinds-expand"
199
- }),
200
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
201
- ...params,
202
- variant: "outlined"
203
- })
204
- }));
170
+ return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, "Kinds"), /* @__PURE__ */ React.createElement(
171
+ Autocomplete,
172
+ {
173
+ className: classes.formControl,
174
+ multiple: true,
175
+ limitTags: 4,
176
+ disableCloseOnSelect: true,
177
+ "aria-label": "Kinds",
178
+ options: normalizedKinds,
179
+ value: value != null ? value : normalizedKinds,
180
+ getOptionLabel: (k) => {
181
+ var _a;
182
+ return (_a = kinds[normalizedKinds.indexOf(k)]) != null ? _a : k;
183
+ },
184
+ onChange: handleChange,
185
+ onBlur: handleEmpty,
186
+ renderOption: (option, { selected }) => {
187
+ var _a;
188
+ return /* @__PURE__ */ React.createElement(
189
+ FormControlLabel,
190
+ {
191
+ control: /* @__PURE__ */ React.createElement(
192
+ Checkbox,
193
+ {
194
+ icon: /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" }),
195
+ checkedIcon: /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" }),
196
+ checked: selected
197
+ }
198
+ ),
199
+ label: (_a = kinds[normalizedKinds.indexOf(option)]) != null ? _a : option
200
+ }
201
+ );
202
+ },
203
+ size: "small",
204
+ popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, { "data-testid": "selected-kinds-expand" }),
205
+ renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, variant: "outlined" })
206
+ }
207
+ ));
205
208
  };
206
209
 
207
210
  const useStyles$2 = makeStyles(
@@ -228,42 +231,37 @@ const SelectedRelationsFilter = ({
228
231
  const handleEmpty = useCallback(() => {
229
232
  onChange((value == null ? void 0 : value.length) ? value : void 0);
230
233
  }, [value, onChange]);
231
- return /* @__PURE__ */ React.createElement(Box, {
232
- pb: 1,
233
- pt: 1
234
- }, /* @__PURE__ */ React.createElement(Typography, {
235
- variant: "button"
236
- }, "Relations"), /* @__PURE__ */ React.createElement(Autocomplete, {
237
- className: classes.formControl,
238
- multiple: true,
239
- limitTags: 4,
240
- disableCloseOnSelect: true,
241
- "aria-label": "Relations",
242
- options: relations,
243
- value: value != null ? value : relations,
244
- onChange: handleChange,
245
- onBlur: handleEmpty,
246
- renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(FormControlLabel, {
247
- control: /* @__PURE__ */ React.createElement(Checkbox, {
248
- icon: /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
249
- fontSize: "small"
250
- }),
251
- checkedIcon: /* @__PURE__ */ React.createElement(CheckBoxIcon, {
252
- fontSize: "small"
253
- }),
254
- checked: selected
255
- }),
256
- label: option
257
- }),
258
- size: "small",
259
- popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, {
260
- "data-testid": "selected-relations-expand"
261
- }),
262
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
263
- ...params,
264
- variant: "outlined"
265
- })
266
- }));
234
+ return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, "Relations"), /* @__PURE__ */ React.createElement(
235
+ Autocomplete,
236
+ {
237
+ className: classes.formControl,
238
+ multiple: true,
239
+ limitTags: 4,
240
+ disableCloseOnSelect: true,
241
+ "aria-label": "Relations",
242
+ options: relations,
243
+ value: value != null ? value : relations,
244
+ onChange: handleChange,
245
+ onBlur: handleEmpty,
246
+ renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(
247
+ FormControlLabel,
248
+ {
249
+ control: /* @__PURE__ */ React.createElement(
250
+ Checkbox,
251
+ {
252
+ icon: /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" }),
253
+ checkedIcon: /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" }),
254
+ checked: selected
255
+ }
256
+ ),
257
+ label: option
258
+ }
259
+ ),
260
+ size: "small",
261
+ popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, { "data-testid": "selected-relations-expand" }),
262
+ renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, variant: "outlined" })
263
+ }
264
+ ));
267
265
  };
268
266
 
269
267
  const useStyles$1 = makeStyles(
@@ -283,19 +281,22 @@ const SwitchFilter = ({ label, value, onChange }) => {
283
281
  },
284
282
  [onChange]
285
283
  );
286
- return /* @__PURE__ */ React.createElement(Box, {
287
- pb: 1,
288
- pt: 1
289
- }, /* @__PURE__ */ React.createElement(FormControlLabel, {
290
- control: /* @__PURE__ */ React.createElement(Switch, {
291
- checked: value,
292
- onChange: handleChange,
293
- name: label,
294
- color: "primary"
295
- }),
296
- label,
297
- className: classes.root
298
- }));
284
+ return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(
285
+ FormControlLabel,
286
+ {
287
+ control: /* @__PURE__ */ React.createElement(
288
+ Switch,
289
+ {
290
+ checked: value,
291
+ onChange: handleChange,
292
+ name: label,
293
+ color: "primary"
294
+ }
295
+ ),
296
+ label,
297
+ className: classes.root
298
+ }
299
+ ));
299
300
  };
300
301
 
301
302
  function useCatalogGraphPage({
@@ -569,81 +570,82 @@ const CatalogGraphPage = (props) => {
569
570
  },
570
571
  [catalogEntityRoute, navigate, setRootEntityNames, analytics]
571
572
  );
572
- return /* @__PURE__ */ React.createElement(Page, {
573
- themeId: "home"
574
- }, /* @__PURE__ */ React.createElement(Header, {
575
- title: "Catalog Graph",
576
- subtitle: rootEntityNames.map((e) => humanizeEntityRef(e)).join(", ")
577
- }), /* @__PURE__ */ React.createElement(Content, {
578
- stretch: true,
579
- className: classes.content
580
- }, /* @__PURE__ */ React.createElement(ContentHeader, {
581
- titleComponent: /* @__PURE__ */ React.createElement(ToggleButton, {
582
- value: "show filters",
583
- selected: showFilters,
584
- onChange: () => toggleShowFilters()
585
- }, /* @__PURE__ */ React.createElement(FilterListIcon, null), " Filters")
586
- }, /* @__PURE__ */ React.createElement(SupportButton, null, "Start tracking your component in by adding it to the software catalog.")), /* @__PURE__ */ React.createElement(Grid, {
587
- container: true,
588
- alignItems: "stretch",
589
- className: classes.container
590
- }, showFilters && /* @__PURE__ */ React.createElement(Grid, {
591
- item: true,
592
- xs: 12,
593
- lg: 2,
594
- className: classes.filters
595
- }, /* @__PURE__ */ React.createElement(MaxDepthFilter, {
596
- value: maxDepth,
597
- onChange: setMaxDepth
598
- }), /* @__PURE__ */ React.createElement(SelectedKindsFilter, {
599
- value: selectedKinds,
600
- onChange: setSelectedKinds
601
- }), /* @__PURE__ */ React.createElement(SelectedRelationsFilter, {
602
- value: selectedRelations,
603
- onChange: setSelectedRelations,
604
- relationPairs
605
- }), /* @__PURE__ */ React.createElement(DirectionFilter, {
606
- value: direction,
607
- onChange: setDirection
608
- }), /* @__PURE__ */ React.createElement(CurveFilter, {
609
- value: curve,
610
- onChange: setCurve
611
- }), /* @__PURE__ */ React.createElement(SwitchFilter, {
612
- value: unidirectional,
613
- onChange: setUnidirectional,
614
- label: "Simplified"
615
- }), /* @__PURE__ */ React.createElement(SwitchFilter, {
616
- value: mergeRelations,
617
- onChange: setMergeRelations,
618
- label: "Merge Relations"
619
- })), /* @__PURE__ */ React.createElement(Grid, {
620
- item: true,
621
- xs: true,
622
- className: classes.fullHeight
623
- }, /* @__PURE__ */ React.createElement(Paper, {
624
- className: classes.graphWrapper
625
- }, /* @__PURE__ */ React.createElement(Typography, {
626
- variant: "caption",
627
- color: "textSecondary",
628
- display: "block",
629
- className: classes.legend
630
- }, /* @__PURE__ */ React.createElement(ZoomOutMap, {
631
- className: "icon"
632
- }), " Use pinch & zoom to move around the diagram. Click to change active node, shift click to navigate to entity."), /* @__PURE__ */ React.createElement(EntityRelationsGraph, {
633
- rootEntityNames,
634
- maxDepth,
635
- kinds: selectedKinds && selectedKinds.length > 0 ? selectedKinds : void 0,
636
- relations: selectedRelations && selectedRelations.length > 0 ? selectedRelations : void 0,
637
- mergeRelations,
638
- unidirectional,
639
- onNodeClick,
640
- direction,
641
- relationPairs,
642
- className: classes.graph,
643
- zoom: "enabled",
644
- curve
645
- }))))));
573
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
574
+ Header,
575
+ {
576
+ title: "Catalog Graph",
577
+ subtitle: rootEntityNames.map((e) => humanizeEntityRef(e)).join(", ")
578
+ }
579
+ ), /* @__PURE__ */ React.createElement(Content, { stretch: true, className: classes.content }, /* @__PURE__ */ React.createElement(
580
+ ContentHeader,
581
+ {
582
+ titleComponent: /* @__PURE__ */ React.createElement(
583
+ ToggleButton,
584
+ {
585
+ value: "show filters",
586
+ selected: showFilters,
587
+ onChange: () => toggleShowFilters()
588
+ },
589
+ /* @__PURE__ */ React.createElement(FilterListIcon, null),
590
+ " Filters"
591
+ )
592
+ },
593
+ /* @__PURE__ */ React.createElement(SupportButton, null, "Start tracking your component in by adding it to the software catalog.")
594
+ ), /* @__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(
595
+ SelectedKindsFilter,
596
+ {
597
+ value: selectedKinds,
598
+ onChange: setSelectedKinds
599
+ }
600
+ ), /* @__PURE__ */ React.createElement(
601
+ SelectedRelationsFilter,
602
+ {
603
+ value: selectedRelations,
604
+ onChange: setSelectedRelations,
605
+ relationPairs
606
+ }
607
+ ), /* @__PURE__ */ React.createElement(DirectionFilter, { value: direction, onChange: setDirection }), /* @__PURE__ */ React.createElement(CurveFilter, { value: curve, onChange: setCurve }), /* @__PURE__ */ React.createElement(
608
+ SwitchFilter,
609
+ {
610
+ value: unidirectional,
611
+ onChange: setUnidirectional,
612
+ label: "Simplified"
613
+ }
614
+ ), /* @__PURE__ */ React.createElement(
615
+ SwitchFilter,
616
+ {
617
+ value: mergeRelations,
618
+ onChange: setMergeRelations,
619
+ label: "Merge Relations"
620
+ }
621
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true, className: classes.fullHeight }, /* @__PURE__ */ React.createElement(Paper, { className: classes.graphWrapper }, /* @__PURE__ */ React.createElement(
622
+ Typography,
623
+ {
624
+ variant: "caption",
625
+ color: "textSecondary",
626
+ display: "block",
627
+ className: classes.legend
628
+ },
629
+ /* @__PURE__ */ React.createElement(ZoomOutMap, { className: "icon" }),
630
+ " Use pinch & zoom to move around the diagram. Click to change active node, shift click to navigate to entity."
631
+ ), /* @__PURE__ */ React.createElement(
632
+ EntityRelationsGraph,
633
+ {
634
+ rootEntityNames,
635
+ maxDepth,
636
+ kinds: selectedKinds && selectedKinds.length > 0 ? selectedKinds : void 0,
637
+ relations: selectedRelations && selectedRelations.length > 0 ? selectedRelations : void 0,
638
+ mergeRelations,
639
+ unidirectional,
640
+ onNodeClick,
641
+ direction,
642
+ relationPairs,
643
+ className: classes.graph,
644
+ zoom: "enabled",
645
+ curve
646
+ }
647
+ ))))));
646
648
  };
647
649
 
648
650
  export { CatalogGraphPage };
649
- //# sourceMappingURL=index-e6a68f95.esm.js.map
651
+ //# sourceMappingURL=index-3f9f92d1.esm.js.map