@backstage/plugin-techdocs 1.8.0 → 1.8.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +9 -2
- package/dist/alpha.esm.js +58 -43
- package/dist/alpha.esm.js.map +1 -1
- package/dist/esm/DocsCardGrid-66754d32.esm.js +41 -0
- package/dist/esm/DocsCardGrid-66754d32.esm.js.map +1 -0
- package/dist/esm/Router-1532ca7a.esm.js +163 -0
- package/dist/esm/Router-1532ca7a.esm.js.map +1 -0
- package/dist/esm/{TechDocsCustomHome-63a41580.esm.js → TechDocsCustomHome-114f3198.esm.js} +6 -26
- package/dist/esm/{TechDocsCustomHome-63a41580.esm.js.map → TechDocsCustomHome-114f3198.esm.js.map} +1 -1
- package/dist/esm/{TechDocsIndexPage-f0a2b203.esm.js → TechDocsIndexPage-a43a1a1c.esm.js} +3 -3
- package/dist/esm/{TechDocsIndexPage-f0a2b203.esm.js.map → TechDocsIndexPage-a43a1a1c.esm.js.map} +1 -1
- package/dist/esm/{TechDocsReaderPage-ac1d5884.esm.js → TechDocsReaderPage-89ab8b88.esm.js} +30 -33
- package/dist/esm/TechDocsReaderPage-89ab8b88.esm.js.map +1 -0
- package/dist/esm/{index-a1239e83.esm.js → index-9eca466a.esm.js} +5 -3
- package/dist/esm/index-9eca466a.esm.js.map +1 -0
- package/dist/esm/{client-3113b6a6.esm.js → routes-691e552c.esm.js} +14 -2
- package/dist/esm/routes-691e552c.esm.js.map +1 -0
- package/dist/index.esm.js +15 -197
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -17
- package/dist/esm/TechDocsReaderPage-ac1d5884.esm.js.map +0 -1
- package/dist/esm/client-3113b6a6.esm.js.map +0 -1
- package/dist/esm/index-a1239e83.esm.js.map +0 -1
- package/dist/esm/routes-f8adf6c9.esm.js +0 -15
- package/dist/esm/routes-f8adf6c9.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
+
## 1.8.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/integration@1.7.2-next.0
|
|
9
|
+
- @backstage/frontend-plugin-api@0.3.0-next.1
|
|
10
|
+
- @backstage/plugin-catalog-react@1.9.0-next.1
|
|
11
|
+
- @backstage/plugin-search-react@1.7.2-next.1
|
|
12
|
+
- @backstage/integration-react@1.1.21-next.1
|
|
13
|
+
- @backstage/core-components@0.13.8-next.1
|
|
14
|
+
- @backstage/catalog-model@1.4.3
|
|
15
|
+
- @backstage/config@1.1.1
|
|
16
|
+
- @backstage/core-plugin-api@1.8.0-next.0
|
|
17
|
+
- @backstage/errors@1.2.3
|
|
18
|
+
- @backstage/theme@0.4.4-next.0
|
|
19
|
+
- @backstage/plugin-search-common@1.2.7
|
|
20
|
+
- @backstage/plugin-techdocs-react@1.1.13-next.1
|
|
21
|
+
|
|
22
|
+
## 1.8.1-next.0
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 4728b3960d: Fixed navigation bug that caused users to not be scrolled to the top of a new page. Fixed navigation bug where using backwards and forwards browser navigation did not scroll users to the correct place on the TechDoc page.
|
|
27
|
+
- a3add7a682: Export alpha routes and nav item extension, only available for applications that uses the new Frontend system.
|
|
28
|
+
- 71c97e7d73: The `spec.lifecycle' field in entities will now always be rendered as a string.
|
|
29
|
+
- 68fc9dc60e: Updated alpha exports according to routing changes in `@backstage/frontend-plugin-api`.
|
|
30
|
+
- 6c2b872153: Add official support for React 18.
|
|
31
|
+
- 0bf6ebda88: Added entity page content for the new plugin exported via `/alpha`.
|
|
32
|
+
- 67cc85bb14: Switched the conditional `react-dom/client` import to use `import(...)` rather than `require(...)`.
|
|
33
|
+
- 38cda52746: Added support for React 18. The new `createRoot` API from `react-dom/client` will now be used if present.
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
- @backstage/core-components@0.13.7-next.0
|
|
36
|
+
- @backstage/frontend-plugin-api@0.3.0-next.0
|
|
37
|
+
- @backstage/plugin-catalog-react@1.9.0-next.0
|
|
38
|
+
- @backstage/integration-react@1.1.21-next.0
|
|
39
|
+
- @backstage/core-plugin-api@1.8.0-next.0
|
|
40
|
+
- @backstage/plugin-techdocs-react@1.1.13-next.0
|
|
41
|
+
- @backstage/plugin-search-react@1.7.2-next.0
|
|
42
|
+
- @backstage/theme@0.4.4-next.0
|
|
43
|
+
- @backstage/integration@1.7.1
|
|
44
|
+
- @backstage/catalog-model@1.4.3
|
|
45
|
+
- @backstage/config@1.1.1
|
|
46
|
+
- @backstage/errors@1.2.3
|
|
47
|
+
- @backstage/plugin-search-common@1.2.7
|
|
48
|
+
|
|
3
49
|
## 1.8.0
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
2
1
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
3
2
|
|
|
4
3
|
/** @alpha */
|
|
@@ -10,6 +9,14 @@ declare const TechDocsSearchResultListItemExtension: _backstage_frontend_plugin_
|
|
|
10
9
|
title?: string | undefined;
|
|
11
10
|
}>;
|
|
12
11
|
/** @alpha */
|
|
13
|
-
declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<
|
|
12
|
+
declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{
|
|
13
|
+
root: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
14
|
+
docRoot: _backstage_frontend_plugin_api.RouteRef<{
|
|
15
|
+
name: string;
|
|
16
|
+
kind: string;
|
|
17
|
+
namespace: string;
|
|
18
|
+
}>;
|
|
19
|
+
entityContent: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
20
|
+
}, {}>;
|
|
14
21
|
|
|
15
22
|
export { TechDocsSearchResultListItemExtension, _default as default };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,49 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import LibraryBooks from '@material-ui/icons/LibraryBooks';
|
|
3
|
+
import { createApiExtension, createSchemaFromZod, createPageExtension, createNavItemExtension, createPlugin } from '@backstage/frontend-plugin-api';
|
|
3
4
|
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha';
|
|
4
|
-
import {
|
|
5
|
+
import { createApiFactory, configApiRef, discoveryApiRef, identityApiRef, fetchApiRef } from '@backstage/core-plugin-api';
|
|
6
|
+
import { convertLegacyRouteRef } from '@backstage/core-plugin-api/alpha';
|
|
5
7
|
import { techdocsStorageApiRef, techdocsApiRef } from '@backstage/plugin-techdocs-react';
|
|
6
|
-
import {
|
|
8
|
+
import { a as TechDocsStorageClient, T as TechDocsClient, r as rootRouteRef, b as rootDocsRouteRef, c as rootCatalogDocsRouteRef } from './esm/routes-691e552c.esm.js';
|
|
9
|
+
import { createEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';
|
|
7
10
|
import '@backstage/errors';
|
|
8
11
|
import 'event-source-polyfill';
|
|
9
12
|
|
|
10
|
-
const rootRouteRef = createRouteRef({
|
|
11
|
-
id: "plugin.techdocs.indexPage"
|
|
12
|
-
});
|
|
13
|
-
const rootDocsRouteRef = createRouteRef({
|
|
14
|
-
id: "plugin.techdocs.readerPage",
|
|
15
|
-
params: ["namespace", "kind", "name"]
|
|
16
|
-
});
|
|
17
|
-
const TechDocsSearchResultListItemExtension = createSearchResultListItemExtension({
|
|
18
|
-
id: "techdocs",
|
|
19
|
-
configSchema: createSchemaFromZod(
|
|
20
|
-
(z) => z.object({
|
|
21
|
-
// TODO: Define how the icon can be configurable
|
|
22
|
-
title: z.string().optional(),
|
|
23
|
-
lineClamp: z.number().default(5),
|
|
24
|
-
asLink: z.boolean().default(true),
|
|
25
|
-
asListItem: z.boolean().default(true),
|
|
26
|
-
noTrack: z.boolean().default(false)
|
|
27
|
-
})
|
|
28
|
-
),
|
|
29
|
-
predicate: (result) => result.type === "techdocs",
|
|
30
|
-
component: async ({ config }) => {
|
|
31
|
-
const { TechDocsSearchResultListItem } = await import('./esm/TechDocsSearchResultListItem-4736f829.esm.js');
|
|
32
|
-
return (props) => /* @__PURE__ */ React.createElement(TechDocsSearchResultListItem, { ...props, ...config });
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const TechDocsIndexPage = createPageExtension({
|
|
36
|
-
id: "plugin.techdocs.indexPage",
|
|
37
|
-
defaultPath: "/docs",
|
|
38
|
-
routeRef: rootRouteRef,
|
|
39
|
-
loader: () => import('./esm/TechDocsIndexPage-f0a2b203.esm.js').then(function (n) { return n.d; }).then((m) => /* @__PURE__ */ React.createElement(m.TechDocsIndexPage, null))
|
|
40
|
-
});
|
|
41
|
-
const TechDocsReaderPage = createPageExtension({
|
|
42
|
-
id: "plugin.techdocs.readerPage",
|
|
43
|
-
loader: () => import('./esm/index-a1239e83.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.TechDocsReaderPage, null)),
|
|
44
|
-
routeRef: rootDocsRouteRef,
|
|
45
|
-
defaultPath: "/docs/:namespace/:kind/:name/*"
|
|
46
|
-
});
|
|
47
13
|
const techDocsStorage = createApiExtension({
|
|
48
14
|
api: techdocsStorageApiRef,
|
|
49
15
|
factory() {
|
|
@@ -82,15 +48,64 @@ const techDocsClient = createApiExtension({
|
|
|
82
48
|
});
|
|
83
49
|
}
|
|
84
50
|
});
|
|
51
|
+
const TechDocsSearchResultListItemExtension = createSearchResultListItemExtension({
|
|
52
|
+
id: "techdocs",
|
|
53
|
+
configSchema: createSchemaFromZod(
|
|
54
|
+
(z) => z.object({
|
|
55
|
+
// TODO: Define how the icon can be configurable
|
|
56
|
+
title: z.string().optional(),
|
|
57
|
+
lineClamp: z.number().default(5),
|
|
58
|
+
asLink: z.boolean().default(true),
|
|
59
|
+
asListItem: z.boolean().default(true),
|
|
60
|
+
noTrack: z.boolean().default(false)
|
|
61
|
+
})
|
|
62
|
+
),
|
|
63
|
+
predicate: (result) => result.type === "techdocs",
|
|
64
|
+
component: async ({ config }) => {
|
|
65
|
+
const { TechDocsSearchResultListItem } = await import('./esm/TechDocsSearchResultListItem-4736f829.esm.js');
|
|
66
|
+
return (props) => /* @__PURE__ */ React.createElement(TechDocsSearchResultListItem, { ...props, ...config });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const TechDocsIndexPage = createPageExtension({
|
|
70
|
+
id: "plugin.techdocs.indexPage",
|
|
71
|
+
defaultPath: "/docs",
|
|
72
|
+
routeRef: convertLegacyRouteRef(rootRouteRef),
|
|
73
|
+
loader: () => import('./esm/TechDocsIndexPage-a43a1a1c.esm.js').then(function (n) { return n.d; }).then((m) => /* @__PURE__ */ React.createElement(m.TechDocsIndexPage, null))
|
|
74
|
+
});
|
|
75
|
+
const TechDocsReaderPage = createPageExtension({
|
|
76
|
+
id: "plugin.techdocs.readerPage",
|
|
77
|
+
defaultPath: "/docs/:namespace/:kind/:name",
|
|
78
|
+
routeRef: convertLegacyRouteRef(rootDocsRouteRef),
|
|
79
|
+
loader: () => import('./esm/index-9eca466a.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.TechDocsReaderPage, null))
|
|
80
|
+
});
|
|
81
|
+
const TechDocsEntityContent = createEntityContentExtension({
|
|
82
|
+
id: "techdocs",
|
|
83
|
+
defaultPath: "docs",
|
|
84
|
+
defaultTitle: "TechDocs",
|
|
85
|
+
loader: () => import('./esm/Router-1532ca7a.esm.js').then(function (n) { return n.f; }).then((m) => /* @__PURE__ */ React.createElement(m.EmbeddedDocsRouter, null))
|
|
86
|
+
});
|
|
87
|
+
const TechDocsNavItem = createNavItemExtension({
|
|
88
|
+
id: "plugin.techdocs.nav.index",
|
|
89
|
+
icon: LibraryBooks,
|
|
90
|
+
title: "Docs",
|
|
91
|
+
routeRef: convertLegacyRouteRef(rootRouteRef)
|
|
92
|
+
});
|
|
85
93
|
var alpha = createPlugin({
|
|
86
94
|
id: "techdocs",
|
|
87
95
|
extensions: [
|
|
88
|
-
TechDocsIndexPage,
|
|
89
|
-
TechDocsReaderPage,
|
|
90
96
|
techDocsClient,
|
|
91
97
|
techDocsStorage,
|
|
98
|
+
TechDocsNavItem,
|
|
99
|
+
TechDocsIndexPage,
|
|
100
|
+
TechDocsReaderPage,
|
|
101
|
+
TechDocsEntityContent,
|
|
92
102
|
TechDocsSearchResultListItemExtension
|
|
93
|
-
]
|
|
103
|
+
],
|
|
104
|
+
routes: {
|
|
105
|
+
root: convertLegacyRouteRef(rootRouteRef),
|
|
106
|
+
docRoot: convertLegacyRouteRef(rootDocsRouteRef),
|
|
107
|
+
entityContent: convertLegacyRouteRef(rootCatalogDocsRouteRef)
|
|
108
|
+
}
|
|
94
109
|
});
|
|
95
110
|
|
|
96
111
|
export { TechDocsSearchResultListItemExtension, alpha as default };
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.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';\nimport {\n createPlugin,\n createSchemaFromZod,\n createApiExtension,\n createPageExtension,\n} from '@backstage/frontend-plugin-api';\nimport { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha';\nimport {\n configApiRef,\n createApiFactory,\n
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.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';\nimport LibraryBooks from '@material-ui/icons/LibraryBooks';\nimport {\n createPlugin,\n createSchemaFromZod,\n createApiExtension,\n createPageExtension,\n createNavItemExtension,\n} from '@backstage/frontend-plugin-api';\nimport { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha';\nimport {\n configApiRef,\n createApiFactory,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { convertLegacyRouteRef } from '@backstage/core-plugin-api/alpha';\nimport {\n techdocsApiRef,\n techdocsStorageApiRef,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsClient, TechDocsStorageClient } from './client';\nimport {\n rootCatalogDocsRouteRef,\n rootDocsRouteRef,\n rootRouteRef,\n} from './routes';\nimport { createEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';\n\n/** @alpha */\nconst techDocsStorage = createApiExtension({\n api: techdocsStorageApiRef,\n\n factory() {\n return createApiFactory({\n api: techdocsStorageApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n identityApi: identityApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, identityApi, fetchApi }) =>\n new TechDocsStorageClient({\n configApi,\n discoveryApi,\n identityApi,\n fetchApi,\n }),\n });\n },\n});\n\n/** @alpha */\nconst techDocsClient = createApiExtension({\n api: techdocsApiRef,\n factory() {\n return createApiFactory({\n api: techdocsApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n });\n },\n});\n\n/** @alpha */\nexport const TechDocsSearchResultListItemExtension =\n createSearchResultListItemExtension({\n id: 'techdocs',\n configSchema: createSchemaFromZod(z =>\n z.object({\n // TODO: Define how the icon can be configurable\n title: z.string().optional(),\n lineClamp: z.number().default(5),\n asLink: z.boolean().default(true),\n asListItem: z.boolean().default(true),\n noTrack: z.boolean().default(false),\n }),\n ),\n predicate: result => result.type === 'techdocs',\n component: async ({ config }) => {\n const { TechDocsSearchResultListItem } = await import(\n './search/components/TechDocsSearchResultListItem'\n );\n return props => <TechDocsSearchResultListItem {...props} {...config} />;\n },\n });\n\n/**\n * Responsible for rendering the provided router element\n *\n * @alpha\n */\nconst TechDocsIndexPage = createPageExtension({\n id: 'plugin.techdocs.indexPage',\n defaultPath: '/docs',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('./home/components/TechDocsIndexPage').then(m => (\n <m.TechDocsIndexPage />\n )),\n});\n\n/**\n * Component responsible for composing a TechDocs reader page experience\n *\n * @alpha\n */\nconst TechDocsReaderPage = createPageExtension({\n id: 'plugin.techdocs.readerPage',\n defaultPath: '/docs/:namespace/:kind/:name',\n routeRef: convertLegacyRouteRef(rootDocsRouteRef),\n loader: () =>\n import('./reader/components/TechDocsReaderPage').then(m => (\n <m.TechDocsReaderPage />\n )),\n});\n\n/**\n * Component responsible for rendering techdocs on entity pages\n *\n * @alpha\n */\nconst TechDocsEntityContent = createEntityContentExtension({\n id: 'techdocs',\n defaultPath: 'docs',\n defaultTitle: 'TechDocs',\n loader: () => import('./Router').then(m => <m.EmbeddedDocsRouter />),\n});\n\n/** @alpha */\nconst TechDocsNavItem = createNavItemExtension({\n id: 'plugin.techdocs.nav.index',\n icon: LibraryBooks,\n title: 'Docs',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n});\n\n/** @alpha */\nexport default createPlugin({\n id: 'techdocs',\n extensions: [\n techDocsClient,\n techDocsStorage,\n TechDocsNavItem,\n TechDocsIndexPage,\n TechDocsReaderPage,\n TechDocsEntityContent,\n TechDocsSearchResultListItemExtension,\n ],\n routes: {\n root: convertLegacyRouteRef(rootRouteRef),\n docRoot: convertLegacyRouteRef(rootDocsRouteRef),\n entityContent: convertLegacyRouteRef(rootCatalogDocsRouteRef),\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AA+CA,MAAM,kBAAkB,kBAAmB,CAAA;AAAA,EACzC,GAAK,EAAA,qBAAA;AAAA,EAEL,OAAU,GAAA;AACR,IAAA,OAAO,gBAAiB,CAAA;AAAA,MACtB,GAAK,EAAA,qBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,SAAW,EAAA,YAAA;AAAA,QACX,YAAc,EAAA,eAAA;AAAA,QACd,WAAa,EAAA,cAAA;AAAA,QACb,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,WAAa,EAAA,QAAA,EAChD,KAAA,IAAI,qBAAsB,CAAA;AAAA,QACxB,SAAA;AAAA,QACA,YAAA;AAAA,QACA,WAAA;AAAA,QACA,QAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA,CAAA;AAAA,GACH;AACF,CAAC,CAAA,CAAA;AAGD,MAAM,iBAAiB,kBAAmB,CAAA;AAAA,EACxC,GAAK,EAAA,cAAA;AAAA,EACL,OAAU,GAAA;AACR,IAAA,OAAO,gBAAiB,CAAA;AAAA,MACtB,GAAK,EAAA,cAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,SAAW,EAAA,YAAA;AAAA,QACX,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,QAAS,EAAA,KAC5C,IAAI,cAA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xC,OAAA,EAAS,sBAAsB,gBAAgB,CAAA;AAAA,IAC/C,aAAA,EAAe,sBAAsB,uBAAuB,CAAA;AAAA,GAC9D;AACF,CAAC,CAAA;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { b as rootDocsRouteRef } from './routes-691e552c.esm.js';
|
|
2
|
+
import { t as toLowerMaybe } from './TechDocsIndexPage-a43a1a1c.esm.js';
|
|
3
|
+
import { useRouteRef, useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
4
|
+
import { ItemCardGrid, ItemCardHeader, LinkButton } from '@backstage/core-components';
|
|
5
|
+
import { Card, CardMedia, CardContent, CardActions } from '@material-ui/core';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
const DocsCardGrid = (props) => {
|
|
9
|
+
const { entities } = props;
|
|
10
|
+
const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);
|
|
11
|
+
const config = useApi(configApiRef);
|
|
12
|
+
if (!entities)
|
|
13
|
+
return null;
|
|
14
|
+
return /* @__PURE__ */ React.createElement(ItemCardGrid, { "data-testid": "docs-explore" }, !(entities == null ? void 0 : entities.length) ? null : entities.map((entity, index) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Card, { key: index }, /* @__PURE__ */ React.createElement(CardMedia, null, /* @__PURE__ */ React.createElement(
|
|
17
|
+
ItemCardHeader,
|
|
18
|
+
{
|
|
19
|
+
title: (_a = entity.metadata.title) != null ? _a : entity.metadata.name
|
|
20
|
+
}
|
|
21
|
+
)), /* @__PURE__ */ React.createElement(CardContent, null, entity.metadata.description), /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement(
|
|
22
|
+
LinkButton,
|
|
23
|
+
{
|
|
24
|
+
to: getRouteToReaderPageFor({
|
|
25
|
+
namespace: toLowerMaybe(
|
|
26
|
+
(_b = entity.metadata.namespace) != null ? _b : "default",
|
|
27
|
+
config
|
|
28
|
+
),
|
|
29
|
+
kind: toLowerMaybe(entity.kind, config),
|
|
30
|
+
name: toLowerMaybe(entity.metadata.name, config)
|
|
31
|
+
}),
|
|
32
|
+
color: "primary",
|
|
33
|
+
"data-testid": "read_docs"
|
|
34
|
+
},
|
|
35
|
+
"Read Docs"
|
|
36
|
+
)));
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { DocsCardGrid as D };
|
|
41
|
+
//# sourceMappingURL=DocsCardGrid-66754d32.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocsCardGrid-66754d32.esm.js","sources":["../../src/home/components/Grids/DocsCardGrid.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 { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n LinkButton,\n ItemCardGrid,\n ItemCardHeader,\n} from '@backstage/core-components';\nimport { Card, CardActions, CardContent, CardMedia } from '@material-ui/core';\nimport React from 'react';\n\n/**\n * Props for {@link DocsCardGrid}\n *\n * @public\n */\nexport type DocsCardGridProps = {\n entities: Entity[] | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a item card for each entity\n *\n * @public\n */\nexport const DocsCardGrid = (props: DocsCardGridProps) => {\n const { entities } = props;\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n return (\n <ItemCardGrid data-testid=\"docs-explore\">\n {!entities?.length\n ? null\n : entities.map((entity, index: number) => (\n <Card key={index}>\n <CardMedia>\n <ItemCardHeader\n title={entity.metadata.title ?? entity.metadata.name}\n />\n </CardMedia>\n <CardContent>{entity.metadata.description}</CardContent>\n <CardActions>\n <LinkButton\n to={getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n })}\n color=\"primary\"\n data-testid=\"read_docs\"\n >\n Read Docs\n </LinkButton>\n </CardActions>\n </Card>\n ))}\n </ItemCardGrid>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0Ca,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA,EAAE,UAAa,GAAA,KAAA,CAAA;AACrB,EAAM,MAAA,uBAAA,GAA0B,YAAY,gBAAgB,CAAA,CAAA;AAC5D,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA,CAAA;AAClC,EAAA,IAAI,CAAC,QAAA;AAAU,IAAO,OAAA,IAAA,CAAA;AACtB,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,aAAY,EAAA,cAAA,EAAA,EACvB,EAAC,QAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAU,MACR,CAAA,GAAA,IAAA,GACA,QAAS,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,KAAe,KAAA;AAnD/C,IAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAoDY,IAAA,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,GAAA,EAAK,KACT,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,QAAO,EAAO,GAAA,MAAA,CAAA,QAAA,CAAS,KAAhB,KAAA,IAAA,GAAA,EAAA,GAAyB,OAAO,QAAS,CAAA,IAAA;AAAA,OAAA;AAAA,KAEpD,mBACC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,IAAA,EAAa,OAAO,QAAS,CAAA,WAAY,CAC1C,kBAAA,KAAA,CAAA,aAAA,CAAC,WACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,IAAI,uBAAwB,CAAA;AAAA,UAC1B,SAAW,EAAA,YAAA;AAAA,YACT,CAAA,EAAA,GAAA,MAAA,CAAO,QAAS,CAAA,SAAA,KAAhB,IAA6B,GAAA,EAAA,GAAA,SAAA;AAAA,YAC7B,MAAA;AAAA,WACF;AAAA,UACA,IAAM,EAAA,YAAA,CAAa,MAAO,CAAA,IAAA,EAAM,MAAM,CAAA;AAAA,UACtC,IAAM,EAAA,YAAA,CAAa,MAAO,CAAA,QAAA,CAAS,MAAM,MAAM,CAAA;AAAA,SAChD,CAAA;AAAA,QACD,KAAM,EAAA,SAAA;AAAA,QACN,aAAY,EAAA,WAAA;AAAA,OAAA;AAAA,MACb,WAAA;AAAA,KAGH,CACF,CAAA,CAAA;AAAA,GACD,CACP,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Routes, Route, useRoutes } from 'react-router-dom';
|
|
3
|
+
import { getCompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';
|
|
4
|
+
import { techdocsStorageApiRef, techdocsApiRef } from '@backstage/plugin-techdocs-react';
|
|
5
|
+
import { a as TechDocsStorageClient, T as TechDocsClient, r as rootRouteRef, b as rootDocsRouteRef, c as rootCatalogDocsRouteRef } from './routes-691e552c.esm.js';
|
|
6
|
+
import { createPlugin, createApiFactory, configApiRef, discoveryApiRef, identityApiRef, fetchApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
7
|
+
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react';
|
|
8
|
+
import { d as TechDocsReaderPageSubheader, c as TechDocsReaderPageContent, f as TechDocsReaderPage$1 } from './TechDocsReaderPage-89ab8b88.esm.js';
|
|
9
|
+
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
10
|
+
import { c as TechDocsIndexPage$1 } from './TechDocsIndexPage-a43a1a1c.esm.js';
|
|
11
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
12
|
+
|
|
13
|
+
const techdocsPlugin = createPlugin({
|
|
14
|
+
id: "techdocs",
|
|
15
|
+
apis: [
|
|
16
|
+
createApiFactory({
|
|
17
|
+
api: techdocsStorageApiRef,
|
|
18
|
+
deps: {
|
|
19
|
+
configApi: configApiRef,
|
|
20
|
+
discoveryApi: discoveryApiRef,
|
|
21
|
+
identityApi: identityApiRef,
|
|
22
|
+
fetchApi: fetchApiRef
|
|
23
|
+
},
|
|
24
|
+
factory: ({ configApi, discoveryApi, identityApi, fetchApi }) => new TechDocsStorageClient({
|
|
25
|
+
configApi,
|
|
26
|
+
discoveryApi,
|
|
27
|
+
identityApi,
|
|
28
|
+
fetchApi
|
|
29
|
+
})
|
|
30
|
+
}),
|
|
31
|
+
createApiFactory({
|
|
32
|
+
api: techdocsApiRef,
|
|
33
|
+
deps: {
|
|
34
|
+
configApi: configApiRef,
|
|
35
|
+
discoveryApi: discoveryApiRef,
|
|
36
|
+
fetchApi: fetchApiRef
|
|
37
|
+
},
|
|
38
|
+
factory: ({ configApi, discoveryApi, fetchApi }) => new TechDocsClient({
|
|
39
|
+
configApi,
|
|
40
|
+
discoveryApi,
|
|
41
|
+
fetchApi
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
],
|
|
45
|
+
routes: {
|
|
46
|
+
root: rootRouteRef,
|
|
47
|
+
docRoot: rootDocsRouteRef,
|
|
48
|
+
entityContent: rootCatalogDocsRouteRef
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const TechdocsPage = techdocsPlugin.provide(
|
|
52
|
+
createRoutableExtension({
|
|
53
|
+
name: "TechdocsPage",
|
|
54
|
+
component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router),
|
|
55
|
+
mountPoint: rootRouteRef
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
const EntityTechdocsContent = techdocsPlugin.provide(
|
|
59
|
+
createRoutableExtension({
|
|
60
|
+
name: "EntityTechdocsContent",
|
|
61
|
+
component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.EmbeddedDocsRouter),
|
|
62
|
+
mountPoint: rootCatalogDocsRouteRef
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
const TechDocsCustomHome = techdocsPlugin.provide(
|
|
66
|
+
createRoutableExtension({
|
|
67
|
+
name: "TechDocsCustomHome",
|
|
68
|
+
component: () => import('./TechDocsCustomHome-114f3198.esm.js').then(
|
|
69
|
+
(m) => m.TechDocsCustomHome
|
|
70
|
+
),
|
|
71
|
+
mountPoint: rootRouteRef
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
const TechDocsIndexPage = techdocsPlugin.provide(
|
|
75
|
+
createRoutableExtension({
|
|
76
|
+
name: "TechDocsIndexPage",
|
|
77
|
+
component: () => import('./TechDocsIndexPage-a43a1a1c.esm.js').then(function (n) { return n.d; }).then(
|
|
78
|
+
(m) => m.TechDocsIndexPage
|
|
79
|
+
),
|
|
80
|
+
mountPoint: rootRouteRef
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
const TechDocsReaderPage = techdocsPlugin.provide(
|
|
84
|
+
createRoutableExtension({
|
|
85
|
+
name: "TechDocsReaderPage",
|
|
86
|
+
component: () => import('./index-9eca466a.esm.js').then(
|
|
87
|
+
(m) => m.TechDocsReaderPage
|
|
88
|
+
),
|
|
89
|
+
mountPoint: rootDocsRouteRef
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
const TechDocsSearchResultListItem = techdocsPlugin.provide(
|
|
93
|
+
createSearchResultListItemExtension({
|
|
94
|
+
name: "TechDocsSearchResultListItem",
|
|
95
|
+
component: () => import('./TechDocsSearchResultListItem-4736f829.esm.js').then(
|
|
96
|
+
(m) => m.TechDocsSearchResultListItem
|
|
97
|
+
),
|
|
98
|
+
predicate: (result) => result.type === "techdocs"
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const TECHDOCS_EXTERNAL_ANNOTATION$1 = "backstage.io/techdocs-entity";
|
|
103
|
+
const EntityPageDocs = ({ entity }) => {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
let entityRef = getCompoundEntityRef(entity);
|
|
106
|
+
if ((_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_EXTERNAL_ANNOTATION$1]) {
|
|
107
|
+
try {
|
|
108
|
+
entityRef = parseEntityRef(
|
|
109
|
+
(_b = entity.metadata.annotations) == null ? void 0 : _b[TECHDOCS_EXTERNAL_ANNOTATION$1]
|
|
110
|
+
);
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return /* @__PURE__ */ React.createElement(TechDocsReaderPage, { entityRef }, /* @__PURE__ */ React.createElement(TechDocsReaderPageSubheader, null), /* @__PURE__ */ React.createElement(TechDocsReaderPageContent, { withSearch: false }));
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const TECHDOCS_ANNOTATION = "backstage.io/techdocs-ref";
|
|
118
|
+
const TECHDOCS_EXTERNAL_ANNOTATION = "backstage.io/techdocs-entity";
|
|
119
|
+
const isTechDocsAvailable = (entity) => {
|
|
120
|
+
var _a, _b, _c, _d;
|
|
121
|
+
return Boolean((_b = (_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b[TECHDOCS_ANNOTATION]) || Boolean((_d = (_c = entity == null ? void 0 : entity.metadata) == null ? void 0 : _c.annotations) == null ? void 0 : _d[TECHDOCS_EXTERNAL_ANNOTATION]);
|
|
122
|
+
};
|
|
123
|
+
const Router = () => {
|
|
124
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(TechDocsIndexPage$1, null) }), /* @__PURE__ */ React.createElement(
|
|
125
|
+
Route,
|
|
126
|
+
{
|
|
127
|
+
path: "/:namespace/:kind/:name/*",
|
|
128
|
+
element: /* @__PURE__ */ React.createElement(TechDocsReaderPage$1, null)
|
|
129
|
+
}
|
|
130
|
+
));
|
|
131
|
+
};
|
|
132
|
+
const EmbeddedDocsRouter = (props) => {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
const { children } = props;
|
|
135
|
+
const { entity } = useEntity();
|
|
136
|
+
const element = useRoutes([
|
|
137
|
+
{
|
|
138
|
+
path: "/*",
|
|
139
|
+
element: /* @__PURE__ */ React.createElement(EntityPageDocs, { entity }),
|
|
140
|
+
children: [
|
|
141
|
+
{
|
|
142
|
+
path: "*",
|
|
143
|
+
element: children
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
]);
|
|
148
|
+
const projectId = ((_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_ANNOTATION]) || ((_b = entity.metadata.annotations) == null ? void 0 : _b[TECHDOCS_EXTERNAL_ANNOTATION]);
|
|
149
|
+
if (!projectId) {
|
|
150
|
+
return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: [TECHDOCS_ANNOTATION] });
|
|
151
|
+
}
|
|
152
|
+
return element;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
var Router$1 = /*#__PURE__*/Object.freeze({
|
|
156
|
+
__proto__: null,
|
|
157
|
+
isTechDocsAvailable: isTechDocsAvailable,
|
|
158
|
+
Router: Router,
|
|
159
|
+
EmbeddedDocsRouter: EmbeddedDocsRouter
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export { EntityTechdocsContent as E, Router as R, TechDocsCustomHome as T, TechDocsIndexPage as a, TechdocsPage as b, TechDocsReaderPage as c, TechDocsSearchResultListItem as d, EmbeddedDocsRouter as e, Router$1 as f, isTechDocsAvailable as i, techdocsPlugin as t };
|
|
163
|
+
//# sourceMappingURL=Router-1532ca7a.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Router-1532ca7a.esm.js","sources":["../../src/plugin.ts","../../src/EntityPageDocs.tsx","../../src/Router.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 {\n techdocsApiRef,\n techdocsStorageApiRef,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsClient, TechDocsStorageClient } from './client';\nimport {\n rootDocsRouteRef,\n rootRouteRef,\n rootCatalogDocsRouteRef,\n} from './routes';\nimport {\n configApiRef,\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n createSearchResultListItemExtension,\n SearchResultListItemExtensionProps,\n} from '@backstage/plugin-search-react';\nimport { TechDocsSearchResultListItemProps } from './search/components/TechDocsSearchResultListItem';\n\n/**\n * The Backstage plugin that renders technical documentation for your components\n *\n * @public\n */\nexport const techdocsPlugin = createPlugin({\n id: 'techdocs',\n apis: [\n createApiFactory({\n api: techdocsStorageApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n identityApi: identityApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, identityApi, fetchApi }) =>\n new TechDocsStorageClient({\n configApi,\n discoveryApi,\n identityApi,\n fetchApi,\n }),\n }),\n createApiFactory({\n api: techdocsApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n docRoot: rootDocsRouteRef,\n entityContent: rootCatalogDocsRouteRef,\n },\n});\n\n/**\n * Routable extension used to render docs\n *\n * @public\n */\nexport const TechdocsPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechdocsPage',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Routable extension used to render docs on Entity page\n *\n * @public\n */\nexport const EntityTechdocsContent = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechdocsContent',\n component: () => import('./Router').then(m => m.EmbeddedDocsRouter),\n mountPoint: rootCatalogDocsRouteRef,\n }),\n);\n\n/**\n * Component which takes a custom tabs config object and renders a documentation landing page.\n *\n * @public\n */\nexport const TechDocsCustomHome = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsCustomHome',\n component: () =>\n import('./home/components/TechDocsCustomHome').then(\n m => m.TechDocsCustomHome,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Responsible for rendering the provided router element\n *\n * @public\n */\nexport const TechDocsIndexPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsIndexPage',\n component: () =>\n import('./home/components/TechDocsIndexPage').then(\n m => m.TechDocsIndexPage,\n ),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Component responsible for composing a TechDocs reader page experience\n *\n * @public\n */\nexport const TechDocsReaderPage = techdocsPlugin.provide(\n createRoutableExtension({\n name: 'TechDocsReaderPage',\n component: () =>\n import('./reader/components/TechDocsReaderPage').then(\n m => m.TechDocsReaderPage,\n ),\n mountPoint: rootDocsRouteRef,\n }),\n);\n\n/**\n * React extension used to render results on Search page or modal\n *\n * @public\n */\nexport const TechDocsSearchResultListItem: (\n props: SearchResultListItemExtensionProps<TechDocsSearchResultListItemProps>,\n) => JSX.Element | null = techdocsPlugin.provide(\n createSearchResultListItemExtension({\n name: 'TechDocsSearchResultListItem',\n component: () =>\n import('./search/components/TechDocsSearchResultListItem').then(\n m => m.TechDocsSearchResultListItem,\n ),\n predicate: result => result.type === 'techdocs',\n }),\n);\n","/*\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 {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\n\nimport React from 'react';\nimport { TechDocsReaderPage } from './plugin';\nimport { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';\nimport { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\ntype EntityPageDocsProps = { entity: Entity };\n\nexport const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {\n let entityRef = getCompoundEntityRef(entity);\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n entityRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n } catch {\n // not a fan of this but we don't care if the parseEntityRef fails\n }\n }\n\n return (\n <TechDocsReaderPage entityRef={entityRef}>\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={false} />\n </TechDocsReaderPage>\n );\n};\n","/*\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 React, { PropsWithChildren } from 'react';\nimport { Route, Routes, useRoutes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { EntityPageDocs } from './EntityPageDocs';\nimport { MissingAnnotationEmptyState } from '@backstage/core-components';\nimport { TechDocsIndexPage } from './home/components/TechDocsIndexPage';\nimport { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nconst TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\n/**\n * Helper that takes in entity and returns true/false if TechDocs is available for the entity\n *\n * @public\n */\nexport const isTechDocsAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) ||\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);\n\n/**\n * Responsible for registering routes for TechDocs, TechDocs Homepage and separate TechDocs page\n *\n * @public\n */\nexport const Router = () => {\n return (\n <Routes>\n <Route path=\"/\" element={<TechDocsIndexPage />} />\n <Route\n path=\"/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n />\n </Routes>\n );\n};\n\n/**\n * Responsible for registering route to view docs on Entity page\n *\n * @public\n */\nexport const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {\n const { children } = props;\n const { entity } = useEntity();\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '/*',\n element: <EntityPageDocs entity={entity} />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n const projectId =\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION];\n\n if (!projectId) {\n return <MissingAnnotationEmptyState annotation={[TECHDOCS_ANNOTATION]} />;\n }\n\n return element;\n};\n"],"names":["TECHDOCS_EXTERNAL_ANNOTATION","TechDocsIndexPage","TechDocsReaderPage"],"mappings":";;;;;;;;;;;;AA8CO,MAAM,iBAAiB,YAAa,CAAA;AAAA,EACzC,EAAI,EAAA,UAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,qBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,SAAW,EAAA,YAAA;AAAA,QACX,YAAc,EAAA,eAAA;AAAA,QACd,WAAa,EAAA,cAAA;AAAA,QACb,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,WAAa,EAAA,QAAA,EAChD,KAAA,IAAI,qBAAsB,CAAA;AAAA,QACxB,SAAA;AAAA,QACA,YAAA;AAAA,QACA,WAAA;AAAA,QACA,QAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,IACD,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,cAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,SAAW,EAAA,YAAA;AAAA,QACX,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,QAAS,EAAA,KAC5C,IAAI,cAAe,CAAA;AAAA,QACjB,SAAA;AAAA,QACA,YAAA;AAAA,QACA,QAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,IACN,OAAS,EAAA,gBAAA;AAAA,IACT,aAAe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A,GAAI,SAAU,EAAA,CAAA;AAG7B,EAAA,MAAM,UAAU,SAAU,CAAA;AAAA,IACxB;AAAA,MACE,IAAM,EAAA,IAAA;AAAA,MACN,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,MAAgB,EAAA,CAAA;AAAA,MACzC,QAAU,EAAA;AAAA,QACR;AAAA,UACE,IAAM,EAAA,GAAA;AAAA,UACN,OAAS,EAAA,QAAA;AAAA,SACX;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAM,MAAA,SAAA,GAAA,CAAA,CACJ,YAAO,QAAS,CAAA,WAAA,KAAhB,mBAA8B,mBAC9B,CAAA,MAAA,CAAA,EAAA,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,KAAhB,IAA8B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,4BAAA,CAAA,CAAA,CAAA;AAEhC,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,2BAAA,EAAA,EAA4B,UAAY,EAAA,CAAC,mBAAmB,CAAG,EAAA,CAAA,CAAA;AAAA,GACzE;AAEA,EAAO,OAAA,OAAA,CAAA;AACT;;;;;;;;;;;"}
|
|
@@ -2,41 +2,21 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import useAsync from 'react-use/lib/useAsync';
|
|
3
3
|
import { makeStyles } from '@material-ui/core';
|
|
4
4
|
import { catalogApiRef, CATALOG_FILTER_EXISTS, useEntityOwnership } from '@backstage/plugin-catalog-react';
|
|
5
|
-
import {
|
|
6
|
-
import { DocsCardGrid } from '
|
|
5
|
+
import { T as TechDocsPageWrapper, D as DocsTable } from './TechDocsIndexPage-a43a1a1c.esm.js';
|
|
6
|
+
import { D as DocsCardGrid } from './DocsCardGrid-66754d32.esm.js';
|
|
7
7
|
import { Content, Progress, WarningPanel, CodeSnippet, HeaderTabs, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
8
8
|
import { useApi } from '@backstage/core-plugin-api';
|
|
9
9
|
import 'react-router-dom';
|
|
10
10
|
import 'react-use/lib/useCopyToClipboard';
|
|
11
11
|
import 'lodash';
|
|
12
12
|
import '@backstage/catalog-model';
|
|
13
|
-
import './routes-
|
|
13
|
+
import './routes-691e552c.esm.js';
|
|
14
|
+
import '@backstage/errors';
|
|
15
|
+
import 'event-source-polyfill';
|
|
14
16
|
import '@material-ui/icons/Share';
|
|
15
17
|
import '@material-ui/styles';
|
|
16
18
|
import '@material-ui/icons/Star';
|
|
17
19
|
import '@material-ui/icons/StarBorder';
|
|
18
|
-
import './client-3113b6a6.esm.js';
|
|
19
|
-
import '@backstage/errors';
|
|
20
|
-
import 'event-source-polyfill';
|
|
21
|
-
import './TechDocsReaderPage-ac1d5884.esm.js';
|
|
22
|
-
import '@backstage/plugin-techdocs-react';
|
|
23
|
-
import '@backstage/plugin-search-react';
|
|
24
|
-
import './TechDocsSearchResultListItem-4736f829.esm.js';
|
|
25
|
-
import '@material-ui/core/Typography';
|
|
26
|
-
import '@material-ui/lab';
|
|
27
|
-
import '@material-ui/icons/Close';
|
|
28
|
-
import 'react-use/lib/useAsyncRetry';
|
|
29
|
-
import '@backstage/integration-react';
|
|
30
|
-
import 'dompurify';
|
|
31
|
-
import '@backstage/integration';
|
|
32
|
-
import '@material-ui/icons/FeedbackOutlined';
|
|
33
|
-
import 'git-url-parse';
|
|
34
|
-
import '@material-ui/icons/Menu';
|
|
35
|
-
import '@material-ui/core/IconButton';
|
|
36
|
-
import 'react-helmet';
|
|
37
|
-
import '@material-ui/core/styles';
|
|
38
|
-
import '@material-ui/icons/Code';
|
|
39
|
-
import '@material-ui/icons/Settings';
|
|
40
20
|
|
|
41
21
|
const panels = {
|
|
42
22
|
DocsTable,
|
|
@@ -130,4 +110,4 @@ const TechDocsCustomHome = (props) => {
|
|
|
130
110
|
};
|
|
131
111
|
|
|
132
112
|
export { TechDocsCustomHome };
|
|
133
|
-
//# sourceMappingURL=TechDocsCustomHome-
|
|
113
|
+
//# sourceMappingURL=TechDocsCustomHome-114f3198.esm.js.map
|
package/dist/esm/{TechDocsCustomHome-63a41580.esm.js.map → TechDocsCustomHome-114f3198.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsCustomHome-
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-114f3198.esm.js","sources":["../../src/home/components/TechDocsCustomHome.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, { useState } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { makeStyles } from '@material-ui/core';\nimport { CSSProperties } from '@material-ui/styles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable } from './Tables';\nimport { DocsCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType = 'DocsCardGrid' | 'DocsTable';\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\nconst CustomPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n return (\n <>\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n <div className={classes.panelContainer}>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n 'metadata.annotations.backstage.io/techdocs-ref': CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.['backstage.io/techdocs-ref'];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AACF,CAAA,CAAA;AAuCA,MAAM,cAAc,CAAC;AAAA,EACnB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACd,GAAI,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,WAAW,EAAC;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAkB,EAAA,aAAA,KAAkB,kBAAmB,EAAA,CAAA;AAExE,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,MAAA,CAAO,SAAS,CAAA,CAAA;AAErC,EAAM,MAAA,aAAA,GAAgB,QAAS,CAAA,M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,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,aAAe,EAAA,WAAA;AAAA,MACf,QAAA,EAAU,CAAS,KAAA,KAAA,cAAA,CAAe,KAAK,CAAA;AAAA,MACvC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,KAAA,IAAS,KAAW,MAAA;AAAA,QAC1C,EAAA,EAAI,MAAM,QAAS,EAAA;AAAA,QACnB,KAAA;AAAA,OACA,CAAA,CAAA;AAAA,KAAA;AAAA,GACJ,kBACC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,aAAY,EAAA,kBAAA,EAAA,EAClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,KACpC,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,KAAA;AAAA,MACL,MAAA;AAAA,MACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,MACnC,KAAA;AAAA,KAAA;AAAA,GAEH,CACH,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -6,7 +6,7 @@ import { useRouteRef, useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
|
6
6
|
import useCopyToClipboard from 'react-use/lib/useCopyToClipboard';
|
|
7
7
|
import { capitalize } from 'lodash';
|
|
8
8
|
import { RELATION_OWNED_BY } from '@backstage/catalog-model';
|
|
9
|
-
import {
|
|
9
|
+
import { b as rootDocsRouteRef } from './routes-691e552c.esm.js';
|
|
10
10
|
import ShareIcon from '@material-ui/icons/Share';
|
|
11
11
|
import { withStyles } from '@material-ui/styles';
|
|
12
12
|
import Star from '@material-ui/icons/Star';
|
|
@@ -253,5 +253,5 @@ var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
|
|
|
253
253
|
TechDocsIndexPage: TechDocsIndexPage
|
|
254
254
|
});
|
|
255
255
|
|
|
256
|
-
export { DocsTable as D, EntityListDocsTable as E,
|
|
257
|
-
//# sourceMappingURL=TechDocsIndexPage-
|
|
256
|
+
export { DocsTable as D, EntityListDocsTable as E, TechDocsPageWrapper as T, DefaultTechDocsHome as a, TechDocsPicker as b, TechDocsIndexPage as c, TechDocsIndexPage$1 as d, toLowerMaybe as t };
|
|
257
|
+
//# sourceMappingURL=TechDocsIndexPage-a43a1a1c.esm.js.map
|