@backstage/plugin-catalog 1.25.2-next.1 → 1.26.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 +53 -0
- package/dist/apis/StarredEntitiesApi/DefaultStarredEntitiesApi.esm.js.map +1 -1
- package/dist/components/CatalogKindHeader/CatalogKindHeader.esm.js +4 -3
- package/dist/components/CatalogKindHeader/CatalogKindHeader.esm.js.map +1 -1
- package/dist/components/CatalogKindHeader/kindFilterUtils.esm.js +13 -17
- package/dist/components/CatalogKindHeader/kindFilterUtils.esm.js.map +1 -1
- package/dist/components/CatalogTable/CatalogTable.esm.js +6 -7
- package/dist/components/CatalogTable/CatalogTable.esm.js.map +1 -1
- package/dist/components/CatalogTable/CursorPaginatedCatalogTable.esm.js +1 -3
- package/dist/components/CatalogTable/CursorPaginatedCatalogTable.esm.js.map +1 -1
- package/dist/components/CatalogTable/OffsetPaginatedCatalogTable.esm.js +2 -2
- package/dist/components/CatalogTable/OffsetPaginatedCatalogTable.esm.js.map +1 -1
- package/dist/components/HasSubdomainsCard/HasSubdomainsCard.esm.js +7 -6
- package/dist/components/HasSubdomainsCard/HasSubdomainsCard.esm.js.map +1 -1
- package/dist/components/RelatedEntitiesCard/RelatedEntitiesCard.esm.js +4 -1
- package/dist/components/RelatedEntitiesCard/RelatedEntitiesCard.esm.js.map +1 -1
- package/dist/components/RelatedEntitiesCard/index.esm.js +1 -1
- package/dist/components/RelatedEntitiesCard/presets.esm.js +8 -1
- package/dist/components/RelatedEntitiesCard/presets.esm.js.map +1 -1
- package/dist/index.d.ts +17 -2
- package/package.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @backstage/plugin-catalog
|
|
2
2
|
|
|
3
|
+
## 1.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 25beb82: Adds an optional columns attribute to HasSubdomainsCardProps and changes its default columns
|
|
8
|
+
- 39f1abc: Consistent title behaviour across CatalogTable, CursorPaginatedCatalogTable, and OffsetPaginatedCatalogTable.
|
|
9
|
+
- 1ffb9f3: Update `CatalogTable` title to use properly capitalized Kind facets (e.g. 'Component' instead of 'component')
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/plugin-catalog-react@1.15.0
|
|
15
|
+
- @backstage/plugin-scaffolder-common@1.5.8
|
|
16
|
+
- @backstage/plugin-search-react@1.8.4
|
|
17
|
+
- @backstage/catalog-client@1.9.0
|
|
18
|
+
- @backstage/core-compat-api@0.3.4
|
|
19
|
+
- @backstage/frontend-plugin-api@0.9.3
|
|
20
|
+
- @backstage/core-components@0.16.2
|
|
21
|
+
- @backstage/errors@1.2.6
|
|
22
|
+
- @backstage/catalog-model@1.7.2
|
|
23
|
+
- @backstage/core-plugin-api@1.10.2
|
|
24
|
+
- @backstage/integration-react@1.2.2
|
|
25
|
+
- @backstage/types@1.2.0
|
|
26
|
+
- @backstage/plugin-catalog-common@1.1.2
|
|
27
|
+
- @backstage/plugin-permission-react@0.4.29
|
|
28
|
+
- @backstage/plugin-search-common@1.2.16
|
|
29
|
+
|
|
30
|
+
## 1.26.0-next.2
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- 25beb82: Adds an optional columns attribute to HasSubdomainsCardProps and changes its default columns
|
|
35
|
+
- 39f1abc: Consistent title behaviour across CatalogTable, CursorPaginatedCatalogTable, and OffsetPaginatedCatalogTable.
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies
|
|
40
|
+
- @backstage/core-compat-api@0.3.4-next.2
|
|
41
|
+
- @backstage/plugin-catalog-react@1.14.3-next.2
|
|
42
|
+
- @backstage/errors@1.2.6-next.0
|
|
43
|
+
- @backstage/catalog-client@1.9.0-next.2
|
|
44
|
+
- @backstage/catalog-model@1.7.2-next.0
|
|
45
|
+
- @backstage/core-components@0.16.2-next.2
|
|
46
|
+
- @backstage/core-plugin-api@1.10.2-next.0
|
|
47
|
+
- @backstage/frontend-plugin-api@0.9.3-next.2
|
|
48
|
+
- @backstage/integration-react@1.2.2-next.1
|
|
49
|
+
- @backstage/types@1.2.0
|
|
50
|
+
- @backstage/plugin-catalog-common@1.1.2-next.0
|
|
51
|
+
- @backstage/plugin-permission-react@0.4.29-next.0
|
|
52
|
+
- @backstage/plugin-scaffolder-common@1.5.8-next.1
|
|
53
|
+
- @backstage/plugin-search-common@1.2.16-next.0
|
|
54
|
+
- @backstage/plugin-search-react@1.8.4-next.2
|
|
55
|
+
|
|
3
56
|
## 1.25.2-next.1
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultStarredEntitiesApi.esm.js","sources":["../../../src/apis/StarredEntitiesApi/DefaultStarredEntitiesApi.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { StorageApi } from '@backstage/core-plugin-api';\nimport { StarredEntitiesApi } from '@backstage/plugin-catalog-react';\nimport { Observable } from '@backstage/types';\nimport ObservableImpl from 'zen-observable';\nimport { performMigrationToTheNewBucket } from './migration';\n\n/**\n * Default implementation of the StarredEntitiesApi that is backed by the StorageApi.\n *\n * @public\n */\nexport class DefaultStarredEntitiesApi implements StarredEntitiesApi {\n private readonly settingsStore: StorageApi;\n private starredEntities: Set<string>;\n\n constructor(opts: { storageApi: StorageApi }) {\n // no need to await. The updated content will be caught by the observe$\n performMigrationToTheNewBucket(opts).then();\n\n this.settingsStore = opts.storageApi.forBucket('starredEntities');\n\n this.starredEntities = new Set(\n this.settingsStore.snapshot<string[]>('entityRefs').value ?? [],\n );\n\n this.settingsStore.observe$<string[]>('entityRefs').subscribe({\n next: next => {\n this.starredEntities = new Set(next.value ?? []);\n this.notifyChanges();\n },\n });\n }\n\n async toggleStarred(entityRef: string): Promise<void> {\n if (this.starredEntities.has(entityRef)) {\n this.starredEntities.delete(entityRef);\n } else {\n this.starredEntities.add(entityRef);\n }\n\n await this.settingsStore.set(\n 'entityRefs',\n Array.from(this.starredEntities),\n );\n }\n\n starredEntitie$(): Observable<Set<string>> {\n return this.observable;\n }\n\n private readonly subscribers = new Set<\n ZenObservable.SubscriptionObserver<Set<string>>\n >();\n\n private readonly observable = new ObservableImpl<Set<string>>(subscriber => {\n // forward the
|
|
1
|
+
{"version":3,"file":"DefaultStarredEntitiesApi.esm.js","sources":["../../../src/apis/StarredEntitiesApi/DefaultStarredEntitiesApi.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { StorageApi } from '@backstage/core-plugin-api';\nimport { StarredEntitiesApi } from '@backstage/plugin-catalog-react';\nimport { Observable } from '@backstage/types';\nimport ObservableImpl from 'zen-observable';\nimport { performMigrationToTheNewBucket } from './migration';\n\n/**\n * Default implementation of the StarredEntitiesApi that is backed by the StorageApi.\n *\n * @public\n */\nexport class DefaultStarredEntitiesApi implements StarredEntitiesApi {\n private readonly settingsStore: StorageApi;\n private starredEntities: Set<string>;\n\n constructor(opts: { storageApi: StorageApi }) {\n // no need to await. The updated content will be caught by the observe$\n performMigrationToTheNewBucket(opts).then();\n\n this.settingsStore = opts.storageApi.forBucket('starredEntities');\n\n this.starredEntities = new Set(\n this.settingsStore.snapshot<string[]>('entityRefs').value ?? [],\n );\n\n this.settingsStore.observe$<string[]>('entityRefs').subscribe({\n next: next => {\n this.starredEntities = new Set(next.value ?? []);\n this.notifyChanges();\n },\n });\n }\n\n async toggleStarred(entityRef: string): Promise<void> {\n if (this.starredEntities.has(entityRef)) {\n this.starredEntities.delete(entityRef);\n } else {\n this.starredEntities.add(entityRef);\n }\n\n await this.settingsStore.set(\n 'entityRefs',\n Array.from(this.starredEntities),\n );\n }\n\n starredEntitie$(): Observable<Set<string>> {\n return this.observable;\n }\n\n private readonly subscribers = new Set<\n ZenObservable.SubscriptionObserver<Set<string>>\n >();\n\n private readonly observable = new ObservableImpl<Set<string>>(subscriber => {\n // forward the latest value\n subscriber.next(new Set(this.starredEntities));\n\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n });\n\n private notifyChanges() {\n for (const subscription of this.subscribers) {\n subscription.next(new Set(this.starredEntities));\n }\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,yBAAwD,CAAA;AAAA,EAClD,aAAA;AAAA,EACT,eAAA;AAAA,EAER,YAAY,IAAkC,EAAA;AAE5C,IAA+B,8BAAA,CAAA,IAAI,EAAE,IAAK,EAAA;AAE1C,IAAA,IAAA,CAAK,aAAgB,GAAA,IAAA,CAAK,UAAW,CAAA,SAAA,CAAU,iBAAiB,CAAA;AAEhE,IAAA,IAAA,CAAK,kBAAkB,IAAI,GAAA;AAAA,MACzB,KAAK,aAAc,CAAA,QAAA,CAAmB,YAAY,CAAA,CAAE,SAAS;AAAC,KAChE;AAEA,IAAA,IAAA,CAAK,aAAc,CAAA,QAAA,CAAmB,YAAY,CAAA,CAAE,SAAU,CAAA;AAAA,MAC5D,MAAM,CAAQ,IAAA,KAAA;AACZ,QAAA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[filters.kind]);
|
|
43
|
+
const selectedKindLabel = allKinds.get(selectedKind.toLocaleLowerCase("en-US")) || selectedKind;
|
|
43
44
|
useEffect(() => {
|
|
44
45
|
updateFilters({
|
|
45
|
-
kind: selectedKind ? new EntityKindFilter(selectedKind) : void 0
|
|
46
|
+
kind: selectedKind ? new EntityKindFilter(selectedKind, selectedKindLabel) : void 0
|
|
46
47
|
});
|
|
47
|
-
}, [selectedKind, updateFilters]);
|
|
48
|
+
}, [selectedKind, selectedKindLabel, updateFilters]);
|
|
48
49
|
const options = filterKinds(allKinds, allowedKinds, selectedKind);
|
|
49
50
|
return /* @__PURE__ */ React.createElement(
|
|
50
51
|
Select,
|
|
@@ -54,7 +55,7 @@ function CatalogKindHeader(props) {
|
|
|
54
55
|
onChange: (e) => setSelectedKind(e.target.value),
|
|
55
56
|
classes
|
|
56
57
|
},
|
|
57
|
-
|
|
58
|
+
[...options.keys()].map((kind) => /* @__PURE__ */ React.createElement(MenuItem, { value: kind, key: kind }, `${pluralize(options.get(kind) || kind)}`))
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogKindHeader.esm.js","sources":["../../../src/components/CatalogKindHeader/CatalogKindHeader.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, { useEffect, useState, useMemo } from 'react';\nimport InputBase from '@material-ui/core/InputBase';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport {\n EntityKindFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\nimport pluralize from 'pluralize';\nimport { filterKinds, useAllKinds } from './kindFilterUtils';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n ...theme.typography.h4,\n },\n }),\n);\n\n/**\n * Props for {@link CatalogKindHeader}.\n *\n * @public\n */\nexport interface CatalogKindHeaderProps {\n /**\n * Entity kinds to show in the dropdown; by default all kinds are fetched from the catalog and\n * displayed.\n */\n allowedKinds?: string[];\n /**\n * The initial kind to select; defaults to 'component'. A kind filter entered directly in the\n * query parameter will override this value.\n */\n initialFilter?: string;\n}\n\n/**\n * @public\n * @deprecated This component has been deprecated in favour of the EntityKindPicker in the list of filters. If you wish to keep this component long term make sure to raise an issue at github.com/backstage/backstage\n */\nexport function CatalogKindHeader(props: CatalogKindHeaderProps) {\n const { initialFilter = 'component', allowedKinds } = props;\n const classes = useStyles();\n const { allKinds } = useAllKinds();\n const {\n filters,\n updateFilters,\n queryParameters: { kind: kindParameter },\n } = useEntityList();\n\n const queryParamKind = useMemo(\n () => [kindParameter].flat()[0],\n [kindParameter],\n );\n\n const [selectedKind, setSelectedKind] = useState(\n queryParamKind ?? filters.kind?.value ?? initialFilter,\n );\n\n // Set selected kinds on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (queryParamKind) {\n setSelectedKind(queryParamKind);\n }\n }, [queryParamKind]);\n\n // Set selected kind from filters; this happens when the kind filter is\n // updated from another component\n useEffect(() => {\n if (filters.kind?.value) {\n setSelectedKind(filters.kind?.value);\n }\n }, [filters.kind]);\n\n useEffect(() => {\n updateFilters({\n kind: selectedKind
|
|
1
|
+
{"version":3,"file":"CatalogKindHeader.esm.js","sources":["../../../src/components/CatalogKindHeader/CatalogKindHeader.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, { useEffect, useState, useMemo } from 'react';\nimport InputBase from '@material-ui/core/InputBase';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport {\n EntityKindFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\nimport pluralize from 'pluralize';\nimport { filterKinds, useAllKinds } from './kindFilterUtils';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n ...theme.typography.h4,\n },\n }),\n);\n\n/**\n * Props for {@link CatalogKindHeader}.\n *\n * @public\n */\nexport interface CatalogKindHeaderProps {\n /**\n * Entity kinds to show in the dropdown; by default all kinds are fetched from the catalog and\n * displayed.\n */\n allowedKinds?: string[];\n /**\n * The initial kind to select; defaults to 'component'. A kind filter entered directly in the\n * query parameter will override this value.\n */\n initialFilter?: string;\n}\n\n/**\n * @public\n * @deprecated This component has been deprecated in favour of the EntityKindPicker in the list of filters. If you wish to keep this component long term make sure to raise an issue at github.com/backstage/backstage\n */\nexport function CatalogKindHeader(props: CatalogKindHeaderProps) {\n const { initialFilter = 'component', allowedKinds } = props;\n const classes = useStyles();\n const { allKinds } = useAllKinds();\n const {\n filters,\n updateFilters,\n queryParameters: { kind: kindParameter },\n } = useEntityList();\n\n const queryParamKind = useMemo(\n () => [kindParameter].flat()[0],\n [kindParameter],\n );\n\n const [selectedKind, setSelectedKind] = useState(\n queryParamKind ?? filters.kind?.value ?? initialFilter,\n );\n\n // Set selected kinds on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (queryParamKind) {\n setSelectedKind(queryParamKind);\n }\n }, [queryParamKind]);\n\n // Set selected kind from filters; this happens when the kind filter is\n // updated from another component\n useEffect(() => {\n if (filters.kind?.value) {\n setSelectedKind(filters.kind?.value);\n }\n }, [filters.kind]);\n\n const selectedKindLabel =\n allKinds.get(selectedKind.toLocaleLowerCase('en-US')) || selectedKind;\n\n useEffect(() => {\n updateFilters({\n kind: selectedKind\n ? new EntityKindFilter(selectedKind, selectedKindLabel)\n : undefined,\n });\n }, [selectedKind, selectedKindLabel, updateFilters]);\n\n const options = filterKinds(allKinds, allowedKinds, selectedKind);\n\n return (\n <Select\n input={<InputBase />}\n value={selectedKind.toLocaleLowerCase('en-US')}\n onChange={e => setSelectedKind(e.target.value as string)}\n classes={classes}\n >\n {[...options.keys()].map(kind => (\n <MenuItem value={kind} key={kind}>\n {`${pluralize(options.get(kind) || kind)}`}\n </MenuItem>\n ))}\n </Select>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AA4BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,IAAM,EAAA;AAAA,MACJ,GAAG,MAAM,UAAW,CAAA;AAAA;AACtB,GACD;AACH,CAAA;AAwBO,SAAS,kBAAkB,KAA+B,EAAA;AAC/D,EAAA,MAAM,EAAE,aAAA,GAAgB,WAAa,EAAA,YAAA,EAAiB,GAAA,KAAA;AACtD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,WAAY,EAAA;AACjC,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,aAAA;AAAA,IACA,eAAA,EAAiB,EAAE,IAAA,EAAM,aAAc;AAAA,MACrC,aAAc,EAAA;AAElB,EAAA,MAAM,cAAiB,GAAA,OAAA;AAAA,IACrB,MAAM,CAAC,aAAa,CAAE,CAAA,IAAA,GAAO,CAAC,CAAA;AAAA,IAC9B,CAAC,aAAa;AAAA,GAChB;AAEA,EAAM,MAAA,CAAC,YAAc,EAAA,eAAe,CAAI,GAAA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AC,QAAS,EAAA,EAAA,KAAA,EAAO,MAAM,GAAK,EAAA,IAAA,EAAA,EACzB,CAAG,EAAA,SAAA,CAAU,OAAQ,CAAA,GAAA,CAAI,IAAI,CAAK,IAAA,IAAI,CAAC,CAAA,CAC1C,CACD;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -9,29 +9,25 @@ function useAllKinds() {
|
|
|
9
9
|
loading,
|
|
10
10
|
value: allKinds
|
|
11
11
|
} = useAsync(async () => {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const { facets } = await catalogApi.getEntityFacets({ facets: ["kind"] });
|
|
13
|
+
const kindFacets = (facets.kind ?? []).map((f) => f.value);
|
|
14
|
+
return new Map(
|
|
15
|
+
kindFacets.map((kind) => [kind.toLocaleLowerCase("en-US"), kind])
|
|
16
|
+
);
|
|
14
17
|
}, [catalogApi]);
|
|
15
|
-
return { loading, error, allKinds: allKinds ??
|
|
18
|
+
return { loading, error, allKinds: allKinds ?? /* @__PURE__ */ new Map() };
|
|
16
19
|
}
|
|
17
20
|
function filterKinds(allKinds, allowedKinds, forcedKinds) {
|
|
18
|
-
let availableKinds = allKinds;
|
|
21
|
+
let availableKinds = Array.from(allKinds.keys());
|
|
19
22
|
if (allowedKinds) {
|
|
20
|
-
availableKinds =
|
|
21
|
-
(k) => allowedKinds.some(
|
|
22
|
-
(a) => a.toLocaleLowerCase("en-US") === k.toLocaleLowerCase("en-US")
|
|
23
|
-
)
|
|
24
|
-
);
|
|
23
|
+
availableKinds = allowedKinds.map((k) => k.toLocaleLowerCase("en-US")).filter((k) => allKinds.has(k));
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
(
|
|
28
|
-
)
|
|
29
|
-
|
|
25
|
+
const kindsMap = new Map(
|
|
26
|
+
availableKinds.map((kind) => [kind, allKinds.get(kind) || kind])
|
|
27
|
+
);
|
|
28
|
+
if (forcedKinds && !kindsMap.has(forcedKinds)) {
|
|
29
|
+
kindsMap.set(forcedKinds.toLocaleLowerCase("en-US"), forcedKinds);
|
|
30
30
|
}
|
|
31
|
-
const kindsMap = availableKinds.sort().reduce((acc, kind) => {
|
|
32
|
-
acc[kind.toLocaleLowerCase("en-US")] = kind;
|
|
33
|
-
return acc;
|
|
34
|
-
}, {});
|
|
35
31
|
return kindsMap;
|
|
36
32
|
}
|
|
37
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kindFilterUtils.esm.js","sources":["../../../src/components/CatalogKindHeader/kindFilterUtils.ts"],"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 { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport useAsync from 'react-use/esm/useAsync';\n\n/**\n * Fetch and return all
|
|
1
|
+
{"version":3,"file":"kindFilterUtils.esm.js","sources":["../../../src/components/CatalogKindHeader/kindFilterUtils.ts"],"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 { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport useAsync from 'react-use/esm/useAsync';\n\n/**\n * Fetch and return all available kinds.\n */\nexport function useAllKinds(): {\n loading: boolean;\n error?: Error;\n allKinds: Map<string, string>;\n} {\n const catalogApi = useApi(catalogApiRef);\n\n const {\n error,\n loading,\n value: allKinds,\n } = useAsync(async () => {\n const { facets } = await catalogApi.getEntityFacets({ facets: ['kind'] });\n const kindFacets = (facets.kind ?? []).map(f => f.value);\n return new Map(\n kindFacets.map(kind => [kind.toLocaleLowerCase('en-US'), kind]),\n );\n }, [catalogApi]);\n\n return { loading, error, allKinds: allKinds ?? new Map() };\n}\n\n/**\n * Filter and capitalize accessible kinds.\n */\nexport function filterKinds(\n allKinds: Map<string, string>,\n allowedKinds?: string[],\n forcedKinds?: string,\n): Map<string, string> {\n // Before allKinds is loaded, or when a kind is entered manually in the URL, selectedKind may not\n // be present in allKinds. It should still be shown in the dropdown, but may not have the nice\n // enforced casing from the catalog-backend. This makes a key/value record for the Select options,\n // including selectedKind if it's unknown - but allows the selectedKind to get clobbered by the\n // more proper catalog kind if it exists.\n let availableKinds = Array.from(allKinds.keys());\n if (allowedKinds) {\n availableKinds = allowedKinds\n .map(k => k.toLocaleLowerCase('en-US'))\n .filter(k => allKinds.has(k));\n }\n\n const kindsMap = new Map(\n availableKinds.map(kind => [kind, allKinds.get(kind) || kind]),\n );\n\n if (forcedKinds && !kindsMap.has(forcedKinds)) {\n // this is the only time we set a label for a kind which is not properly capitalized\n kindsMap.set(forcedKinds.toLocaleLowerCase('en-US'), forcedKinds);\n }\n\n return kindsMap;\n}\n"],"names":[],"mappings":";;;;AAuBO,SAAS,WAId,GAAA;AACA,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAO,EAAA;AAAA,GACT,GAAI,SAAS,YAAY;AACvB,IAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAM,UAAA,CAAW,eAAgB,CAAA,EAAE,MAAQ,EAAA,CAAC,MAAM,CAAA,EAAG,CAAA;AACxE,IAAM,MAAA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ultCatalogTableColumnsFunc.esm.js';
|
|
15
15
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
16
16
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
17
|
+
import { CatalogTableToolbar } from './CatalogTableToolbar.esm.js';
|
|
17
18
|
|
|
18
19
|
const refCompare = (a, b) => {
|
|
19
20
|
const toRef = (entity) => entity.metadata.title || humanizeEntityRef(entity, {
|
|
@@ -92,16 +93,11 @@ const CatalogTable = (props) => {
|
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
];
|
|
95
|
-
const currentKind = filters.kind?.
|
|
96
|
+
const currentKind = filters.kind?.label || "";
|
|
96
97
|
const currentType = filters.type?.value || "";
|
|
97
98
|
const currentCount = typeof totalItems === "number" ? `(${totalItems})` : "";
|
|
98
99
|
const titlePreamble = capitalize(filters.user?.value ?? "all");
|
|
99
|
-
const title = [
|
|
100
|
-
titlePreamble,
|
|
101
|
-
currentType,
|
|
102
|
-
pluralize(currentKind),
|
|
103
|
-
currentCount
|
|
104
|
-
].filter((s) => s).join(" ");
|
|
100
|
+
const title = props.title || [titlePreamble, currentType, pluralize(currentKind), currentCount].filter((s) => s).join(" ");
|
|
105
101
|
const actions = props.actions || defaultActions;
|
|
106
102
|
const options = {
|
|
107
103
|
actionsColumnIndex: -1,
|
|
@@ -155,6 +151,9 @@ const CatalogTable = (props) => {
|
|
|
155
151
|
pageSizeOptions: [20, 50, 100],
|
|
156
152
|
...options
|
|
157
153
|
},
|
|
154
|
+
components: {
|
|
155
|
+
Toolbar: CatalogTableToolbar
|
|
156
|
+
},
|
|
158
157
|
title,
|
|
159
158
|
data: rows,
|
|
160
159
|
actions,
|
|
@@ -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 { 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;AAAA,GACd,CAAA;AAEH,EAAA,OAAO,MAAM,CAAC,CAAA,CAAE,aAAc,CAAA,KAAA,CAAM,CAAC,CAAC,CAAA;AACxC,CAAA;AAGa,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,8BAAA;AAAA,IACV,YAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,EAAE,eAAA,EAAiB,mBAAoB,EAAA,GAAI,kBAAmB,EAAA;AACpE,EAAA,MAAM,oBAAoB,aAAc,EAAA;AAExC,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACE,GAAA,iBAAA;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;AAAA,GAC7B;AACA,EA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I,CAAA;AAAA,MACZ,gBAAA;AAAA,MACA,2BAA2B,qBACxB,CAAA,GAAA;AAAA,QAAI,CAAA,CAAA,KACH,kBAAkB,CAAG,EAAA;AAAA,UACnB,WAAa,EAAA;AAAA,SACd;AAAA,OACH,CACC,KAAK,IAAI,CAAA;AAAA,MACZ;AAAA;AACF,GACF;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';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\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 /**\n * A static title to use for the table. If not provided, a title will be\n * generated based on the current Kind and Type filters and total number of items.\n */\n title?: string;\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/**\n * CatalogTable is a wrapper around the Table component that is pre-configured\n * to display catalog entities.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/features/software-catalog/catalog-customization}\n *\n * @public\n */\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?.label || '';\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 props.title ||\n [titlePreamble, currentType, pluralize(currentKind), currentCount]\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 components={{\n Toolbar: CatalogTableToolbar,\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":";;;;;;;;;;;;;;;;;;AAuEA,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;AAAA,GACd,CAAA;AAEH,EAAA,OAAO,MAAM,CAAC,CAAA,CAAE,aAAc,CAAA,KAAA,CA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A,MACA;AAAA;AAAA,GACF;AAEJ;AAEA,YAAA,CAAa,OAAU,GAAA,eAAA;AACvB,YAAA,CAAa,kBAAqB,GAAA,8BAAA;AAElC,SAAS,YAAY,MAAgB,EAAA;AACnC,EAAM,MAAA,qBAAA,GAAwB,kBAAmB,CAAA,MAAA,EAAQ,gBAAkB,EAAA;AAAA,IACzE,IAAM,EAAA;AAAA,GACP,CAAA;AACD,EAAM,MAAA,gBAAA,GAAmB,kBAAmB,CAAA,MAAA,EAAQ,iBAAiB,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;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;AAAA,SACd;AAAA,OACH,CACC,KAAK,IAAI,CAAA;AAAA,MACZ;AAAA;AACF,GACF;AACF;;;;"}
|
|
@@ -3,11 +3,10 @@ import { Table } from '@backstage/core-components';
|
|
|
3
3
|
import { CatalogTableToolbar } from './CatalogTableToolbar.esm.js';
|
|
4
4
|
|
|
5
5
|
function CursorPaginatedCatalogTable(props) {
|
|
6
|
-
const { columns, data, next, prev,
|
|
6
|
+
const { columns, data, next, prev, options, ...restProps } = props;
|
|
7
7
|
return /* @__PURE__ */ React.createElement(
|
|
8
8
|
Table,
|
|
9
9
|
{
|
|
10
|
-
title: isLoading ? "" : title,
|
|
11
10
|
columns,
|
|
12
11
|
data,
|
|
13
12
|
options: {
|
|
@@ -32,7 +31,6 @@ function CursorPaginatedCatalogTable(props) {
|
|
|
32
31
|
page: prev ? 1 : 0,
|
|
33
32
|
totalCount: next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER,
|
|
34
33
|
localization: { pagination: { labelDisplayedRows: "" } },
|
|
35
|
-
isLoading,
|
|
36
34
|
...restProps
|
|
37
35
|
}
|
|
38
36
|
);
|
|
@@ -1 +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,
|
|
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, options, ...restProps } = props;\n\n return (\n <Table\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n ...options,\n // These settings are configured to force server side pagination\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":";;;;AA+BO,SAAS,4BAA4B,KAAmC,EAAA;AAC7E,EAAM,MAAA,EAAE,SAAS,IAAM,EAAA,IAAA,EAAM,MAAM,OAAS,EAAA,GAAG,WAAc,GAAA,KAAA;AAE7D,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,kBAAoB,EAAA,MAAA;AAAA,QACpB,GAAG,OAAA;AAAA;AAAA,QAEH,iBAAiB,EAAC;AAAA,QAClB,wBAA0B,EAAA,KAAA;AAAA,QAC1B,UAAU,MAAO,CAAA,gBAAA;AAAA,QACjB,mBAAqB,EAAA;AAAA,OACvB;AAAA,MACA,cAAc,CAAQ,IAAA,KAAA;AACpB,QAAA,IAAI,OAAO,CAAG,EAAA;AACZ,UAAO,IAAA,IAAA;AAAA,SACF,MAAA;AACL,UAAO,IAAA,IAAA;AAAA;AACT,OACF;AAAA,MACA,UAAY,EAAA;AAAA,QACV,OAAS,EAAA;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;AAAA;AAAA,GACN;AAEJ;;;;"}
|
|
@@ -4,7 +4,7 @@ import { useEntityList } from '@backstage/plugin-catalog-react';
|
|
|
4
4
|
import { CatalogTableToolbar } from './CatalogTableToolbar.esm.js';
|
|
5
5
|
|
|
6
6
|
function OffsetPaginatedCatalogTable(props) {
|
|
7
|
-
const { columns, data,
|
|
7
|
+
const { columns, data, options, ...restProps } = props;
|
|
8
8
|
const { setLimit, setOffset, limit, totalItems, offset } = useEntityList();
|
|
9
9
|
const [page, setPage] = React.useState(
|
|
10
10
|
offset && limit ? Math.floor(offset / limit) : 0
|
|
@@ -40,7 +40,7 @@ function OffsetPaginatedCatalogTable(props) {
|
|
|
40
40
|
},
|
|
41
41
|
totalCount: totalItems,
|
|
42
42
|
localization: { pagination: { labelDisplayedRows: "" } },
|
|
43
|
-
|
|
43
|
+
...restProps
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
}
|
|
@@ -1 +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 { useEntityList } from '@backstage/plugin-catalog-react';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedCatalogTable(\n props: TableProps<CatalogTableRow>,\n) {\n const { columns, data,
|
|
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 { useEntityList } from '@backstage/plugin-catalog-react';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedCatalogTable(\n props: TableProps<CatalogTableRow>,\n) {\n const { columns, data, options, ...restProps } = props;\n const { setLimit, setOffset, limit, totalItems, offset } = useEntityList();\n\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 ...options,\n }}\n components={{\n Toolbar: CatalogTableToolbar,\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 {...restProps}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AA0BO,SAAS,4BACd,KACA,EAAA;AACA,EAAA,MAAM,EAAE,OAAS,EAAA,IAAA,EAAM,OAAS,EAAA,GAAG,WAAc,GAAA,KAAA;AACjD,EAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,OAAO,UAAY,EAAA,MAAA,KAAW,aAAc,EAAA;AAEzE,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;AAAA,GACjD;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,UAAA,IAAc,IAAO,GAAA,KAAA,IAAS,UAAY,EAAA;AAC5C,MAAA,SAAA,CAAW,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,UAAA,GAAa,KAAK,CAAC,CAAA;AAAA,KACrC,MAAA;AACL,MAAA,SAAA,CAAW,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,IAAA,GAAO,KAAK,CAAC,CAAA;AAAA;AACtC,KACC,CAAC,SAAA,EAAW,IAAM,EAAA,KAAA,EAAO,UAAU,CAAC,CAAA;AAEvC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,kBAAoB,EAAA,MAAA;AAAA,QACpB,iBAAiB,CAAC,CAAA,EAAG,EAAI,EAAA,EAAA,EAAI,IAAI,GAAG,CAAA;AAAA,QACpC,QAAU,EAAA,KAAA;AAAA,QACV,mBAAqB,EAAA,KAAA;AAAA,QACrB,GAAG;AAAA,OACL;AAAA,MACA,UAAY,EAAA;AAAA,QACV,OAAS,EAAA;AAAA,OACX;AAAA,MACA,IAAA;AAAA,MACA,cAAc,CAAW,OAAA,KAAA;AACvB,QAAA,OAAA,CAAQ,OAAO,CAAA;AAAA,OACjB;AAAA,MACA,qBAAqB,CAAY,QAAA,KAAA;AAC/B,QAAA,QAAA,CAAS,QAAQ,CAAA;AAAA,OACnB;AAAA,MACA,UAAY,EAAA,UAAA;AAAA,MACZ,cAAc,EAAE,UAAA,EAAY,EAAE,kBAAA,EAAoB,IAAK,EAAA;AAAA,MACtD,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_HAS_PART } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import {
|
|
4
|
+
import { domainEntityColumns, asDomainEntities, domainEntityHelpLink } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
|
@@ -9,8 +9,9 @@ function HasSubdomainsCard(props) {
|
|
|
9
9
|
const { t } = useTranslationRef(catalogTranslationRef);
|
|
10
10
|
const {
|
|
11
11
|
variant = "gridItem",
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
title = t("hasSubdomainsCard.title"),
|
|
13
|
+
columns = domainEntityColumns,
|
|
14
|
+
tableOptions = {}
|
|
14
15
|
} = props;
|
|
15
16
|
return /* @__PURE__ */ React.createElement(
|
|
16
17
|
RelatedEntitiesCard,
|
|
@@ -19,10 +20,10 @@ function HasSubdomainsCard(props) {
|
|
|
19
20
|
title,
|
|
20
21
|
entityKind: "Domain",
|
|
21
22
|
relationType: RELATION_HAS_PART,
|
|
22
|
-
columns
|
|
23
|
-
asRenderableEntities:
|
|
23
|
+
columns,
|
|
24
|
+
asRenderableEntities: asDomainEntities,
|
|
24
25
|
emptyMessage: t("hasSubdomainsCard.emptyMessage"),
|
|
25
|
-
emptyHelpLink:
|
|
26
|
+
emptyHelpLink: domainEntityHelpLink,
|
|
26
27
|
tableOptions
|
|
27
28
|
}
|
|
28
29
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HasSubdomainsCard.esm.js","sources":["../../../src/components/HasSubdomainsCard/HasSubdomainsCard.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 { RELATION_HAS_PART } from '@backstage/catalog-model';\nimport {
|
|
1
|
+
{"version":3,"file":"HasSubdomainsCard.esm.js","sources":["../../../src/components/HasSubdomainsCard/HasSubdomainsCard.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 { DomainEntity, RELATION_HAS_PART } from '@backstage/catalog-model';\nimport {\n InfoCardVariants,\n TableColumn,\n TableOptions,\n} from '@backstage/core-components';\nimport React from 'react';\nimport {\n asDomainEntities,\n domainEntityColumns,\n domainEntityHelpLink,\n RelatedEntitiesCard,\n} from '../RelatedEntitiesCard';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport interface HasSubdomainsCardProps {\n variant?: InfoCardVariants;\n tableOptions?: TableOptions;\n columns?: TableColumn<DomainEntity>[];\n title?: string;\n}\n\nexport function HasSubdomainsCard(props: HasSubdomainsCardProps) {\n const { t } = useTranslationRef(catalogTranslationRef);\n const {\n variant = 'gridItem',\n title = t('hasSubdomainsCard.title'),\n columns = domainEntityColumns,\n tableOptions = {},\n } = props;\n return (\n <RelatedEntitiesCard\n variant={variant}\n title={title}\n entityKind=\"Domain\"\n relationType={RELATION_HAS_PART}\n columns={columns}\n asRenderableEntities={asDomainEntities}\n emptyMessage={t('hasSubdomainsCard.emptyMessage')}\n emptyHelpLink={domainEntityHelpLink}\n tableOptions={tableOptions}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;AAwCO,SAAS,kBAAkB,KAA+B,EAAA;AAC/D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAA,GAAQ,EAAE,yBAAyB,CAAA;AAAA,IACnC,OAAU,GAAA,mBAAA;AAAA,IACV,eAAe;AAAC,GACd,GAAA,KAAA;AACJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,KAAA;AAAA,MACA,UAAW,EAAA,QAAA;AAAA,MACX,YAAc,EAAA,iBAAA;AAAA,MACd,OAAA;AAAA,MACA,oBAAsB,EAAA,gBAAA;AAAA,MACtB,YAAA,EAAc,EAAE,gCAAgC,CAAA;AAAA,MAChD,aAAe,EAAA,oBAAA;AAAA,MACf;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -2,7 +2,7 @@ import Typography from '@material-ui/core/Typography';
|
|
|
2
2
|
import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { InfoCard, Progress, ResponseErrorPanel, Link } from '@backstage/core-components';
|
|
5
|
-
import { componentEntityColumns, componentEntityHelpLink, asComponentEntities, resourceEntityColumns, resourceEntityHelpLink, asResourceEntities, systemEntityColumns, systemEntityHelpLink, asSystemEntities } from './presets.esm.js';
|
|
5
|
+
import { componentEntityColumns, componentEntityHelpLink, asComponentEntities, resourceEntityColumns, resourceEntityHelpLink, asResourceEntities, systemEntityColumns, systemEntityHelpLink, asSystemEntities, domainEntityColumns, domainEntityHelpLink, asDomainEntities } from './presets.esm.js';
|
|
6
6
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
7
7
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
8
8
|
|
|
@@ -51,6 +51,9 @@ RelatedEntitiesCard.asResourceEntities = asResourceEntities;
|
|
|
51
51
|
RelatedEntitiesCard.systemEntityColumns = systemEntityColumns;
|
|
52
52
|
RelatedEntitiesCard.systemEntityHelpLink = systemEntityHelpLink;
|
|
53
53
|
RelatedEntitiesCard.asSystemEntities = asSystemEntities;
|
|
54
|
+
RelatedEntitiesCard.domainEntityColums = domainEntityColumns;
|
|
55
|
+
RelatedEntitiesCard.domainEntityHelpLink = domainEntityHelpLink;
|
|
56
|
+
RelatedEntitiesCard.asDomainEntities = asDomainEntities;
|
|
54
57
|
|
|
55
58
|
export { RelatedEntitiesCard };
|
|
56
59
|
//# sourceMappingURL=RelatedEntitiesCard.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelatedEntitiesCard.esm.js","sources":["../../../src/components/RelatedEntitiesCard/RelatedEntitiesCard.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 { Entity } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n ResponseErrorPanel,\n TableColumn,\n TableOptions,\n} from '@backstage/core-components';\nimport {\n asComponentEntities,\n asResourceEntities,\n asSystemEntities,\n componentEntityColumns,\n componentEntityHelpLink,\n resourceEntityColumns,\n resourceEntityHelpLink,\n systemEntityColumns,\n systemEntityHelpLink,\n} from './presets';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type RelatedEntitiesCardProps<T extends Entity> = {\n variant?: InfoCardVariants;\n title: string;\n columns: TableColumn<T>[];\n entityKind?: string;\n relationType: string;\n emptyMessage: string;\n emptyHelpLink: string;\n asRenderableEntities: (entities: Entity[]) => T[];\n tableOptions?: TableOptions;\n};\n\n/**\n * A low level card component that can be used as a building block for more\n * specific cards.\n *\n * @remarks\n *\n * You probably want to make a dedicated component for your needs, which renders\n * this card as its implementation with some of the props set to the appropriate\n * values.\n *\n * @public\n */\nexport const RelatedEntitiesCard = <T extends Entity>(\n props: RelatedEntitiesCardProps<T>,\n) => {\n const {\n variant = 'gridItem',\n title,\n columns,\n entityKind,\n relationType,\n emptyMessage,\n emptyHelpLink,\n asRenderableEntities,\n tableOptions = {},\n } = props;\n const { t } = useTranslationRef(catalogTranslationRef);\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: relationType,\n kind: entityKind,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error) {\n return (\n <InfoCard variant={variant} title={title}>\n <ResponseErrorPanel error={error} />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">{emptyMessage}</Typography>\n <Typography variant=\"body2\">\n <Link to={emptyHelpLink} externalLinkIcon>\n {t('relatedEntitiesCard.emptyHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={asRenderableEntities(entities || [])}\n tableOptions={tableOptions}\n />\n );\n};\n\nRelatedEntitiesCard.componentEntityColumns = componentEntityColumns;\nRelatedEntitiesCard.componentEntityHelpLink = componentEntityHelpLink;\nRelatedEntitiesCard.asComponentEntities = asComponentEntities;\nRelatedEntitiesCard.resourceEntityColumns = resourceEntityColumns;\nRelatedEntitiesCard.resourceEntityHelpLink = resourceEntityHelpLink;\nRelatedEntitiesCard.asResourceEntities = asResourceEntities;\nRelatedEntitiesCard.systemEntityColumns = systemEntityColumns;\nRelatedEntitiesCard.systemEntityHelpLink = systemEntityHelpLink;\nRelatedEntitiesCard.asSystemEntities = asSystemEntities;\n"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"RelatedEntitiesCard.esm.js","sources":["../../../src/components/RelatedEntitiesCard/RelatedEntitiesCard.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 { Entity } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n ResponseErrorPanel,\n TableColumn,\n TableOptions,\n} from '@backstage/core-components';\nimport {\n asComponentEntities,\n asDomainEntities,\n asResourceEntities,\n asSystemEntities,\n componentEntityColumns,\n componentEntityHelpLink,\n domainEntityColumns,\n domainEntityHelpLink,\n resourceEntityColumns,\n resourceEntityHelpLink,\n systemEntityColumns,\n systemEntityHelpLink,\n} from './presets';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type RelatedEntitiesCardProps<T extends Entity> = {\n variant?: InfoCardVariants;\n title: string;\n columns: TableColumn<T>[];\n entityKind?: string;\n relationType: string;\n emptyMessage: string;\n emptyHelpLink: string;\n asRenderableEntities: (entities: Entity[]) => T[];\n tableOptions?: TableOptions;\n};\n\n/**\n * A low level card component that can be used as a building block for more\n * specific cards.\n *\n * @remarks\n *\n * You probably want to make a dedicated component for your needs, which renders\n * this card as its implementation with some of the props set to the appropriate\n * values.\n *\n * @public\n */\nexport const RelatedEntitiesCard = <T extends Entity>(\n props: RelatedEntitiesCardProps<T>,\n) => {\n const {\n variant = 'gridItem',\n title,\n columns,\n entityKind,\n relationType,\n emptyMessage,\n emptyHelpLink,\n asRenderableEntities,\n tableOptions = {},\n } = props;\n const { t } = useTranslationRef(catalogTranslationRef);\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: relationType,\n kind: entityKind,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error) {\n return (\n <InfoCard variant={variant} title={title}>\n <ResponseErrorPanel error={error} />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">{emptyMessage}</Typography>\n <Typography variant=\"body2\">\n <Link to={emptyHelpLink} externalLinkIcon>\n {t('relatedEntitiesCard.emptyHelpLinkTitle')}\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={asRenderableEntities(entities || [])}\n tableOptions={tableOptions}\n />\n );\n};\n\nRelatedEntitiesCard.componentEntityColumns = componentEntityColumns;\nRelatedEntitiesCard.componentEntityHelpLink = componentEntityHelpLink;\nRelatedEntitiesCard.asComponentEntities = asComponentEntities;\nRelatedEntitiesCard.resourceEntityColumns = resourceEntityColumns;\nRelatedEntitiesCard.resourceEntityHelpLink = resourceEntityHelpLink;\nRelatedEntitiesCard.asResourceEntities = asResourceEntities;\nRelatedEntitiesCard.systemEntityColumns = systemEntityColumns;\nRelatedEntitiesCard.systemEntityHelpLink = systemEntityHelpLink;\nRelatedEntitiesCard.asSystemEntities = asSystemEntities;\nRelatedEntitiesCard.domainEntityColums = domainEntityColumns;\nRelatedEntitiesCard.domainEntityHelpLink = domainEntityHelpLink;\nRelatedEntitiesCard.asDomainEntities = asDomainEntities;\n"],"names":[],"mappings":";;;;;;;;AA2Ea,MAAA,mBAAA,GAAsB,CACjC,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,oBAAA;AAAA,IACA,eAAe;AAAC,GACd,GAAA,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU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GAAA,mBAAA;AAC1C,mBAAA,CAAoB,qBAAwB,GAAA,qBAAA;AAC5C,mBAAA,CAAoB,sBAAyB,GAAA,sBAAA;AAC7C,mBAAA,CAAoB,kBAAqB,GAAA,kBAAA;AACzC,mBAAA,CAAoB,mBAAsB,GAAA,mBAAA;AAC1C,mBAAA,CAAoB,oBAAuB,GAAA,oBAAA;AAC3C,mBAAA,CAAoB,gBAAmB,GAAA,gBAAA;AACvC,mBAAA,CAAoB,kBAAqB,GAAA,mBAAA;AACzC,mBAAA,CAAoB,oBAAuB,GAAA,oBAAA;AAC3C,mBAAA,CAAoB,gBAAmB,GAAA,gBAAA;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { RelatedEntitiesCard } from './RelatedEntitiesCard.esm.js';
|
|
2
|
-
export { asComponentEntities, asResourceEntities, asSystemEntities, componentEntityColumns, componentEntityHelpLink, resourceEntityColumns, resourceEntityHelpLink, systemEntityColumns, systemEntityHelpLink } from './presets.esm.js';
|
|
2
|
+
export { asComponentEntities, asDomainEntities, asResourceEntities, asSystemEntities, componentEntityColumns, componentEntityHelpLink, domainEntityColumns, domainEntityHelpLink, resourceEntityColumns, resourceEntityHelpLink, systemEntityColumns, systemEntityHelpLink } from './presets.esm.js';
|
|
3
3
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -25,6 +25,13 @@ const systemEntityColumns = [
|
|
|
25
25
|
];
|
|
26
26
|
const systemEntityHelpLink = "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system";
|
|
27
27
|
const asSystemEntities = (entities) => entities;
|
|
28
|
+
const domainEntityColumns = [
|
|
29
|
+
EntityTable.columns.createEntityRefColumn({ defaultKind: "domain" }),
|
|
30
|
+
EntityTable.columns.createOwnerColumn(),
|
|
31
|
+
EntityTable.columns.createMetadataDescriptionColumn()
|
|
32
|
+
];
|
|
33
|
+
const domainEntityHelpLink = "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain";
|
|
34
|
+
const asDomainEntities = (entities) => entities;
|
|
28
35
|
|
|
29
|
-
export { asComponentEntities, asResourceEntities, asSystemEntities, componentEntityColumns, componentEntityHelpLink, resourceEntityColumns, resourceEntityHelpLink, systemEntityColumns, systemEntityHelpLink };
|
|
36
|
+
export { asComponentEntities, asDomainEntities, asResourceEntities, asSystemEntities, componentEntityColumns, componentEntityHelpLink, domainEntityColumns, domainEntityHelpLink, resourceEntityColumns, resourceEntityHelpLink, systemEntityColumns, systemEntityHelpLink };
|
|
30
37
|
//# sourceMappingURL=presets.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.esm.js","sources":["../../../src/components/RelatedEntitiesCard/presets.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ComponentEntity,\n Entity,\n ResourceEntity,\n SystemEntity,\n} from '@backstage/catalog-model';\nimport { EntityTable } from '@backstage/plugin-catalog-react';\nimport { TableColumn } from '@backstage/core-components';\n\nexport const componentEntityColumns: TableColumn<ComponentEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'component' }),\n EntityTable.columns.createOwnerColumn(),\n EntityTable.columns.createSpecTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\nexport const componentEntityHelpLink: string =\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component';\nexport const asComponentEntities = (entities: Entity[]): ComponentEntity[] =>\n entities as ComponentEntity[];\n\nexport const resourceEntityColumns: TableColumn<ResourceEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'resource' }),\n EntityTable.columns.createOwnerColumn(),\n EntityTable.columns.createSpecTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\nexport const resourceEntityHelpLink: string =\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-resource';\nexport const asResourceEntities = (entities: Entity[]): ResourceEntity[] =>\n entities as ResourceEntity[];\n\nexport const systemEntityColumns: TableColumn<SystemEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'system' }),\n EntityTable.columns.createOwnerColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\nexport const systemEntityHelpLink: string =\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system';\nexport const asSystemEntities = (entities: Entity[]): SystemEntity[] =>\n entities as SystemEntity[];\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"presets.esm.js","sources":["../../../src/components/RelatedEntitiesCard/presets.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ComponentEntity,\n DomainEntity,\n Entity,\n ResourceEntity,\n SystemEntity,\n} from '@backstage/catalog-model';\nimport { EntityTable } from '@backstage/plugin-catalog-react';\nimport { TableColumn } from '@backstage/core-components';\n\nexport const componentEntityColumns: TableColumn<ComponentEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'component' }),\n EntityTable.columns.createOwnerColumn(),\n EntityTable.columns.createSpecTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\nexport const componentEntityHelpLink: string =\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component';\nexport const asComponentEntities = (entities: Entity[]): ComponentEntity[] =>\n entities as ComponentEntity[];\n\nexport const resourceEntityColumns: TableColumn<ResourceEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'resource' }),\n EntityTable.columns.createOwnerColumn(),\n EntityTable.columns.createSpecTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\nexport const resourceEntityHelpLink: string =\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-resource';\nexport const asResourceEntities = (entities: Entity[]): ResourceEntity[] =>\n entities as ResourceEntity[];\n\nexport const systemEntityColumns: TableColumn<SystemEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'system' }),\n EntityTable.columns.createOwnerColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\nexport const systemEntityHelpLink: string =\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system';\nexport const asSystemEntities = (entities: Entity[]): SystemEntity[] =>\n entities as SystemEntity[];\n\nexport const domainEntityColumns: TableColumn<DomainEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'domain' }),\n EntityTable.columns.createOwnerColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\nexport const domainEntityHelpLink: string =\n 'https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain';\nexport const asDomainEntities = (entities: Entity[]): DomainEntity[] =>\n entities as DomainEntity[];\n"],"names":[],"mappings":";;AAyBO,MAAM,sBAAyD,GAAA;AAAA,EACpE,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,aAAa,CAAA;AAAA,EACtE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,WAAA,CAAY,QAAQ,oBAAqB,EAAA;AAAA,EACzC,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,EAC9C,WAAA,CAAY,QAAQ,+BAAgC;AACtD;AACO,MAAM,uBACX,GAAA;AACW,MAAA,mBAAA,GAAsB,CAAC,QAClC,KAAA;AAEK,MAAM,qBAAuD,GAAA;AAAA,EAClE,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,YAAY,CAAA;AAAA,EACrE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,WAAA,CAAY,QAAQ,oBAAqB,EAAA;AAAA,EACzC,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,EAC9C,WAAA,CAAY,QAAQ,+BAAgC;AACtD;AACO,MAAM,sBACX,GAAA;AACW,MAAA,kBAAA,GAAqB,CAAC,QACjC,KAAA;AAEK,MAAM,mBAAmD,GAAA;AAAA,EAC9D,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,UAAU,CAAA;AAAA,EACnE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,WAAA,CAAY,QAAQ,+BAAgC;AACtD;AACO,MAAM,oBACX,GAAA;AACW,MAAA,gBAAA,GAAmB,CAAC,QAC/B,KAAA;AAEK,MAAM,mBAAmD,GAAA;AAAA,EAC9D,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,UAAU,CAAA;AAAA,EACnE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,WAAA,CAAY,QAAQ,+BAAgC;AACtD;AACO,MAAM,oBACX,GAAA;AACW,MAAA,gBAAA,GAAmB,CAAC,QAC/B,KAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Entity, CompoundEntityRef, ComponentEntity, ResourceEntity, SystemEntity } from '@backstage/catalog-model';
|
|
2
|
+
import { Entity, CompoundEntityRef, ComponentEntity, ResourceEntity, DomainEntity, 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
5
|
import { EntityRefPresentationSnapshot, CatalogApi, EntityPresentationApi, EntityRefPresentation, StarredEntitiesApi, EntityListContextProps, UserListFilterKind, EntityOwnerPickerProps, EntityListPagination } from '@backstage/plugin-catalog-react';
|
|
@@ -242,9 +242,23 @@ interface CatalogTableProps {
|
|
|
242
242
|
actions?: TableProps<CatalogTableRow>['actions'];
|
|
243
243
|
tableOptions?: TableProps<CatalogTableRow>['options'];
|
|
244
244
|
emptyContent?: ReactNode;
|
|
245
|
+
/**
|
|
246
|
+
* A static title to use for the table. If not provided, a title will be
|
|
247
|
+
* generated based on the current Kind and Type filters and total number of items.
|
|
248
|
+
*/
|
|
249
|
+
title?: string;
|
|
245
250
|
subtitle?: string;
|
|
246
251
|
}
|
|
247
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* CatalogTable is a wrapper around the Table component that is pre-configured
|
|
254
|
+
* to display catalog entities.
|
|
255
|
+
*
|
|
256
|
+
* @remarks
|
|
257
|
+
*
|
|
258
|
+
* See {@link https://backstage.io/docs/features/software-catalog/catalog-customization}
|
|
259
|
+
*
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
248
262
|
declare const CatalogTable: {
|
|
249
263
|
(props: CatalogTableProps): React__default.JSX.Element;
|
|
250
264
|
columns: Readonly<{
|
|
@@ -604,6 +618,7 @@ interface HasSubcomponentsCardProps {
|
|
|
604
618
|
interface HasSubdomainsCardProps {
|
|
605
619
|
variant?: InfoCardVariants;
|
|
606
620
|
tableOptions?: TableOptions;
|
|
621
|
+
columns?: TableColumn<DomainEntity>[];
|
|
607
622
|
title?: string;
|
|
608
623
|
}
|
|
609
624
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "The Backstage plugin for browsing the Backstage catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -67,21 +67,21 @@
|
|
|
67
67
|
"test": "backstage-cli package test"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@backstage/catalog-client": "1.9.0
|
|
71
|
-
"@backstage/catalog-model": "1.7.
|
|
72
|
-
"@backstage/core-compat-api": "0.3.4
|
|
73
|
-
"@backstage/core-components": "0.16.2
|
|
74
|
-
"@backstage/core-plugin-api": "1.10.
|
|
75
|
-
"@backstage/errors": "1.2.
|
|
76
|
-
"@backstage/frontend-plugin-api": "0.9.3
|
|
77
|
-
"@backstage/integration-react": "1.2.2
|
|
78
|
-
"@backstage/plugin-catalog-common": "1.1.
|
|
79
|
-
"@backstage/plugin-catalog-react": "1.
|
|
80
|
-
"@backstage/plugin-permission-react": "0.4.
|
|
81
|
-
"@backstage/plugin-scaffolder-common": "1.5.8
|
|
82
|
-
"@backstage/plugin-search-common": "1.2.
|
|
83
|
-
"@backstage/plugin-search-react": "1.8.4
|
|
84
|
-
"@backstage/types": "1.2.0",
|
|
70
|
+
"@backstage/catalog-client": "^1.9.0",
|
|
71
|
+
"@backstage/catalog-model": "^1.7.2",
|
|
72
|
+
"@backstage/core-compat-api": "^0.3.4",
|
|
73
|
+
"@backstage/core-components": "^0.16.2",
|
|
74
|
+
"@backstage/core-plugin-api": "^1.10.2",
|
|
75
|
+
"@backstage/errors": "^1.2.6",
|
|
76
|
+
"@backstage/frontend-plugin-api": "^0.9.3",
|
|
77
|
+
"@backstage/integration-react": "^1.2.2",
|
|
78
|
+
"@backstage/plugin-catalog-common": "^1.1.2",
|
|
79
|
+
"@backstage/plugin-catalog-react": "^1.15.0",
|
|
80
|
+
"@backstage/plugin-permission-react": "^0.4.29",
|
|
81
|
+
"@backstage/plugin-scaffolder-common": "^1.5.8",
|
|
82
|
+
"@backstage/plugin-search-common": "^1.2.16",
|
|
83
|
+
"@backstage/plugin-search-react": "^1.8.4",
|
|
84
|
+
"@backstage/types": "^1.2.0",
|
|
85
85
|
"@material-ui/core": "^4.12.2",
|
|
86
86
|
"@material-ui/icons": "^4.9.1",
|
|
87
87
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -95,12 +95,12 @@
|
|
|
95
95
|
"zen-observable": "^0.10.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@backstage/cli": "0.29.
|
|
99
|
-
"@backstage/core-app-api": "1.15.3
|
|
100
|
-
"@backstage/dev-utils": "1.1.5
|
|
101
|
-
"@backstage/frontend-test-utils": "0.2.4
|
|
102
|
-
"@backstage/plugin-permission-common": "0.8.
|
|
103
|
-
"@backstage/test-utils": "1.7.3
|
|
98
|
+
"@backstage/cli": "^0.29.4",
|
|
99
|
+
"@backstage/core-app-api": "^1.15.3",
|
|
100
|
+
"@backstage/dev-utils": "^1.1.5",
|
|
101
|
+
"@backstage/frontend-test-utils": "^0.2.4",
|
|
102
|
+
"@backstage/plugin-permission-common": "^0.8.3",
|
|
103
|
+
"@backstage/test-utils": "^1.7.3",
|
|
104
104
|
"@testing-library/dom": "^10.0.0",
|
|
105
105
|
"@testing-library/jest-dom": "^6.0.0",
|
|
106
106
|
"@testing-library/react": "^16.0.0",
|