@backstage/plugin-techdocs 1.18.1-next.1 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/dist/helpers.esm.js +1 -1
- package/dist/helpers.esm.js.map +1 -1
- package/dist/home/components/Grids/EntityListDocsGrid.esm.js +2 -2
- package/dist/home/components/Grids/EntityListDocsGrid.esm.js.map +1 -1
- package/dist/home/components/Tables/columns.esm.js +3 -9
- package/dist/home/components/Tables/columns.esm.js.map +1 -1
- package/dist/plugins/techdocs/package.json.esm.js +1 -1
- package/dist/search/hooks/useTechDocsLocation.esm.js +1 -1
- package/dist/search/hooks/useTechDocsLocation.esm.js.map +1 -1
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
+
## 1.18.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
|
|
8
|
+
- d421187: Reduced the initial app bundle size by loading page and optional UI implementations only when their extensions render.
|
|
9
|
+
- 9cb79f5: Use the catalog presentation API for TechDocs document titles and owner labels so entity display names are consistent with the rest of Backstage.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/core-components@0.18.14
|
|
12
|
+
- @backstage/integration@2.1.2
|
|
13
|
+
- @backstage/ui@0.18.0
|
|
14
|
+
- @backstage/catalog-client@1.16.2
|
|
15
|
+
- @backstage/catalog-model@1.10.1
|
|
16
|
+
- @backstage/plugin-catalog-react@3.2.3
|
|
17
|
+
- @backstage/plugin-techdocs-react@1.3.15
|
|
18
|
+
- @backstage/config@1.3.9
|
|
19
|
+
- @backstage/frontend-plugin-api@0.18.1
|
|
20
|
+
- @backstage/core-plugin-api@1.12.10
|
|
21
|
+
- @backstage/integration-react@1.2.22
|
|
22
|
+
- @backstage/plugin-auth-react@0.1.31
|
|
23
|
+
- @backstage/plugin-search-common@1.2.25
|
|
24
|
+
- @backstage/plugin-search-react@1.11.8
|
|
25
|
+
|
|
26
|
+
## 1.18.1-next.2
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
- @backstage/config@1.3.9-next.0
|
|
32
|
+
- @backstage/ui@0.18.0-next.2
|
|
33
|
+
- @backstage/catalog-client@1.16.2-next.1
|
|
34
|
+
- @backstage/plugin-catalog-react@3.2.3-next.2
|
|
35
|
+
- @backstage/core-components@0.18.14-next.2
|
|
36
|
+
- @backstage/core-plugin-api@1.12.10-next.1
|
|
37
|
+
- @backstage/frontend-plugin-api@0.18.1-next.1
|
|
38
|
+
- @backstage/integration@2.1.2-next.1
|
|
39
|
+
- @backstage/integration-react@1.2.22-next.1
|
|
40
|
+
- @backstage/plugin-techdocs-react@1.3.15-next.2
|
|
41
|
+
- @backstage/plugin-search-common@1.2.25-next.0
|
|
42
|
+
- @backstage/plugin-search-react@1.11.8-next.2
|
|
43
|
+
|
|
3
44
|
## 1.18.1-next.1
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/dist/helpers.esm.js
CHANGED
package/dist/helpers.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.esm.js","sources":["../src/helpers.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 { Config } from '@backstage/config';\n\n// Lower-case entity triplets by default, but allow override.\nexport function toLowerMaybe(str: string, config: Config) {\n return config.getOptionalBoolean(\n 'techdocs.legacyUseCaseSensitiveTripletPaths',\n )\n ? str\n : str.
|
|
1
|
+
{"version":3,"file":"helpers.esm.js","sources":["../src/helpers.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 { Config } from '@backstage/config';\n\n// Lower-case entity triplets by default, but allow override.\nexport function toLowerMaybe(str: string, config: Config) {\n return config.getOptionalBoolean(\n 'techdocs.legacyUseCaseSensitiveTripletPaths',\n )\n ? str\n : str.toLowerCase();\n}\n"],"names":[],"mappings":"AAmBO,SAAS,YAAA,CAAa,KAAa,MAAA,EAAgB;AACxD,EAAA,OAAO,MAAA,CAAO,kBAAA;AAAA,IACZ;AAAA,GACF,GACI,GAAA,GACA,GAAA,CAAI,WAAA,EAAY;AACtB;;;;"}
|
|
@@ -62,12 +62,12 @@ const EntityListDocsGrid = (props) => {
|
|
|
62
62
|
a,
|
|
63
63
|
void 0,
|
|
64
64
|
presentationApi
|
|
65
|
-
).primaryTitle.
|
|
65
|
+
).primaryTitle.toLowerCase();
|
|
66
66
|
const titleB = entityPresentationSnapshot(
|
|
67
67
|
b,
|
|
68
68
|
void 0,
|
|
69
69
|
presentationApi
|
|
70
|
-
).primaryTitle.
|
|
70
|
+
).primaryTitle.toLowerCase();
|
|
71
71
|
return titleA.localeCompare(titleB);
|
|
72
72
|
});
|
|
73
73
|
return /* @__PURE__ */ jsx(Content, { children: (props.groups || [allEntitiesGroup]).map((group, index) => /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListDocsGrid.esm.js","sources":["../../../../src/home/components/Grids/EntityListDocsGrid.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 { DocsCardGrid } from './DocsCardGrid';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Content,\n ContentHeader,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n entityPresentationApiRef,\n entityPresentationSnapshot,\n useEntityList,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type DocsGroupConfig = {\n title: ReactNode;\n filterPredicate: ((entity: Entity) => boolean) | string;\n};\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type EntityListDocsGridPageProps = {\n groups?: DocsGroupConfig[];\n};\n\nconst allEntitiesGroup: DocsGroupConfig = {\n title: 'All Documentation',\n filterPredicate: () => true,\n};\n\nconst EntityListDocsGridGroup = (props: {\n group: DocsGroupConfig;\n entities: Entity[];\n}) => {\n const { entities, group } = props;\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const shownEntities = entities.filter(entity => {\n if (group.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof group.filterPredicate === 'function' &&\n group.filterPredicate(entity)\n );\n });\n\n const titleComponent: ReactNode = (() => {\n return typeof group.title === 'string' ? (\n <ContentHeader title={group.title} />\n ) : (\n group.title\n );\n })();\n\n if (shownEntities.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <DocsCardGrid entities={shownEntities} />\n </Content>\n );\n};\n\n/**\n * Component responsible to get entities from entity list context and pass down to DocsCardGrid\n *\n * @public\n */\nexport const EntityListDocsGrid = (props: EntityListDocsGridPageProps) => {\n const { loading, error, entities } = useEntityList();\n const apiHolder = useApiHolder();\n const presentationApi = apiHolder.get(entityPresentationApiRef);\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (entities.length === 0) {\n return (\n <div data-testid=\"doc-not-found\">\n <Typography variant=\"body2\">\n No documentation found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/techdocs/creating-and-publishing\">\n publishing documentation\n </Link>\n .\n </Typography>\n </div>\n );\n }\n\n const sortedEntities = [...entities].sort((a, b) => {\n const titleA = entityPresentationSnapshot(\n a,\n undefined,\n presentationApi,\n ).primaryTitle.
|
|
1
|
+
{"version":3,"file":"EntityListDocsGrid.esm.js","sources":["../../../../src/home/components/Grids/EntityListDocsGrid.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 { DocsCardGrid } from './DocsCardGrid';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Content,\n ContentHeader,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n entityPresentationApiRef,\n entityPresentationSnapshot,\n useEntityList,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type DocsGroupConfig = {\n title: ReactNode;\n filterPredicate: ((entity: Entity) => boolean) | string;\n};\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type EntityListDocsGridPageProps = {\n groups?: DocsGroupConfig[];\n};\n\nconst allEntitiesGroup: DocsGroupConfig = {\n title: 'All Documentation',\n filterPredicate: () => true,\n};\n\nconst EntityListDocsGridGroup = (props: {\n group: DocsGroupConfig;\n entities: Entity[];\n}) => {\n const { entities, group } = props;\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const shownEntities = entities.filter(entity => {\n if (group.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof group.filterPredicate === 'function' &&\n group.filterPredicate(entity)\n );\n });\n\n const titleComponent: ReactNode = (() => {\n return typeof group.title === 'string' ? (\n <ContentHeader title={group.title} />\n ) : (\n group.title\n );\n })();\n\n if (shownEntities.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <DocsCardGrid entities={shownEntities} />\n </Content>\n );\n};\n\n/**\n * Component responsible to get entities from entity list context and pass down to DocsCardGrid\n *\n * @public\n */\nexport const EntityListDocsGrid = (props: EntityListDocsGridPageProps) => {\n const { loading, error, entities } = useEntityList();\n const apiHolder = useApiHolder();\n const presentationApi = apiHolder.get(entityPresentationApiRef);\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (entities.length === 0) {\n return (\n <div data-testid=\"doc-not-found\">\n <Typography variant=\"body2\">\n No documentation found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/techdocs/creating-and-publishing\">\n publishing documentation\n </Link>\n .\n </Typography>\n </div>\n );\n }\n\n const sortedEntities = [...entities].sort((a, b) => {\n const titleA = entityPresentationSnapshot(\n a,\n undefined,\n presentationApi,\n ).primaryTitle.toLowerCase();\n const titleB = entityPresentationSnapshot(\n b,\n undefined,\n presentationApi,\n ).primaryTitle.toLowerCase();\n return titleA.localeCompare(titleB);\n });\n\n return (\n <Content>\n {(props.groups || [allEntitiesGroup]).map((group, index: number) => (\n <EntityListDocsGridGroup\n entities={sortedEntities}\n group={group}\n key={`${group.title}-${index}`}\n />\n ))}\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuDA,MAAM,gBAAA,GAAoC;AAAA,EACxC,KAAA,EAAO,mBAAA;AAAA,EACP,iBAAiB,MAAM;AACzB,CAAA;AAEA,MAAM,uBAAA,GAA0B,CAAC,KAAA,KAG3B;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAM,GAAI,KAAA;AAC5B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAA,EAAkB,aAAA,KAAkB,kBAAA,EAAmB;AAExE,EAAA,MAAM,aAAA,GAAgB,QAAA,CAAS,MAAA,CAAO,CAAA,MAAA,KAAU;AAC9C,IAAA,IAAI,KAAA,CAAM,oBAAoB,aAAA,EAAe;AAC3C,MAAA,IAAI,gBAAA,EAAkB;AACpB,QAAA,OAAO,KAAA;AAAA,MACT;AACA,MAAA,OAAO,cAAc,MAAM,CAAA;AAAA,IAC7B;AAEA,IAAA,OACE,OAAO,KAAA,CAAM,eAAA,KAAoB,UAAA,IACjC,KAAA,CAAM,gBAAgB,MAAM,CAAA;AAAA,EAEhC,CAAC,CAAA;AAED,EAAA,MAAM,kBAA6B,MAAM;AACvC,IAAA,OAAO,OAAO,KAAA,CAAM,KAAA,KAAU,QA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AsE,QAAA,EAAA,0BAAA,EAE/E,CAAA;AAAA,MAAO;AAAA,KAAA,EAET,CAAA,EACF,CAAA;AAAA,EAEJ;AAEA,EAAA,MAAM,cAAA,GAAiB,CAAC,GAAG,QAAQ,EAAE,IAAA,CAAK,CAAC,GAAG,CAAA,KAAM;AAClD,IAAA,MAAM,MAAA,GAAS,0BAAA;AAAA,MACb,CAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACF,CAAE,aAAa,WAAA,EAAY;AAC3B,IAAA,MAAM,MAAA,GAAS,0BAAA;AAAA,MACb,CAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACF,CAAE,aAAa,WAAA,EAAY;AAC3B,IAAA,OAAO,MAAA,CAAO,cAAc,MAAM,CAAA;AAAA,EACpC,CAAC,CAAA;AAED,EAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACG,QAAA,EAAA,CAAA,KAAA,CAAM,MAAA,IAAU,CAAC,gBAAgB,CAAA,EAAG,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,qBAChD,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,cAAA;AAAA,MACV;AAAA,KAAA;AAAA,IACK,CAAA,EAAG,KAAA,CAAM,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,GAE/B,CAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -33,17 +33,11 @@ const columnFactories = {
|
|
|
33
33
|
searchable: true,
|
|
34
34
|
defaultSort: "asc",
|
|
35
35
|
customSort: (row1, row2) => {
|
|
36
|
-
const title1 = customTitle(
|
|
37
|
-
|
|
38
|
-
presentationApi
|
|
39
|
-
).toLocaleLowerCase();
|
|
40
|
-
const title2 = customTitle(
|
|
41
|
-
row2.entity,
|
|
42
|
-
presentationApi
|
|
43
|
-
).toLocaleLowerCase();
|
|
36
|
+
const title1 = customTitle(row1.entity, presentationApi).toLowerCase();
|
|
37
|
+
const title2 = customTitle(row2.entity, presentationApi).toLowerCase();
|
|
44
38
|
return title1.localeCompare(title2);
|
|
45
39
|
},
|
|
46
|
-
customFilterAndSearch: (filter, row) => customTitle(row.entity, presentationApi).
|
|
40
|
+
customFilterAndSearch: (filter, row) => customTitle(row.entity, presentationApi).toLowerCase().includes(filter.toLowerCase()),
|
|
47
41
|
render: (row) => /* @__PURE__ */ jsx(
|
|
48
42
|
SubvalueCell,
|
|
49
43
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columns.esm.js","sources":["../../../../src/home/components/Tables/columns.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 Link,\n SubvalueCell,\n type TableColumn,\n} from '@backstage/core-components';\nimport {\n EntityDisplayName,\n type EntityPresentationApi,\n entityPresentationSnapshot,\n EntityRefLinks,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../../translation';\nimport { DocsTableRow } from './types';\n\nfunction customTitle(\n entity: Entity,\n presentationApi?: EntityPresentationApi,\n): string {\n return entityPresentationSnapshot(entity, undefined, presentationApi)\n .primaryTitle;\n}\n\n/**\n * Component for translating table column titles\n * @alpha\n */\nconst TableColumnTitle = ({\n translationKey,\n}: {\n translationKey: 'document' | 'owner' | 'kind' | 'type';\n}) => {\n const { t } = useTranslationRef(techdocsTranslationRef);\n return <>{t(`table.columns.${translationKey}`)}</>;\n};\n\n/**\n * Not directly exported, but through DocsTable.columns and EntityListDocsTable.columns\n *\n * @public\n */\nexport const columnFactories = {\n createTitleColumn(options?: {\n hidden?: boolean;\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const nameCol = columnFactories.createNameColumn({\n entityPresentationApi: options?.entityPresentationApi,\n });\n return {\n ...nameCol,\n field: 'entity.metadata.title',\n hidden: options?.hidden,\n };\n },\n\n createNameColumn(options?: {\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const presentationApi = options?.entityPresentationApi;\n return {\n title: <TableColumnTitle translationKey=\"document\" />,\n field: 'entity.metadata.name',\n highlight: true,\n searchable: true,\n defaultSort: 'asc',\n customSort: (row1, row2) => {\n const title1 = customTitle(
|
|
1
|
+
{"version":3,"file":"columns.esm.js","sources":["../../../../src/home/components/Tables/columns.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 Link,\n SubvalueCell,\n type TableColumn,\n} from '@backstage/core-components';\nimport {\n EntityDisplayName,\n type EntityPresentationApi,\n entityPresentationSnapshot,\n EntityRefLinks,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../../translation';\nimport { DocsTableRow } from './types';\n\nfunction customTitle(\n entity: Entity,\n presentationApi?: EntityPresentationApi,\n): string {\n return entityPresentationSnapshot(entity, undefined, presentationApi)\n .primaryTitle;\n}\n\n/**\n * Component for translating table column titles\n * @alpha\n */\nconst TableColumnTitle = ({\n translationKey,\n}: {\n translationKey: 'document' | 'owner' | 'kind' | 'type';\n}) => {\n const { t } = useTranslationRef(techdocsTranslationRef);\n return <>{t(`table.columns.${translationKey}`)}</>;\n};\n\n/**\n * Not directly exported, but through DocsTable.columns and EntityListDocsTable.columns\n *\n * @public\n */\nexport const columnFactories = {\n createTitleColumn(options?: {\n hidden?: boolean;\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const nameCol = columnFactories.createNameColumn({\n entityPresentationApi: options?.entityPresentationApi,\n });\n return {\n ...nameCol,\n field: 'entity.metadata.title',\n hidden: options?.hidden,\n };\n },\n\n createNameColumn(options?: {\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const presentationApi = options?.entityPresentationApi;\n return {\n title: <TableColumnTitle translationKey=\"document\" />,\n field: 'entity.metadata.name',\n highlight: true,\n searchable: true,\n defaultSort: 'asc',\n customSort: (row1, row2) => {\n const title1 = customTitle(row1.entity, presentationApi).toLowerCase();\n const title2 = customTitle(row2.entity, presentationApi).toLowerCase();\n return title1.localeCompare(title2);\n },\n customFilterAndSearch: (filter, row) =>\n customTitle(row.entity, presentationApi)\n .toLowerCase()\n .includes(filter.toLowerCase()),\n render: (row: DocsTableRow) => (\n <SubvalueCell\n value={\n <Link to={row.resolved.docsUrl}>\n {presentationApi ? (\n <EntityDisplayName entityRef={row.entity} />\n ) : (\n customTitle(row.entity)\n )}\n </Link>\n }\n subvalue={row.entity.metadata.description}\n />\n ),\n };\n },\n createOwnerColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"owner\" />,\n field: 'resolved.ownedByRelationsTitle',\n render: ({ resolved }) => (\n <EntityRefLinks\n entityRefs={resolved.ownedByRelations}\n defaultKind=\"group\"\n />\n ),\n };\n },\n createKindColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"kind\" />,\n field: 'entity.kind',\n };\n },\n createTypeColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"type\" />,\n field: 'entity.spec.type',\n };\n },\n};\n\nexport const defaultColumns: TableColumn<DocsTableRow>[] = [\n columnFactories.createTitleColumn({ hidden: true }),\n columnFactories.createNameColumn(),\n columnFactories.createOwnerColumn(),\n columnFactories.createKindColumn(),\n columnFactories.createTypeColumn(),\n];\n"],"names":[],"mappings":";;;;;;AAgCA,SAAS,WAAA,CACP,QACA,eAAA,EACQ;AACR,EAAA,OAAO,0BAAA,CAA2B,MAAA,EAAQ,MAAA,EAAW,eAAe,CAAA,CACjE,YAAA;AACL;AAMA,MAAM,mBAAmB,CAAC;AAAA,EACxB;AACF,CAAA,KAEM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,sBAAsB,CAAA;AACtD,EAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA,CAAA,CAAE,CAAA,cAAA,EAAiB,cAAc,EAAE,CAAA,EAAE,CAAA;AACjD,CAAA;AAOO,MAAM,eAAA,GAAkB;AAAA,EAC7B,kBAAkB,OAAA,EAGY;AAC5B,IAAA,MAAM,OAAA,GAAU,gBAAgB,gBAAA,CAAiB;AAAA,MAC/C,uBAAuB,OAAA,EAAS;AAAA,KACjC,CAAA;AACD,IAAA,OAAO;AAAA,MACL,GAAG,OAAA;AAAA,MACH,KAAA,EAAO,uBAAA;AAAA,MACP,QAAQ,OAAA,EAAS;AAAA,KACnB;AAAA,EACF,CAAA;AAAA,EAEA,iBAAiB,OAAA,EAEa;AAC5B,IAAA,MAAM,kBAAkB,OAAA,EAAS,qBAAA;AACjC,IAAA,OAAO;AAAA,MACL,KAAA,kBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAAA,EAAe,UAAA,EAAW,CAAA;AAAA,MACnD,KAAA,EAAO,sBAAA;AAAA,MACP,SAAA,EAAW,IAAA;AAAA,MACX,UAAA,EAAY,IAAA;AAAA,MACZ,WAAA,EAAa,KAAA;AAAA,MACb,UAAA,EAAY,CAAC,IAAA,EA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AAA,MACL,KAAA,kBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAAA,EAAe,MAAA,EAAO,CAAA;AAAA,MAC/C,KAAA,EAAO;AAAA,KACT;AAAA,EACF,CAAA;AAAA,EACA,gBAAA,GAA8C;AAC5C,IAAA,OAAO;AAAA,MACL,KAAA,kBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAAA,EAAe,MAAA,EAAO,CAAA;AAAA,MAC/C,KAAA,EAAO;AAAA,KACT;AAAA,EACF;AACF;AAE2D;AAAA,EACzD,eAAA,CAAgB,iBAAA,CAAkB,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EAClD,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,iBAAA,EAAkB;AAAA,EAClC,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,gBAAA;AAClB;;;;"}
|
|
@@ -12,7 +12,7 @@ function useEntityPageTechDocsRedirect(entityRef) {
|
|
|
12
12
|
const rootDocsPath = trimEndSlash(routeDocsRoot({ kind, namespace, name }));
|
|
13
13
|
const catalogDocsPath = trimEndSlash(routeDocsCatalog());
|
|
14
14
|
return (url) => {
|
|
15
|
-
if (url.
|
|
15
|
+
if (url.toLowerCase().startsWith(rootDocsPath.toLowerCase())) {
|
|
16
16
|
const suffix = trimStartSlash(url.slice(rootDocsPath.length));
|
|
17
17
|
return suffix.length === 0 || suffix.startsWith("#") ? `${catalogDocsPath}${suffix}` : `${catalogDocsPath}/${suffix}`;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTechDocsLocation.esm.js","sources":["../../../src/search/hooks/useTechDocsLocation.ts"],"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 { useMemo } from 'react';\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nimport { rootCatalogDocsRouteRef, rootDocsRouteRef } from '../../routes';\n\nconst trimStartSlash = (path: string) => path.replace(/^\\/+/, '');\nconst trimEndSlash = (path: string) => path.replace(/\\/+$/, '');\n\n/**\n * Returns a function that takes a location to a Tech Docs entry, and returns a\n * new location, re-routed to the catalog page tab.\n *\n * @internal\n */\nexport function useEntityPageTechDocsRedirect(entityRef: CompoundEntityRef) {\n const { kind, name, namespace } = entityRef;\n\n const routeDocsRoot = useRouteRef(rootDocsRouteRef);\n const routeDocsCatalog = useRouteRef(rootCatalogDocsRouteRef);\n\n // Re-routes a /docs/:namespace/:kind/:name/* location into\n // /catalog/:namespace/:kind/:name/docs/*, while handling situations where\n // these defaults are changed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const reRouteLocationToCatalog = useMemo(() => {\n const rootDocsPath = trimEndSlash(routeDocsRoot({ kind, namespace, name }));\n const catalogDocsPath = trimEndSlash(routeDocsCatalog());\n\n return (url: string): string => {\n if (
|
|
1
|
+
{"version":3,"file":"useTechDocsLocation.esm.js","sources":["../../../src/search/hooks/useTechDocsLocation.ts"],"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 { useMemo } from 'react';\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nimport { rootCatalogDocsRouteRef, rootDocsRouteRef } from '../../routes';\n\nconst trimStartSlash = (path: string) => path.replace(/^\\/+/, '');\nconst trimEndSlash = (path: string) => path.replace(/\\/+$/, '');\n\n/**\n * Returns a function that takes a location to a Tech Docs entry, and returns a\n * new location, re-routed to the catalog page tab.\n *\n * @internal\n */\nexport function useEntityPageTechDocsRedirect(entityRef: CompoundEntityRef) {\n const { kind, name, namespace } = entityRef;\n\n const routeDocsRoot = useRouteRef(rootDocsRouteRef);\n const routeDocsCatalog = useRouteRef(rootCatalogDocsRouteRef);\n\n // Re-routes a /docs/:namespace/:kind/:name/* location into\n // /catalog/:namespace/:kind/:name/docs/*, while handling situations where\n // these defaults are changed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const reRouteLocationToCatalog = useMemo(() => {\n const rootDocsPath = trimEndSlash(routeDocsRoot({ kind, namespace, name }));\n const catalogDocsPath = trimEndSlash(routeDocsCatalog());\n\n return (url: string): string => {\n if (url.toLowerCase().startsWith(rootDocsPath.toLowerCase())) {\n const suffix = trimStartSlash(url.slice(rootDocsPath.length));\n return suffix.length === 0 || suffix.startsWith('#')\n ? `${catalogDocsPath}${suffix}`\n : `${catalogDocsPath}/${suffix}`;\n }\n return url;\n };\n }, [routeDocsRoot, routeDocsCatalog, kind, name, namespace]);\n\n return reRouteLocationToCatalog;\n}\n"],"names":[],"mappings":";;;;AAsBA,MAAM,iBAAiB,CAAC,IAAA,KAAiB,IAAA,CAAK,OAAA,CAAQ,QAAQ,EAAE,CAAA;AAChE,MAAM,eAAe,CAAC,IAAA,KAAiB,IAAA,CAAK,OAAA,CAAQ,QAAQ,EAAE,CAAA;AAQvD,SAAS,8BAA8B,SAAA,EAA8B;AAC1E,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,SAAA,EAAU,GAAI,SAAA;AAElC,EAAA,MAAM,aAAA,GAAgB,YAAY,gBAAgB,CAAA;AAClD,EAAA,MAAM,gBAAA,GAAmB,YAAY,uBAAuB,CAAA;AAM5D,EAAA,MAAM,wBAAA,GAA2B,QAAQ,MAAM;AAC7C,IAAA,MAAM,YAAA,GAAe,aAAa,aAAA,CAAc,EAAE,MAAM,SAAA,EAAW,IAAA,EAAM,CAAC,CAAA;AAC1E,IAAA,MAAM,eAAA,GAAkB,YAAA,CAAa,gBAAA,EAAkB,CAAA;AAEvD,IAAA,OAAO,CAAC,GAAA,KAAwB;AAC9B,MAAA,IAAI,IAAI,WAAA,EAAY,CAAE,WAAW,YAAA,CAAa,WAAA,EAAa,CAAA,EAAG;AAC5D,QAAA,MAAM,SAAS,cAAA,CAAe,GAAA,CAAI,KAAA,CAAM,YAAA,CAAa,MAAM,CAAC,CAAA;AAC5D,QAAA,OAAO,MAAA,CAAO,MAAA,KAAW,CAAA,IAAK,MAAA,CAAO,WAAW,GAAG,CAAA,GAC/C,CAAA,EAAG,eAAe,GAAG,MAAM,CAAA,CAAA,GAC3B,CAAA,EAAG,eAAe,IAAI,MAAM,CAAA,CAAA;AAAA,MAClC;AACA,MAAA,OAAO,GAAA;AAAA,IACT,CAAA;AAAA,EACF,GAAG,CAAC,aAAA,EAAe,kBAAkB,IAAA,EAAM,IAAA,EAAM,SAAS,CAAC,CAAA;AAE3D,EAAA,OAAO,wBAAA;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-techdocs",
|
|
3
|
-
"version": "1.18.1
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "The Backstage plugin that renders technical documentation for your components",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -71,23 +71,23 @@
|
|
|
71
71
|
"test": "backstage-cli package test"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@backstage/catalog-client": "1.16.2
|
|
75
|
-
"@backstage/catalog-model": "1.10.
|
|
76
|
-
"@backstage/config": "1.3.
|
|
77
|
-
"@backstage/core-components": "0.18.14
|
|
78
|
-
"@backstage/core-plugin-api": "1.12.10
|
|
79
|
-
"@backstage/errors": "1.3.1",
|
|
80
|
-
"@backstage/frontend-plugin-api": "0.18.1
|
|
81
|
-
"@backstage/integration": "2.1.2
|
|
82
|
-
"@backstage/integration-react": "1.2.22
|
|
83
|
-
"@backstage/plugin-auth-react": "0.1.31
|
|
84
|
-
"@backstage/plugin-catalog-react": "3.2.3
|
|
85
|
-
"@backstage/plugin-search-common": "1.2.
|
|
86
|
-
"@backstage/plugin-search-react": "1.11.8
|
|
87
|
-
"@backstage/plugin-techdocs-common": "0.1.1",
|
|
88
|
-
"@backstage/plugin-techdocs-react": "1.3.15
|
|
89
|
-
"@backstage/theme": "0.7.3",
|
|
90
|
-
"@backstage/ui": "0.18.0
|
|
74
|
+
"@backstage/catalog-client": "^1.16.2",
|
|
75
|
+
"@backstage/catalog-model": "^1.10.1",
|
|
76
|
+
"@backstage/config": "^1.3.9",
|
|
77
|
+
"@backstage/core-components": "^0.18.14",
|
|
78
|
+
"@backstage/core-plugin-api": "^1.12.10",
|
|
79
|
+
"@backstage/errors": "^1.3.1",
|
|
80
|
+
"@backstage/frontend-plugin-api": "^0.18.1",
|
|
81
|
+
"@backstage/integration": "^2.1.2",
|
|
82
|
+
"@backstage/integration-react": "^1.2.22",
|
|
83
|
+
"@backstage/plugin-auth-react": "^0.1.31",
|
|
84
|
+
"@backstage/plugin-catalog-react": "^3.2.3",
|
|
85
|
+
"@backstage/plugin-search-common": "^1.2.25",
|
|
86
|
+
"@backstage/plugin-search-react": "^1.11.8",
|
|
87
|
+
"@backstage/plugin-techdocs-common": "^0.1.1",
|
|
88
|
+
"@backstage/plugin-techdocs-react": "^1.3.15",
|
|
89
|
+
"@backstage/theme": "^0.7.3",
|
|
90
|
+
"@backstage/ui": "^0.18.0",
|
|
91
91
|
"@material-ui/core": "^4.12.2",
|
|
92
92
|
"@material-ui/icons": "^4.9.1",
|
|
93
93
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -102,12 +102,12 @@
|
|
|
102
102
|
"zod": "^4.0.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@backstage/cli": "0.36.6
|
|
106
|
-
"@backstage/core-app-api": "1.20.5
|
|
107
|
-
"@backstage/dev-utils": "1.1.27
|
|
108
|
-
"@backstage/plugin-catalog": "2.0.9
|
|
109
|
-
"@backstage/plugin-techdocs-module-addons-contrib": "1.1.40
|
|
110
|
-
"@backstage/test-utils": "1.7.22
|
|
105
|
+
"@backstage/cli": "^0.36.6",
|
|
106
|
+
"@backstage/core-app-api": "^1.20.5",
|
|
107
|
+
"@backstage/dev-utils": "^1.1.27",
|
|
108
|
+
"@backstage/plugin-catalog": "^2.0.9",
|
|
109
|
+
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.40",
|
|
110
|
+
"@backstage/test-utils": "^1.7.22",
|
|
111
111
|
"@testing-library/dom": "^10.0.0",
|
|
112
112
|
"@testing-library/jest-dom": "^6.0.0",
|
|
113
113
|
"@testing-library/react": "^16.0.0",
|