@backstage/plugin-catalog-react 1.13.0-next.2 → 1.13.1-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 +49 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +0 -2
- package/dist/components/EntityLifecyclePicker/EntityLifecyclePicker.esm.js +1 -3
- package/dist/components/EntityLifecyclePicker/EntityLifecyclePicker.esm.js.map +1 -1
- package/dist/components/EntityOwnerPicker/EntityOwnerPicker.esm.js +1 -3
- package/dist/components/EntityOwnerPicker/EntityOwnerPicker.esm.js.map +1 -1
- package/dist/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.esm.js +1 -3
- package/dist/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.esm.js.map +1 -1
- package/dist/components/EntitySearchBar/EntitySearchBar.esm.js +1 -3
- package/dist/components/EntitySearchBar/EntitySearchBar.esm.js.map +1 -1
- package/dist/components/UserListPicker/UserListPicker.esm.js +1 -3
- package/dist/components/UserListPicker/UserListPicker.esm.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.13.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/frontend-plugin-api@0.9.0-next.0
|
|
9
|
+
- @backstage/core-compat-api@0.3.1-next.0
|
|
10
|
+
- @backstage/core-components@0.15.1-next.0
|
|
11
|
+
- @backstage/core-plugin-api@1.10.0-next.0
|
|
12
|
+
- @backstage/catalog-client@1.7.0
|
|
13
|
+
- @backstage/catalog-model@1.7.0
|
|
14
|
+
- @backstage/errors@1.2.4
|
|
15
|
+
- @backstage/integration-react@1.1.32-next.0
|
|
16
|
+
- @backstage/types@1.1.1
|
|
17
|
+
- @backstage/version-bridge@1.0.9
|
|
18
|
+
- @backstage/plugin-catalog-common@1.1.0
|
|
19
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
20
|
+
- @backstage/plugin-permission-react@0.4.27-next.0
|
|
21
|
+
|
|
22
|
+
## 1.13.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- 78475c3: Allow offset mode paging in entity list provider
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- c891b69: Add `FavoriteToggle` in `core-components` to standardise favorite marking
|
|
31
|
+
- fec8b57: Updated exports to use the new type parameters for extensions and extension blueprints.
|
|
32
|
+
- b537bd7: Allow custom star icons to be provided via the `star` and `unstarred` icon overrides. See how to override existing icons in the [Backstage documentation](https://backstage.io/docs/getting-started/app-custom-theme/#custom-icons).
|
|
33
|
+
- 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
|
|
34
|
+
- 5446061: The `/alpha` export no longer export extension creators for the new frontend system, existing usage should be switched to use the equivalent extension blueprint instead. For more information see the [new frontend system 1.30 migration documentation](https://backstage.io/docs/frontend-system/architecture/migrations#130).
|
|
35
|
+
- a159180: Added missing items to `overridableComponents`
|
|
36
|
+
- ae9b6cb: Small internal fix to better work with recent `lodash` versions
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
- @backstage/core-components@0.15.0
|
|
39
|
+
- @backstage/frontend-plugin-api@0.8.0
|
|
40
|
+
- @backstage/core-compat-api@0.3.0
|
|
41
|
+
- @backstage/integration-react@1.1.31
|
|
42
|
+
- @backstage/catalog-model@1.7.0
|
|
43
|
+
- @backstage/catalog-client@1.7.0
|
|
44
|
+
- @backstage/plugin-catalog-common@1.1.0
|
|
45
|
+
- @backstage/core-plugin-api@1.9.4
|
|
46
|
+
- @backstage/version-bridge@1.0.9
|
|
47
|
+
- @backstage/plugin-permission-react@0.4.26
|
|
48
|
+
- @backstage/errors@1.2.4
|
|
49
|
+
- @backstage/types@1.1.1
|
|
50
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
51
|
+
|
|
3
52
|
## 1.13.0-next.2
|
|
4
53
|
|
|
5
54
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ declare function isOwnerOf(owner: Entity, entity: Entity): boolean;
|
|
|
25
25
|
*/
|
|
26
26
|
declare const EntityCardBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
27
27
|
kind: "entity-card";
|
|
28
|
-
namespace: undefined;
|
|
29
28
|
name: undefined;
|
|
30
29
|
params: {
|
|
31
30
|
loader: () => Promise<JSX.Element>;
|
|
@@ -55,7 +54,6 @@ declare const EntityCardBlueprint: _backstage_frontend_plugin_api.ExtensionBluep
|
|
|
55
54
|
*/
|
|
56
55
|
declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
57
56
|
kind: "entity-content";
|
|
58
|
-
namespace: undefined;
|
|
59
57
|
name: undefined;
|
|
60
58
|
params: {
|
|
61
59
|
loader: () => Promise<JSX.Element>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityLifecyclePicker.esm.js","sources":["../../../src/components/EntityLifecyclePicker/EntityLifecyclePicker.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 { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\nimport { EntityLifecycleFilter } from '../../filters';\nimport { EntityAutocompletePicker } from '../EntityAutocompletePicker';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntityLifecyclePickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n input: {},\n },\n {
|
|
1
|
+
{"version":3,"file":"EntityLifecyclePicker.esm.js","sources":["../../../src/components/EntityLifecyclePicker/EntityLifecyclePicker.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 { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\nimport { EntityLifecycleFilter } from '../../filters';\nimport { EntityAutocompletePicker } from '../EntityAutocompletePicker';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntityLifecyclePickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n input: {},\n },\n { name: 'CatalogReactEntityLifecyclePicker' },\n);\n\n/** @public */\nexport const EntityLifecyclePicker = (props: { initialFilter?: string[] }) => {\n const { initialFilter = [] } = props;\n const classes = useStyles();\n const { t } = useTranslationRef(catalogReactTranslationRef);\n\n return (\n <EntityAutocompletePicker\n label={t('entityLifecyclePicker.title')}\n name=\"lifecycles\"\n path=\"spec.lifecycle\"\n Filter={EntityLifecycleFilter}\n InputProps={{ className: classes.input }}\n initialSelectedOptions={initialFilter}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,OAAO,EAAC;AAAA,GACV;AAAA,EACA,EAAE,MAAM,mCAAoC,EAAA;AAC9C,CAAA,CAAA;AAGa,MAAA,qBAAA,GAAwB,CAAC,KAAwC,KAAA;AAC5E,EAAA,MAAM,EAAE,aAAA,GAAgB,EAAC,EAAM,GAAA,KAAA,CAAA;AAC/B,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,0BAA0B,CAAA,CAAA;AAE1D,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,MACtC,IAAK,EAAA,YAAA;AAAA,MACL,IAAK,EAAA,gBAAA;AAAA,MACL,MAAQ,EAAA,qBAAA;AAAA,MACR,UAAY,EAAA,EAAE,SAAW,EAAA,OAAA,CAAQ,KAAM,EAAA;AAAA,MACvC,sBAAwB,EAAA,aAAA;AAAA,KAAA;AAAA,GAC1B,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityOwnerPicker.esm.js","sources":["../../../src/components/EntityOwnerPicker/EntityOwnerPicker.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 Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\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 Tooltip from '@material-ui/core/Tooltip';\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 React, { useEffect, useMemo, useState, ReactNode } from 'react';\nimport { useEntityList } from '../../hooks/useEntityListProvider';\nimport { EntityOwnerFilter } from '../../filters';\nimport { useDebouncedEffect } from '@react-hookz/web';\nimport PersonIcon from '@material-ui/icons/Person';\nimport GroupIcon from '@material-ui/icons/Group';\nimport { humanizeEntity, humanizeEntityRef } from '../EntityRefLink/humanize';\nimport { useFetchEntities } from './useFetchEntities';\nimport { withStyles } from '@material-ui/core/styles';\nimport { useEntityPresentation } from '../../apis';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntityOwnerPickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n root: {},\n label: {},\n input: {},\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n },\n {\n name: 'CatalogReactEntityOwnerPicker',\n },\n);\n\nconst FixedWidthFormControlLabel = withStyles(\n _theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n }),\n { name: 'FixedWidthFormControlLabel' },\n)(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/**\n * @public\n */\nexport type EntityOwnerPickerProps = {\n mode?: 'owners-only' | 'all';\n};\n\nfunction RenderOptionLabel(props: { entity: Entity; isSelected: boolean }) {\n const classes = useStyles();\n const isGroup = props.entity.kind.toLocaleLowerCase('en-US') === 'group';\n const { primaryTitle: title } = useEntityPresentation(props.entity);\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={props.isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={title}>\n <Box display=\"flex\" alignItems=\"center\">\n {isGroup ? (\n <GroupIcon fontSize=\"small\" />\n ) : (\n <PersonIcon fontSize=\"small\" />\n )}\n \n <Box className={classes.boxLabel}>\n <Typography noWrap>{title}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\n/** @public */\nexport const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => {\n const classes = useStyles();\n const { mode = 'owners-only' } = props || {};\n const {\n updateFilters,\n filters,\n queryParameters: { owners: ownersParameter },\n } = useEntityList();\n\n const [text, setText] = useState('');\n const { t } = useTranslationRef(catalogReactTranslationRef);\n\n const queryParamOwners = useMemo(\n () => [ownersParameter].flat().filter(Boolean) as string[],\n [ownersParameter],\n );\n\n const [selectedOwners, setSelectedOwners] = useState(\n queryParamOwners.length ? queryParamOwners : filters.owners?.values ?? [],\n );\n\n const [{ value, loading }, handleFetch, cache] = useFetchEntities({\n mode,\n initialSelectedOwnersRefs: selectedOwners,\n });\n useDebouncedEffect(() => handleFetch({ text }), [text, handleFetch], 250);\n\n const availableOwners = value?.items || [];\n\n // Set selected owners on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (queryParamOwners.length) {\n const filter = new EntityOwnerFilter(queryParamOwners);\n setSelectedOwners(filter.values);\n }\n }, [queryParamOwners]);\n\n useEffect(() => {\n updateFilters({\n owners: selectedOwners.length\n ? new EntityOwnerFilter(selectedOwners)\n : undefined,\n });\n }, [selectedOwners, updateFilters]);\n\n if (\n ['user', 'group'].includes(\n filters.kind?.value.toLocaleLowerCase('en-US') || '',\n )\n ) {\n return null;\n }\n\n return (\n <Box className={classes.root} pb={1} pt={1}>\n <Typography className={classes.label} variant=\"button\" component=\"label\">\n {t('entityOwnerPicker.title')}\n <Autocomplete\n PopperComponent={popperProps => (\n <div {...popperProps}>{popperProps.children as ReactNode}</div>\n )}\n multiple\n disableCloseOnSelect\n loading={loading}\n options={availableOwners}\n value={selectedOwners as unknown as Entity[]}\n getOptionSelected={(o, v) => {\n if (typeof v === 'string') {\n return stringifyEntityRef(o) === v;\n }\n return o === v;\n }}\n getOptionLabel={o => {\n const entity =\n typeof o === 'string'\n ? cache.getEntity(o) ||\n parseEntityRef(o, {\n defaultKind: 'group',\n defaultNamespace: 'default',\n })\n : o;\n return humanizeEntity(entity, humanizeEntityRef(entity));\n }}\n onChange={(_: object, owners) => {\n setText('');\n setSelectedOwners(\n owners.map(e => {\n const entityRef =\n typeof e === 'string' ? e : stringifyEntityRef(e);\n\n if (typeof e !== 'string') {\n cache.setEntity(e);\n }\n return entityRef;\n }),\n );\n }}\n filterOptions={x => x}\n renderOption={(entity, { selected }) => {\n return <RenderOptionLabel entity={entity} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon data-testid=\"owner-picker-expand\" />}\n renderInput={params => (\n <TextField\n {...params}\n className={classes.input}\n onChange={e => {\n setText(e.currentTarget.value);\n }}\n variant=\"outlined\"\n />\n )}\n ListboxProps={{\n onScroll: (e: React.MouseEvent) => {\n const element = e.currentTarget;\n const hasReachedEnd =\n Math.abs(\n element.scrollHeight -\n element.clientHeight -\n element.scrollTop,\n ) < 1;\n\n if (hasReachedEnd && value?.cursor) {\n handleFetch({ items: value.items, cursor: value.cursor });\n }\n },\n 'data-testid': 'owner-picker-listbox',\n }}\n />\n </Typography>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,MAAM,EAAC;AAAA,IACP,OAAO,EAAC;AAAA,IACR,OAAO,EAAC;AAAA,IACR,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,IAC3B,QAAU,EAAA;AAAA,MACR,KAAO,E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AQ,CAAA,YAAA,GACR,OAAQ,CAAA,SAAA;AAAA,WACR,GAAA,CAAA,CAAA;AAEN,UAAI,IAAA,aAAA,IAAiB,OAAO,MAAQ,EAAA;AAClC,YAAA,WAAA,CAAY,EAAE,KAAO,EAAA,KAAA,CAAM,OAAO,MAAQ,EAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAAA,WAC1D;AAAA,SACF;AAAA,QACA,aAAe,EAAA,sBAAA;AAAA,OACjB;AAAA,KAAA;AAAA,GAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"EntityOwnerPicker.esm.js","sources":["../../../src/components/EntityOwnerPicker/EntityOwnerPicker.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 Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\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 Tooltip from '@material-ui/core/Tooltip';\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 React, { useEffect, useMemo, useState, ReactNode } from 'react';\nimport { useEntityList } from '../../hooks/useEntityListProvider';\nimport { EntityOwnerFilter } from '../../filters';\nimport { useDebouncedEffect } from '@react-hookz/web';\nimport PersonIcon from '@material-ui/icons/Person';\nimport GroupIcon from '@material-ui/icons/Group';\nimport { humanizeEntity, humanizeEntityRef } from '../EntityRefLink/humanize';\nimport { useFetchEntities } from './useFetchEntities';\nimport { withStyles } from '@material-ui/core/styles';\nimport { useEntityPresentation } from '../../apis';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntityOwnerPickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n root: {},\n label: {},\n input: {},\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n },\n { name: 'CatalogReactEntityOwnerPicker' },\n);\n\n/** @public */\nexport type FixedWidthFormControlLabelClassKey = 'label' | 'root';\n\nconst FixedWidthFormControlLabel = withStyles(\n _theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n }),\n { name: 'FixedWidthFormControlLabel' },\n)(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/**\n * @public\n */\nexport type EntityOwnerPickerProps = {\n mode?: 'owners-only' | 'all';\n};\n\nfunction RenderOptionLabel(props: { entity: Entity; isSelected: boolean }) {\n const classes = useStyles();\n const isGroup = props.entity.kind.toLocaleLowerCase('en-US') === 'group';\n const { primaryTitle: title } = useEntityPresentation(props.entity);\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={props.isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={title}>\n <Box display=\"flex\" alignItems=\"center\">\n {isGroup ? (\n <GroupIcon fontSize=\"small\" />\n ) : (\n <PersonIcon fontSize=\"small\" />\n )}\n \n <Box className={classes.boxLabel}>\n <Typography noWrap>{title}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\n/** @public */\nexport const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => {\n const classes = useStyles();\n const { mode = 'owners-only' } = props || {};\n const {\n updateFilters,\n filters,\n queryParameters: { owners: ownersParameter },\n } = useEntityList();\n\n const [text, setText] = useState('');\n const { t } = useTranslationRef(catalogReactTranslationRef);\n\n const queryParamOwners = useMemo(\n () => [ownersParameter].flat().filter(Boolean) as string[],\n [ownersParameter],\n );\n\n const [selectedOwners, setSelectedOwners] = useState(\n queryParamOwners.length ? queryParamOwners : filters.owners?.values ?? [],\n );\n\n const [{ value, loading }, handleFetch, cache] = useFetchEntities({\n mode,\n initialSelectedOwnersRefs: selectedOwners,\n });\n useDebouncedEffect(() => handleFetch({ text }), [text, handleFetch], 250);\n\n const availableOwners = value?.items || [];\n\n // Set selected owners on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (queryParamOwners.length) {\n const filter = new EntityOwnerFilter(queryParamOwners);\n setSelectedOwners(filter.values);\n }\n }, [queryParamOwners]);\n\n useEffect(() => {\n updateFilters({\n owners: selectedOwners.length\n ? new EntityOwnerFilter(selectedOwners)\n : undefined,\n });\n }, [selectedOwners, updateFilters]);\n\n if (\n ['user', 'group'].includes(\n filters.kind?.value.toLocaleLowerCase('en-US') || '',\n )\n ) {\n return null;\n }\n\n return (\n <Box className={classes.root} pb={1} pt={1}>\n <Typography className={classes.label} variant=\"button\" component=\"label\">\n {t('entityOwnerPicker.title')}\n <Autocomplete\n PopperComponent={popperProps => (\n <div {...popperProps}>{popperProps.children as ReactNode}</div>\n )}\n multiple\n disableCloseOnSelect\n loading={loading}\n options={availableOwners}\n value={selectedOwners as unknown as Entity[]}\n getOptionSelected={(o, v) => {\n if (typeof v === 'string') {\n return stringifyEntityRef(o) === v;\n }\n return o === v;\n }}\n getOptionLabel={o => {\n const entity =\n typeof o === 'string'\n ? cache.getEntity(o) ||\n parseEntityRef(o, {\n defaultKind: 'group',\n defaultNamespace: 'default',\n })\n : o;\n return humanizeEntity(entity, humanizeEntityRef(entity));\n }}\n onChange={(_: object, owners) => {\n setText('');\n setSelectedOwners(\n owners.map(e => {\n const entityRef =\n typeof e === 'string' ? e : stringifyEntityRef(e);\n\n if (typeof e !== 'string') {\n cache.setEntity(e);\n }\n return entityRef;\n }),\n );\n }}\n filterOptions={x => x}\n renderOption={(entity, { selected }) => {\n return <RenderOptionLabel entity={entity} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon data-testid=\"owner-picker-expand\" />}\n renderInput={params => (\n <TextField\n {...params}\n className={classes.input}\n onChange={e => {\n setText(e.currentTarget.value);\n }}\n variant=\"outlined\"\n />\n )}\n ListboxProps={{\n onScroll: (e: React.MouseEvent) => {\n const element = e.currentTarget;\n const hasReachedEnd =\n Math.abs(\n element.scrollHeight -\n element.clientHeight -\n element.scrollTop,\n ) < 1;\n\n if (hasReachedEnd && value?.cursor) {\n handleFetch({ items: value.items, cursor: value.cursor });\n }\n },\n 'data-testid': 'owner-picker-listbox',\n }}\n />\n </Typography>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,MAAM,EAAC;AAAA,IACP,OAAO,EAAC;AAAA,IACR,OAAO,EAAC;AAAA,IACR,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,IAC3B,QAAU,EAAA;AAAA,MACR,KAAO,EAAA,MAAA;AAAA,MACP,YAAc,EAAA,UAAA;AAAA,MACd,QAAU,EAAA,QAAA;AAAA,KACZ;AAAA,GACF;AAAA,EACA,EAAE,MAAM,+BAAgC,EAAA;AAC1C,CAAA,CAAA;AAKA,MAAM,0BAA6B,GAAA,UAAA;AAAA,EACjC,CAAW,MAAA,MAAA;AAAA,IAC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WAC1D;AAAA,SACF;AAAA,QACA,aAAe,EAAA,sBAAA;AAAA,OACjB;AAAA,KAAA;AAAA,GAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -32,9 +32,7 @@ const useStyles = makeStyles(
|
|
|
32
32
|
input: {},
|
|
33
33
|
label: {}
|
|
34
34
|
},
|
|
35
|
-
{
|
|
36
|
-
name: "CatalogReactEntityProcessingStatusPickerPicker"
|
|
37
|
-
}
|
|
35
|
+
{ name: "CatalogReactEntityProcessingStatusPickerPicker" }
|
|
38
36
|
);
|
|
39
37
|
const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
40
38
|
const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
|
package/dist/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityProcessingStatusPicker.esm.js","sources":["../../../src/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { EntityErrorFilter, EntityOrphanFilter } from '../../filters';\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 React, { useState, ReactNode } from 'react';\nimport { useEntityList } from '../../hooks';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntityProcessingStatusPickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n root: {},\n input: {},\n label: {},\n },\n {
|
|
1
|
+
{"version":3,"file":"EntityProcessingStatusPicker.esm.js","sources":["../../../src/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { EntityErrorFilter, EntityOrphanFilter } from '../../filters';\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 React, { useState, ReactNode } from 'react';\nimport { useEntityList } from '../../hooks';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntityProcessingStatusPickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n root: {},\n input: {},\n label: {},\n },\n { name: 'CatalogReactEntityProcessingStatusPickerPicker' },\n);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/** @public */\nexport const EntityProcessingStatusPicker = () => {\n const classes = useStyles();\n const { updateFilters } = useEntityList();\n const { t } = useTranslationRef(catalogReactTranslationRef);\n\n const [selectedAdvancedItems, setSelectedAdvancedItems] = useState<string[]>(\n [],\n );\n\n function orphanChange(value: boolean) {\n updateFilters({\n orphan: value ? new EntityOrphanFilter(value) : undefined,\n });\n }\n\n function errorChange(value: boolean) {\n updateFilters({\n error: value ? new EntityErrorFilter(value) : undefined,\n });\n }\n\n const availableAdvancedItems = ['Is Orphan', 'Has Error'];\n\n return (\n <Box className={classes.root} pb={1} pt={1}>\n <Typography className={classes.label} variant=\"button\" component=\"label\">\n {t('entityProcessingStatusPicker.title')}\n <Autocomplete<string, true>\n PopperComponent={popperProps => (\n <div {...popperProps}>{popperProps.children as ReactNode}</div>\n )}\n multiple\n disableCloseOnSelect\n options={availableAdvancedItems}\n value={selectedAdvancedItems}\n onChange={(_: object, value: string[]) => {\n setSelectedAdvancedItems(value);\n orphanChange(value.includes('Is Orphan'));\n errorChange(value.includes('Has Error'));\n }}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n onClick={event => event.preventDefault()}\n label={option}\n />\n )}\n size=\"small\"\n popupIcon={\n <ExpandMoreIcon data-testid=\"processing-status-picker-expand\" />\n }\n renderInput={params => (\n <TextField\n {...params}\n className={classes.input}\n variant=\"outlined\"\n />\n )}\n />\n </Typography>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE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aAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACE,GAAG,MAAA;AAAA,UACJ,WAAW,OAAQ,CAAA,KAAA;AAAA,UACnB,OAAQ,EAAA,UAAA;AAAA,SAAA;AAAA,OACV;AAAA,KAAA;AAAA,GAGN,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySearchBar.esm.js","sources":["../../../src/components/EntitySearchBar/EntitySearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport Input from '@material-ui/core/Input';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Clear from '@material-ui/icons/Clear';\nimport Search from '@material-ui/icons/Search';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { useEntityList } from '../../hooks/useEntityListProvider';\nimport { EntityTextFilter } from '../../filters';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntitySearchBarClassKey = 'searchToolbar' | 'input';\n\nconst useStyles = makeStyles(\n _theme => ({\n searchToolbar: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n input: {},\n }),\n {
|
|
1
|
+
{"version":3,"file":"EntitySearchBar.esm.js","sources":["../../../src/components/EntitySearchBar/EntitySearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport Input from '@material-ui/core/Input';\nimport InputAdornment from '@material-ui/core/InputAdornment';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Clear from '@material-ui/icons/Clear';\nimport Search from '@material-ui/icons/Search';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { useEntityList } from '../../hooks/useEntityListProvider';\nimport { EntityTextFilter } from '../../filters';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type CatalogReactEntitySearchBarClassKey = 'searchToolbar' | 'input';\n\nconst useStyles = makeStyles(\n _theme => ({\n searchToolbar: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n input: {},\n }),\n { name: 'CatalogReactEntitySearchBar' },\n);\n\n/**\n * Renders search bar for filtering the entity list.\n * @public\n */\nexport const EntitySearchBar = () => {\n const classes = useStyles();\n const { t } = useTranslationRef(catalogReactTranslationRef);\n\n const {\n updateFilters,\n queryParameters: { text: textParameter },\n } = useEntityList();\n\n const queryParamTextFilter = useMemo(\n () => [textParameter].flat()[0],\n [textParameter],\n );\n\n const [search, setSearch] = useState(queryParamTextFilter ?? '');\n\n useDebounce(\n () => {\n updateFilters({\n text: search.length ? new EntityTextFilter(search) : undefined,\n });\n },\n 250,\n [search, updateFilters],\n );\n\n useEffect(() => {\n if (queryParamTextFilter) {\n setSearch(queryParamTextFilter);\n }\n }, [queryParamTextFilter]);\n\n return (\n <Toolbar className={classes.searchToolbar}>\n <FormControl>\n <Input\n aria-label=\"search\"\n id=\"input-with-icon-adornment\"\n className={classes.input}\n placeholder={t('entitySearchBar.placeholder')}\n autoComplete=\"off\"\n onChange={event => setSearch(event.target.value)}\n value={search}\n startAdornment={\n <InputAdornment position=\"start\">\n <Search />\n </InputAdornment>\n }\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"clear search\"\n onClick={() => setSearch('')}\n edge=\"end\"\n disabled={search.length === 0}\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n }\n />\n </FormControl>\n </Toolbar>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAW,MAAA,MAAA;AAAA,IACT,aAAe,EAAA;AAAA,MACb,WAAa,EAAA,CAAA;AAAA,MACb,YAAc,EAAA,CAAA;AAAA,KAChB;AAAA,IACA,OAAO,EAAC;AAAA,GACV,CAAA;AAAA,EACA,EAAE,MAAM,6BAA8B,EAAA;AACxC,CAAA,CAAA;AAMO,MAAM,kBAAkB,MAAM;AACnC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,0BAA0B,CAAA,CAAA;AAE1D,EAAM,MAAA;AAAA,IACJ,aAAA;AAAA,IACA,eAAA,EAAiB,EAAE,IAAA,EAAM,aAAc,EAAA;AAAA,MACrC,aAAc,EAAA,CAAA;AAElB,EAAA,MAAM,oBAAuB,GAAA,OAAA;AAAA,IAC3B,MAAM,CAAC,aAAa,CAAE,CAAA,IAAA,GAAO,CAAC,CAAA;AAAA,IAC9B,CAAC,aAAa,CAAA;AAAA,GAChB,CAAA;AAEA,EAAA,MAAM,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAA,QAAA,CAAS,w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EAAE,CAAA;AAAA,UAC3B,IAAK,EAAA,KAAA;AAAA,UACL,QAAA,EAAU,OAAO,MAAW,KAAA,CAAA;AAAA,SAAA;AAAA,4CAE3B,KAAM,EAAA,IAAA,CAAA;AAAA,OAEX,CAAA;AAAA,KAAA;AAAA,GAGN,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserListPicker.esm.js","sources":["../../../src/components/UserListPicker/UserListPicker.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 configApiRef,\n IconComponent,\n useApi,\n} from '@backstage/core-plugin-api';\nimport Card from '@material-ui/core/Card';\nimport List from '@material-ui/core/List';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { StarIcon } from '@backstage/core-components';\nimport React, { Fragment, useEffect, useMemo, useState } from 'react';\nimport { EntityUserFilter } from '../../filters';\nimport { useEntityList } from '../../hooks';\nimport { UserListFilterKind } from '../../types';\nimport { useOwnedEntitiesCount } from './useOwnedEntitiesCount';\nimport { useAllEntitiesCount } from './useAllEntitiesCount';\nimport { useStarredEntitiesCount } from './useStarredEntitiesCount';\nimport {\n TranslationFunction,\n useTranslationRef,\n} from '@backstage/core-plugin-api/alpha';\nimport { catalogReactTranslationRef } from '../../translation';\n\n/** @public */\nexport type CatalogReactUserListPickerClassKey =\n | 'root'\n | 'title'\n | 'listIcon'\n | 'menuItem'\n | 'groupWrapper';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n backgroundColor: 'rgba(0, 0, 0, .11)',\n boxShadow: 'none',\n margin: theme.spacing(1, 0, 1, 0),\n },\n title: {\n margin: theme.spacing(1, 0, 0, 1),\n textTransform: 'uppercase',\n fontSize: 12,\n fontWeight: 'bold',\n },\n listIcon: {\n minWidth: 30,\n color: theme.palette.text.primary,\n },\n menuItem: {\n minHeight: theme.spacing(6),\n },\n groupWrapper: {\n margin: theme.spacing(1, 1, 2, 1),\n },\n }),\n {\n name: 'CatalogReactUserListPicker',\n },\n);\n\nexport type ButtonGroup = {\n name: string;\n items: {\n id: 'owned' | 'starred' | 'all';\n label: string;\n icon?: IconComponent;\n }[];\n};\n\nfunction getFilterGroups(\n orgName: string,\n t: TranslationFunction<typeof catalogReactTranslationRef.T>,\n): ButtonGroup[] {\n return [\n {\n name: t('userListPicker.personalFilter.title'),\n items: [\n {\n id: 'owned',\n label: t('userListPicker.personalFilter.ownedLabel'),\n icon: SettingsIcon,\n },\n {\n id: 'starred',\n label: t('userListPicker.personalFilter.starredLabel'),\n icon: StarIcon,\n },\n ],\n },\n {\n name: orgName,\n items: [\n {\n id: 'all',\n label: t('userListPicker.orgFilterAllLabel'),\n },\n ],\n },\n ];\n}\n\n/** @public */\nexport type UserListPickerProps = {\n initialFilter?: UserListFilterKind;\n availableFilters?: UserListFilterKind[];\n};\n\n/** @public */\nexport const UserListPicker = (props: UserListPickerProps) => {\n const { initialFilter, availableFilters } = props;\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(catalogReactTranslationRef);\n const orgName =\n configApi.getOptionalString('organization.name') ??\n t('userListPicker.defaultOrgName');\n const {\n filters,\n updateFilters,\n queryParameters: { kind: kindParameter, user: userParameter },\n } = useEntityList();\n\n // Remove group items that aren't in availableFilters and exclude\n // any now-empty groups.\n const userAndGroupFilterIds = ['starred', 'all'];\n const filterGroups = getFilterGroups(orgName, t)\n .map(filterGroup => ({\n ...filterGroup,\n items: filterGroup.items.filter(({ id }) =>\n // TODO: avoid hardcoding kinds here\n ['group', 'user'].some(kind => kind === kindParameter)\n ? userAndGroupFilterIds.includes(id)\n : !availableFilters || availableFilters.includes(id),\n ),\n }))\n .filter(({ items }) => !!items.length);\n\n const {\n count: ownedEntitiesCount,\n loading: loadingOwnedEntities,\n filter: ownedEntitiesFilter,\n } = useOwnedEntitiesCount();\n const { count: allCount } = useAllEntitiesCount();\n const {\n count: starredEntitiesCount,\n filter: starredEntitiesFilter,\n loading: loadingStarredEntities,\n } = useStarredEntitiesCount();\n\n const queryParamUserFilter = useMemo(\n () => [userParameter].flat()[0],\n [userParameter],\n );\n\n const [selectedUserFilter, setSelectedUserFilter] = useState(\n (queryParamUserFilter as UserListFilterKind) ?? initialFilter,\n );\n\n const filterCounts = useMemo(() => {\n return {\n all: allCount,\n starred: starredEntitiesCount,\n owned: ownedEntitiesCount,\n };\n }, [starredEntitiesCount, ownedEntitiesCount, allCount]);\n\n // Set selected user filter on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (queryParamUserFilter) {\n setSelectedUserFilter(queryParamUserFilter as UserListFilterKind);\n }\n }, [queryParamUserFilter]);\n\n const loading = loadingOwnedEntities || loadingStarredEntities;\n\n useEffect(() => {\n if (\n !loading &&\n !!selectedUserFilter &&\n selectedUserFilter !== 'all' &&\n filterCounts[selectedUserFilter] === 0\n ) {\n setSelectedUserFilter('all');\n }\n }, [loading, filterCounts, selectedUserFilter, setSelectedUserFilter]);\n\n useEffect(() => {\n if (!selectedUserFilter) {\n return;\n }\n if (loading) {\n return;\n }\n\n const getFilter = () => {\n if (selectedUserFilter === 'owned') {\n return ownedEntitiesFilter;\n }\n if (selectedUserFilter === 'starred') {\n return starredEntitiesFilter;\n }\n return EntityUserFilter.all();\n };\n\n updateFilters({ user: getFilter() });\n }, [\n selectedUserFilter,\n starredEntitiesFilter,\n ownedEntitiesFilter,\n updateFilters,\n\n loading,\n ]);\n\n return (\n <Card className={classes.root}>\n {filterGroups.map(group => (\n <Fragment key={group.name}>\n <Typography\n variant=\"subtitle2\"\n component=\"span\"\n className={classes.title}\n >\n {group.name}\n </Typography>\n <Card className={classes.groupWrapper}>\n <List disablePadding dense role=\"menu\" aria-label={group.name}>\n {group.items.map((item, index) => (\n <MenuItem\n role=\"none presentation\"\n key={item.id}\n divider={index !== group.items.length - 1}\n onClick={() => setSelectedUserFilter(item.id)}\n selected={item.id === filters.user?.value}\n className={classes.menuItem}\n disabled={filterCounts[item.id] === 0}\n data-testid={`user-picker-${item.id}`}\n tabIndex={0}\n ContainerProps={{ role: 'menuitem' }}\n >\n {item.icon && (\n <ListItemIcon className={classes.listIcon}>\n <item.icon fontSize=\"small\" />\n </ListItemIcon>\n )}\n <ListItemText>\n <Typography variant=\"body1\">{item.label} </Typography>\n </ListItemText>\n <ListItemSecondaryAction>\n {filterCounts[item.id] ?? '-'}\n </ListItemSecondaryAction>\n </MenuItem>\n ))}\n </List>\n </Card>\n </Fragment>\n ))}\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,eAAiB,EAAA,oBAAA;AAAA,MACjB,SAAW,EAAA,MAAA;AAAA,MACX,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,KAClC;AAAA,IACA,KAAO,EAAA;AAAA,MACL,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,MAChC,aAAe,EAAA,WAAA;AAAA,MACf,QAAU,EAAA,EAAA;AAAA,MAC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,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,mBAAA;AAAA,MACL,KAAK,IAAK,CAAA,EAAA;AAAA,MACV,OAAS,EAAA,KAAA,KAAU,KAAM,CAAA,KAAA,CAAM,MAAS,GAAA,CAAA;AAAA,MACxC,OAAS,EAAA,MAAM,qBAAsB,CAAA,IAAA,CAAK,EAAE,CAAA;AAAA,MAC5C,QAAU,EAAA,IAAA,CAAK,EAAO,KAAA,OAAA,CAAQ,IAAM,EAAA,KAAA;AAAA,MACpC,WAAW,OAAQ,CAAA,QAAA;AAAA,MACnB,QAAU,EAAA,YAAA,CAAa,IAAK,CAAA,EAAE,CAAM,KAAA,CAAA;AAAA,MACpC,aAAA,EAAa,CAAe,YAAA,EAAA,IAAA,CAAK,EAAE,CAAA,CAAA;AAAA,MACnC,QAAU,EAAA,CAAA;AAAA,MACV,cAAA,EAAgB,EAAE,IAAA,EAAM,UAAW,EAAA;AAAA,KAAA;AAAA,IAElC,IAAK,CAAA,IAAA,oBACH,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,SAAW,EAAA,OAAA,CAAQ,QAC/B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,CAAA,IAAA,EAAL,EAAU,QAAA,EAAS,SAAQ,CAC9B,CAAA;AAAA,oBAEF,KAAA,CAAA,aAAA,CAAC,oCACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,OAAS,EAAA,EAAA,IAAA,CAAK,KAAM,EAAA,GAAC,CAC3C,CAAA;AAAA,wCACC,uBACE,EAAA,IAAA,EAAA,YAAA,CAAa,IAAK,CAAA,EAAE,KAAK,GAC5B,CAAA;AAAA,GAEH,CACH,CACF,CACF,CACD,CACH,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"UserListPicker.esm.js","sources":["../../../src/components/UserListPicker/UserListPicker.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 configApiRef,\n IconComponent,\n useApi,\n} from '@backstage/core-plugin-api';\nimport Card from '@material-ui/core/Card';\nimport List from '@material-ui/core/List';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { StarIcon } from '@backstage/core-components';\nimport React, { Fragment, useEffect, useMemo, useState } from 'react';\nimport { EntityUserFilter } from '../../filters';\nimport { useEntityList } from '../../hooks';\nimport { UserListFilterKind } from '../../types';\nimport { useOwnedEntitiesCount } from './useOwnedEntitiesCount';\nimport { useAllEntitiesCount } from './useAllEntitiesCount';\nimport { useStarredEntitiesCount } from './useStarredEntitiesCount';\nimport {\n TranslationFunction,\n useTranslationRef,\n} from '@backstage/core-plugin-api/alpha';\nimport { catalogReactTranslationRef } from '../../translation';\n\n/** @public */\nexport type CatalogReactUserListPickerClassKey =\n | 'root'\n | 'title'\n | 'listIcon'\n | 'menuItem'\n | 'groupWrapper';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n backgroundColor: 'rgba(0, 0, 0, .11)',\n boxShadow: 'none',\n margin: theme.spacing(1, 0, 1, 0),\n },\n title: {\n margin: theme.spacing(1, 0, 0, 1),\n textTransform: 'uppercase',\n fontSize: 12,\n fontWeight: 'bold',\n },\n listIcon: {\n minWidth: 30,\n color: theme.palette.text.primary,\n },\n menuItem: {\n minHeight: theme.spacing(6),\n },\n groupWrapper: {\n margin: theme.spacing(1, 1, 2, 1),\n },\n }),\n { name: 'CatalogReactUserListPicker' },\n);\n\nexport type ButtonGroup = {\n name: string;\n items: {\n id: 'owned' | 'starred' | 'all';\n label: string;\n icon?: IconComponent;\n }[];\n};\n\nfunction getFilterGroups(\n orgName: string,\n t: TranslationFunction<typeof catalogReactTranslationRef.T>,\n): ButtonGroup[] {\n return [\n {\n name: t('userListPicker.personalFilter.title'),\n items: [\n {\n id: 'owned',\n label: t('userListPicker.personalFilter.ownedLabel'),\n icon: SettingsIcon,\n },\n {\n id: 'starred',\n label: t('userListPicker.personalFilter.starredLabel'),\n icon: StarIcon,\n },\n ],\n },\n {\n name: orgName,\n items: [\n {\n id: 'all',\n label: t('userListPicker.orgFilterAllLabel'),\n },\n ],\n },\n ];\n}\n\n/** @public */\nexport type UserListPickerProps = {\n initialFilter?: UserListFilterKind;\n availableFilters?: UserListFilterKind[];\n};\n\n/** @public */\nexport const UserListPicker = (props: UserListPickerProps) => {\n const { initialFilter, availableFilters } = props;\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(catalogReactTranslationRef);\n const orgName =\n configApi.getOptionalString('organization.name') ??\n t('userListPicker.defaultOrgName');\n const {\n filters,\n updateFilters,\n queryParameters: { kind: kindParameter, user: userParameter },\n } = useEntityList();\n\n // Remove group items that aren't in availableFilters and exclude\n // any now-empty groups.\n const userAndGroupFilterIds = ['starred', 'all'];\n const filterGroups = getFilterGroups(orgName, t)\n .map(filterGroup => ({\n ...filterGroup,\n items: filterGroup.items.filter(({ id }) =>\n // TODO: avoid hardcoding kinds here\n ['group', 'user'].some(kind => kind === kindParameter)\n ? userAndGroupFilterIds.includes(id)\n : !availableFilters || availableFilters.includes(id),\n ),\n }))\n .filter(({ items }) => !!items.length);\n\n const {\n count: ownedEntitiesCount,\n loading: loadingOwnedEntities,\n filter: ownedEntitiesFilter,\n } = useOwnedEntitiesCount();\n const { count: allCount } = useAllEntitiesCount();\n const {\n count: starredEntitiesCount,\n filter: starredEntitiesFilter,\n loading: loadingStarredEntities,\n } = useStarredEntitiesCount();\n\n const queryParamUserFilter = useMemo(\n () => [userParameter].flat()[0],\n [userParameter],\n );\n\n const [selectedUserFilter, setSelectedUserFilter] = useState(\n (queryParamUserFilter as UserListFilterKind) ?? initialFilter,\n );\n\n const filterCounts = useMemo(() => {\n return {\n all: allCount,\n starred: starredEntitiesCount,\n owned: ownedEntitiesCount,\n };\n }, [starredEntitiesCount, ownedEntitiesCount, allCount]);\n\n // Set selected user filter on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (queryParamUserFilter) {\n setSelectedUserFilter(queryParamUserFilter as UserListFilterKind);\n }\n }, [queryParamUserFilter]);\n\n const loading = loadingOwnedEntities || loadingStarredEntities;\n\n useEffect(() => {\n if (\n !loading &&\n !!selectedUserFilter &&\n selectedUserFilter !== 'all' &&\n filterCounts[selectedUserFilter] === 0\n ) {\n setSelectedUserFilter('all');\n }\n }, [loading, filterCounts, selectedUserFilter, setSelectedUserFilter]);\n\n useEffect(() => {\n if (!selectedUserFilter) {\n return;\n }\n if (loading) {\n return;\n }\n\n const getFilter = () => {\n if (selectedUserFilter === 'owned') {\n return ownedEntitiesFilter;\n }\n if (selectedUserFilter === 'starred') {\n return starredEntitiesFilter;\n }\n return EntityUserFilter.all();\n };\n\n updateFilters({ user: getFilter() });\n }, [\n selectedUserFilter,\n starredEntitiesFilter,\n ownedEntitiesFilter,\n updateFilters,\n\n loading,\n ]);\n\n return (\n <Card className={classes.root}>\n {filterGroups.map(group => (\n <Fragment key={group.name}>\n <Typography\n variant=\"subtitle2\"\n component=\"span\"\n className={classes.title}\n >\n {group.name}\n </Typography>\n <Card className={classes.groupWrapper}>\n <List disablePadding dense role=\"menu\" aria-label={group.name}>\n {group.items.map((item, index) => (\n <MenuItem\n role=\"none presentation\"\n key={item.id}\n divider={index !== group.items.length - 1}\n onClick={() => setSelectedUserFilter(item.id)}\n selected={item.id === filters.user?.value}\n className={classes.menuItem}\n disabled={filterCounts[item.id] === 0}\n data-testid={`user-picker-${item.id}`}\n tabIndex={0}\n ContainerProps={{ role: 'menuitem' }}\n >\n {item.icon && (\n <ListItemIcon className={classes.listIcon}>\n <item.icon fontSize=\"small\" />\n </ListItemIcon>\n )}\n <ListItemText>\n <Typography variant=\"body1\">{item.label} </Typography>\n </ListItemText>\n <ListItemSecondaryAction>\n {filterCounts[item.id] ?? '-'}\n </ListItemSecondaryAction>\n </MenuItem>\n ))}\n </List>\n </Card>\n </Fragment>\n ))}\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,eAAiB,EAAA,oBAAA;AAAA,MACjB,SAAW,EAAA,MAAA;AAAA,MACX,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,KAClC;AAAA,IACA,KAAO,EAAA;AAAA,MACL,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,MAChC,aAAe,EAAA,WAAA;AAAA,MACf,QAAU,EAAA,EAAA;AAAA,MACV,UAAY,EAAA,MAAA;AAAA,KACd;AAAA,IACA,QAAU,EAAA;AAAA,MACR,QAAU,EAAA,EAAA;AAAA,MACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,OAAA;AAAA,KAC5B;AAAA,IACA,QAAU,EAAA;AAAA,MACR,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,KAC5B;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAA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AAA,MACnB,QAAU,EAAA,YAAA,CAAa,IAAK,CAAA,EAAE,CAAM,KAAA,CAAA;AAAA,MACpC,aAAA,EAAa,CAAe,YAAA,EAAA,IAAA,CAAK,EAAE,CAAA,CAAA;AAAA,MACnC,QAAU,EAAA,CAAA;AAAA,MACV,cAAA,EAAgB,EAAE,IAAA,EAAM,UAAW,EAAA;AAAA,KAAA;AAAA,IAElC,IAAK,CAAA,IAAA,oBACH,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,SAAW,EAAA,OAAA,CAAQ,QAC/B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,CAAA,IAAA,EAAL,EAAU,QAAA,EAAS,SAAQ,CAC9B,CAAA;AAAA,oBAEF,KAAA,CAAA,aAAA,CAAC,oCACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,OAAS,EAAA,EAAA,IAAA,CAAK,KAAM,EAAA,GAAC,CAC3C,CAAA;AAAA,wCACC,uBACE,EAAA,IAAA,EAAA,YAAA,CAAa,IAAK,CAAA,EAAE,KAAK,GAC5B,CAAA;AAAA,GAEH,CACH,CACF,CACF,CACD,CACH,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -251,6 +251,8 @@ type EntityListPagination = boolean | {
|
|
|
251
251
|
|
|
252
252
|
/** @public */
|
|
253
253
|
type CatalogReactEntityOwnerPickerClassKey = 'input';
|
|
254
|
+
/** @public */
|
|
255
|
+
type FixedWidthFormControlLabelClassKey = 'label' | 'root';
|
|
254
256
|
/**
|
|
255
257
|
* @public
|
|
256
258
|
*/
|
|
@@ -939,8 +941,10 @@ type CatalogReactComponentsNameToClassKey = {
|
|
|
939
941
|
CatalogReactEntitySearchBar: CatalogReactEntitySearchBarClassKey;
|
|
940
942
|
CatalogReactEntityTagPicker: CatalogReactEntityTagPickerClassKey;
|
|
941
943
|
CatalogReactEntityOwnerPicker: CatalogReactEntityOwnerPickerClassKey;
|
|
944
|
+
CatalogReactFixedWidthFormControlLabel: FixedWidthFormControlLabelClassKey;
|
|
942
945
|
CatalogReactEntityProcessingStatusPicker: CatalogReactEntityProcessingStatusPickerClassKey;
|
|
943
946
|
CatalogReactEntityAutocompletePickerClassKey: CatalogReactEntityAutocompletePickerClassKey;
|
|
947
|
+
CatalogReactMissingAnnotationEmptyState: MissingAnnotationEmptyStateClassKey;
|
|
944
948
|
};
|
|
945
949
|
/** @public */
|
|
946
950
|
type BackstageOverrides = Overrides & {
|
|
@@ -968,4 +972,4 @@ type EntitySourceLocation = {
|
|
|
968
972
|
/** @public */
|
|
969
973
|
declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: typeof scmIntegrationsApiRef.T): EntitySourceLocation | undefined;
|
|
970
974
|
|
|
971
|
-
export { type AllowedEntityFilters, AsyncEntityProvider, type AsyncEntityProviderProps, type BackstageOverrides, CatalogFilterLayout, type CatalogReactComponentsNameToClassKey, type CatalogReactEntityAutocompletePickerClassKey, type CatalogReactEntityDisplayNameClassKey, type CatalogReactEntityLifecyclePickerClassKey, type CatalogReactEntityNamespacePickerClassKey, type CatalogReactEntityOwnerPickerClassKey, type CatalogReactEntityProcessingStatusPickerClassKey, type CatalogReactEntitySearchBarClassKey, type CatalogReactEntityTagPickerClassKey, type CatalogReactUserListPickerClassKey, type DefaultEntityFilters, DefaultFilters, type DefaultFiltersProps, EntityAutocompletePicker, type EntityAutocompletePickerProps, EntityDisplayName, type EntityDisplayNameProps, EntityErrorFilter, type EntityFilter, EntityKindFilter, EntityKindPicker, type EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, type EntityListContextProps, type EntityListPagination, EntityListProvider, type EntityListProviderProps, type EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, type EntityNamespacePickerProps, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, type EntityOwnerPickerProps, EntityPeekAheadPopover, type EntityPeekAheadPopoverProps, type EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, type EntityProviderProps, EntityRefLink, type EntityRefLinkProps, EntityRefLinks, type EntityRefLinksProps, type EntityRefPresentation, type EntityRefPresentationSnapshot, EntitySearchBar, type EntitySourceLocation, EntityTable, type EntityTableProps, EntityTagFilter, EntityTagPicker, type EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, type EntityTypePickerProps, EntityUserFilter, FavoriteEntity, type FavoriteEntityProps, InspectEntityDialog, MissingAnnotationEmptyState, type MissingAnnotationEmptyStateClassKey, MockEntityListContextProvider, MockStarredEntitiesApi, type PaginationMode, type StarredEntitiesApi, UnregisterEntityDialog, type UnregisterEntityDialogProps, UserListFilter, type UserListFilterKind, UserListPicker, type UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
|
|
975
|
+
export { type AllowedEntityFilters, AsyncEntityProvider, type AsyncEntityProviderProps, type BackstageOverrides, CatalogFilterLayout, type CatalogReactComponentsNameToClassKey, type CatalogReactEntityAutocompletePickerClassKey, type CatalogReactEntityDisplayNameClassKey, type CatalogReactEntityLifecyclePickerClassKey, type CatalogReactEntityNamespacePickerClassKey, type CatalogReactEntityOwnerPickerClassKey, type CatalogReactEntityProcessingStatusPickerClassKey, type CatalogReactEntitySearchBarClassKey, type CatalogReactEntityTagPickerClassKey, type CatalogReactUserListPickerClassKey, type DefaultEntityFilters, DefaultFilters, type DefaultFiltersProps, EntityAutocompletePicker, type EntityAutocompletePickerProps, EntityDisplayName, type EntityDisplayNameProps, EntityErrorFilter, type EntityFilter, EntityKindFilter, EntityKindPicker, type EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, type EntityListContextProps, type EntityListPagination, EntityListProvider, type EntityListProviderProps, type EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, type EntityNamespacePickerProps, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, type EntityOwnerPickerProps, EntityPeekAheadPopover, type EntityPeekAheadPopoverProps, type EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, type EntityProviderProps, EntityRefLink, type EntityRefLinkProps, EntityRefLinks, type EntityRefLinksProps, type EntityRefPresentation, type EntityRefPresentationSnapshot, EntitySearchBar, type EntitySourceLocation, EntityTable, type EntityTableProps, EntityTagFilter, EntityTagPicker, type EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, type EntityTypePickerProps, EntityUserFilter, FavoriteEntity, type FavoriteEntityProps, type FixedWidthFormControlLabelClassKey, InspectEntityDialog, MissingAnnotationEmptyState, type MissingAnnotationEmptyStateClassKey, MockEntityListContextProvider, MockStarredEntitiesApi, type PaginationMode, type StarredEntitiesApi, UnregisterEntityDialog, type UnregisterEntityDialogProps, UserListFilter, type UserListFilterKind, UserListPicker, type UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-react",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.1-next.0",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
"test": "backstage-cli package test"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@backstage/catalog-client": "^1.7.0
|
|
60
|
-
"@backstage/catalog-model": "^1.
|
|
61
|
-
"@backstage/core-compat-api": "^0.3.
|
|
62
|
-
"@backstage/core-components": "^0.
|
|
63
|
-
"@backstage/core-plugin-api": "^1.
|
|
59
|
+
"@backstage/catalog-client": "^1.7.0",
|
|
60
|
+
"@backstage/catalog-model": "^1.7.0",
|
|
61
|
+
"@backstage/core-compat-api": "^0.3.1-next.0",
|
|
62
|
+
"@backstage/core-components": "^0.15.1-next.0",
|
|
63
|
+
"@backstage/core-plugin-api": "^1.10.0-next.0",
|
|
64
64
|
"@backstage/errors": "^1.2.4",
|
|
65
|
-
"@backstage/frontend-plugin-api": "^0.
|
|
66
|
-
"@backstage/integration-react": "^1.1.
|
|
67
|
-
"@backstage/plugin-catalog-common": "^1.0
|
|
65
|
+
"@backstage/frontend-plugin-api": "^0.9.0-next.0",
|
|
66
|
+
"@backstage/integration-react": "^1.1.32-next.0",
|
|
67
|
+
"@backstage/plugin-catalog-common": "^1.1.0",
|
|
68
68
|
"@backstage/plugin-permission-common": "^0.8.1",
|
|
69
|
-
"@backstage/plugin-permission-react": "^0.4.
|
|
69
|
+
"@backstage/plugin-permission-react": "^0.4.27-next.0",
|
|
70
70
|
"@backstage/types": "^1.1.1",
|
|
71
|
-
"@backstage/version-bridge": "^1.0.9
|
|
71
|
+
"@backstage/version-bridge": "^1.0.9",
|
|
72
72
|
"@material-ui/core": "^4.12.2",
|
|
73
73
|
"@material-ui/icons": "^4.9.1",
|
|
74
74
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -83,12 +83,12 @@
|
|
|
83
83
|
"zen-observable": "^0.10.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@backstage/cli": "^0.
|
|
87
|
-
"@backstage/core-app-api": "^1.
|
|
88
|
-
"@backstage/frontend-test-utils": "^0.2.
|
|
89
|
-
"@backstage/plugin-catalog-common": "^1.0
|
|
90
|
-
"@backstage/plugin-scaffolder-common": "^1.5.
|
|
91
|
-
"@backstage/test-utils": "^1.6.
|
|
86
|
+
"@backstage/cli": "^0.28.0-next.0",
|
|
87
|
+
"@backstage/core-app-api": "^1.15.1-next.0",
|
|
88
|
+
"@backstage/frontend-test-utils": "^0.2.1-next.0",
|
|
89
|
+
"@backstage/plugin-catalog-common": "^1.1.0",
|
|
90
|
+
"@backstage/plugin-scaffolder-common": "^1.5.6",
|
|
91
|
+
"@backstage/test-utils": "^1.6.1-next.0",
|
|
92
92
|
"@testing-library/dom": "^10.0.0",
|
|
93
93
|
"@testing-library/jest-dom": "^6.0.0",
|
|
94
94
|
"@testing-library/react": "^16.0.0",
|