@backstage/plugin-catalog 1.22.1-next.1 → 1.23.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 CHANGED
@@ -1,5 +1,64 @@
1
1
  # @backstage/plugin-catalog
2
2
 
3
+ ## 1.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 78475c3: Allow offset mode paging in entity list provider
8
+
9
+ ### Patch Changes
10
+
11
+ - c891b69: Add `FavoriteToggle` in `core-components` to standardise favorite marking
12
+ - fec8b57: Updated exports to use the new type parameters for extensions and extension blueprints.
13
+ - 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
14
+ - 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).
15
+ - 0ff53c8: Enable loading state for paginated catalog tables by passing `isLoading` prop
16
+ - 180a45f: Entity presentation api now only fetches fields that are required to display entity title
17
+ - a159180: Added missing items to `overridableComponents`
18
+ - Updated dependencies
19
+ - @backstage/core-components@0.15.0
20
+ - @backstage/plugin-catalog-react@1.13.0
21
+ - @backstage/frontend-plugin-api@0.8.0
22
+ - @backstage/core-compat-api@0.3.0
23
+ - @backstage/plugin-search-react@1.8.0
24
+ - @backstage/integration-react@1.1.31
25
+ - @backstage/catalog-model@1.7.0
26
+ - @backstage/catalog-client@1.7.0
27
+ - @backstage/plugin-catalog-common@1.1.0
28
+ - @backstage/core-plugin-api@1.9.4
29
+ - @backstage/plugin-permission-react@0.4.26
30
+ - @backstage/errors@1.2.4
31
+ - @backstage/types@1.1.1
32
+ - @backstage/plugin-scaffolder-common@1.5.6
33
+ - @backstage/plugin-search-common@1.2.14
34
+
35
+ ## 1.23.0-next.2
36
+
37
+ ### Minor Changes
38
+
39
+ - 78475c3: Allow offset mode paging in entity list provider
40
+
41
+ ### Patch Changes
42
+
43
+ - c891b69: Add `FavoriteToggle` in `core-components` to standardise favorite marking
44
+ - 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
45
+ - Updated dependencies
46
+ - @backstage/core-components@0.14.11-next.1
47
+ - @backstage/plugin-catalog-react@1.13.0-next.2
48
+ - @backstage/integration-react@1.1.31-next.0
49
+ - @backstage/catalog-client@1.7.0-next.1
50
+ - @backstage/plugin-search-react@1.8.0-next.2
51
+ - @backstage/core-compat-api@0.3.0-next.2
52
+ - @backstage/core-plugin-api@1.9.4-next.0
53
+ - @backstage/frontend-plugin-api@0.8.0-next.2
54
+ - @backstage/plugin-permission-react@0.4.26-next.0
55
+ - @backstage/catalog-model@1.6.0
56
+ - @backstage/errors@1.2.4
57
+ - @backstage/types@1.1.1
58
+ - @backstage/plugin-catalog-common@1.0.26
59
+ - @backstage/plugin-scaffolder-common@1.5.5
60
+ - @backstage/plugin-search-common@1.2.14
61
+
3
62
  ## 1.22.1-next.1
4
63
 
5
64
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog__alpha",
3
- "version": "1.22.1-next.1",
3
+ "version": "1.23.0",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultCatalogPage.esm.js","sources":["../../../src/components/CatalogPage/DefaultCatalogPage.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 Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n EntityListProvider,\n UserListFilterKind,\n EntityOwnerPickerProps,\n} from '@backstage/plugin-catalog-react';\nimport React, { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nimport { CatalogTableColumnsFunc } from '../CatalogTable/types';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { DefaultFilters } from '@backstage/plugin-catalog-react';\n\n/** @internal */\nexport type BaseCatalogPageProps = {\n filters: ReactNode;\n content?: ReactNode;\n pagination?: boolean | { limit?: number };\n};\n\n/** @internal */\nexport function BaseCatalogPage(props: BaseCatalogPageProps) {\n const { filters, content = <CatalogTable />, pagination } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <PageWithHeader title={t('indexPage.title', { orgName })} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">\n {allowed && (\n <CreateButton\n title={t('indexPage.createButtonTitle')}\n to={createComponentLink && createComponentLink()}\n />\n )}\n <SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>\n </ContentHeader>\n <EntityListProvider pagination={pagination}>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>{filters}</CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>{content}</CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n}\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: boolean | { limit?: number };\n filters?: ReactNode;\n initiallySelectedNamespaces?: string[];\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n pagination,\n ownerPickerMode,\n filters,\n initiallySelectedNamespaces,\n } = props;\n\n return (\n <BaseCatalogPage\n filters={\n filters ?? (\n <DefaultFilters\n initialKind={initialKind}\n initiallySelectedFilter={initiallySelectedFilter}\n ownerPickerMode={ownerPickerMode}\n initiallySelectedNamespaces={initiallySelectedNamespaces}\n />\n )\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n }\n pagination={pagination}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAmDO,SAAS,gBAAgB,KAA6B,EAAA;AAC3D,EAAA,MAAM,EAAE,OAAS,EAAA,OAAA,uCAAW,YAAa,EAAA,IAAA,CAAA,EAAI,YAAe,GAAA,KAAA,CAAA;AAC5D,EAAA,MAAM,UACJ,MAAO,CAAA,YAAY,CAAE,CAAA,iBAAA,CAAkB,mBAAmB,CAAK,IAAA,WAAA,CAAA;AACjE,EAAM,MAAA,mBAAA,GAAsB,YAAY,uBAAuB,CAAA,CAAA;AAC/D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA,CAAA;AACrD,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,aAAc,CAAA;AAAA,IAChC,UAAY,EAAA,6BAAA;AAAA,GACb,CAAA,CAAA;AAED,EAAA,2CACG,cAAe,E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,uBAAA;AAAA,UACA,eAAA;AAAA,UACA,2BAAA;AAAA,SAAA;AAAA,OACF;AAAA,MAGJ,OACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA,YAAA;AAAA,SAAA;AAAA,OACF;AAAA,MAEF,UAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultCatalogPage.esm.js","sources":["../../../src/components/CatalogPage/DefaultCatalogPage.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 Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n DefaultFilters,\n EntityListPagination,\n EntityListProvider,\n EntityOwnerPickerProps,\n UserListFilterKind,\n} from '@backstage/plugin-catalog-react';\nimport React, { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { CatalogTableColumnsFunc } from '../CatalogTable/types';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\n\n/** @internal */\nexport type BaseCatalogPageProps = {\n filters: ReactNode;\n content?: ReactNode;\n pagination?: EntityListPagination;\n};\n\n/** @internal */\nexport function BaseCatalogPage(props: BaseCatalogPageProps) {\n const { filters, content = <CatalogTable />, pagination } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <PageWithHeader title={t('indexPage.title', { orgName })} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">\n {allowed && (\n <CreateButton\n title={t('indexPage.createButtonTitle')}\n to={createComponentLink && createComponentLink()}\n />\n )}\n <SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>\n </ContentHeader>\n <EntityListProvider pagination={pagination}>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>{filters}</CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>{content}</CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n}\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n filters?: ReactNode;\n initiallySelectedNamespaces?: string[];\n pagination?: EntityListPagination;\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n pagination,\n ownerPickerMode,\n filters,\n initiallySelectedNamespaces,\n } = props;\n\n return (\n <BaseCatalogPage\n filters={\n filters ?? (\n <DefaultFilters\n initialKind={initialKind}\n initiallySelectedFilter={initiallySelectedFilter}\n ownerPickerMode={ownerPickerMode}\n initiallySelectedNamespaces={initiallySelectedNamespaces}\n />\n )\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n }\n pagination={pagination}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAmDO,SAAS,gBAAgB,KAA6B,EAAA;AAC3D,EAAA,MAAM,EAAE,OAAS,EAAA,OAAA,uCAAW,YAAa,EAAA,IAAA,CAAA,EAAI,YAAe,GAAA,KAAA,CAAA;AAC5D,EAAA,MAAM,UACJ,MAAO,CAAA,YAAY,CAAE,CAAA,iBAAA,CAAkB,mBAAmB,CAAK,IAAA,WAAA,CAAA;AACjE,EAAM,MAAA,mBAAA,GAAsB,YAAY,uBAAuB,CAAA,CAAA;AAC/D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA,CAAA;AACrD,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,aAAc,CAAA;AAAA,IAChC,UAAY,EAAA,6BAAA;AAAA,GACb,CAAA,CAAA;AAED,EAAA,2CACG,cAAe,EAAA,EAAA,KAAA,EAAO,CAAE,CAAA,iBAAA,EAAmB,EAAE,OAAQ,EAAC,CAAG,EAAA,OAAA,EAAQ,0BAC/D,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,sCACE,aAAc,EAAA,EAAA,KAAA,EAAM,MAClB,OACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,MACtC,EAAA,EAAI,uBAAuB,mBAAoB,EAAA;AAAA,KAAA;AAAA,GACjD,kBAED,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,IAAA,EAAe,CAAE,CAAA,gCAAgC,CAAE,CACtD,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,UAAA,EAAA,kBACjB,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,mBAAA,CAAoB,OAApB,EAAA,IAAA,EAA6B,OAAQ,CAAA,kBACrC,KAAA,CAAA,aAAA,CAAA,mBAAA,CAAoB,OAApB,EAAA,IAAA,EAA6B,OAAQ,CACxC,CACF,CACF,CACF,CAAA,CAAA;AAEJ,CAAA;AAoBO,SAAS,mBAAmB,KAAgC,EAAA;AACjE,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,OAAA;AAAA,IACA,uBAA0B,GAAA,OAAA;AAAA,IAC1B,WAAc,GAAA,WAAA;AAAA,IACd,eAAe,EAAC;AAAA,IAChB,YAAA;AAAA,IACA,UAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,2BAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SACE,OACE,oBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA,uBAAA;AAAA,UACA,eAAA;AAAA,UACA,2BAAA;AAAA,SAAA;AAAA,OACF;AAAA,MAGJ,OACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA,YAAA;AAAA,SAAA;AAAA,OACF;AAAA,MAEF,UAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CatalogSearchResultListItem.esm.js","sources":["../../../src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.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 React, { ReactNode } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Link } from '@backstage/core-components';\nimport {\n IndexableDocument,\n ResultHighlight,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '@backstage/plugin-search-react';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\nconst useStyles = makeStyles(\n {\n item: {\n display: 'flex',\n },\n flexContainer: {\n flexWrap: 'wrap',\n },\n itemText: {\n width: '100%',\n wordBreak: 'break-all',\n marginBottom: '1rem',\n },\n },\n { name: 'CatalogSearchResultListItem' },\n);\n\n/**\n * Props for {@link CatalogSearchResultListItem}.\n *\n * @public\n */\nexport interface CatalogSearchResultListItemProps {\n icon?: ReactNode | ((result: IndexableDocument) => ReactNode);\n result?: IndexableDocument;\n highlight?: ResultHighlight;\n rank?: number;\n lineClamp?: number;\n}\n\n/** @public */\nexport function CatalogSearchResultListItem(\n props: CatalogSearchResultListItemProps,\n) {\n const result = props.result as any;\n const highlight = props.highlight as ResultHighlight;\n\n const classes = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n if (!result) return null;\n\n return (\n <div className={classes.item}>\n {props.icon && (\n <ListItemIcon>\n {typeof props.icon === 'function' ? props.icon(result) : props.icon}\n </ListItemIcon>\n )}\n <div className={classes.flexContainer}>\n <ListItemText\n className={classes.itemText}\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight.fields.title}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n <Typography\n component=\"span\"\n style={{\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: props.lineClamp,\n overflow: 'hidden',\n }}\n color=\"textSecondary\"\n variant=\"body2\"\n >\n {highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )}\n </Typography>\n }\n />\n <Box>\n {result.kind && <Chip label={`Kind: ${result.kind}`} size=\"small\" />}\n {result.type && <Chip label={`Type: ${result.type}`} size=\"small\" />}\n {result.lifecycle && (\n <Chip\n label={`${t('searchResultItem.lifecycle')}: ${result.lifecycle}`}\n size=\"small\"\n />\n )}\n {result.owner && (\n <Chip\n label={`${t('searchResultItem.Owner')}: ${result.owner}`}\n size=\"small\"\n />\n )}\n </Box>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAgCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,IACA,aAAe,EAAA;AAAA,MACb,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,IACA,QAAU,EAAA;AAAA,MACR,KAAO,EAAA,MAAA;AAAA,MACP,SAAW,EAAA,WAAA;AAAA,MACX,YAAc,EAAA,MAAA;AAAA,KAChB;AAAA,GACF;AAAA,EACA,EAAE,MAAM,6BAA8B,EAAA;AACxC,CAAA,CAAA;AAgBO,SAAS,4BACd,KACA,EAAA;AACA,EAAA,MAAM,SAAS,KAAM,CAAA,MAAA,CAAA;AACrB,EAAA,MAAM,YAAY,KAAM,CAAA,SAAA,CAAA;AAExB,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,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CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"CatalogSearchResultListItem.esm.js","sources":["../../../src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.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 React, { ReactNode } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Link } from '@backstage/core-components';\nimport {\n IndexableDocument,\n ResultHighlight,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '@backstage/plugin-search-react';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\n/** @public */\nexport type CatalogSearchResultListItemClassKey =\n | 'item'\n | 'flexContainer'\n | 'itemText';\n\nconst useStyles = makeStyles(\n {\n item: {\n display: 'flex',\n },\n flexContainer: {\n flexWrap: 'wrap',\n },\n itemText: {\n width: '100%',\n wordBreak: 'break-all',\n marginBottom: '1rem',\n },\n },\n { name: 'CatalogSearchResultListItem' },\n);\n\n/**\n * Props for {@link CatalogSearchResultListItem}.\n *\n * @public\n */\nexport interface CatalogSearchResultListItemProps {\n icon?: ReactNode | ((result: IndexableDocument) => ReactNode);\n result?: IndexableDocument;\n highlight?: ResultHighlight;\n rank?: number;\n lineClamp?: number;\n}\n\n/** @public */\nexport function CatalogSearchResultListItem(\n props: CatalogSearchResultListItemProps,\n) {\n const result = props.result as any;\n const highlight = props.highlight as ResultHighlight;\n\n const classes = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n if (!result) return null;\n\n return (\n <div className={classes.item}>\n {props.icon && (\n <ListItemIcon>\n {typeof props.icon === 'function' ? props.icon(result) : props.icon}\n </ListItemIcon>\n )}\n <div className={classes.flexContainer}>\n <ListItemText\n className={classes.itemText}\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight.fields.title}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n <Typography\n component=\"span\"\n style={{\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: props.lineClamp,\n overflow: 'hidden',\n }}\n color=\"textSecondary\"\n variant=\"body2\"\n >\n {highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )}\n </Typography>\n }\n />\n <Box>\n {result.kind && <Chip label={`Kind: ${result.kind}`} size=\"small\" />}\n {result.type && <Chip label={`Type: ${result.type}`} size=\"small\" />}\n {result.lifecycle && (\n <Chip\n label={`${t('searchResultItem.lifecycle')}: ${result.lifecycle}`}\n size=\"small\"\n />\n )}\n {result.owner && (\n <Chip\n label={`${t('searchResultItem.Owner')}: ${result.owner}`}\n size=\"small\"\n />\n )}\n </Box>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAsCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,IACA,aAAe,EAAA;AAAA,MACb,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,IACA,QAAU,EAAA;AAAA,MACR,KAAO,EAAA,MAAA;AAAA,MACP,S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EAAK,OAAO,SAAS,CAAA,CAAA;AAAA,MAC9D,IAAK,EAAA,OAAA;AAAA,KAAA;AAAA,GACP,EAED,OAAO,KACN,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,OAAO,CAAG,EAAA,CAAA,CAAE,wBAAwB,CAAC,CAAA,EAAA,EAAK,OAAO,KAAK,CAAA,CAAA;AAAA,MACtD,IAAK,EAAA,OAAA;AAAA,KAAA;AAAA,GAGX,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -1,27 +1,20 @@
1
1
  import { RELATION_PART_OF, RELATION_OWNED_BY, stringifyEntityRef, ANNOTATION_VIEW_URL, ANNOTATION_EDIT_URL } from '@backstage/catalog-model';
2
- import { WarningPanel, CodeSnippet, Table } from '@backstage/core-components';
2
+ import { WarningPanel, CodeSnippet, Table, FavoriteToggleIcon } from '@backstage/core-components';
3
3
  import { useStarredEntities, useEntityList, getEntityRelations, humanizeEntityRef } from '@backstage/plugin-catalog-react';
4
4
  import Typography from '@material-ui/core/Typography';
5
- import { withStyles } from '@material-ui/core/styles';
6
5
  import { visuallyHidden } from '@mui/utils';
7
6
  import EditIcon from '@material-ui/icons/Edit';
8
7
  import OpenInNew from '@material-ui/icons/OpenInNew';
9
- import Star from '@material-ui/icons/Star';
10
- import StarBorder from '@material-ui/icons/StarBorder';
11
8
  import { capitalize } from 'lodash';
12
9
  import pluralize from 'pluralize';
13
10
  import React, { useMemo } from 'react';
14
11
  import { columnFactories } from './columns.esm.js';
15
- import { PaginatedCatalogTable } from './PaginatedCatalogTable.esm.js';
12
+ import { OffsetPaginatedCatalogTable } from './OffsetPaginatedCatalogTable.esm.js';
13
+ import { CursorPaginatedCatalogTable } from './CursorPaginatedCatalogTable.esm.js';
16
14
  import { defaultCatalogTableColumnsFunc } from './defaultCatalogTableColumnsFunc.esm.js';
17
15
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
18
16
  import { catalogTranslationRef } from '../../alpha/translation.esm.js';
19
17
 
20
- const YellowStar = withStyles({
21
- root: {
22
- color: "#f3ba37"
23
- }
24
- })(Star);
25
18
  const refCompare = (a, b) => {
26
19
  const toRef = (entity) => entity.metadata.title || humanizeEntityRef(entity, {
27
20
  defaultKind: "Component"
@@ -37,8 +30,15 @@ const CatalogTable = (props) => {
37
30
  } = props;
38
31
  const { isStarredEntity, toggleStarredEntity } = useStarredEntities();
39
32
  const entityListContext = useEntityList();
40
- const { loading, error, entities, filters, pageInfo, totalItems } = entityListContext;
41
- const enablePagination = !!pageInfo;
33
+ const {
34
+ loading,
35
+ error,
36
+ entities,
37
+ filters,
38
+ pageInfo,
39
+ totalItems,
40
+ paginationMode
41
+ } = entityListContext;
42
42
  const tableColumns = useMemo(
43
43
  () => typeof columns === "function" ? columns(entityListContext) : columns,
44
44
  [columns, entityListContext]
@@ -86,7 +86,7 @@ const CatalogTable = (props) => {
86
86
  const title2 = isStarred ? t("catalogTable.unStarActionTitle") : t("catalogTable.starActionTitle");
87
87
  return {
88
88
  cellStyle: { paddingLeft: "1em" },
89
- icon: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { style: visuallyHidden }, title2), isStarred ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(StarBorder, null)),
89
+ icon: () => /* @__PURE__ */ React.createElement(FavoriteToggleIcon, { isFavorite: isStarred }),
90
90
  tooltip: title2,
91
91
  onClick: () => toggleStarredEntity(entity)
92
92
  };
@@ -110,9 +110,9 @@ const CatalogTable = (props) => {
110
110
  padding: "dense",
111
111
  ...tableOptions
112
112
  };
113
- if (enablePagination) {
113
+ if (paginationMode === "cursor") {
114
114
  return /* @__PURE__ */ React.createElement(
115
- PaginatedCatalogTable,
115
+ CursorPaginatedCatalogTable,
116
116
  {
117
117
  columns: tableColumns,
118
118
  emptyContent,
@@ -122,8 +122,22 @@ const CatalogTable = (props) => {
122
122
  subtitle,
123
123
  options,
124
124
  data: entities.map(toEntityRow),
125
- next: pageInfo.next,
126
- prev: pageInfo.prev
125
+ next: pageInfo?.next,
126
+ prev: pageInfo?.prev
127
+ }
128
+ );
129
+ } else if (paginationMode === "offset") {
130
+ return /* @__PURE__ */ React.createElement(
131
+ OffsetPaginatedCatalogTable,
132
+ {
133
+ columns: tableColumns,
134
+ emptyContent,
135
+ isLoading: loading,
136
+ title,
137
+ actions,
138
+ subtitle,
139
+ options,
140
+ data: entities.map(toEntityRow)
127
141
  }
128
142
  );
129
143
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CatalogTable.esm.js","sources":["../../../src/components/CatalogTable/CatalogTable.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 */\nimport {\n ANNOTATION_EDIT_URL,\n ANNOTATION_VIEW_URL,\n Entity,\n RELATION_OWNED_BY,\n RELATION_PART_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Table,\n TableColumn,\n TableProps,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n getEntityRelations,\n humanizeEntityRef,\n useEntityList,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport { visuallyHidden } from '@mui/utils';\nimport Edit from '@material-ui/icons/Edit';\nimport OpenInNew from '@material-ui/icons/OpenInNew';\nimport Star from '@material-ui/icons/Star';\nimport StarBorder from '@material-ui/icons/StarBorder';\nimport { capitalize } from 'lodash';\nimport pluralize from 'pluralize';\nimport React, { ReactNode, useMemo } from 'react';\nimport { columnFactories } from './columns';\nimport { CatalogTableColumnsFunc, CatalogTableRow } from './types';\nimport { PaginatedCatalogTable } from './PaginatedCatalogTable';\nimport { defaultCatalogTableColumnsFunc } from './defaultCatalogTableColumnsFunc';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogTranslationRef } from '../../alpha/translation';\n\n/**\n * Props for {@link CatalogTable}.\n *\n * @public\n */\nexport interface CatalogTableProps {\n columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;\n actions?: TableProps<CatalogTableRow>['actions'];\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n subtitle?: string;\n}\n\nconst YellowStar = withStyles({\n root: {\n color: '#f3ba37',\n },\n})(Star);\n\nconst refCompare = (a: Entity, b: Entity) => {\n const toRef = (entity: Entity) =>\n entity.metadata.title ||\n humanizeEntityRef(entity, {\n defaultKind: 'Component',\n });\n\n return toRef(a).localeCompare(toRef(b));\n};\n\n/** @public */\nexport const CatalogTable = (props: CatalogTableProps) => {\n const {\n columns = defaultCatalogTableColumnsFunc,\n tableOptions,\n subtitle,\n emptyContent,\n } = props;\n const { isStarredEntity, toggleStarredEntity } = useStarredEntities();\n const entityListContext = useEntityList();\n const { loading, error, entities, filters, pageInfo, totalItems } =\n entityListContext;\n const enablePagination = !!pageInfo;\n const tableColumns = useMemo(\n () =>\n typeof columns === 'function' ? columns(entityListContext) : columns,\n [columns, entityListContext],\n );\n const { t } = useTranslationRef(catalogTranslationRef);\n\n if (error) {\n return (\n <div>\n <WarningPanel\n severity=\"error\"\n title={t('catalogTable.warningPanelTitle')}\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </div>\n );\n }\n\n const defaultActions: TableProps<CatalogTableRow>['actions'] = [\n ({ entity }) => {\n const url = entity.metadata.annotations?.[ANNOTATION_VIEW_URL];\n const title = t('catalogTable.viewActionTitle');\n\n return {\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n <OpenInNew fontSize=\"small\" />\n </>\n ),\n tooltip: title,\n disabled: !url,\n onClick: () => {\n if (!url) return;\n window.open(url, '_blank');\n },\n };\n },\n ({ entity }) => {\n const url = entity.metadata.annotations?.[ANNOTATION_EDIT_URL];\n const title = t('catalogTable.editActionTitle');\n\n return {\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n <Edit fontSize=\"small\" />\n </>\n ),\n tooltip: title,\n disabled: !url,\n onClick: () => {\n if (!url) return;\n window.open(url, '_blank');\n },\n };\n },\n ({ entity }) => {\n const isStarred = isStarredEntity(entity);\n const title = isStarred\n ? t('catalogTable.unStarActionTitle')\n : t('catalogTable.starActionTitle');\n\n return {\n cellStyle: { paddingLeft: '1em' },\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n {isStarred ? <YellowStar /> : <StarBorder />}\n </>\n ),\n tooltip: title,\n onClick: () => toggleStarredEntity(entity),\n };\n },\n ];\n\n const currentKind = filters.kind?.value || '';\n const currentType = filters.type?.value || '';\n const currentCount = typeof totalItems === 'number' ? `(${totalItems})` : '';\n // TODO(timbonicus): remove the title from the CatalogTable once using EntitySearchBar\n const titlePreamble = capitalize(filters.user?.value ?? 'all');\n const title = [\n titlePreamble,\n currentType,\n pluralize(currentKind),\n currentCount,\n ]\n .filter(s => s)\n .join(' ');\n\n const actions = props.actions || defaultActions;\n const options = {\n actionsColumnIndex: -1,\n loadingType: 'linear' as const,\n showEmptyDataSourceMessage: !loading,\n padding: 'dense' as const,\n ...tableOptions,\n };\n\n if (enablePagination) {\n return (\n <PaginatedCatalogTable\n columns={tableColumns}\n emptyContent={emptyContent}\n isLoading={loading}\n title={title}\n actions={actions}\n subtitle={subtitle}\n options={options}\n data={entities.map(toEntityRow)}\n next={pageInfo.next}\n prev={pageInfo.prev}\n />\n );\n }\n\n const rows = entities.sort(refCompare).map(toEntityRow);\n const pageSize = 20;\n const showPagination = rows.length > pageSize;\n\n return (\n <Table<CatalogTableRow>\n isLoading={loading}\n columns={tableColumns}\n options={{\n paging: showPagination,\n pageSize: pageSize,\n pageSizeOptions: [20, 50, 100],\n ...options,\n }}\n title={title}\n data={rows}\n actions={actions}\n subtitle={subtitle}\n emptyContent={emptyContent}\n />\n );\n};\n\nCatalogTable.columns = columnFactories;\nCatalogTable.defaultColumnsFunc = defaultCatalogTableColumnsFunc;\n\nfunction toEntityRow(entity: Entity) {\n const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {\n kind: 'system',\n });\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n\n return {\n entity,\n resolved: {\n // This name is here for backwards compatibility mostly; the\n // presentation of refs in the table should in general be handled with\n // EntityRefLink / EntityName components\n name: humanizeEntityRef(entity, {\n defaultKind: 'Component',\n }),\n entityRef: stringifyEntityRef(entity),\n ownedByRelationsTitle: ownedByRelations\n .map(r => humanizeEntityRef(r, { defaultKind: 'group' }))\n .join(', '),\n ownedByRelations,\n partOfSystemRelationTitle: partOfSystemRelations\n .map(r =>\n humanizeEntityRef(r, {\n defaultKind: 'system',\n }),\n )\n .join(', '),\n partOfSystemRelations,\n },\n };\n}\n"],"names":["title","Edit"],"mappings":";;;;;;;;;;;;;;;;;;;AAkEA,MAAM,aAAa,UAAW,CAAA;AAAA,EAC5B,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,SAAA;AAAA,GACT;AACF,CAAC,EAAE,IAAI,CAAA,CAAA;AAEP,MAAM,UAAA,GAAa,CAAC,CAAA,EAAW,CAAc,KAAA;AAC3C,EAAA,MAAM,QAAQ,CAAC,MAAA,KACb,OAAO,QAAS,CAAA,KAAA,IAChB,kBAAkB,MAAQ,EAAA;AAAA,IACxB,WAAa,EAAA,WAAA;AAAA,GACd,CAAA,CAAA;AAEH,EAAA,OAAO,MAAM,CAAC,CAAA,CAAE,aAAc,CAAA,KAAA,CAAM,CAAC,CAAC,CAAA,CAAA;AACxC,CAAA,CAAA;AAGa,MAAA,YAAA,GAAe,CAAC,KAA6B,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AAAA,MACA,YAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ,EAAA;AAEA,YAAA,CAAa,OAAU,GAAA,eAAA,CAAA;AACvB,YAAA,CAAa,kBAAqB,GAAA,8BAAA,CAAA;AAElC,SAAS,YAAY,MAAgB,EAAA;AACnC,EAAM,MAAA,qBAAA,GAAwB,kBAAmB,CAAA,MAAA,EAAQ,gBAAkB,EAAA;AAAA,IACzE,IAAM,EAAA,QAAA;AAAA,GACP,CAAA,CAAA;AACD,EAAM,MAAA,gBAAA,GAAmB,kBAAmB,CAAA,MAAA,EAAQ,iBAAiB,CAAA,CAAA;AAErE,EAAO,OAAA;AAAA,IACL,MAAA;AAAA,IACA,QAAU,EAAA;AAAA;AAAA;AAAA;AAAA,MAIR,IAAA,EAAM,kBAAkB,MAAQ,EAAA;AAAA,QAC9B,WAAa,EAAA,WAAA;AAAA,OACd,CAAA;AAAA,MACD,SAAA,EAAW,mBAAmB,MAAM,CAAA;AAAA,MACpC,qBAAuB,EAAA,gBAAA,CACpB,GAAI,CAAA,CAAA,CAAA,KAAK,iBAAkB,CAAA,CAAA,EAAG,EAAE,WAAA,EAAa,OAAQ,EAAC,CAAC,CAAA,CACvD,KAAK,IAAI,CAAA;AAAA,MACZ,gBAAA;AAAA,MACA,2BAA2B,qBACxB,CAAA,GAAA;AAAA,QAAI,CAAA,CAAA,KACH,kBAAkB,CAAG,EAAA;AAAA,UACnB,WAAa,EAAA,QAAA;AAAA,SACd,CAAA;AAAA,OACH,CACC,KAAK,IAAI,CAAA;AAAA,MACZ,qBAAA;AAAA,KACF;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"CatalogTable.esm.js","sources":["../../../src/components/CatalogTable/CatalogTable.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 */\nimport {\n ANNOTATION_EDIT_URL,\n ANNOTATION_VIEW_URL,\n Entity,\n RELATION_OWNED_BY,\n RELATION_PART_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Table,\n TableColumn,\n TableProps,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n getEntityRelations,\n humanizeEntityRef,\n useEntityList,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport Typography from '@material-ui/core/Typography';\nimport { visuallyHidden } from '@mui/utils';\nimport Edit from '@material-ui/icons/Edit';\nimport OpenInNew from '@material-ui/icons/OpenInNew';\nimport { capitalize } from 'lodash';\nimport pluralize from 'pluralize';\nimport React, { ReactNode, useMemo } from 'react';\nimport { columnFactories } from './columns';\nimport { CatalogTableColumnsFunc, CatalogTableRow } from './types';\nimport { OffsetPaginatedCatalogTable } from './OffsetPaginatedCatalogTable';\nimport { CursorPaginatedCatalogTable } from './CursorPaginatedCatalogTable';\nimport { defaultCatalogTableColumnsFunc } from './defaultCatalogTableColumnsFunc';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { FavoriteToggleIcon } from '@backstage/core-components';\n\n/**\n * Props for {@link CatalogTable}.\n *\n * @public\n */\nexport interface CatalogTableProps {\n columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;\n actions?: TableProps<CatalogTableRow>['actions'];\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n subtitle?: string;\n}\n\nconst refCompare = (a: Entity, b: Entity) => {\n const toRef = (entity: Entity) =>\n entity.metadata.title ||\n humanizeEntityRef(entity, {\n defaultKind: 'Component',\n });\n\n return toRef(a).localeCompare(toRef(b));\n};\n\n/** @public */\nexport const CatalogTable = (props: CatalogTableProps) => {\n const {\n columns = defaultCatalogTableColumnsFunc,\n tableOptions,\n subtitle,\n emptyContent,\n } = props;\n const { isStarredEntity, toggleStarredEntity } = useStarredEntities();\n const entityListContext = useEntityList();\n\n const {\n loading,\n error,\n entities,\n filters,\n pageInfo,\n totalItems,\n paginationMode,\n } = entityListContext;\n\n const tableColumns = useMemo(\n () =>\n typeof columns === 'function' ? columns(entityListContext) : columns,\n [columns, entityListContext],\n );\n const { t } = useTranslationRef(catalogTranslationRef);\n\n if (error) {\n return (\n <div>\n <WarningPanel\n severity=\"error\"\n title={t('catalogTable.warningPanelTitle')}\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </div>\n );\n }\n\n const defaultActions: TableProps<CatalogTableRow>['actions'] = [\n ({ entity }) => {\n const url = entity.metadata.annotations?.[ANNOTATION_VIEW_URL];\n const title = t('catalogTable.viewActionTitle');\n\n return {\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n <OpenInNew fontSize=\"small\" />\n </>\n ),\n tooltip: title,\n disabled: !url,\n onClick: () => {\n if (!url) return;\n window.open(url, '_blank');\n },\n };\n },\n ({ entity }) => {\n const url = entity.metadata.annotations?.[ANNOTATION_EDIT_URL];\n const title = t('catalogTable.editActionTitle');\n\n return {\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n <Edit fontSize=\"small\" />\n </>\n ),\n tooltip: title,\n disabled: !url,\n onClick: () => {\n if (!url) return;\n window.open(url, '_blank');\n },\n };\n },\n ({ entity }) => {\n const isStarred = isStarredEntity(entity);\n const title = isStarred\n ? t('catalogTable.unStarActionTitle')\n : t('catalogTable.starActionTitle');\n\n return {\n cellStyle: { paddingLeft: '1em' },\n icon: () => <FavoriteToggleIcon isFavorite={isStarred} />,\n tooltip: title,\n onClick: () => toggleStarredEntity(entity),\n };\n },\n ];\n\n const currentKind = filters.kind?.value || '';\n const currentType = filters.type?.value || '';\n const currentCount = typeof totalItems === 'number' ? `(${totalItems})` : '';\n // TODO(timbonicus): remove the title from the CatalogTable once using EntitySearchBar\n const titlePreamble = capitalize(filters.user?.value ?? 'all');\n const title = [\n titlePreamble,\n currentType,\n pluralize(currentKind),\n currentCount,\n ]\n .filter(s => s)\n .join(' ');\n\n const actions = props.actions || defaultActions;\n const options = {\n actionsColumnIndex: -1,\n loadingType: 'linear' as const,\n showEmptyDataSourceMessage: !loading,\n padding: 'dense' as const,\n ...tableOptions,\n };\n\n if (paginationMode === 'cursor') {\n return (\n <CursorPaginatedCatalogTable\n columns={tableColumns}\n emptyContent={emptyContent}\n isLoading={loading}\n title={title}\n actions={actions}\n subtitle={subtitle}\n options={options}\n data={entities.map(toEntityRow)}\n next={pageInfo?.next}\n prev={pageInfo?.prev}\n />\n );\n } else if (paginationMode === 'offset') {\n return (\n <OffsetPaginatedCatalogTable\n columns={tableColumns}\n emptyContent={emptyContent}\n isLoading={loading}\n title={title}\n actions={actions}\n subtitle={subtitle}\n options={options}\n data={entities.map(toEntityRow)}\n />\n );\n }\n\n const rows = entities.sort(refCompare).map(toEntityRow);\n const pageSize = 20;\n const showPagination = rows.length > pageSize;\n\n return (\n <Table<CatalogTableRow>\n isLoading={loading}\n columns={tableColumns}\n options={{\n paging: showPagination,\n pageSize: pageSize,\n pageSizeOptions: [20, 50, 100],\n ...options,\n }}\n title={title}\n data={rows}\n actions={actions}\n subtitle={subtitle}\n emptyContent={emptyContent}\n />\n );\n};\n\nCatalogTable.columns = columnFactories;\nCatalogTable.defaultColumnsFunc = defaultCatalogTableColumnsFunc;\n\nfunction toEntityRow(entity: Entity) {\n const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {\n kind: 'system',\n });\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n\n return {\n entity,\n resolved: {\n // This name is here for backwards compatibility mostly; the\n // presentation of refs in the table should in general be handled with\n // EntityRefLink / EntityName components\n name: humanizeEntityRef(entity, {\n defaultKind: 'Component',\n }),\n entityRef: stringifyEntityRef(entity),\n ownedByRelationsTitle: ownedByRelations\n .map(r => humanizeEntityRef(r, { defaultKind: 'group' }))\n .join(', '),\n ownedByRelations,\n partOfSystemRelationTitle: partOfSystemRelations\n .map(r =>\n humanizeEntityRef(r, {\n defaultKind: 'system',\n }),\n )\n .join(', '),\n partOfSystemRelations,\n },\n };\n}\n"],"names":["title","Edit"],"mappings":";;;;;;;;;;;;;;;;;AAiEA,MAAM,UAAA,GAAa,CAAC,CAAA,EAAW,CAAc,KAAA;AAC3C,EAAA,MAAM,QAAQ,CAAC,MAAA,KACb,OAAO,QAAS,CAAA,KAAA,IAChB,kBAAkB,MAAQ,EAAA;AAAA,IACxB,WAAa,EAAA,WAAA;AAAA,GACd,CAAA,CAAA;AAEH,EAAA,OAAO,MAAM,CAAC,CAAA,CAAE,aAAc,CAAA,KAAA,CAAM,CAAC,CAAC,CAAA,CAAA;AACxC,CAAA,CAAA;AAGa,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,8BAAA;AAAA,IACV,YAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,EAAE,eAAA,EAAiB,mBAAoB,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACpE,EAAA,MAAM,oBAAoB,aAAc,EAAA,CAAA;AAExC,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,GACE,GAAA,iBAAA,CAAA;AAEJ,EAAA,MAAM,YAAe,GAAA,OAAA;AAAA,IACnB,MACE,OAAO,OAAA,KAAY,UAAa,GAAA,OAAA,CAAQ,iBAAiB,CAAI,GAAA,OAAA;AAAA,IAC/D,CAAC,SAAS,iBAAiB,CAAA;AAAA,GAC7B,CAAA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IACA,QAAU,EAAA;AAAA;AAAA;AAAA;AAAA,MAIR,IAAA,EAAM,kBAAkB,MAAQ,EAAA;AAAA,QAC9B,WAAa,EAAA,WAAA;AAAA,OACd,CAAA;AAAA,MACD,SAAA,EAAW,mBAAmB,MAAM,CAAA;AAAA,MACpC,qBAAuB,EAAA,gBAAA,CACpB,GAAI,CAAA,CAAA,CAAA,KAAK,iBAAkB,CAAA,CAAA,EAAG,EAAE,WAAA,EAAa,OAAQ,EAAC,CAAC,CAAA,CACvD,KAAK,IAAI,CAAA;AAAA,MACZ,gBAAA;AAAA,MACA,2BAA2B,qBACxB,CAAA,GAAA;AAAA,QAAI,CAAA,CAAA,KACH,kBAAkB,CAAG,EAAA;AAAA,UACnB,WAAa,EAAA,QAAA;AAAA,SACd,CAAA;AAAA,OACH,CACC,KAAK,IAAI,CAAA;AAAA,MACZ,qBAAA;AAAA,KACF;AAAA,GACF,CAAA;AACF;;;;"}
@@ -19,7 +19,7 @@ const useToolbarStyles = makeStyles(
19
19
  textOverflow: "ellipsis"
20
20
  }
21
21
  }),
22
- { name: "BackstageTableToolbar" }
22
+ { name: "PluginCatalogTableToolbar" }
23
23
  );
24
24
  function CatalogTableToolbar(props) {
25
25
  const styles = useToolbarStyles();
@@ -1 +1 @@
1
- {"version":3,"file":"CatalogTableToolbar.esm.js","sources":["../../../src/components/CatalogTable/CatalogTableToolbar.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { EntitySearchBar } from '@backstage/plugin-catalog-react';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useToolbarStyles = makeStyles(\n theme => ({\n root: {\n paddingTop: theme.spacing(1.25),\n paddingLeft: theme.spacing(2.5),\n paddingBottom: theme.spacing(0.75),\n display: 'flex',\n justifyContent: 'space-between',\n },\n text: {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n }),\n { name: 'BackstageTableToolbar' },\n);\n\nexport function CatalogTableToolbar(props: {\n title?: string | React.ReactElement<any>;\n}) {\n const styles = useToolbarStyles();\n return (\n <Toolbar className={styles.root}>\n <Typography variant=\"h5\" className={styles.text}>\n {props.title}\n </Typography>\n <EntitySearchBar />\n </Toolbar>\n );\n}\n"],"names":[],"mappings":";;;;;;AAqBA,MAAM,gBAAmB,GAAA,UAAA;AAAA,EACvB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,MAC9B,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,MAC9B,aAAA,EAAe,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,MACjC,OAAS,EAAA,MAAA;AAAA,MACT,cAAgB,EAAA,eAAA;AAAA,KAClB;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA,QAAA;AAAA,MACV,YAAc,EAAA,UAAA;AAAA,KAChB;AAAA,GACF,CAAA;AAAA,EACA,EAAE,MAAM,uBAAwB,EAAA;AAClC,CAAA,CAAA;AAEO,SAAS,oBAAoB,KAEjC,EAAA;AACD,EAAA,MAAM,SAAS,gBAAiB,EAAA,CAAA;AAChC,EAAA,2CACG,OAAQ,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,IAAA,EAAA,sCACxB,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAK,EAAA,SAAA,EAAW,OAAO,IACxC,EAAA,EAAA,KAAA,CAAM,KACT,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,qBAAgB,CACnB,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"CatalogTableToolbar.esm.js","sources":["../../../src/components/CatalogTable/CatalogTableToolbar.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { EntitySearchBar } from '@backstage/plugin-catalog-react';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\n\n/** @public */\nexport type CatalogTableToolbarClassKey = 'root' | 'text';\n\nconst useToolbarStyles = makeStyles(\n theme => ({\n root: {\n paddingTop: theme.spacing(1.25),\n paddingLeft: theme.spacing(2.5),\n paddingBottom: theme.spacing(0.75),\n display: 'flex',\n justifyContent: 'space-between',\n },\n text: {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n }),\n { name: 'PluginCatalogTableToolbar' },\n);\n\nexport function CatalogTableToolbar(props: {\n title?: string | React.ReactElement<any>;\n}) {\n const styles = useToolbarStyles();\n return (\n <Toolbar className={styles.root}>\n <Typography variant=\"h5\" className={styles.text}>\n {props.title}\n </Typography>\n <EntitySearchBar />\n </Toolbar>\n );\n}\n"],"names":[],"mappings":";;;;;;AAwBA,MAAM,gBAAmB,GAAA,UAAA;AAAA,EACvB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,MAC9B,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,MAC9B,aAAA,EAAe,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,MACjC,OAAS,EAAA,MAAA;AAAA,MACT,cAAgB,EAAA,eAAA;AAAA,KAClB;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA,QAAA;AAAA,MACV,YAAc,EAAA,UAAA;AAAA,KAChB;AAAA,GACF,CAAA;AAAA,EACA,EAAE,MAAM,2BAA4B,EAAA;AACtC,CAAA,CAAA;AAEO,SAAS,oBAAoB,KAEjC,EAAA;AACD,EAAA,MAAM,SAAS,gBAAiB,EAAA,CAAA;AAChC,EAAA,2CACG,OAAQ,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,IAAA,EAAA,sCACxB,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAK,EAAA,SAAA,EAAW,OAAO,IACxC,EAAA,EAAA,KAAA,CAAM,KACT,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,qBAAgB,CACnB,CAAA,CAAA;AAEJ;;;;"}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Table } from '@backstage/core-components';
3
3
  import { CatalogTableToolbar } from './CatalogTableToolbar.esm.js';
4
4
 
5
- function PaginatedCatalogTable(props) {
5
+ function CursorPaginatedCatalogTable(props) {
6
6
  const { columns, data, next, prev, title, isLoading, options, ...restProps } = props;
7
7
  return /* @__PURE__ */ React.createElement(
8
8
  Table,
@@ -32,10 +32,11 @@ function PaginatedCatalogTable(props) {
32
32
  page: prev ? 1 : 0,
33
33
  totalCount: next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER,
34
34
  localization: { pagination: { labelDisplayedRows: "" } },
35
+ isLoading,
35
36
  ...restProps
36
37
  }
37
38
  );
38
39
  }
39
40
 
40
- export { PaginatedCatalogTable };
41
- //# sourceMappingURL=PaginatedCatalogTable.esm.js.map
41
+ export { CursorPaginatedCatalogTable };
42
+ //# sourceMappingURL=CursorPaginatedCatalogTable.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CursorPaginatedCatalogTable.esm.js","sources":["../../../src/components/CatalogTable/CursorPaginatedCatalogTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { CatalogTableRow } from './types';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\n\ntype PaginatedCatalogTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<CatalogTableRow>;\n\n/**\n * @internal\n */\n\nexport function CursorPaginatedCatalogTable(props: PaginatedCatalogTableProps) {\n const { columns, data, next, prev, title, isLoading, options, ...restProps } =\n props;\n\n return (\n <Table\n title={isLoading ? '' : title}\n columns={columns}\n data={data}\n options={{\n ...options,\n // These settings are configured to force server side pagination\n paginationPosition: 'both',\n pageSizeOptions: [],\n showFirstLastPageButtons: false,\n pageSize: Number.MAX_SAFE_INTEGER,\n emptyRowsWhenPaging: false,\n }}\n onPageChange={page => {\n if (page > 0) {\n next?.();\n } else {\n prev?.();\n }\n }}\n components={{\n Toolbar: CatalogTableToolbar,\n }}\n /* this will enable the prev button accordingly */\n page={prev ? 1 : 0}\n /* this will enable the next button accordingly */\n totalCount={next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n {...restProps}\n />\n );\n}\n"],"names":[],"mappings":";;;;AA+BO,SAAS,4BAA4B,KAAmC,EAAA;AAC7E,EAAM,MAAA,EAAE,OAAS,EAAA,IAAA,EAAM,IAAM,EAAA,IAAA,EAAM,OAAO,SAAW,EAAA,OAAA,EAAS,GAAG,SAAA,EAC/D,GAAA,KAAA,CAAA;AAEF,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAY,EAAK,GAAA,KAAA;AAAA,MACxB,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,GAAG,OAAA;AAAA;AAAA,QAEH,kBAAoB,EAAA,MAAA;AAAA,QACpB,iBAAiB,EAAC;AAAA,QAClB,wBAA0B,EAAA,KAAA;AAAA,QAC1B,UAAU,MAAO,CAAA,gBAAA;AAAA,QACjB,mBAAqB,EAAA,KAAA;AAAA,OACvB;AAAA,MACA,cAAc,CAAQ,IAAA,KAAA;AACpB,QAAA,IAAI,OAAO,CAAG,EAAA;AACZ,UAAO,IAAA,IAAA,CAAA;AAAA,SACF,MAAA;AACL,UAAO,IAAA,IAAA,CAAA;AAAA,SACT;AAAA,OACF;AAAA,MACA,UAAY,EAAA;AAAA,QACV,OAAS,EAAA,mBAAA;AAAA,OACX;AAAA,MAEA,IAAA,EAAM,OAAO,CAAI,GAAA,CAAA;AAAA,MAEjB,UAAY,EAAA,IAAA,GAAO,MAAO,CAAA,SAAA,GAAY,MAAO,CAAA,gBAAA;AAAA,MAC7C,cAAc,EAAE,UAAA,EAAY,EAAE,kBAAA,EAAoB,IAAK,EAAA;AAAA,MACvD,SAAA;AAAA,MACC,GAAG,SAAA;AAAA,KAAA;AAAA,GACN,CAAA;AAEJ;;;;"}
@@ -0,0 +1,47 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Table } from '@backstage/core-components';
3
+ import { useEntityList, EntityTextFilter } from '@backstage/plugin-catalog-react';
4
+
5
+ function OffsetPaginatedCatalogTable(props) {
6
+ const { columns, data, isLoading } = props;
7
+ const { updateFilters, setLimit, setOffset, limit, totalItems, offset } = useEntityList();
8
+ const [page, setPage] = React.useState(
9
+ offset && limit ? Math.floor(offset / limit) : 0
10
+ );
11
+ useEffect(() => {
12
+ if (totalItems && page * limit >= totalItems) {
13
+ setOffset(Math.max(0, totalItems - limit));
14
+ } else {
15
+ setOffset(Math.max(0, page * limit));
16
+ }
17
+ }, [setOffset, page, limit, totalItems]);
18
+ return /* @__PURE__ */ React.createElement(
19
+ Table,
20
+ {
21
+ columns,
22
+ data,
23
+ options: {
24
+ paginationPosition: "both",
25
+ pageSizeOptions: [5, 10, 20, 50, 100],
26
+ pageSize: limit,
27
+ emptyRowsWhenPaging: false
28
+ },
29
+ onSearchChange: (searchText) => updateFilters({
30
+ text: searchText ? new EntityTextFilter(searchText) : void 0
31
+ }),
32
+ page,
33
+ onPageChange: (newPage) => {
34
+ setPage(newPage);
35
+ },
36
+ onRowsPerPageChange: (pageSize) => {
37
+ setLimit(pageSize);
38
+ },
39
+ totalCount: totalItems,
40
+ localization: { pagination: { labelDisplayedRows: "" } },
41
+ isLoading
42
+ }
43
+ );
44
+ }
45
+
46
+ export { OffsetPaginatedCatalogTable };
47
+ //# sourceMappingURL=OffsetPaginatedCatalogTable.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffsetPaginatedCatalogTable.esm.js","sources":["../../../src/components/CatalogTable/OffsetPaginatedCatalogTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect } from 'react';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { CatalogTableRow } from './types';\nimport {\n EntityTextFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedCatalogTable(\n props: TableProps<CatalogTableRow>,\n) {\n const { columns, data, isLoading } = props;\n const { updateFilters, setLimit, setOffset, limit, totalItems, offset } =\n useEntityList();\n const [page, setPage] = React.useState(\n offset && limit ? Math.floor(offset / limit) : 0,\n );\n\n useEffect(() => {\n if (totalItems && page * limit >= totalItems) {\n setOffset!(Math.max(0, totalItems - limit));\n } else {\n setOffset!(Math.max(0, page * limit));\n }\n }, [setOffset, page, limit, totalItems]);\n\n return (\n <Table\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n pageSizeOptions: [5, 10, 20, 50, 100],\n pageSize: limit,\n emptyRowsWhenPaging: false,\n }}\n onSearchChange={(searchText: string) =>\n updateFilters({\n text: searchText ? new EntityTextFilter(searchText) : undefined,\n })\n }\n page={page}\n onPageChange={newPage => {\n setPage(newPage);\n }}\n onRowsPerPageChange={pageSize => {\n setLimit(pageSize);\n }}\n totalCount={totalItems}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n />\n );\n}\n"],"names":[],"mappings":";;;;AA4BO,SAAS,4BACd,KACA,EAAA;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,IAAM,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AACrC,EAAM,MAAA,EAAE,eAAe,QAAU,EAAA,SAAA,EAAW,OAAO,UAAY,EAAA,MAAA,KAC7D,aAAc,EAAA,CAAA;AAChB,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IAC5B,UAAU,KAAQ,GAAA,IAAA,CAAK,KAAM,CAAA,MAAA,GAAS,KAAK,CAAI,GAAA,CAAA;AAAA,GACjD,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,UAAA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/components/EntityLabelsCard/EntityLabelsEmptyState.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 Button from '@material-ui/core/Button';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\nimport { CodeSnippet } from '@backstage/core-components';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst ENTITY_YAML = `metadata:\n name: example\n labels:\n javaVersion: 1.2.3`;\n\nconst useStyles = makeStyles(\n theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n }),\n { name: 'PluginCatalogEntityLabelsEmptyState' },\n);\n\nexport function EntityLabelsEmptyState() {\n const classes = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n return (\n <>\n <Typography variant=\"body1\">\n {t('entityLabelsCard.emptyDescription')}\n </Typography>\n <div className={classes.code}>\n <CodeSnippet\n text={ENTITY_YAML}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[3, 4, 5, 6]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </div>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://backstage.io/docs/features/software-catalog/descriptor-format#labels-optional\"\n >\n {t('entityLabelsCard.readMoreButtonTitle')}\n </Button>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,WAAc,GAAA,CAAA;AAAA;AAAA;AAAA,s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M,EAAA,SAAA;AAAA,MACN,MAAO,EAAA,QAAA;AAAA,MACP,IAAK,EAAA,uFAAA;AAAA,KAAA;AAAA,IAEJ,EAAE,sCAAsC,CAAA;AAAA,GAE7C,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityLabelsEmptyState.esm.js","sources":["../../../src/components/EntityLabelsCard/EntityLabelsEmptyState.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 Button from '@material-ui/core/Button';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\nimport { CodeSnippet } from '@backstage/core-components';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst ENTITY_YAML = `metadata:\n name: example\n labels:\n javaVersion: 1.2.3`;\n\n/** @public */\nexport type EntityLabelsEmptyStateClassKey = 'code';\n\nconst useStyles = makeStyles(\n theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n }),\n { name: 'PluginCatalogEntityLabelsEmptyState' },\n);\n\nexport function EntityLabelsEmptyState() {\n const classes = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n return (\n <>\n <Typography variant=\"body1\">\n {t('entityLabelsCard.emptyDescription')}\n </Typography>\n <div className={classes.code}>\n <CodeSnippet\n text={ENTITY_YAML}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[3, 4, 5, 6]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </div>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://backstage.io/docs/features/software-catalog/descriptor-format#labels-optional\"\n >\n {t('entityLabelsCard.readMoreButtonTitle')}\n </Button>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,WAAc,GAAA,CAAA;AAAA;AAAA;AAAA,sBAAA,CAAA,CAAA;AAQpB,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,CAAA;AAAA,MACd,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,MAC1B,UAAA,EACE,MAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,MAAS,GAAA,KAAA,CAAM,QAAQ,MAAO,CAAA,KAAA;AAAA,KAClE;AAAA,GACF,CAAA;AAAA,EACA,EAAE,MAAM,qCAAsC,EAAA;AAChD,CAAA,CAAA;AAEO,SAAS,sBAAyB,GAAA;AACvC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA,CAAA;AAErD,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OACjB,EAAA,EAAA,CAAA,CAAE,mCAAmC,CACxC,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,IACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,WAAA;AAAA,MACN,QAAS,EAAA,MAAA;AAAA,MACT,eAAe,EAAA,IAAA;AAAA,MACf,kBAAoB,EAAA,CAAC,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,MAC/B,WAAa,EAAA,EAAE,UAAY,EAAA,SAAA,EAAW,UAAU,MAAO,EAAA;AAAA,KAAA;AAAA,GAE3D,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,WAAA;AAAA,MACR,KAAM,EAAA,SAAA;AAAA,MACN,MAAO,EAAA,QAAA;AAAA,MACP,IAAK,EAAA,uFAAA;AAAA,KAAA;AAAA,IAEJ,EAAE,sCAAsC,CAAA;AAAA,GAE7C,CAAA,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Entity, CompoundEntityRef, ComponentEntity, ResourceEntity, SystemEntity } from '@backstage/catalog-model';
3
3
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
4
4
  import { IconComponent, StorageApi, ApiHolder } from '@backstage/core-plugin-api';
5
- import { EntityRefPresentationSnapshot, CatalogApi, EntityPresentationApi, EntityRefPresentation, StarredEntitiesApi, EntityListContextProps, UserListFilterKind, EntityOwnerPickerProps } from '@backstage/plugin-catalog-react';
5
+ import { EntityRefPresentationSnapshot, CatalogApi, EntityPresentationApi, EntityRefPresentation, StarredEntitiesApi, EntityListContextProps, UserListFilterKind, EntityOwnerPickerProps, EntityListPagination } from '@backstage/plugin-catalog-react';
6
6
  import { HumanDuration, Observable } from '@backstage/types';
7
7
  import { InfoCardVariants, TableColumn, TableProps, TableOptions } from '@backstage/core-components';
8
8
  import * as React$1 from 'react';
@@ -10,8 +10,8 @@ import React__default, { ReactNode } from 'react';
10
10
  import { TabProps } from '@material-ui/core/Tab';
11
11
  import { Overrides } from '@material-ui/core/styles/overrides';
12
12
  import { StyleRules } from '@material-ui/core/styles/withStyles';
13
- import { SearchResultListItemExtensionProps } from '@backstage/plugin-search-react';
14
13
  import { IndexableDocument, ResultHighlight } from '@backstage/plugin-search-common';
14
+ import { SearchResultListItemExtensionProps } from '@backstage/plugin-search-react';
15
15
 
16
16
  /**
17
17
  * A custom renderer for the {@link DefaultEntityPresentationApi}.
@@ -271,6 +271,9 @@ declare const CatalogTable: {
271
271
  defaultColumnsFunc: CatalogTableColumnsFunc;
272
272
  };
273
273
 
274
+ /** @public */
275
+ type CatalogTableToolbarClassKey = 'root' | 'text';
276
+
274
277
  /** @public */
275
278
  type EntityLayoutRouteProps = {
276
279
  path: string;
@@ -470,18 +473,18 @@ type SystemDiagramCardClassKey = 'domainNode' | 'systemNode' | 'componentNode' |
470
473
  type EntityContextMenuClassKey = 'button';
471
474
 
472
475
  /** @public */
473
- type PluginCatalogComponentsNameToClassKey = {
474
- PluginCatalogEntityLinksEmptyState: EntityLinksEmptyStateClassKey;
475
- PluginCatalogSystemDiagramCard: SystemDiagramCardClassKey;
476
- PluginCatalogEntityContextMenu: EntityContextMenuClassKey;
477
- };
478
- /** @public */
479
- type BackstageOverrides = Overrides & {
480
- [Name in keyof PluginCatalogComponentsNameToClassKey]?: Partial<StyleRules<PluginCatalogComponentsNameToClassKey[Name]>>;
481
- };
482
- declare module '@backstage/theme' {
483
- interface OverrideComponentNameToClassKeys extends PluginCatalogComponentsNameToClassKey {
484
- }
476
+ type CatalogSearchResultListItemClassKey = 'item' | 'flexContainer' | 'itemText';
477
+ /**
478
+ * Props for {@link CatalogSearchResultListItem}.
479
+ *
480
+ * @public
481
+ */
482
+ interface CatalogSearchResultListItemProps {
483
+ icon?: ReactNode | ((result: IndexableDocument) => ReactNode);
484
+ result?: IndexableDocument;
485
+ highlight?: ResultHighlight;
486
+ rank?: number;
487
+ lineClamp?: number;
485
488
  }
486
489
 
487
490
  /** @public */
@@ -498,6 +501,27 @@ interface EntityLabelsCardProps {
498
501
  */
499
502
  declare function hasLabels(entity: Entity): boolean;
500
503
 
504
+ /** @public */
505
+ type EntityLabelsEmptyStateClassKey = 'code';
506
+
507
+ /** @public */
508
+ type PluginCatalogComponentsNameToClassKey = {
509
+ PluginCatalogEntityLinksEmptyState: EntityLinksEmptyStateClassKey;
510
+ PluginCatalogSystemDiagramCard: SystemDiagramCardClassKey;
511
+ PluginCatalogEntityContextMenu: EntityContextMenuClassKey;
512
+ PluginCatalogSearchResultListItem: CatalogSearchResultListItemClassKey;
513
+ PluginCatalogTableToolbar: CatalogTableToolbarClassKey;
514
+ PluginCatalogEntityLabelsEmptyState: EntityLabelsEmptyStateClassKey;
515
+ };
516
+ /** @public */
517
+ type BackstageOverrides = Overrides & {
518
+ [Name in keyof PluginCatalogComponentsNameToClassKey]?: Partial<StyleRules<PluginCatalogComponentsNameToClassKey[Name]>>;
519
+ };
520
+ declare module '@backstage/theme' {
521
+ interface OverrideComponentNameToClassKeys extends PluginCatalogComponentsNameToClassKey {
522
+ }
523
+ }
524
+
501
525
  /**
502
526
  * Props for root catalog pages.
503
527
  *
@@ -511,11 +535,9 @@ interface DefaultCatalogPageProps {
511
535
  tableOptions?: TableProps<CatalogTableRow>['options'];
512
536
  emptyContent?: ReactNode;
513
537
  ownerPickerMode?: EntityOwnerPickerProps['mode'];
514
- pagination?: boolean | {
515
- limit?: number;
516
- };
517
538
  filters?: ReactNode;
518
539
  initiallySelectedNamespaces?: string[];
540
+ pagination?: EntityListPagination;
519
541
  }
520
542
 
521
543
  /** @public */
@@ -594,19 +616,6 @@ type RelatedEntitiesCardProps<T extends Entity> = {
594
616
  tableOptions?: TableOptions;
595
617
  };
596
618
 
597
- /**
598
- * Props for {@link CatalogSearchResultListItem}.
599
- *
600
- * @public
601
- */
602
- interface CatalogSearchResultListItemProps {
603
- icon?: ReactNode | ((result: IndexableDocument) => ReactNode);
604
- result?: IndexableDocument;
605
- highlight?: ResultHighlight;
606
- rank?: number;
607
- lineClamp?: number;
608
- }
609
-
610
619
  /** @public */
611
620
  declare const catalogPlugin: _backstage_core_plugin_api.BackstagePlugin<{
612
621
  catalogIndex: _backstage_core_plugin_api.RouteRef<undefined>;
@@ -670,4 +679,4 @@ declare const RelatedEntitiesCard: <T extends Entity>(props: RelatedEntitiesCard
670
679
  /** @public */
671
680
  declare const CatalogSearchResultListItem: (props: SearchResultListItemExtensionProps<CatalogSearchResultListItemProps>) => JSX.Element | null;
672
681
 
673
- export { type AboutCardProps, AboutContent, type AboutContentProps, AboutField, type AboutFieldProps, type BackstageOverrides, type Breakpoint, CatalogEntityPage, CatalogIndexPage, CatalogKindHeader, type CatalogKindHeaderProps, CatalogSearchResultListItem, type CatalogSearchResultListItemProps, CatalogTable, type CatalogTableColumnsFunc, type CatalogTableProps, type CatalogTableRow, type ColumnBreakpoints, type DefaultCatalogPageProps, DefaultEntityPresentationApi, type DefaultEntityPresentationApiOptions, type DefaultEntityPresentationApiRenderer, DefaultStarredEntitiesApi, type DependencyOfComponentsCardProps, type DependsOnComponentsCardProps, type DependsOnResourcesCardProps, EntityAboutCard, type EntityContextMenuClassKey, EntityDependencyOfComponentsCard, EntityDependsOnComponentsCard, EntityDependsOnResourcesCard, EntityHasComponentsCard, EntityHasResourcesCard, EntityHasSubcomponentsCard, EntityHasSubdomainsCard, EntityHasSystemsCard, EntityLabelsCard, type EntityLabelsCardProps, EntityLayout, type EntityLayoutProps, type EntityLayoutRouteProps, EntityLinksCard, type EntityLinksCardProps, type EntityLinksEmptyStateClassKey, EntityListContainer, EntityOrphanWarning, type EntityPredicates, EntityProcessingErrorsPanel, EntityRelationWarning, EntitySwitch, type EntitySwitchCaseProps, type EntitySwitchProps, FilterContainer, FilteredEntityLayout, type HasComponentsCardProps, type HasResourcesCardProps, type HasSubcomponentsCardProps, type HasSubdomainsCardProps, type HasSystemsCardProps, type PluginCatalogComponentsNameToClassKey, RelatedEntitiesCard, type RelatedEntitiesCardProps, type SystemDiagramCardClassKey, catalogPlugin, hasCatalogProcessingErrors, hasLabels, hasRelationWarnings, isApiType, isComponentType, isEntityWith, isKind, isNamespace, isOrphan, isResourceType };
682
+ export { type AboutCardProps, AboutContent, type AboutContentProps, AboutField, type AboutFieldProps, type BackstageOverrides, type Breakpoint, CatalogEntityPage, CatalogIndexPage, CatalogKindHeader, type CatalogKindHeaderProps, CatalogSearchResultListItem, type CatalogSearchResultListItemClassKey, type CatalogSearchResultListItemProps, CatalogTable, type CatalogTableColumnsFunc, type CatalogTableProps, type CatalogTableRow, type CatalogTableToolbarClassKey, type ColumnBreakpoints, type DefaultCatalogPageProps, DefaultEntityPresentationApi, type DefaultEntityPresentationApiOptions, type DefaultEntityPresentationApiRenderer, DefaultStarredEntitiesApi, type DependencyOfComponentsCardProps, type DependsOnComponentsCardProps, type DependsOnResourcesCardProps, EntityAboutCard, type EntityContextMenuClassKey, EntityDependencyOfComponentsCard, EntityDependsOnComponentsCard, EntityDependsOnResourcesCard, EntityHasComponentsCard, EntityHasResourcesCard, EntityHasSubcomponentsCard, EntityHasSubdomainsCard, EntityHasSystemsCard, EntityLabelsCard, type EntityLabelsCardProps, type EntityLabelsEmptyStateClassKey, EntityLayout, type EntityLayoutProps, type EntityLayoutRouteProps, EntityLinksCard, type EntityLinksCardProps, type EntityLinksEmptyStateClassKey, EntityListContainer, EntityOrphanWarning, type EntityPredicates, EntityProcessingErrorsPanel, EntityRelationWarning, EntitySwitch, type EntitySwitchCaseProps, type EntitySwitchProps, FilterContainer, FilteredEntityLayout, type HasComponentsCardProps, type HasResourcesCardProps, type HasSubcomponentsCardProps, type HasSubdomainsCardProps, type HasSystemsCardProps, type PluginCatalogComponentsNameToClassKey, RelatedEntitiesCard, type RelatedEntitiesCardProps, type SystemDiagramCardClassKey, catalogPlugin, hasCatalogProcessingErrors, hasLabels, hasRelationWarnings, isApiType, isComponentType, isEntityWith, isKind, isNamespace, isOrphan, isResourceType };
package/dist/index.esm.js CHANGED
@@ -14,5 +14,6 @@ export { isApiType, isComponentType, isEntityWith, isKind, isNamespace, isResour
14
14
  export { EntityListContainer, FilterContainer, FilteredEntityLayout } from './components/FilteredEntityLayout/index.esm.js';
15
15
  import './components/EntityLabelsCard/EntityLabelsCard.esm.js';
16
16
  export { hasLabels } from './components/EntityLabelsCard/conditions.esm.js';
17
+ import './components/CatalogSearchResultListItem/CatalogSearchResultListItem.esm.js';
17
18
  export { CatalogEntityPage, CatalogIndexPage, CatalogSearchResultListItem, EntityAboutCard, EntityDependencyOfComponentsCard, EntityDependsOnComponentsCard, EntityDependsOnResourcesCard, EntityHasComponentsCard, EntityHasResourcesCard, EntityHasSubcomponentsCard, EntityHasSubdomainsCard, EntityHasSystemsCard, EntityLabelsCard, EntityLinksCard, RelatedEntitiesCard, catalogPlugin } from './plugin.esm.js';
18
19
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog",
3
- "version": "1.22.1-next.1",
3
+ "version": "1.23.0",
4
4
  "description": "The Backstage plugin for browsing the Backstage catalog",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -57,20 +57,20 @@
57
57
  "test": "backstage-cli package test"
58
58
  },
59
59
  "dependencies": {
60
- "@backstage/catalog-client": "^1.6.7-next.0",
61
- "@backstage/catalog-model": "^1.6.0",
62
- "@backstage/core-compat-api": "^0.3.0-next.1",
63
- "@backstage/core-components": "^0.14.11-next.0",
64
- "@backstage/core-plugin-api": "^1.9.3",
60
+ "@backstage/catalog-client": "^1.7.0",
61
+ "@backstage/catalog-model": "^1.7.0",
62
+ "@backstage/core-compat-api": "^0.3.0",
63
+ "@backstage/core-components": "^0.15.0",
64
+ "@backstage/core-plugin-api": "^1.9.4",
65
65
  "@backstage/errors": "^1.2.4",
66
- "@backstage/frontend-plugin-api": "^0.8.0-next.1",
67
- "@backstage/integration-react": "^1.1.30",
68
- "@backstage/plugin-catalog-common": "^1.0.26",
69
- "@backstage/plugin-catalog-react": "^1.12.4-next.1",
70
- "@backstage/plugin-permission-react": "^0.4.25",
71
- "@backstage/plugin-scaffolder-common": "^1.5.5",
66
+ "@backstage/frontend-plugin-api": "^0.8.0",
67
+ "@backstage/integration-react": "^1.1.31",
68
+ "@backstage/plugin-catalog-common": "^1.1.0",
69
+ "@backstage/plugin-catalog-react": "^1.13.0",
70
+ "@backstage/plugin-permission-react": "^0.4.26",
71
+ "@backstage/plugin-scaffolder-common": "^1.5.6",
72
72
  "@backstage/plugin-search-common": "^1.2.14",
73
- "@backstage/plugin-search-react": "^1.8.0-next.1",
73
+ "@backstage/plugin-search-react": "^1.8.0",
74
74
  "@backstage/types": "^1.1.1",
75
75
  "@material-ui/core": "^4.12.2",
76
76
  "@material-ui/icons": "^4.9.1",
@@ -86,15 +86,15 @@
86
86
  "zen-observable": "^0.10.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@backstage/cli": "^0.27.1-next.1",
90
- "@backstage/core-app-api": "^1.14.2",
91
- "@backstage/dev-utils": "^1.0.38-next.1",
92
- "@backstage/frontend-test-utils": "^0.2.0-next.1",
89
+ "@backstage/cli": "^0.27.1",
90
+ "@backstage/core-app-api": "^1.15.0",
91
+ "@backstage/dev-utils": "^1.1.0",
92
+ "@backstage/frontend-test-utils": "^0.2.0",
93
93
  "@backstage/plugin-permission-common": "^0.8.1",
94
- "@backstage/test-utils": "^1.6.0-next.0",
94
+ "@backstage/test-utils": "^1.6.0",
95
95
  "@testing-library/dom": "^10.0.0",
96
96
  "@testing-library/jest-dom": "^6.0.0",
97
- "@testing-library/react": "^15.0.0",
97
+ "@testing-library/react": "^16.0.0",
98
98
  "@testing-library/user-event": "^14.0.0",
99
99
  "@types/pluralize": "^0.0.33",
100
100
  "swr": "^2.2.5"
@@ -1 +0,0 @@
1
- {"version":3,"file":"PaginatedCatalogTable.esm.js","sources":["../../../src/components/CatalogTable/PaginatedCatalogTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { CatalogTableRow } from './types';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\n\ntype PaginatedCatalogTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<CatalogTableRow>;\n\n/**\n * @internal\n */\nexport function PaginatedCatalogTable(props: PaginatedCatalogTableProps) {\n const { columns, data, next, prev, title, isLoading, options, ...restProps } =\n props;\n\n return (\n <Table\n title={isLoading ? '' : title}\n columns={columns}\n data={data}\n options={{\n ...options,\n // These settings are configured to force server side pagination\n paginationPosition: 'both',\n pageSizeOptions: [],\n showFirstLastPageButtons: false,\n pageSize: Number.MAX_SAFE_INTEGER,\n emptyRowsWhenPaging: false,\n }}\n onPageChange={page => {\n if (page > 0) {\n next?.();\n } else {\n prev?.();\n }\n }}\n components={{\n Toolbar: CatalogTableToolbar,\n }}\n /* this will enable the prev button accordingly */\n page={prev ? 1 : 0}\n /* this will enable the next button accordingly */\n totalCount={next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n {...restProps}\n />\n );\n}\n"],"names":[],"mappings":";;;;AA8BO,SAAS,sBAAsB,KAAmC,EAAA;AACvE,EAAM,MAAA,EAAE,OAAS,EAAA,IAAA,EAAM,IAAM,EAAA,IAAA,EAAM,OAAO,SAAW,EAAA,OAAA,EAAS,GAAG,SAAA,EAC/D,GAAA,KAAA,CAAA;AAEF,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAY,EAAK,GAAA,KAAA;AAAA,MACxB,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,GAAG,OAAA;AAAA;AAAA,QAEH,kBAAoB,EAAA,MAAA;AAAA,QACpB,iBAAiB,EAAC;AAAA,QAClB,wBAA0B,EAAA,KAAA;AAAA,QAC1B,UAAU,MAAO,CAAA,gBAAA;AAAA,QACjB,mBAAqB,EAAA,KAAA;AAAA,OACvB;AAAA,MACA,cAAc,CAAQ,IAAA,KAAA;AACpB,QAAA,IAAI,OAAO,CAAG,EAAA;AACZ,UAAO,IAAA,IAAA,CAAA;AAAA,SACF,MAAA;AACL,UAAO,IAAA,IAAA,CAAA;AAAA,SACT;AAAA,OACF;AAAA,MACA,UAAY,EAAA;AAAA,QACV,OAAS,EAAA,mBAAA;AAAA,OACX;AAAA,MAEA,IAAA,EAAM,OAAO,CAAI,GAAA,CAAA;AAAA,MAEjB,UAAY,EAAA,IAAA,GAAO,MAAO,CAAA,SAAA,GAAY,MAAO,CAAA,gBAAA;AAAA,MAC7C,cAAc,EAAE,UAAA,EAAY,EAAE,kBAAA,EAAoB,IAAK,EAAA;AAAA,MACtD,GAAG,SAAA;AAAA,KAAA;AAAA,GACN,CAAA;AAEJ;;;;"}