@backstage/plugin-techdocs 1.17.7-next.1 → 1.17.8-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/config.schema.json +57 -0
- package/dist/alpha.d.ts +45 -1
- package/dist/alpha.esm.js +1 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/home/components/DefaultTechDocsHome.esm.js +4 -1
- package/dist/home/components/DefaultTechDocsHome.esm.js.map +1 -1
- package/dist/home/components/Grids/InfoCardGrid.esm.js +1 -1
- package/dist/home/components/Grids/InfoCardGrid.esm.js.map +1 -1
- package/dist/home/components/Tables/CursorPaginatedDocsTable.esm.js +18 -1
- package/dist/home/components/Tables/CursorPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/DocsTable.esm.js +24 -6
- package/dist/home/components/Tables/DocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/EntityListDocsTable.esm.js +9 -11
- package/dist/home/components/Tables/EntityListDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/OffsetPaginatedDocsTable.esm.js +18 -1
- package/dist/home/components/Tables/OffsetPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/actions.esm.js +5 -4
- package/dist/home/components/Tables/actions.esm.js.map +1 -1
- package/dist/home/components/Tables/columns.esm.js +13 -5
- package/dist/home/components/Tables/columns.esm.js.map +1 -1
- package/dist/home/components/TechDocsCustomHome.esm.js +6 -9
- package/dist/home/components/TechDocsCustomHome.esm.js.map +1 -1
- package/dist/home/components/TechDocsPageWrapper.esm.js +6 -2
- package/dist/home/components/TechDocsPageWrapper.esm.js.map +1 -1
- package/dist/index.d.ts +40 -56
- package/dist/plugins/techdocs/package.json.esm.js +1 -1
- package/dist/reader/components/TechDocsBuildLogs.esm.js +8 -4
- package/dist/reader/components/TechDocsBuildLogs.esm.js.map +1 -1
- package/dist/reader/components/TechDocsNotFound.esm.js +5 -2
- package/dist/reader/components/TechDocsNotFound.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js +12 -3
- package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js +4 -1
- package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js +4 -1
- package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js.map +1 -1
- package/dist/reader/components/TechDocsStateIndicator.esm.js +9 -6
- package/dist/reader/components/TechDocsStateIndicator.esm.js.map +1 -1
- package/dist/search/components/TechDocsSearch.esm.js +7 -2
- package/dist/search/components/TechDocsSearch.esm.js.map +1 -1
- package/dist/translation.esm.js +89 -0
- package/dist/translation.esm.js.map +1 -1
- package/package.json +20 -20
- package/config.d.ts +0 -73
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
+
## 1.17.8-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 65c7f98: Fixed duplicate React key warnings when documentation entities share a name across different namespaces or kinds.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-react@3.2.0-next.0
|
|
10
|
+
- @backstage/ui@0.17.0-next.0
|
|
11
|
+
- @backstage/frontend-plugin-api@0.17.3-next.0
|
|
12
|
+
- @backstage/plugin-search-react@1.11.6-next.0
|
|
13
|
+
- @backstage/catalog-client@1.16.1-next.0
|
|
14
|
+
- @backstage/core-components@0.18.12-next.0
|
|
15
|
+
- @backstage/core-plugin-api@1.12.8-next.0
|
|
16
|
+
- @backstage/integration-react@1.2.20-next.0
|
|
17
|
+
- @backstage/plugin-auth-react@0.1.29-next.0
|
|
18
|
+
- @backstage/plugin-techdocs-react@1.3.13-next.0
|
|
19
|
+
|
|
20
|
+
## 1.17.7
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 460c597: Added missing i18n support for TechDocs plugin components including:
|
|
25
|
+
|
|
26
|
+
- Search components (placeholder text, no results message)
|
|
27
|
+
- Table components (column headers, pagination, toolbar, actions, empty states)
|
|
28
|
+
- Home page components (support button, page wrapper title/subtitle)
|
|
29
|
+
- Reader components (build logs, not found errors, state indicators, settings)
|
|
30
|
+
- Error messages and navigation labels
|
|
31
|
+
|
|
32
|
+
Also exported `techdocsTranslationRef` from the alpha entrypoint for external use.
|
|
33
|
+
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
- @backstage/catalog-client@1.16.0
|
|
36
|
+
- @backstage/plugin-catalog-react@3.1.0
|
|
37
|
+
- @backstage/core-components@0.18.11
|
|
38
|
+
- @backstage/plugin-search-react@1.11.5
|
|
39
|
+
- @backstage/integration@2.0.3
|
|
40
|
+
- @backstage/frontend-plugin-api@0.17.2
|
|
41
|
+
- @backstage/ui@0.16.0
|
|
42
|
+
- @backstage/core-plugin-api@1.12.7
|
|
43
|
+
- @backstage/integration-react@1.2.19
|
|
44
|
+
- @backstage/plugin-auth-react@0.1.28
|
|
45
|
+
- @backstage/plugin-techdocs-react@1.3.12
|
|
46
|
+
|
|
3
47
|
## 1.17.7-next.1
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"techdocs": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"builder": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": [
|
|
11
|
+
"local",
|
|
12
|
+
"external"
|
|
13
|
+
],
|
|
14
|
+
"description": "Documentation building process depends on the builder attr",
|
|
15
|
+
"visibility": "frontend"
|
|
16
|
+
},
|
|
17
|
+
"legacyUseCaseSensitiveTripletPaths": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "Allows fallback to case-sensitive triplets in case of migration issues.",
|
|
20
|
+
"visibility": "frontend"
|
|
21
|
+
},
|
|
22
|
+
"sanitizer": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"allowedIframeHosts": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"description": "Allows iframe tag only for listed hosts Example: allowedIframeHosts: [\"example.com\"] this will allow all iframes with the host `example.com` in the src attribute",
|
|
31
|
+
"visibility": "frontend"
|
|
32
|
+
},
|
|
33
|
+
"allowedCustomElementTagNameRegExp": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Allows listed custom element tag name regex Example: allowedCustomElementTagNameRegExp: '^backstage-' this will allow all custom elements with tag name matching `^backstage-` like <backstage-custom-element /> etc.",
|
|
36
|
+
"visibility": "frontend"
|
|
37
|
+
},
|
|
38
|
+
"allowedCustomElementAttributeNameRegExp": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Allows listed custom element attribute name regex Example: allowedCustomElementAttributeNameRegExp: 'attribute1|attribute2' this will allow all custom element attributes matching `attribute1` or `attribute2` like <backstage-custom-element attribute1=\"yes\" attribute2/>",
|
|
41
|
+
"visibility": "frontend"
|
|
42
|
+
},
|
|
43
|
+
"additionalAllowedURIProtocols": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"description": "Allows listed protocols in attributes with URI values Example: additionalAllowedURIProtocols: ['vscode'] this will allow all attributes with URI values to have `vscode` protocol like `vscode://some/path` in addition to the default protocols matched by DOMPurify's IS_ALLOWED_URI RegExp:",
|
|
49
|
+
"visibility": "frontend"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"description": "Configuration options for the techdocs plugin"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -8,6 +8,50 @@ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api'
|
|
|
8
8
|
import * as react from 'react';
|
|
9
9
|
import * as _backstage_plugin_search_react_alpha from '@backstage/plugin-search-react/alpha';
|
|
10
10
|
|
|
11
|
+
/** @alpha */
|
|
12
|
+
declare const techdocsTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"techdocs", {
|
|
13
|
+
readonly "search.placeholder": "Search {{entityTitle}} docs";
|
|
14
|
+
readonly "search.noResults": "No results found";
|
|
15
|
+
readonly "error.couldNotLoad": "Could not load available documentation.";
|
|
16
|
+
readonly "nav.title": "Docs";
|
|
17
|
+
readonly "table.columns.type": "Type";
|
|
18
|
+
readonly "table.columns.document": "Document";
|
|
19
|
+
readonly "table.columns.kind": "Kind";
|
|
20
|
+
readonly "table.columns.owner": "Owner";
|
|
21
|
+
readonly "table.body.emptyDataSourceMessage": "No records to display";
|
|
22
|
+
readonly "table.header.actions": "Actions";
|
|
23
|
+
readonly "table.title.all": "All";
|
|
24
|
+
readonly "table.toolbar.searchPlaceholder": "Filter";
|
|
25
|
+
readonly "table.actions.addToFavorites": "Add to favorites";
|
|
26
|
+
readonly "table.actions.removeFromFavorites": "Remove from favorites";
|
|
27
|
+
readonly "table.actions.copyDocsUrl": "Click to copy documentation link to clipboard";
|
|
28
|
+
readonly "table.pagination.labelRowsSelect": "rows";
|
|
29
|
+
readonly "table.emptyState.title": "No documents to show";
|
|
30
|
+
readonly "table.emptyState.description": "Create your own document. Check out our Getting Started Information";
|
|
31
|
+
readonly "table.emptyState.docsButton": "DOCS";
|
|
32
|
+
readonly "home.supportButton": "Discover documentation in your ecosystem.";
|
|
33
|
+
readonly "aboutCard.viewTechdocs": "View TechDocs";
|
|
34
|
+
readonly "notFound.title": "Documentation not found";
|
|
35
|
+
readonly "notFound.builderNote": "Note that techdocs.builder is not set to 'local' in your config, which means this Backstage app will not generate docs if they are not found. Make sure the project's docs are generated and published by some external process (e.g. CI/CD pipeline). Or change techdocs.builder to 'local' to generate docs from this Backstage instance.";
|
|
36
|
+
readonly "buildLogs.title": "Build Details";
|
|
37
|
+
readonly "buildLogs.closeDrawer": "Close the drawer";
|
|
38
|
+
readonly "buildLogs.showBuildLogs": "Show Build Logs";
|
|
39
|
+
readonly "buildLogs.waitingForLogs": "Waiting for logs...";
|
|
40
|
+
readonly "stateIndicator.initialBuild.message": "Documentation is accessed for the first time and is being prepared. The subsequent loads are much faster.";
|
|
41
|
+
readonly "stateIndicator.contentStaleRefreshing.message": "A newer version of this documentation is being prepared and will be available shortly.";
|
|
42
|
+
readonly "stateIndicator.contentStaleReady.message": "A newer version of this documentation is now available, please refresh to view.";
|
|
43
|
+
readonly "stateIndicator.contentStaleReady.refreshButton": "Refresh";
|
|
44
|
+
readonly "stateIndicator.contentStaleError.message": "Building a newer version of this documentation failed.";
|
|
45
|
+
readonly "redirectNotification.redirectNow": "Redirect now";
|
|
46
|
+
readonly "readerPageHeader.source": "Source";
|
|
47
|
+
readonly "readerPageHeader.owner": "Owner";
|
|
48
|
+
readonly "readerPageHeader.lifecycle": "Lifecycle";
|
|
49
|
+
readonly "pageWrapper.title": "Documentation";
|
|
50
|
+
readonly "pageWrapper.subtitle": "Documentation available in {{orgName}}";
|
|
51
|
+
readonly "entityContent.title": "TechDocs";
|
|
52
|
+
readonly "reader.settings": "Settings";
|
|
53
|
+
}>;
|
|
54
|
+
|
|
11
55
|
/** @alpha */
|
|
12
56
|
declare const techDocsSearchResultListItemExtension: _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
13
57
|
config: {
|
|
@@ -300,4 +344,4 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
|
|
|
300
344
|
}>;
|
|
301
345
|
}>;
|
|
302
346
|
|
|
303
|
-
export { _default as default, techDocsSearchResultListItemExtension };
|
|
347
|
+
export { _default as default, techDocsSearchResultListItemExtension, techdocsTranslationRef };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -14,6 +14,7 @@ import { TechDocsReaderLayout } from './alpha/components/TechDocsReaderLayout.es
|
|
|
14
14
|
import { techdocsStorageApiRef, techdocsApiRef, TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
|
15
15
|
import { useTechdocsReaderIconLinkProps } from './alpha/hooks/useTechdocsReaderIconLinkProps.esm.js';
|
|
16
16
|
import { DocsIcon, SupportButton } from '@backstage/core-components';
|
|
17
|
+
export { techdocsTranslationRef } from './translation.esm.js';
|
|
17
18
|
|
|
18
19
|
const techdocsEntityIconLink = EntityIconLinkBlueprint.make({
|
|
19
20
|
name: "read-docs",
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha/index.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 { Suspense } from 'react';\nimport { z } from 'zod/v4';\nimport { RiArticleLine } from '@remixicon/react';\nimport {\n createFrontendPlugin,\n ApiBlueprint,\n PageBlueprint,\n PluginHeaderActionBlueprint,\n createExtensionInput,\n coreExtensionData,\n createExtension,\n} from '@backstage/frontend-plugin-api';\nimport {\n configApiRef,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n EntityContentBlueprint,\n EntityIconLinkBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\nimport { SearchResultListItemBlueprint } from '@backstage/plugin-search-react/alpha';\nimport {\n AddonBlueprint,\n attachTechDocsAddonComponentData,\n} from '@backstage/plugin-techdocs-react/alpha';\nimport { TechDocsAddonsApiExtension, techdocsAddonsApiRef } from './addonsApi';\nimport { TechDocsClient, TechDocsStorageClient } from '../client';\nimport {\n rootCatalogDocsRouteRef,\n rootDocsRouteRef,\n rootRouteRef,\n} from '../routes';\nimport { TechDocsReaderLayout } from './components/TechDocsReaderLayout';\nimport {\n TechDocsAddons,\n techdocsApiRef,\n techdocsStorageApiRef,\n} from '@backstage/plugin-techdocs-react';\n\nimport { useTechdocsReaderIconLinkProps } from './hooks/useTechdocsReaderIconLinkProps';\nimport { DocsIcon, SupportButton } from '@backstage/core-components';\n\n/** @alpha */\nconst techdocsEntityIconLink = EntityIconLinkBlueprint.make({\n name: 'read-docs',\n params: {\n useProps: useTechdocsReaderIconLinkProps,\n },\n});\n\n/** @alpha */\nconst techDocsStorageApi = ApiBlueprint.make({\n name: 'storage',\n params: defineParams =>\n defineParams({\n api: techdocsStorageApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsStorageClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n }),\n});\n\n/** @alpha */\nconst techDocsClientApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\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/** @alpha */\nexport const techDocsSearchResultListItemExtension =\n SearchResultListItemBlueprint.makeWithOverrides({\n configSchema: {\n title: z.string().optional(),\n lineClamp: z.number().default(5),\n asLink: z.boolean().default(true),\n asListItem: z.boolean().default(true),\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n icon: <DocsIcon />,\n predicate: result => result.type === 'techdocs',\n component: async () => {\n const { TechDocsSearchResultListItem } = await import(\n '../search/components/TechDocsSearchResultListItem'\n );\n return props => (\n <TechDocsSearchResultListItem {...props} {...config} />\n );\n },\n });\n },\n });\n\n/**\n * Responsible for rendering the provided router element\n *\n * @alpha\n */\nconst techDocsPage = PageBlueprint.make({\n params: {\n path: '/docs',\n routeRef: rootRouteRef,\n title: 'Docs',\n icon: <RiArticleLine />,\n loader: () =>\n import('./components/TechDocsIndexPageContent').then(m => (\n <m.TechDocsIndexPageContent />\n )),\n },\n});\n\n/**\n * Component responsible for composing a TechDocs reader page experience\n *\n * @alpha\n */\nconst techDocsReaderPage = PageBlueprint.makeWithOverrides({\n name: 'reader',\n inputs: {\n addons: createExtensionInput([AddonBlueprint.dataRefs.addon]),\n },\n configSchema: {\n withoutSearch: z.boolean().default(false),\n withoutHeader: z.boolean().default(false),\n },\n factory(originalFactory, { apis, inputs, config }) {\n const addonsApi = apis.get(techdocsAddonsApiRef);\n\n return originalFactory({\n path: '/docs/:namespace/:kind/:name',\n routeRef: rootDocsRouteRef,\n loader: async () => {\n // Merge addons from the API with old-style direct attachments\n const apiAddons = addonsApi?.getAddons() ?? [];\n const directAddons = inputs.addons.map(output =>\n output.get(AddonBlueprint.dataRefs.addon),\n );\n const addonOptions = [...apiAddons, ...directAddons];\n\n const addons = addonOptions.map(options => {\n const Addon = options.component;\n attachTechDocsAddonComponentData(Addon, options);\n return (\n <Suspense key={options.name} fallback={null}>\n <Addon />\n </Suspense>\n );\n });\n\n return import('../Router').then(({ TechDocsReaderRouter }) => (\n <TechDocsReaderRouter>\n <TechDocsReaderLayout\n withSearch={!config.withoutSearch}\n withHeader={!config.withoutHeader}\n />\n <TechDocsAddons>{addons}</TechDocsAddons>\n </TechDocsReaderRouter>\n ));\n },\n });\n },\n});\n\n/**\n * Component responsible for rendering techdocs on entity pages\n *\n * @alpha\n */\nconst techDocsEntityContent = EntityContentBlueprint.makeWithOverrides({\n inputs: {\n addons: createExtensionInput([AddonBlueprint.dataRefs.addon]),\n emptyState: createExtensionInput(\n [coreExtensionData.reactElement.optional()],\n {\n singleton: true,\n optional: true,\n },\n ),\n },\n factory(originalFactory, context) {\n const addonsApi = context.apis.get(techdocsAddonsApiRef);\n\n return originalFactory(\n {\n path: 'docs',\n title: 'TechDocs',\n group: 'documentation',\n routeRef: rootCatalogDocsRouteRef,\n loader: () => {\n // Merge addons from the API with old-style direct attachments\n const apiAddons = addonsApi?.getAddons() ?? [];\n const directAddons = context.inputs.addons.map(output =>\n output.get(AddonBlueprint.dataRefs.addon),\n );\n const addonOptions = [...apiAddons, ...directAddons];\n\n const addons = addonOptions.map(options => {\n const Addon = options.component;\n attachTechDocsAddonComponentData(Addon, options);\n return (\n <Suspense key={options.name} fallback={null}>\n <Addon />\n </Suspense>\n );\n });\n\n return import('../Router').then(({ EmbeddedDocsRouter }) => (\n <EmbeddedDocsRouter\n emptyState={context.inputs.emptyState?.get(\n coreExtensionData.reactElement,\n )}\n >\n <TechDocsAddons>{addons}</TechDocsAddons>\n </EmbeddedDocsRouter>\n ));\n },\n },\n context,\n );\n },\n});\n\nconst techDocsEntityContentEmptyState = createExtension({\n kind: 'empty-state',\n name: 'entity-content',\n attachTo: { id: 'entity-content:techdocs', input: 'emptyState' },\n output: [coreExtensionData.reactElement.optional()],\n factory: () => [],\n});\n\nconst techDocsSupportAction = PluginHeaderActionBlueprint.make({\n params: defineParams =>\n defineParams({\n loader: async () => (\n <SupportButton>Discover documentation in your ecosystem.</SupportButton>\n ),\n }),\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'techdocs',\n title: 'Documentation',\n icon: <RiArticleLine />,\n info: { packageJson: () => import('../../package.json') },\n extensions: [\n techDocsClientApi,\n techDocsStorageApi,\n TechDocsAddonsApiExtension,\n techDocsSupportAction,\n techDocsPage,\n techDocsReaderPage,\n techdocsEntityIconLink,\n techDocsEntityContent,\n techDocsEntityContentEmptyState,\n techDocsSearchResultListItemExtension,\n ],\n routes: {\n root: rootRouteRef,\n docRoot: rootDocsRouteRef,\n entityContent: rootCatalogDocsRouteRef,\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA4DA,MAAM,sBAAA,GAAyB,wBAAwB,IAAA,CAAK;AAAA,EAC1D,IAAA,EAAM,WAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,QAAA,EAAU;AAAA;AAEd,CAAC,CAAA;AAGD,MAAM,kBAAA,GAAqB,aAAa,IAAA,CAAK;AAAA,EAC3C,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,qBAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,SAAA,EAAW,YAAA;AAAA,MACX,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,QAAA,EAAS,KAC5C,IAAI,qBAAA,CAAsB;AAAA,MACxB,SAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC,CAAA;AAGD,MAAM,iBAAA,GAAoB,aAAa,IAAA,CAAK;AAAA,EAC1C,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,cAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,SAAA,EAAW,YAAA;AAAA,MACX,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,QAAA,EAAS,KAC5C,IAAI,cAAA,CAAe;AAAA,MACjB,SAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC,CAAA;AAGM,MAAM,qCAAA,GACX,8BAA8B,iBAAA,CAAkB;AAAA,EAC9C,YAAA,EAAc;AAAA,IACZ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;AAAA,EAClC,QAAA,EAAU,UAAA;AAAA,EACV,KAAA,EAAO,eAAA;AAAA,EACP,IAAA,sBAAO,aAAA,EAAA,EAAc,CAAA;AAAA,EACrB,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,wCAAoB,CAAA,EAAE;AAAA,EACxD,UAAA,EAAY;AAAA,IACV,iBAAA;AAAA,IACA,kBAAA;AAAA,IACA,0BAAA;AAAA,IACA,qBAAA;AAAA,IACA,YAAA;AAAA,IACA,kBAAA;AAAA,IACA,sBAAA;AAAA,IACA,qBAAA;AAAA,IACA,+BAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,YAAA;AAAA,IACN,OAAA,EAAS,gBAAA;AAAA,IACT,aAAA,EAAe;AAAA;AAEnB,CAAC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha/index.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 { Suspense } from 'react';\nimport { z } from 'zod/v4';\nimport { RiArticleLine } from '@remixicon/react';\nimport {\n createFrontendPlugin,\n ApiBlueprint,\n PageBlueprint,\n PluginHeaderActionBlueprint,\n createExtensionInput,\n coreExtensionData,\n createExtension,\n} from '@backstage/frontend-plugin-api';\nimport {\n configApiRef,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n EntityContentBlueprint,\n EntityIconLinkBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\nimport { SearchResultListItemBlueprint } from '@backstage/plugin-search-react/alpha';\nimport {\n AddonBlueprint,\n attachTechDocsAddonComponentData,\n} from '@backstage/plugin-techdocs-react/alpha';\nimport { TechDocsAddonsApiExtension, techdocsAddonsApiRef } from './addonsApi';\nimport { TechDocsClient, TechDocsStorageClient } from '../client';\nimport {\n rootCatalogDocsRouteRef,\n rootDocsRouteRef,\n rootRouteRef,\n} from '../routes';\nimport { TechDocsReaderLayout } from './components/TechDocsReaderLayout';\nimport {\n TechDocsAddons,\n techdocsApiRef,\n techdocsStorageApiRef,\n} from '@backstage/plugin-techdocs-react';\n\nimport { useTechdocsReaderIconLinkProps } from './hooks/useTechdocsReaderIconLinkProps';\nimport { DocsIcon, SupportButton } from '@backstage/core-components';\n\n/** @alpha */\nconst techdocsEntityIconLink = EntityIconLinkBlueprint.make({\n name: 'read-docs',\n params: {\n useProps: useTechdocsReaderIconLinkProps,\n },\n});\n\n/** @alpha */\nconst techDocsStorageApi = ApiBlueprint.make({\n name: 'storage',\n params: defineParams =>\n defineParams({\n api: techdocsStorageApiRef,\n deps: {\n configApi: configApiRef,\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, discoveryApi, fetchApi }) =>\n new TechDocsStorageClient({\n configApi,\n discoveryApi,\n fetchApi,\n }),\n }),\n});\n\n/** @alpha */\nconst techDocsClientApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\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/** @alpha */\nexport const techDocsSearchResultListItemExtension =\n SearchResultListItemBlueprint.makeWithOverrides({\n configSchema: {\n title: z.string().optional(),\n lineClamp: z.number().default(5),\n asLink: z.boolean().default(true),\n asListItem: z.boolean().default(true),\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n icon: <DocsIcon />,\n predicate: result => result.type === 'techdocs',\n component: async () => {\n const { TechDocsSearchResultListItem } = await import(\n '../search/components/TechDocsSearchResultListItem'\n );\n return props => (\n <TechDocsSearchResultListItem {...props} {...config} />\n );\n },\n });\n },\n });\n\n/**\n * Responsible for rendering the provided router element\n *\n * @alpha\n */\nconst techDocsPage = PageBlueprint.make({\n params: {\n path: '/docs',\n routeRef: rootRouteRef,\n title: 'Docs',\n icon: <RiArticleLine />,\n loader: () =>\n import('./components/TechDocsIndexPageContent').then(m => (\n <m.TechDocsIndexPageContent />\n )),\n },\n});\n\n/**\n * Component responsible for composing a TechDocs reader page experience\n *\n * @alpha\n */\nconst techDocsReaderPage = PageBlueprint.makeWithOverrides({\n name: 'reader',\n inputs: {\n addons: createExtensionInput([AddonBlueprint.dataRefs.addon]),\n },\n configSchema: {\n withoutSearch: z.boolean().default(false),\n withoutHeader: z.boolean().default(false),\n },\n factory(originalFactory, { apis, inputs, config }) {\n const addonsApi = apis.get(techdocsAddonsApiRef);\n\n return originalFactory({\n path: '/docs/:namespace/:kind/:name',\n routeRef: rootDocsRouteRef,\n loader: async () => {\n // Merge addons from the API with old-style direct attachments\n const apiAddons = addonsApi?.getAddons() ?? [];\n const directAddons = inputs.addons.map(output =>\n output.get(AddonBlueprint.dataRefs.addon),\n );\n const addonOptions = [...apiAddons, ...directAddons];\n\n const addons = addonOptions.map(options => {\n const Addon = options.component;\n attachTechDocsAddonComponentData(Addon, options);\n return (\n <Suspense key={options.name} fallback={null}>\n <Addon />\n </Suspense>\n );\n });\n\n return import('../Router').then(({ TechDocsReaderRouter }) => (\n <TechDocsReaderRouter>\n <TechDocsReaderLayout\n withSearch={!config.withoutSearch}\n withHeader={!config.withoutHeader}\n />\n <TechDocsAddons>{addons}</TechDocsAddons>\n </TechDocsReaderRouter>\n ));\n },\n });\n },\n});\n\n/**\n * Component responsible for rendering techdocs on entity pages\n *\n * @alpha\n */\nconst techDocsEntityContent = EntityContentBlueprint.makeWithOverrides({\n inputs: {\n addons: createExtensionInput([AddonBlueprint.dataRefs.addon]),\n emptyState: createExtensionInput(\n [coreExtensionData.reactElement.optional()],\n {\n singleton: true,\n optional: true,\n },\n ),\n },\n factory(originalFactory, context) {\n const addonsApi = context.apis.get(techdocsAddonsApiRef);\n\n return originalFactory(\n {\n path: 'docs',\n title: 'TechDocs',\n group: 'documentation',\n routeRef: rootCatalogDocsRouteRef,\n loader: () => {\n // Merge addons from the API with old-style direct attachments\n const apiAddons = addonsApi?.getAddons() ?? [];\n const directAddons = context.inputs.addons.map(output =>\n output.get(AddonBlueprint.dataRefs.addon),\n );\n const addonOptions = [...apiAddons, ...directAddons];\n\n const addons = addonOptions.map(options => {\n const Addon = options.component;\n attachTechDocsAddonComponentData(Addon, options);\n return (\n <Suspense key={options.name} fallback={null}>\n <Addon />\n </Suspense>\n );\n });\n\n return import('../Router').then(({ EmbeddedDocsRouter }) => (\n <EmbeddedDocsRouter\n emptyState={context.inputs.emptyState?.get(\n coreExtensionData.reactElement,\n )}\n >\n <TechDocsAddons>{addons}</TechDocsAddons>\n </EmbeddedDocsRouter>\n ));\n },\n },\n context,\n );\n },\n});\n\nconst techDocsEntityContentEmptyState = createExtension({\n kind: 'empty-state',\n name: 'entity-content',\n attachTo: { id: 'entity-content:techdocs', input: 'emptyState' },\n output: [coreExtensionData.reactElement.optional()],\n factory: () => [],\n});\n\nconst techDocsSupportAction = PluginHeaderActionBlueprint.make({\n params: defineParams =>\n defineParams({\n loader: async () => (\n <SupportButton>Discover documentation in your ecosystem.</SupportButton>\n ),\n }),\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'techdocs',\n title: 'Documentation',\n icon: <RiArticleLine />,\n info: { packageJson: () => import('../../package.json') },\n extensions: [\n techDocsClientApi,\n techDocsStorageApi,\n TechDocsAddonsApiExtension,\n techDocsSupportAction,\n techDocsPage,\n techDocsReaderPage,\n techdocsEntityIconLink,\n techDocsEntityContent,\n techDocsEntityContentEmptyState,\n techDocsSearchResultListItemExtension,\n ],\n routes: {\n root: rootRouteRef,\n docRoot: rootDocsRouteRef,\n entityContent: rootCatalogDocsRouteRef,\n },\n});\n\n/** @alpha */\nexport { techdocsTranslationRef } from '../translation';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA4DA,MAAM,sBAAA,GAAyB,wBAAwB,IAAA,CAAK;AAAA,EAC1D,IAAA,EAAM,WAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,QAAA,EAAU;AAAA;AAEd,CAAC,CAAA;AAGD,MAAM,kBAAA,GAAqB,aAAa,IAAA,CAAK;AAAA,EAC3C,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,qBAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,SAAA,EAAW,YAAA;AAAA,MACX,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,QAAA,EAAS,KAC5C,IAAI,qBAAA,CAAsB;AAAA,MACxB,SAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC,CAAA;AAGD,MAAM,iBAAA,GAAoB,aAAa,IAAA,CAAK;AAAA,EAC1C,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,cAAA;AAAA,IACL,IAAA,EAAM;AAAA,MACJ,SAAA,EAAW,YAAA;AAAA,MACX,YAAA,EAAc,eAAA;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,cAAc,QAAA,EAAS,KAC5C,IAAI,cAAA,CAAe;AAAA,MACjB,SAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC,CAAA;AAGM,MAAM,qCAAA,GACX,8BAA8B,iBAAA,CAAkB;AAAA,EAC9C,YAAA,EAAc;AA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A,CAAqB;AAAA,EAClC,QAAA,EAAU,UAAA;AAAA,EACV,KAAA,EAAO,eAAA;AAAA,EACP,IAAA,sBAAO,aAAA,EAAA,EAAc,CAAA;AAAA,EACrB,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,wCAAoB,CAAA,EAAE;AAAA,EACxD,UAAA,EAAY;AAAA,IACV,iBAAA;AAAA,IACA,kBAAA;AAAA,IACA,0BAAA;AAAA,IACA,qBAAA;AAAA,IACA,YAAA;AAAA,IACA,kBAAA;AAAA,IACA,sBAAA;AAAA,IACA,qBAAA;AAAA,IACA,+BAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,YAAA;AAAA,IACN,OAAA,EAAS,gBAAA;AAAA,IACT,aAAA,EAAe;AAAA;AAEnB,CAAC,CAAA;;;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Content, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
3
3
|
import { EntityListProvider, CatalogFilterLayout, UserListPicker, EntityOwnerPicker, EntityTagPicker } from '@backstage/plugin-catalog-react';
|
|
4
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
5
|
+
import { techdocsTranslationRef } from '../../translation.esm.js';
|
|
4
6
|
import { TechDocsPageWrapper } from './TechDocsPageWrapper.esm.js';
|
|
5
7
|
import { TechDocsPicker } from './TechDocsPicker.esm.js';
|
|
6
8
|
import { EntityListDocsTable } from './Tables/EntityListDocsTable.esm.js';
|
|
@@ -17,8 +19,9 @@ const DefaultTechDocsHome = (props) => {
|
|
|
17
19
|
PageWrapper,
|
|
18
20
|
CustomHeader
|
|
19
21
|
} = props;
|
|
22
|
+
const { t } = useTranslationRef(techdocsTranslationRef);
|
|
20
23
|
const Wrapper = PageWrapper ? PageWrapper : TechDocsPageWrapper;
|
|
21
|
-
const Header = CustomHeader || (() => /* @__PURE__ */ jsx(ContentHeader, { title: "", children: /* @__PURE__ */ jsx(SupportButton, { children: "
|
|
24
|
+
const Header = CustomHeader || (() => /* @__PURE__ */ jsx(ContentHeader, { title: "", children: /* @__PURE__ */ jsx(SupportButton, { children: t("home.supportButton") }) }));
|
|
22
25
|
return /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
23
26
|
/* @__PURE__ */ jsx(Header, {}),
|
|
24
27
|
/* @__PURE__ */ jsx(EntityListProvider, { pagination, children: /* @__PURE__ */ jsxs(CatalogFilterLayout, { children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultTechDocsHome.esm.js","sources":["../../../src/home/components/DefaultTechDocsHome.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 { ReactNode, FC } from 'react';\nimport {\n Content,\n ContentHeader,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n CatalogFilterLayout,\n EntityListProvider,\n EntityOwnerPicker,\n EntityTagPicker,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\nimport { TechDocsPicker } from './TechDocsPicker';\nimport { EntityListDocsTable } from './Tables';\nimport { TechDocsIndexPageProps } from './TechDocsIndexPage';\n\n/**\n * Props for {@link DefaultTechDocsHome}\n *\n * @public\n * @deprecated Please use `TechDocsIndexPageProps` instead.\n */\nexport type DefaultTechDocsHomeProps = TechDocsIndexPageProps;\n\n/**\n * Component which renders a default documentation landing page.\n *\n * @public\n */\nexport const DefaultTechDocsHome = (props: TechDocsIndexPageProps) => {\n const {\n initialFilter = 'owned',\n columns,\n actions,\n ownerPickerMode,\n pagination,\n options,\n PageWrapper,\n CustomHeader,\n } = props;\n const Wrapper: FC<{\n children: ReactNode;\n }> = PageWrapper ? PageWrapper : TechDocsPageWrapper;\n const Header: FC =\n CustomHeader ||\n (() => (\n <ContentHeader title=\"\">\n <SupportButton>
|
|
1
|
+
{"version":3,"file":"DefaultTechDocsHome.esm.js","sources":["../../../src/home/components/DefaultTechDocsHome.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 { ReactNode, FC } from 'react';\nimport {\n Content,\n ContentHeader,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n CatalogFilterLayout,\n EntityListProvider,\n EntityOwnerPicker,\n EntityTagPicker,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../translation';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\nimport { TechDocsPicker } from './TechDocsPicker';\nimport { EntityListDocsTable } from './Tables';\nimport { TechDocsIndexPageProps } from './TechDocsIndexPage';\n\n/**\n * Props for {@link DefaultTechDocsHome}\n *\n * @public\n * @deprecated Please use `TechDocsIndexPageProps` instead.\n */\nexport type DefaultTechDocsHomeProps = TechDocsIndexPageProps;\n\n/**\n * Component which renders a default documentation landing page.\n *\n * @public\n */\nexport const DefaultTechDocsHome = (props: TechDocsIndexPageProps) => {\n const {\n initialFilter = 'owned',\n columns,\n actions,\n ownerPickerMode,\n pagination,\n options,\n PageWrapper,\n CustomHeader,\n } = props;\n const { t } = useTranslationRef(techdocsTranslationRef);\n const Wrapper: FC<{\n children: ReactNode;\n }> = PageWrapper ? PageWrapper : TechDocsPageWrapper;\n const Header: FC =\n CustomHeader ||\n (() => (\n <ContentHeader title=\"\">\n <SupportButton>{t('home.supportButton')}</SupportButton>\n </ContentHeader>\n ));\n return (\n <Wrapper>\n <Content>\n <Header />\n <EntityListProvider pagination={pagination}>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <TechDocsPicker />\n <UserListPicker initialFilter={initialFilter} />\n <EntityOwnerPicker mode={ownerPickerMode} />\n <EntityTagPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <EntityListDocsTable\n actions={actions}\n columns={columns}\n options={options}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </Wrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAiDO,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAkC;AACpE,EAAA,MAAM;AAAA,IACJ,aAAA,GAAgB,OAAA;AAAA,IAChB,OAAA;AAAA,IACA,OAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,sBAAsB,CAAA;AACtD,EAAA,MAAM,OAAA,GAED,cAAc,WAAA,GAAc,mBAAA;AACjC,EAAA,MAAM,MAAA,GACJ,YAAA,KACC,sBACC,GAAA,CAAC,aAAA,EAAA,EAAc,KAAA,EAAM,EAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAe,QAAA,EAAA,CAAA,CAAE,oBAAoB,CAAA,EAAE,CAAA,EAC1C,CAAA,CAAA;AAEJ,EAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,CAAA;AAAA,oBACR,GAAA,CAAC,kBAAA,EAAA,EAAmB,UAAA,EAClB,QAAA,kBAAA,IAAA,CAAC,mBAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,IAAA,CAAC,mBAAA,CAAoB,SAApB,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,CAAA;AAAA,wBAChB,GAAA,CAAC,kBAAe,aAAA,EAA8B,CAAA;AAAA,wBAC9C,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EAAM,eAAA,EAAiB,CAAA;AAAA,4BACzC,eAAA,EAAA,EAAgB;AAAA,OAAA,EACnB,CAAA;AAAA,sBACA,GAAA,CAAC,mBAAA,CAAoB,OAAA,EAApB,EACC,QAAA,kBAAA,GAAA;AAAA,QAAC,mBAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,OAAA;AAAA,UACA;AAAA;AAAA,OACF,EACF;AAAA,KAAA,EACF,CAAA,EACF;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoCardGrid.esm.js","sources":["../../../../src/home/components/Grids/InfoCardGrid.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 useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n ItemCardGrid,\n InfoCard,\n Link,\n Progress,\n} from '@backstage/core-components';\nimport {\n EntityRefPresentationSnapshot,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\n\n/** @public */\nexport type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';\n\nconst useStyles = makeStyles(\n theme => ({\n linkSpacer: {\n paddingTop: theme.spacing(0.2),\n },\n readMoreLink: {\n paddingTop: theme.spacing(0.2),\n },\n }),\n { name: 'BackstageInfoCardGrid' },\n);\n\n/**\n * Props for {@link InfoCardGrid}\n *\n * @public\n */\nexport type InfoCardGridProps = {\n entities: Entity[] | undefined;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a info card for each entity\n *\n * @public\n */\nexport const InfoCardGrid = (props: InfoCardGridProps) => {\n const { entities, linkContent, linkDestination } = props;\n const classes = useStyles();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const linkRoute = (entity: Entity) => {\n if (linkDestination) {\n const destination = linkDestination(entity);\n if (destination) {\n return destination;\n }\n }\n return getRouteToReaderPageFor({\n namespace: toLowerMaybe(entity.metadata.namespace ?? 'default', config),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n });\n };\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entityRefToPresentation, loading } = useAsync(async () => {\n return new Map<string, EntityRefPresentationSnapshot>(\n await Promise.all(\n entities?.map(async entity => {\n const presentation = await entityPresentationApi.forEntity(entity)\n .promise;\n return [stringifyEntityRef(entity), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }) || [],\n ),\n );\n });\n if (loading) return <Progress />;\n if (!entities || !entities?.length) return null;\n return (\n <ItemCardGrid data-testid=\"info-card-container\">\n {entities.map(entity => (\n <InfoCard\n key={entity
|
|
1
|
+
{"version":3,"file":"InfoCardGrid.esm.js","sources":["../../../../src/home/components/Grids/InfoCardGrid.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 useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n ItemCardGrid,\n InfoCard,\n Link,\n Progress,\n} from '@backstage/core-components';\nimport {\n EntityRefPresentationSnapshot,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\n\n/** @public */\nexport type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';\n\nconst useStyles = makeStyles(\n theme => ({\n linkSpacer: {\n paddingTop: theme.spacing(0.2),\n },\n readMoreLink: {\n paddingTop: theme.spacing(0.2),\n },\n }),\n { name: 'BackstageInfoCardGrid' },\n);\n\n/**\n * Props for {@link InfoCardGrid}\n *\n * @public\n */\nexport type InfoCardGridProps = {\n entities: Entity[] | undefined;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a info card for each entity\n *\n * @public\n */\nexport const InfoCardGrid = (props: InfoCardGridProps) => {\n const { entities, linkContent, linkDestination } = props;\n const classes = useStyles();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const linkRoute = (entity: Entity) => {\n if (linkDestination) {\n const destination = linkDestination(entity);\n if (destination) {\n return destination;\n }\n }\n return getRouteToReaderPageFor({\n namespace: toLowerMaybe(entity.metadata.namespace ?? 'default', config),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n });\n };\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entityRefToPresentation, loading } = useAsync(async () => {\n return new Map<string, EntityRefPresentationSnapshot>(\n await Promise.all(\n entities?.map(async entity => {\n const presentation = await entityPresentationApi.forEntity(entity)\n .promise;\n return [stringifyEntityRef(entity), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }) || [],\n ),\n );\n });\n if (loading) return <Progress />;\n if (!entities || !entities?.length) return null;\n return (\n <ItemCardGrid data-testid=\"info-card-container\">\n {entities.map(entity => (\n <InfoCard\n key={stringifyEntityRef(entity)}\n data-testid={entity?.metadata?.title}\n title={\n entityRefToPresentation?.get(stringifyEntityRef(entity))\n ?.primaryTitle\n }\n >\n <div>{entity?.metadata?.description}</div>\n <div className={classes.linkSpacer} />\n <Link\n to={linkRoute(entity)}\n className={classes.readMoreLink}\n data-testid=\"read-docs-link\"\n >\n {linkContent || 'Read Docs'}\n </Link>\n </InfoCard>\n ))}\n </ItemCardGrid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,UAAA,EAAY;AAAA,MACV,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA,KAC/B;AAAA,IACA,YAAA,EAAc;AAAA,MACZ,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA;AAC/B,GACF,CAAA;AAAA,EACA,EAAE,MAAM,uBAAA;AACV,CAAA;AAkBO,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACxD,EAAA,MA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AAA,EAAS,CAAA;AAC9B,EAAA,IAAI,CAAC,QAAA,IAAY,CAAC,QAAA,EAAU,QAAQ,OAAO,IAAA;AAC3C,EAAA,2BACG,YAAA,EAAA,EAAa,aAAA,EAAY,qBAAA,EACvB,QAAA,EAAA,QAAA,CAAS,IAAI,CAAA,MAAA,qBACZ,IAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MAEC,aAAA,EAAa,QAAQ,QAAA,EAAU,KAAA;AAAA,MAC/B,OACE,uBAAA,EAAyB,GAAA,CAAI,kBAAA,CAAmB,MAAM,CAAC,CAAA,EACnD,YAAA;AAAA,MAGN,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,KAAA,EAAA,EAAK,QAAA,EAAA,MAAA,EAAQ,QAAA,EAAU,WAAA,EAAY,CAAA;AAAA,wBACpC,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,UAAA,EAAY,CAAA;AAAA,wBACpC,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,EAAA,EAAI,UAAU,MAAM,CAAA;AAAA,YACpB,WAAW,OAAA,CAAQ,YAAA;AAAA,YACnB,aAAA,EAAY,gBAAA;AAAA,YAEX,QAAA,EAAA,WAAA,IAAe;AAAA;AAAA;AAClB;AAAA,KAAA;AAAA,IAfK,mBAAmB,MAAM;AAAA,GAiBjC,CAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Table } from '@backstage/core-components';
|
|
3
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
4
|
+
import { techdocsTranslationRef } from '../../../translation.esm.js';
|
|
3
5
|
|
|
4
6
|
function CursorPaginatedDocsTable(props) {
|
|
5
7
|
const {
|
|
@@ -13,6 +15,7 @@ function CursorPaginatedDocsTable(props) {
|
|
|
13
15
|
options,
|
|
14
16
|
...restProps
|
|
15
17
|
} = props;
|
|
18
|
+
const { t } = useTranslationRef(techdocsTranslationRef);
|
|
16
19
|
return /* @__PURE__ */ jsx(
|
|
17
20
|
Table,
|
|
18
21
|
{
|
|
@@ -38,7 +41,21 @@ function CursorPaginatedDocsTable(props) {
|
|
|
38
41
|
},
|
|
39
42
|
page: prev ? 1 : 0,
|
|
40
43
|
totalCount: next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER,
|
|
41
|
-
localization: {
|
|
44
|
+
localization: {
|
|
45
|
+
header: {
|
|
46
|
+
actions: t("table.header.actions")
|
|
47
|
+
},
|
|
48
|
+
toolbar: {
|
|
49
|
+
searchPlaceholder: t("table.toolbar.searchPlaceholder")
|
|
50
|
+
},
|
|
51
|
+
pagination: {
|
|
52
|
+
labelDisplayedRows: "",
|
|
53
|
+
labelRowsSelect: t("table.pagination.labelRowsSelect")
|
|
54
|
+
},
|
|
55
|
+
body: {
|
|
56
|
+
emptyDataSourceMessage: t("table.body.emptyDataSourceMessage")
|
|
57
|
+
}
|
|
58
|
+
},
|
|
42
59
|
isLoading,
|
|
43
60
|
...restProps
|
|
44
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorPaginatedDocsTable.esm.js","sources":["../../../../src/home/components/Tables/CursorPaginatedDocsTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { DocsTableRow } from './types';\n\ntype PaginatedDocsTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<DocsTableRow>;\n\n/**\n * @internal\n */\n\nexport function CursorPaginatedDocsTable(props: PaginatedDocsTableProps) {\n const {\n actions,\n columns,\n data,\n next,\n prev,\n title,\n isLoading,\n options,\n ...restProps\n } = props;\n\n return (\n <Table\n title={isLoading ? '' : title}\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 actionsColumnIndex: -1,\n }}\n onPageChange={page => {\n if (page > 0) {\n next?.();\n } else {\n prev?.();\n }\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: {
|
|
1
|
+
{"version":3,"file":"CursorPaginatedDocsTable.esm.js","sources":["../../../../src/home/components/Tables/CursorPaginatedDocsTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../../translation';\nimport { DocsTableRow } from './types';\n\ntype PaginatedDocsTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<DocsTableRow>;\n\n/**\n * @internal\n */\n\nexport function CursorPaginatedDocsTable(props: PaginatedDocsTableProps) {\n const {\n actions,\n columns,\n data,\n next,\n prev,\n title,\n isLoading,\n options,\n ...restProps\n } = props;\n const { t } = useTranslationRef(techdocsTranslationRef);\n\n return (\n <Table\n title={isLoading ? '' : title}\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 actionsColumnIndex: -1,\n }}\n onPageChange={page => {\n if (page > 0) {\n next?.();\n } else {\n prev?.();\n }\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={{\n header: {\n actions: t('table.header.actions'),\n },\n toolbar: {\n searchPlaceholder: t('table.toolbar.searchPlaceholder'),\n },\n pagination: {\n labelDisplayedRows: '',\n labelRowsSelect: t('table.pagination.labelRowsSelect'),\n },\n body: {\n emptyDataSourceMessage: t('table.body.emptyDataSourceMessage'),\n },\n }}\n isLoading={isLoading}\n {...restProps}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AA8BO,SAAS,yBAAyB,KAAA,EAAgC;AACvE,EAAA,MAAM;AAAA,IACJ,OAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,sBAAsB,CAAA;AAEtD,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAY,EAAA,GAAK,KAAA;AAAA,MACxB,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAA,EAAS;AAAA,QACP,kBAAA,EAAoB,MAAA;AAAA,QACpB,GAAG,OAAA;AAAA;AAAA,QAEH,iBAAiB,EAAC;AAAA,QAClB,wBAAA,EAA0B,KAAA;AAAA,QAC1B,UAAU,MAAA,CAAO,gBAAA;AAAA,QACjB,mBAAA,EAAqB,KAAA;AAAA,QACrB,kBAAA,EAAoB;AAAA,OACtB;AAAA,MACA,cAAc,CAAA,IAAA,KAAQ;AACpB,QAAA,IAAI,OAAO,CAAA,EAAG;AACZ,UAAA,IAAA,IAAO;AAAA,QACT,CAAA,MAAO;AACL,UAAA,IAAA,IAAO;AAAA,QACT;AAAA,MACF,CAAA;AAAA,MAEA,IAAA,EAAM,OAAO,CAAA,GAAI,CAAA;AAAA,MAEjB,UAAA,EAAY,IAAA,GAAO,MAAA,CAAO,SAAA,GAAY,MAAA,CAAO,gBAAA;AAAA,MAC7C,YAAA,EAAc;AAAA,QACZ,MAAA,EAAQ;AAAA,UACN,OAAA,EAAS,EAAE,sBAAsB;AAAA,SACnC;AAAA,QACA,OAAA,EAAS;AAAA,UACP,iBAAA,EAAmB,EAAE,iCAAiC;AAAA,SACxD;AAAA,QACA,UAAA,EAAY;AAAA,UACV,kBAAA,EAAoB,EAAA;AAAA,UACpB,eAAA,EAAiB,EAAE,kCAAkC;AAAA,SACvD;AAAA,QACA,IAAA,EAAM;AAAA,UACJ,sBAAA,EAAwB,EAAE,mCAAmC;AAAA;AAC/D,OACF;AAAA,MACA,SAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import useCopyToClipboard from 'react-use/esm/useCopyToClipboard';
|
|
3
3
|
import { useRouteRef, useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
4
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
4
5
|
import { rootDocsRouteRef } from '../../../routes.esm.js';
|
|
5
6
|
import { Table, EmptyState, LinkButton } from '@backstage/core-components';
|
|
7
|
+
import { techdocsTranslationRef } from '../../../translation.esm.js';
|
|
6
8
|
import { actionFactories } from './actions.esm.js';
|
|
7
9
|
import { defaultColumns, columnFactories } from './columns.esm.js';
|
|
8
10
|
import { entitiesToDocsMapper } from './helpers.esm.js';
|
|
9
11
|
|
|
10
|
-
const
|
|
12
|
+
const DocsTableComponent = (props) => {
|
|
11
13
|
const { entities, title, loading, columns, actions, options } = props;
|
|
12
14
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
13
15
|
const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);
|
|
14
16
|
const config = useApi(configApiRef);
|
|
17
|
+
const { t } = useTranslationRef(techdocsTranslationRef);
|
|
15
18
|
if (!entities) return null;
|
|
16
19
|
const documents = entitiesToDocsMapper(
|
|
17
20
|
entities,
|
|
@@ -19,7 +22,7 @@ const DocsTable = (props) => {
|
|
|
19
22
|
config
|
|
20
23
|
);
|
|
21
24
|
const defaultActions = [
|
|
22
|
-
actionFactories.createCopyDocsUrlAction(copyToClipboard)
|
|
25
|
+
actionFactories.createCopyDocsUrlAction(copyToClipboard, t)
|
|
23
26
|
];
|
|
24
27
|
const pageSize = 20;
|
|
25
28
|
const paging = documents && documents.length > pageSize;
|
|
@@ -37,26 +40,41 @@ const DocsTable = (props) => {
|
|
|
37
40
|
data: documents,
|
|
38
41
|
columns: columns || defaultColumns,
|
|
39
42
|
actions: actions || defaultActions,
|
|
40
|
-
title: title ? `${title} (${documents.length})` :
|
|
43
|
+
title: title ? `${title} (${documents.length})` : `${t("table.title.all")} (${documents.length})`,
|
|
44
|
+
localization: {
|
|
45
|
+
header: {
|
|
46
|
+
actions: t("table.header.actions")
|
|
47
|
+
},
|
|
48
|
+
toolbar: {
|
|
49
|
+
searchPlaceholder: t("table.toolbar.searchPlaceholder")
|
|
50
|
+
},
|
|
51
|
+
pagination: {
|
|
52
|
+
labelRowsSelect: t("table.pagination.labelRowsSelect")
|
|
53
|
+
},
|
|
54
|
+
body: {
|
|
55
|
+
emptyDataSourceMessage: t("table.body.emptyDataSourceMessage")
|
|
56
|
+
}
|
|
57
|
+
}
|
|
41
58
|
}
|
|
42
59
|
) : /* @__PURE__ */ jsx(
|
|
43
60
|
EmptyState,
|
|
44
61
|
{
|
|
45
62
|
missing: "data",
|
|
46
|
-
title: "
|
|
47
|
-
description: "
|
|
63
|
+
title: t("table.emptyState.title"),
|
|
64
|
+
description: t("table.emptyState.description"),
|
|
48
65
|
action: /* @__PURE__ */ jsx(
|
|
49
66
|
LinkButton,
|
|
50
67
|
{
|
|
51
68
|
color: "primary",
|
|
52
69
|
to: "https://backstage.io/docs/features/techdocs/getting-started",
|
|
53
70
|
variant: "contained",
|
|
54
|
-
children: "
|
|
71
|
+
children: t("table.emptyState.docsButton")
|
|
55
72
|
}
|
|
56
73
|
)
|
|
57
74
|
}
|
|
58
75
|
) });
|
|
59
76
|
};
|
|
77
|
+
const DocsTable = DocsTableComponent;
|
|
60
78
|
DocsTable.columns = columnFactories;
|
|
61
79
|
DocsTable.actions = actionFactories;
|
|
62
80
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocsTable.esm.js","sources":["../../../../src/home/components/Tables/DocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\n\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n EmptyState,\n LinkButton,\n Table,\n TableColumn,\n TableOptions,\n TableProps,\n} from '@backstage/core-components';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport {
|
|
1
|
+
{"version":3,"file":"DocsTable.esm.js","sources":["../../../../src/home/components/Tables/DocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\n\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { Entity } from '@backstage/catalog-model';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n EmptyState,\n LinkButton,\n Table,\n TableColumn,\n TableOptions,\n TableProps,\n} from '@backstage/core-components';\nimport { techdocsTranslationRef } from '../../../translation';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport {\n DocsTableRow,\n DocsTableColumnFactories,\n DocsTableActionFactories,\n} from './types';\nimport { entitiesToDocsMapper } from './helpers';\n\n/**\n * Props for {@link DocsTable}.\n *\n * @public\n */\nexport type DocsTableProps = {\n entities: Entity[] | undefined;\n title?: string | undefined;\n loading?: boolean | undefined;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n options?: TableOptions<DocsTableRow>;\n};\n\n/**\n * Component which renders a table documents\n *\n * @public\n */\nconst DocsTableComponent = (props: DocsTableProps): JSX.Element | null => {\n const { entities, title, loading, columns, actions, options } = props;\n const [, copyToClipboard] = useCopyToClipboard();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const { t } = useTranslationRef(techdocsTranslationRef);\n if (!entities) return null;\n\n const documents = entitiesToDocsMapper(\n entities,\n getRouteToReaderPageFor,\n config,\n );\n\n const defaultActions: TableProps<DocsTableRow>['actions'] = [\n actionFactories.createCopyDocsUrlAction(copyToClipboard, t),\n ];\n\n const pageSize = 20;\n const paging = documents && documents.length > pageSize;\n\n return (\n <>\n {loading || (documents && documents.length > 0) ? (\n <Table<DocsTableRow>\n isLoading={loading}\n options={{\n paging,\n pageSize,\n search: true,\n actionsColumnIndex: -1,\n ...options,\n }}\n data={documents}\n columns={columns || defaultColumns}\n actions={actions || defaultActions}\n title={\n title\n ? `${title} (${documents.length})`\n : `${t('table.title.all')} (${documents.length})`\n }\n localization={{\n header: {\n actions: t('table.header.actions'),\n },\n toolbar: {\n searchPlaceholder: t('table.toolbar.searchPlaceholder'),\n },\n pagination: {\n labelRowsSelect: t('table.pagination.labelRowsSelect'),\n },\n body: {\n emptyDataSourceMessage: t('table.body.emptyDataSourceMessage'),\n },\n }}\n />\n ) : (\n <EmptyState\n missing=\"data\"\n title={t('table.emptyState.title')}\n description={t('table.emptyState.description')}\n action={\n <LinkButton\n color=\"primary\"\n to=\"https://backstage.io/docs/features/techdocs/getting-started\"\n variant=\"contained\"\n >\n {t('table.emptyState.docsButton')}\n </LinkButton>\n }\n />\n )}\n </>\n );\n};\n\n/**\n * @public\n */\nexport const DocsTable = DocsTableComponent as {\n (props: DocsTableProps): JSX.Element | null;\n columns: DocsTableColumnFactories;\n actions: DocsTableActionFactories;\n};\n\nDocsTable.columns = columnFactories;\nDocsTable.actions = actionFactories;\n"],"names":[],"mappings":";;;;;;;;;;;AA2DA,MAAM,kBAAA,GAAqB,CAAC,KAAA,KAA8C;AACxE,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,SAAS,OAAA,EAAS,OAAA,EAAS,SAAQ,GAAI,KAAA;AAChE,EAAA,MAAM,GAAG,eAAe,CAAA,GAAI,kBAAA,EAAmB;AAC/C,EAAA,MAAM,uBAAA,GAA0B,YAAY,gBAAgB,CAAA;AAC5D,EAAA,MAAM,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EA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UACV,eAAA,EAAiB,EAAE,kCAAkC;AAAA,SACvD;AAAA,QACA,IAAA,EAAM;AAAA,UACJ,sBAAA,EAAwB,EAAE,mCAAmC;AAAA;AAC/D;AACF;AAAA,GACF,mBAEA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,EAAE,wBAAwB,CAAA;AAAA,MACjC,WAAA,EAAa,EAAE,8BAA8B,CAAA;AAAA,MAC7C,MAAA,kBACE,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAM,SAAA;AAAA,UACN,EAAA,EAAG,6DAAA;AAAA,UACH,OAAA,EAAQ,WAAA;AAAA,UAEP,YAAE,6BAA6B;AAAA;AAAA;AAClC;AAAA,GAEJ,EAEJ,CAAA;AAEJ,CAAA;AAKO,MAAM,SAAA,GAAY;AAMzB,SAAA,CAAU,OAAA,GAAU,eAAA;AACpB,SAAA,CAAU,OAAA,GAAU,eAAA;;;;"}
|
|
@@ -3,7 +3,9 @@ import useCopyToClipboard from 'react-use/esm/useCopyToClipboard';
|
|
|
3
3
|
import { capitalize } from 'lodash';
|
|
4
4
|
import { WarningPanel, CodeSnippet } from '@backstage/core-components';
|
|
5
5
|
import { useRouteRef, useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
6
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
6
7
|
import { useEntityList, useStarredEntities } from '@backstage/plugin-catalog-react';
|
|
8
|
+
import { techdocsTranslationRef } from '../../../translation.esm.js';
|
|
7
9
|
import { DocsTable } from './DocsTable.esm.js';
|
|
8
10
|
import { OffsetPaginatedDocsTable } from './OffsetPaginatedDocsTable.esm.js';
|
|
9
11
|
import { CursorPaginatedDocsTable } from './CursorPaginatedDocsTable.esm.js';
|
|
@@ -12,19 +14,21 @@ import { defaultColumns, columnFactories } from './columns.esm.js';
|
|
|
12
14
|
import { rootDocsRouteRef } from '../../../routes.esm.js';
|
|
13
15
|
import { entitiesToDocsMapper } from './helpers.esm.js';
|
|
14
16
|
|
|
15
|
-
const
|
|
17
|
+
const EntityListDocsTableComponent = (props) => {
|
|
16
18
|
const { columns, actions, options } = props;
|
|
17
19
|
const { loading, error, entities, filters, paginationMode, pageInfo } = useEntityList();
|
|
18
20
|
const { isStarredEntity, toggleStarredEntity } = useStarredEntities();
|
|
19
21
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
20
22
|
const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);
|
|
21
23
|
const config = useApi(configApiRef);
|
|
24
|
+
const { t } = useTranslationRef(techdocsTranslationRef);
|
|
22
25
|
const title = capitalize(filters.user?.value ?? "all");
|
|
23
26
|
const defaultActions = [
|
|
24
|
-
actionFactories.createCopyDocsUrlAction(copyToClipboard),
|
|
27
|
+
actionFactories.createCopyDocsUrlAction(copyToClipboard, t),
|
|
25
28
|
actionFactories.createStarEntityAction(
|
|
26
29
|
isStarredEntity,
|
|
27
|
-
toggleStarredEntity
|
|
30
|
+
toggleStarredEntity,
|
|
31
|
+
t
|
|
28
32
|
)
|
|
29
33
|
];
|
|
30
34
|
const documents = entitiesToDocsMapper(
|
|
@@ -60,14 +64,7 @@ const EntityListDocsTable = (props) => {
|
|
|
60
64
|
);
|
|
61
65
|
}
|
|
62
66
|
if (error) {
|
|
63
|
-
return /* @__PURE__ */ jsx(
|
|
64
|
-
WarningPanel,
|
|
65
|
-
{
|
|
66
|
-
severity: "error",
|
|
67
|
-
title: "Could not load available documentation.",
|
|
68
|
-
children: /* @__PURE__ */ jsx(CodeSnippet, { language: "text", text: error.toString() })
|
|
69
|
-
}
|
|
70
|
-
);
|
|
67
|
+
return /* @__PURE__ */ jsx(WarningPanel, { severity: "error", title: t("error.couldNotLoad"), children: /* @__PURE__ */ jsx(CodeSnippet, { language: "text", text: error.toString() }) });
|
|
71
68
|
}
|
|
72
69
|
return /* @__PURE__ */ jsx(
|
|
73
70
|
DocsTable,
|
|
@@ -81,6 +78,7 @@ const EntityListDocsTable = (props) => {
|
|
|
81
78
|
}
|
|
82
79
|
);
|
|
83
80
|
};
|
|
81
|
+
const EntityListDocsTable = EntityListDocsTableComponent;
|
|
84
82
|
EntityListDocsTable.columns = columnFactories;
|
|
85
83
|
EntityListDocsTable.actions = actionFactories;
|
|
86
84
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListDocsTable.esm.js","sources":["../../../../src/home/components/Tables/EntityListDocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\nimport { capitalize } from 'lodash';\nimport {\n CodeSnippet,\n TableColumn,\n TableOptions,\n TableProps,\n WarningPanel,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n useEntityList,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { DocsTable } from './DocsTable';\nimport { OffsetPaginatedDocsTable } from './OffsetPaginatedDocsTable';\nimport { CursorPaginatedDocsTable } from './CursorPaginatedDocsTable';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport {
|
|
1
|
+
{"version":3,"file":"EntityListDocsTable.esm.js","sources":["../../../../src/home/components/Tables/EntityListDocsTable.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 useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\nimport { capitalize } from 'lodash';\nimport {\n CodeSnippet,\n TableColumn,\n TableOptions,\n TableProps,\n WarningPanel,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport {\n useEntityList,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { techdocsTranslationRef } from '../../../translation';\nimport { DocsTable } from './DocsTable';\nimport { OffsetPaginatedDocsTable } from './OffsetPaginatedDocsTable';\nimport { CursorPaginatedDocsTable } from './CursorPaginatedDocsTable';\nimport { actionFactories } from './actions';\nimport { columnFactories, defaultColumns } from './columns';\nimport {\n DocsTableRow,\n DocsTableColumnFactories,\n DocsTableActionFactories,\n} from './types';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { entitiesToDocsMapper } from './helpers';\n\n/**\n * Props for {@link EntityListDocsTable}.\n *\n * @public\n */\nexport type EntityListDocsTableProps = {\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n options?: TableOptions<DocsTableRow>;\n};\n\n/**\n * Component which renders a table with entities from catalog.\n *\n * @public\n */\nconst EntityListDocsTableComponent = (\n props: EntityListDocsTableProps,\n): JSX.Element | null => {\n const { columns, actions, options } = props;\n const { loading, error, entities, filters, paginationMode, pageInfo } =\n useEntityList();\n const { isStarredEntity, toggleStarredEntity } = useStarredEntities();\n const [, copyToClipboard] = useCopyToClipboard();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const { t } = useTranslationRef(techdocsTranslationRef);\n\n const title = capitalize(filters.user?.value ?? 'all');\n\n const defaultActions = [\n actionFactories.createCopyDocsUrlAction(copyToClipboard, t),\n actionFactories.createStarEntityAction(\n isStarredEntity,\n toggleStarredEntity,\n t,\n ),\n ];\n\n const documents = entitiesToDocsMapper(\n entities,\n getRouteToReaderPageFor,\n config,\n );\n\n if (paginationMode === 'cursor') {\n return (\n <CursorPaginatedDocsTable\n columns={columns || defaultColumns}\n isLoading={loading}\n title={title}\n actions={actions || defaultActions}\n options={options}\n data={documents}\n next={pageInfo?.next}\n prev={pageInfo?.prev}\n />\n );\n } else if (paginationMode === 'offset') {\n return (\n <OffsetPaginatedDocsTable\n columns={columns || defaultColumns}\n isLoading={loading}\n title={title}\n actions={actions || defaultActions}\n options={options}\n data={documents}\n />\n );\n }\n\n if (error) {\n return (\n <WarningPanel severity=\"error\" title={t('error.couldNotLoad')}>\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n return (\n <DocsTable\n title={title}\n entities={entities}\n loading={loading}\n actions={actions || defaultActions}\n columns={columns}\n options={options}\n />\n );\n};\n\n/**\n * @public\n */\nexport const EntityListDocsTable = EntityListDocsTableComponent as {\n (props: EntityListDocsTableProps): JSX.Element | null;\n columns: DocsTableColumnFactories;\n actions: DocsTableActionFactories;\n};\n\nEntityListDocsTable.columns = columnFactories;\nEntityListDocsTable.actions = actionFactories;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA6DA,MAAM,4BAAA,GAA+B,CACnC,KAAA,KACuB;AACvB,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,OAAA,EAAQ,GAAI,KAAA;AACtC,EAAA,MAAM,EAAE,SAAS,KAAA,EAAO,QAAA,EAAU,SAAS,cAAA,EAAgB,QAAA,KACzD,aAAA,EAAc;AAChB,EAAA,MAAM,EAAE,eAAA,EAAiB,mBAAA,EAAoB,GAAI,kBAAA,EAAmB;AACpE,EAAA,MAAM,GAAG,eAAe,CAAA,GAAI,kBAAA,EAAmB;AAC/C,EAAA,MAAM,uBAAA,GAA0B,YAAY,g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