@backstage/plugin-techdocs 0.0.0-nightly-20220301023335 → 0.0.0-nightly-20220305022735
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 +25 -8
- package/dist/esm/{TechDocsCustomHome-c5d31d27.esm.js → TechDocsCustomHome-75cceaae.esm.js} +10 -18
- package/dist/esm/TechDocsCustomHome-75cceaae.esm.js.map +1 -0
- package/dist/index.d.ts +17 -17
- package/dist/index.esm.js +24 -16
- package/dist/index.esm.js.map +1 -1
- package/package.json +13 -13
- package/dist/esm/TechDocsCustomHome-c5d31d27.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20220305022735
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7a1dbe6ce9: The panels of `TechDocsCustomHome` now use the `useEntityOwnership` hook to resolve ownership when the `'ownedByUser'` filter predicate is used.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog@0.0.0-nightly-20220305022735
|
|
10
|
+
- @backstage/plugin-catalog-react@0.0.0-nightly-20220305022735
|
|
11
|
+
- @backstage/core-components@0.0.0-nightly-20220305022735
|
|
12
|
+
- @backstage/catalog-model@0.0.0-nightly-20220305022735
|
|
13
|
+
- @backstage/plugin-search@0.0.0-nightly-20220305022735
|
|
14
|
+
|
|
15
|
+
## 0.15.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
6
18
|
|
|
@@ -33,18 +45,23 @@
|
|
|
33
45
|
### Patch Changes
|
|
34
46
|
|
|
35
47
|
- 64b430f80d: chore(deps): bump `react-text-truncate` from 0.17.0 to 0.18.0
|
|
48
|
+
- 899f196af5: Use `getEntityByRef` instead of `getEntityByName` in the catalog client
|
|
49
|
+
- f41a293231: - **DEPRECATION**: Deprecated `formatEntityRefTitle` in favor of the new `humanizeEntityRef` method instead. Please migrate to using the new method instead.
|
|
36
50
|
- c5fda066b1: Collapse techdocs sidebar on small devices
|
|
51
|
+
- f590d1681b: Removed usage of deprecated favorite utility methods.
|
|
37
52
|
- 5b0f9a75fa: Remove copyright from old footer in documentation generated with previous version of `mkdocs-techdocs-plugin` (`v0.2.2`).
|
|
38
53
|
- 0c3ba547a6: Show feedback when copying code snippet to clipboard.
|
|
39
54
|
- 0ca964ee0e: Fixed a bug that could cause searches in the in-context TechDocs search bar to show results from a different TechDocs site.
|
|
55
|
+
- 36aa63022b: Use `CompoundEntityRef` instead of `EntityName`, and `getCompoundEntityRef` instead of `getEntityName`, from `@backstage/catalog-model`.
|
|
40
56
|
- Updated dependencies
|
|
41
|
-
- @backstage/
|
|
42
|
-
- @backstage/
|
|
43
|
-
- @backstage/
|
|
44
|
-
- @backstage/plugin-catalog
|
|
45
|
-
- @backstage/
|
|
46
|
-
- @backstage/
|
|
47
|
-
- @backstage/
|
|
57
|
+
- @backstage/catalog-model@0.12.0
|
|
58
|
+
- @backstage/core-components@0.9.0
|
|
59
|
+
- @backstage/plugin-search@0.7.2
|
|
60
|
+
- @backstage/plugin-catalog@0.9.1
|
|
61
|
+
- @backstage/plugin-catalog-react@0.8.0
|
|
62
|
+
- @backstage/integration@0.8.0
|
|
63
|
+
- @backstage/core-plugin-api@0.8.0
|
|
64
|
+
- @backstage/integration-react@0.1.24
|
|
48
65
|
|
|
49
66
|
## 0.14.0
|
|
50
67
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import useAsync from 'react-use/lib/useAsync';
|
|
3
3
|
import { makeStyles } from '@material-ui/core';
|
|
4
|
-
import { catalogApiRef, CATALOG_FILTER_EXISTS,
|
|
5
|
-
import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
4
|
+
import { catalogApiRef, CATALOG_FILTER_EXISTS, useEntityOwnership } from '@backstage/plugin-catalog-react';
|
|
6
5
|
import { TechDocsPageWrapper, DocsTable, DocsCardGrid } from '../index.esm.js';
|
|
7
6
|
import { Content, Progress, WarningPanel, CodeSnippet, HeaderTabs, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
8
|
-
import { useApi
|
|
7
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
9
8
|
import '@backstage/errors';
|
|
10
9
|
import 'event-source-polyfill';
|
|
11
10
|
import 'react-router-dom';
|
|
@@ -26,9 +25,13 @@ import '@material-ui/lab';
|
|
|
26
25
|
import '@material-ui/icons/Close';
|
|
27
26
|
import 'react-use/lib/useAsyncRetry';
|
|
28
27
|
import '@material-ui/icons/Code';
|
|
28
|
+
import '@backstage/catalog-model';
|
|
29
29
|
import 'react-use/lib/useCopyToClipboard';
|
|
30
30
|
import 'lodash';
|
|
31
31
|
import '@material-ui/icons/Share';
|
|
32
|
+
import '@material-ui/styles';
|
|
33
|
+
import '@material-ui/icons/Star';
|
|
34
|
+
import '@material-ui/icons/StarBorder';
|
|
32
35
|
import '@backstage/plugin-catalog';
|
|
33
36
|
|
|
34
37
|
const panels = {
|
|
@@ -47,14 +50,14 @@ const CustomPanel = ({
|
|
|
47
50
|
}
|
|
48
51
|
});
|
|
49
52
|
const classes = useStyles();
|
|
50
|
-
const {
|
|
53
|
+
const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();
|
|
51
54
|
const Panel = panels[config.panelType];
|
|
52
55
|
const shownEntities = entities.filter((entity) => {
|
|
53
56
|
if (config.filterPredicate === "ownedByUser") {
|
|
54
|
-
if (
|
|
57
|
+
if (loadingOwnership) {
|
|
55
58
|
return false;
|
|
56
59
|
}
|
|
57
|
-
return
|
|
60
|
+
return isOwnedEntity(entity);
|
|
58
61
|
}
|
|
59
62
|
return typeof config.filterPredicate === "function" && config.filterPredicate(entity);
|
|
60
63
|
});
|
|
@@ -124,17 +127,6 @@ const TechDocsCustomHome = (props) => {
|
|
|
124
127
|
index
|
|
125
128
|
}))));
|
|
126
129
|
};
|
|
127
|
-
function useOwnUser() {
|
|
128
|
-
const catalogApi = useApi(catalogApiRef);
|
|
129
|
-
const identityApi = useApi(identityApiRef);
|
|
130
|
-
return useAsync(async () => {
|
|
131
|
-
const identity = await identityApi.getBackstageIdentity();
|
|
132
|
-
return catalogApi.getEntityByName(parseEntityRef(identity.userEntityRef, {
|
|
133
|
-
defaultKind: "User",
|
|
134
|
-
defaultNamespace: DEFAULT_NAMESPACE
|
|
135
|
-
}));
|
|
136
|
-
}, [catalogApi, identityApi]);
|
|
137
|
-
}
|
|
138
130
|
|
|
139
131
|
export { TechDocsCustomHome };
|
|
140
|
-
//# sourceMappingURL=TechDocsCustomHome-
|
|
132
|
+
//# sourceMappingURL=TechDocsCustomHome-75cceaae.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TechDocsCustomHome-75cceaae.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,SAAS;AAAA,EACb;AAAA,EACA;AAAA;AAwCF,MAAM,cAAc,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,MAKI;AACJ,QAAM,YAAY,WAAW;AAAA,IAC3B,gBAAgB;AAAA,MACd,cAAc;AAAA,SACV,OAAO,WAAW,OAAO,WAAW;AAAA;AAAA;AAG5C,QAAM,UAAU;AAChB,QAAM,EAAE,SAAS,kBAAkB,kBAAkB;AAErD,QAAM,QAAQ,OAAO,OAAO;AAE5B,QAAM,gBAAgB,SAAS,OAAO,YAAU;AAC9C,QAAI,OAAO,oBAAoB,eAAe;AAC5C,UAAI,kBAAkB;AACpB,eAAO;AAAA;AAET,aAAO,cAAc;AAAA;AAGvB,WACE,OAAO,OAAO,oBAAoB,cAClC,OAAO,gBAAgB;AAAA;AAI3B,uGAEK,eAAD;AAAA,IAAe,OAAO,OAAO;AAAA,IAAO,aAAa,OAAO;AAAA,KACrD,UAAU,wCACR,eAAD,MAAe,+CAGb,2CAEL,OAAD;AAAA,IAAK,WAAW,QAAQ;AAAA,yCACrB,OAAD;AAAA,IAAO,eAAY;AAAA,IAAwB,UAAU;AAAA;AAAA;MAehD,qBAAqB,CAAC,UAAmC;AACpE,QAAM,EAAE,eAAe;AACvB,QAAM,CAAC,aAAa,kBAAkB,SAAiB;AACvD,QAAM,aAAyB,OAAO;AAEtC,QAAM;AAAA,IACJ,OAAO;AAAA,IACP;AAAA,IACA;AAAA,MACE,SAAS,YAAY;AACvB,UAAM,WAAW,MAAM,WAAW,YAAY;AAAA,MAC5C,QAAQ;AAAA,QACN,kDAAkD;AAAA;AAAA,MAEpD,QAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA;AAGJ,WAAO,SAAS,MAAM,OAAO,CAAC,WAAmB;AAtKrD;AAuKM,aAAO,CAAC,eAAQ,SAAS,gBAAhB,mBAA8B;AAAA;AAAA;AAI3C,QAAM,mBAAmB,WAAW;AAEpC,MAAI,SAAS;AACX,+CACG,qBAAD,0CACG,SAAD,0CACG,UAAD;AAAA;AAMR,MAAI,OAAO;AACT,+CACG,qBAAD,0CACG,SAAD,0CACG,cAAD;AAAA,MACE,UAAS;AAAA,MACT,OAAM;AAAA,2CAEL,aAAD;AAAA,MAAa,UAAS;AAAA,MAAO,MAAM,MAAM;AAAA;AAAA;AAOnD,6CACG,qBAAD,0CACG,YAAD;AAAA,IACE,eAAe;AAAA,IACf,UAAU,WAAS,eAAe;AAAA,IAClC,MAAM,WAAW,IAAI,CAAC,EAAE,SAAS;AAAW,MAC1C,IAAI,MAAM;AAAA,MACV;AAAA;AAAA,0CAGH,SAAD;AAAA,IAAS,eAAY;AAAA,KAClB,iBAAiB,OAAO,IAAI,CAAC,QAAQ,8CACnC,aAAD;AAAA,IACE,KAAK;AAAA,IACL;AAAA,IACA,UAAU,CAAC,CAAC,WAAW,WAAW;AAAA,IAClC;AAAA;AAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Entity,
|
|
2
|
+
import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
|
|
3
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
4
|
import { DiscoveryApi, FetchApi, IdentityApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import { Config } from '@backstage/config';
|
|
@@ -59,9 +59,9 @@ interface TechDocsStorageApi {
|
|
|
59
59
|
getApiOrigin(): Promise<string>;
|
|
60
60
|
getStorageUrl(): Promise<string>;
|
|
61
61
|
getBuilder(): Promise<string>;
|
|
62
|
-
getEntityDocs(entityId:
|
|
63
|
-
syncEntityDocs(entityId:
|
|
64
|
-
getBaseUrl(oldBaseUrl: string, entityId:
|
|
62
|
+
getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;
|
|
63
|
+
syncEntityDocs(entityId: CompoundEntityRef, logHandler?: (line: string) => void): Promise<SyncResult>;
|
|
64
|
+
getBaseUrl(oldBaseUrl: string, entityId: CompoundEntityRef, path: string): Promise<string>;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* API to talk to techdocs-backend.
|
|
@@ -73,8 +73,8 @@ interface TechDocsApi {
|
|
|
73
73
|
* Set to techdocs.requestUrl as the URL for techdocs-backend API.
|
|
74
74
|
*/
|
|
75
75
|
getApiOrigin(): Promise<string>;
|
|
76
|
-
getTechDocsMetadata(entityId:
|
|
77
|
-
getEntityMetadata(entityId:
|
|
76
|
+
getTechDocsMetadata(entityId: CompoundEntityRef): Promise<TechDocsMetadata>;
|
|
77
|
+
getEntityMetadata(entityId: CompoundEntityRef): Promise<TechDocsEntityMetadata>;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
@@ -101,7 +101,7 @@ declare class TechDocsClient implements TechDocsApi {
|
|
|
101
101
|
*
|
|
102
102
|
* @param entityId - Object containing entity data like name, namespace, etc.
|
|
103
103
|
*/
|
|
104
|
-
getTechDocsMetadata(entityId:
|
|
104
|
+
getTechDocsMetadata(entityId: CompoundEntityRef): Promise<TechDocsMetadata>;
|
|
105
105
|
/**
|
|
106
106
|
* Retrieve metadata about an entity.
|
|
107
107
|
*
|
|
@@ -110,7 +110,7 @@ declare class TechDocsClient implements TechDocsApi {
|
|
|
110
110
|
*
|
|
111
111
|
* @param entityId - Object containing entity data like name, namespace, etc.
|
|
112
112
|
*/
|
|
113
|
-
getEntityMetadata(entityId:
|
|
113
|
+
getEntityMetadata(entityId: CompoundEntityRef): Promise<TechDocsEntityMetadata>;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* API which talks to TechDocs storage to fetch files to render.
|
|
@@ -139,7 +139,7 @@ declare class TechDocsStorageClient implements TechDocsStorageApi {
|
|
|
139
139
|
* @returns HTML content of the docs page as string
|
|
140
140
|
* @throws Throws error when the page is not found.
|
|
141
141
|
*/
|
|
142
|
-
getEntityDocs(entityId:
|
|
142
|
+
getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;
|
|
143
143
|
/**
|
|
144
144
|
* Check if docs are on the latest version and trigger rebuild if not
|
|
145
145
|
*
|
|
@@ -148,8 +148,8 @@ declare class TechDocsStorageClient implements TechDocsStorageApi {
|
|
|
148
148
|
* @returns Whether documents are currently synchronized to newest version
|
|
149
149
|
* @throws Throws error on error from sync endpoint in Techdocs Backend
|
|
150
150
|
*/
|
|
151
|
-
syncEntityDocs(entityId:
|
|
152
|
-
getBaseUrl(oldBaseUrl: string, entityId:
|
|
151
|
+
syncEntityDocs(entityId: CompoundEntityRef, logHandler?: (line: string) => void): Promise<SyncResult>;
|
|
152
|
+
getBaseUrl(oldBaseUrl: string, entityId: CompoundEntityRef, path: string): Promise<string>;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
/**
|
|
@@ -158,7 +158,7 @@ declare class TechDocsStorageClient implements TechDocsStorageApi {
|
|
|
158
158
|
* @public
|
|
159
159
|
*/
|
|
160
160
|
declare type ReaderProps = {
|
|
161
|
-
entityRef:
|
|
161
|
+
entityRef: CompoundEntityRef;
|
|
162
162
|
withSearch?: boolean;
|
|
163
163
|
onReady?: () => void;
|
|
164
164
|
};
|
|
@@ -170,14 +170,14 @@ declare type ReaderProps = {
|
|
|
170
170
|
declare const Reader: (props: ReaderProps) => JSX.Element;
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
* Helper function that gives the children of {@link TechDocsReaderPage}
|
|
173
|
+
* Helper function that gives the children of {@link TechDocsReaderPage} access to techdocs and entity metadata
|
|
174
174
|
*
|
|
175
175
|
* @public
|
|
176
176
|
*/
|
|
177
177
|
declare type TechDocsReaderPageRenderFunction = ({ techdocsMetadataValue, entityMetadataValue, entityRef, }: {
|
|
178
178
|
techdocsMetadataValue?: TechDocsMetadata | undefined;
|
|
179
179
|
entityMetadataValue?: TechDocsEntityMetadata | undefined;
|
|
180
|
-
entityRef:
|
|
180
|
+
entityRef: CompoundEntityRef;
|
|
181
181
|
onReady: () => void;
|
|
182
182
|
}) => JSX.Element;
|
|
183
183
|
/**
|
|
@@ -205,7 +205,7 @@ declare type TechDocsPageRenderFunction = TechDocsReaderPageRenderFunction;
|
|
|
205
205
|
* @public
|
|
206
206
|
*/
|
|
207
207
|
declare type TechDocsReaderPageHeaderProps = PropsWithChildren<{
|
|
208
|
-
entityRef:
|
|
208
|
+
entityRef: CompoundEntityRef;
|
|
209
209
|
entityMetadata?: TechDocsEntityMetadata;
|
|
210
210
|
techDocsMetadata?: TechDocsMetadata;
|
|
211
211
|
}>;
|
|
@@ -256,7 +256,7 @@ declare const DocsResultListItem: (props: TechDocsSearchResultListItemProps) =>
|
|
|
256
256
|
* @public
|
|
257
257
|
*/
|
|
258
258
|
declare type TechDocsSearchProps = {
|
|
259
|
-
entityId:
|
|
259
|
+
entityId: CompoundEntityRef;
|
|
260
260
|
debounceTime?: number;
|
|
261
261
|
};
|
|
262
262
|
/**
|
|
@@ -298,7 +298,7 @@ declare type DocsTableRow = {
|
|
|
298
298
|
resolved: {
|
|
299
299
|
docsUrl: string;
|
|
300
300
|
ownedByRelationsTitle: string;
|
|
301
|
-
ownedByRelations:
|
|
301
|
+
ownedByRelations: CompoundEntityRef[];
|
|
302
302
|
};
|
|
303
303
|
};
|
|
304
304
|
|
package/dist/index.esm.js
CHANGED
|
@@ -24,10 +24,13 @@ import useAsync from 'react-use/lib/useAsync';
|
|
|
24
24
|
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
25
25
|
import CodeIcon from '@material-ui/icons/Code';
|
|
26
26
|
import { RELATION_OWNED_BY } from '@backstage/catalog-model';
|
|
27
|
-
import { getEntityRelations, EntityRefLink, EntityRefLinks, useEntityList,
|
|
27
|
+
import { getEntityRelations, EntityRefLink, EntityRefLinks, useEntityList, humanizeEntityRef, useStarredEntities, CATALOG_FILTER_EXISTS, EntityListProvider, UserListPicker, EntityOwnerPicker, EntityTagPicker, useEntity } from '@backstage/plugin-catalog-react';
|
|
28
28
|
import useCopyToClipboard from 'react-use/lib/useCopyToClipboard';
|
|
29
29
|
import { capitalize } from 'lodash';
|
|
30
30
|
import ShareIcon from '@material-ui/icons/Share';
|
|
31
|
+
import { withStyles as withStyles$1 } from '@material-ui/styles';
|
|
32
|
+
import Star from '@material-ui/icons/Star';
|
|
33
|
+
import StarBorder from '@material-ui/icons/StarBorder';
|
|
31
34
|
import { FilteredEntityLayout, FilterContainer, EntityListContainer } from '@backstage/plugin-catalog';
|
|
32
35
|
|
|
33
36
|
const techdocsStorageApiRef = createApiRef({
|
|
@@ -1121,7 +1124,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1121
1124
|
--md-source-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 0 1 .25-.25h5.025a.25.25 0 0 1 .177.073l6.25 6.25a.25.25 0 0 1 0 .354l-5.025 5.025a.25.25 0 0 1-.354 0l-6.25-6.25a.25.25 0 0 1-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.75 1.75 0 0 1 1 7.775zM6 5a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>');
|
|
1122
1125
|
--md-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="m310.6 246.6-127.1 128c-7.1 6.3-15.3 9.4-23.5 9.4s-16.38-3.125-22.63-9.375l-127.1-128C.224 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75s3.12 25.75-6.08 34.85z"/></svg>');
|
|
1123
1126
|
}
|
|
1124
|
-
|
|
1127
|
+
|
|
1125
1128
|
:host > * {
|
|
1126
1129
|
/* CODE */
|
|
1127
1130
|
--md-code-fg-color: ${theme.palette.text.primary};
|
|
@@ -1209,7 +1212,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1209
1212
|
.md-main__inner {
|
|
1210
1213
|
margin-top: 0;
|
|
1211
1214
|
}
|
|
1212
|
-
|
|
1215
|
+
|
|
1213
1216
|
.md-sidebar {
|
|
1214
1217
|
height: calc(100% - 100px);
|
|
1215
1218
|
position: fixed;
|
|
@@ -1221,13 +1224,13 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1221
1224
|
.md-sidebar--secondary {
|
|
1222
1225
|
right: ${theme.spacing(3)}px;
|
|
1223
1226
|
}
|
|
1224
|
-
|
|
1227
|
+
|
|
1225
1228
|
.md-content {
|
|
1226
1229
|
max-width: calc(100% - 16rem * 2);
|
|
1227
1230
|
margin-left: 16rem;
|
|
1228
1231
|
margin-bottom: 50px;
|
|
1229
1232
|
}
|
|
1230
|
-
|
|
1233
|
+
|
|
1231
1234
|
.md-footer {
|
|
1232
1235
|
position: fixed;
|
|
1233
1236
|
bottom: 0px;
|
|
@@ -1242,7 +1245,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1242
1245
|
.md-dialog {
|
|
1243
1246
|
background-color: unset;
|
|
1244
1247
|
}
|
|
1245
|
-
|
|
1248
|
+
|
|
1246
1249
|
@media screen and (max-width: 76.1875em) {
|
|
1247
1250
|
.md-nav {
|
|
1248
1251
|
transition: none !important;
|
|
@@ -1335,7 +1338,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1335
1338
|
`
|
|
1336
1339
|
}),
|
|
1337
1340
|
injectCss({
|
|
1338
|
-
css: `
|
|
1341
|
+
css: `
|
|
1339
1342
|
.md-typeset {
|
|
1340
1343
|
font-size: var(--md-typeset-font-size);
|
|
1341
1344
|
}
|
|
@@ -1367,11 +1370,11 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1367
1370
|
.md-typeset .md-content__button {
|
|
1368
1371
|
color: var(--md-default-fg-color);
|
|
1369
1372
|
}
|
|
1370
|
-
|
|
1373
|
+
|
|
1371
1374
|
.md-typeset hr {
|
|
1372
1375
|
border-bottom: 0.05rem dotted ${theme.palette.divider};
|
|
1373
1376
|
}
|
|
1374
|
-
|
|
1377
|
+
|
|
1375
1378
|
.md-typeset details {
|
|
1376
1379
|
font-size: var(--md-typeset-font-size) !important;
|
|
1377
1380
|
}
|
|
@@ -1388,7 +1391,7 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1388
1391
|
.md-typeset details[open] > summary:after {
|
|
1389
1392
|
transform: rotate(90deg) translateX(-50%) !important;
|
|
1390
1393
|
}
|
|
1391
|
-
|
|
1394
|
+
|
|
1392
1395
|
.md-typeset blockquote {
|
|
1393
1396
|
color: var(--md-default-fg-color--light);
|
|
1394
1397
|
border-left: 0.2rem solid var(--md-default-fg-color--light);
|
|
@@ -1432,13 +1435,13 @@ const useTechDocsReaderDom = (entityRef) => {
|
|
|
1432
1435
|
.highlight .md-clipboard:after {
|
|
1433
1436
|
content: unset;
|
|
1434
1437
|
}
|
|
1435
|
-
|
|
1438
|
+
|
|
1436
1439
|
.highlight .nx {
|
|
1437
1440
|
color: ${isDarkTheme ? "#ff53a3" : "#ec407a"};
|
|
1438
1441
|
}
|
|
1439
1442
|
|
|
1440
1443
|
/* CODE HILITE */
|
|
1441
|
-
.codehilite .gd {
|
|
1444
|
+
.codehilite .gd {
|
|
1442
1445
|
background-color: ${isDarkTheme ? "rgba(248,81,73,0.65)" : "#fdd"};
|
|
1443
1446
|
}
|
|
1444
1447
|
|
|
@@ -1804,6 +1807,11 @@ const EntityListDocsGrid = () => {
|
|
|
1804
1807
|
});
|
|
1805
1808
|
};
|
|
1806
1809
|
|
|
1810
|
+
const YellowStar = withStyles$1({
|
|
1811
|
+
root: {
|
|
1812
|
+
color: "#f3ba37"
|
|
1813
|
+
}
|
|
1814
|
+
})(Star);
|
|
1807
1815
|
const actionFactories = {
|
|
1808
1816
|
createCopyDocsUrlAction(copyToClipboard) {
|
|
1809
1817
|
return (row) => {
|
|
@@ -1821,8 +1829,8 @@ const actionFactories = {
|
|
|
1821
1829
|
const isStarred = isStarredEntity(entity);
|
|
1822
1830
|
return {
|
|
1823
1831
|
cellStyle: { paddingLeft: "1em" },
|
|
1824
|
-
icon: () =>
|
|
1825
|
-
tooltip:
|
|
1832
|
+
icon: () => isStarred ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(StarBorder, null),
|
|
1833
|
+
tooltip: isStarred ? "Remove from favorites" : "Add to favorites",
|
|
1826
1834
|
onClick: () => toggleStarredEntity(entity)
|
|
1827
1835
|
};
|
|
1828
1836
|
};
|
|
@@ -1883,7 +1891,7 @@ const DocsTable = (props) => {
|
|
|
1883
1891
|
name: toLowerMaybe(entity.metadata.name, config)
|
|
1884
1892
|
}),
|
|
1885
1893
|
ownedByRelations,
|
|
1886
|
-
ownedByRelationsTitle: ownedByRelations.map((r) =>
|
|
1894
|
+
ownedByRelationsTitle: ownedByRelations.map((r) => humanizeEntityRef(r, { defaultKind: "group" })).join(", ")
|
|
1887
1895
|
}
|
|
1888
1896
|
};
|
|
1889
1897
|
});
|
|
@@ -2043,7 +2051,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
|
|
|
2043
2051
|
}));
|
|
2044
2052
|
const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
|
|
2045
2053
|
name: "TechDocsCustomHome",
|
|
2046
|
-
component: () => import('./esm/TechDocsCustomHome-
|
|
2054
|
+
component: () => import('./esm/TechDocsCustomHome-75cceaae.esm.js').then((m) => m.TechDocsCustomHome),
|
|
2047
2055
|
mountPoint: rootRouteRef
|
|
2048
2056
|
}));
|
|
2049
2057
|
const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
|