Merge branch 'master' into migrate/oss
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
# @backstage/plugin-techdocs
|
||||
|
||||
## 0.12.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fe5738fe1c: Lazy load `LazyLog` as it is rarely used.
|
||||
- 53c9ad7e04: Update font weight for headings in TechDocs
|
||||
- Updated dependencies
|
||||
- @backstage/core-components@0.7.3
|
||||
- @backstage/theme@0.2.13
|
||||
- @backstage/plugin-search@0.4.17
|
||||
- @backstage/core-plugin-api@0.1.13
|
||||
- @backstage/plugin-catalog-react@0.6.3
|
||||
|
||||
## 0.12.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@backstage/plugin-techdocs",
|
||||
"description": "The Backstage plugin that renders technical documentation for your components",
|
||||
"version": "0.12.4",
|
||||
"version": "0.12.5",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
@@ -34,15 +34,15 @@
|
||||
"dependencies": {
|
||||
"@backstage/catalog-model": "^0.9.6",
|
||||
"@backstage/config": "^0.1.11",
|
||||
"@backstage/core-components": "^0.7.2",
|
||||
"@backstage/core-plugin-api": "^0.1.12",
|
||||
"@backstage/core-components": "^0.7.3",
|
||||
"@backstage/core-plugin-api": "^0.1.13",
|
||||
"@backstage/errors": "^0.1.4",
|
||||
"@backstage/integration": "^0.6.9",
|
||||
"@backstage/integration-react": "^0.1.13",
|
||||
"@backstage/plugin-catalog": "^0.7.2",
|
||||
"@backstage/plugin-catalog-react": "^0.6.2",
|
||||
"@backstage/plugin-search": "^0.4.16",
|
||||
"@backstage/theme": "^0.2.12",
|
||||
"@backstage/plugin-catalog-react": "^0.6.3",
|
||||
"@backstage/plugin-search": "^0.4.17",
|
||||
"@backstage/theme": "^0.2.13",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.57",
|
||||
@@ -61,10 +61,10 @@
|
||||
"react-use": "^17.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.8.1",
|
||||
"@backstage/core-app-api": "^0.1.19",
|
||||
"@backstage/cli": "^0.8.2",
|
||||
"@backstage/core-app-api": "^0.1.20",
|
||||
"@backstage/dev-utils": "^0.2.12",
|
||||
"@backstage/test-utils": "^0.1.20",
|
||||
"@backstage/test-utils": "^0.1.21",
|
||||
"@testing-library/jest-dom": "^5.10.1",
|
||||
"@testing-library/react": "^11.2.5",
|
||||
"@testing-library/react-hooks": "^7.0.2",
|
||||
|
||||
@@ -198,6 +198,7 @@ export const useTechDocsReaderDom = (): Element | null => {
|
||||
.md-footer-nav__link { width: 20rem;}
|
||||
.md-content { margin-left: 20rem; max-width: calc(100% - 20rem * 2 - 3rem); }
|
||||
.md-typeset { font-size: 1rem; }
|
||||
.md-typeset h1, .md-typeset h2, .md-typeset h3 { font-weight: bold; }
|
||||
.md-nav { font-size: 1rem; }
|
||||
.md-grid { max-width: 90vw; margin: 0 }
|
||||
.md-typeset table:not([class]) {
|
||||
|
||||
@@ -23,9 +23,9 @@ import {
|
||||
|
||||
// react-lazylog is based on a react-virtualized component which doesn't
|
||||
// write the content to the dom, so we mock it.
|
||||
jest.mock('react-lazylog', () => {
|
||||
jest.mock('react-lazylog/build/LazyLog', () => {
|
||||
return {
|
||||
LazyLog: ({ text }: { text: string }) => {
|
||||
default: ({ text }: { text: string }) => {
|
||||
return <p>{text}</p>;
|
||||
},
|
||||
};
|
||||
@@ -46,18 +46,20 @@ describe('<TechDocsBuildLogs />', () => {
|
||||
});
|
||||
|
||||
describe('<TechDocsBuildLogsDrawerContent />', () => {
|
||||
it('should render with empty log', () => {
|
||||
it('should render with empty log', async () => {
|
||||
const onClose = jest.fn();
|
||||
const rendered = render(
|
||||
<TechDocsBuildLogsDrawerContent buildLog={[]} onClose={onClose} />,
|
||||
);
|
||||
expect(rendered.getByText(/Build Details/i)).toBeInTheDocument();
|
||||
expect(rendered.getByText(/Waiting for logs.../i)).toBeInTheDocument();
|
||||
expect(
|
||||
await rendered.findByText(/Waiting for logs.../i),
|
||||
).toBeInTheDocument();
|
||||
|
||||
expect(onClose).toBeCalledTimes(0);
|
||||
});
|
||||
|
||||
it('should render with empty logs', () => {
|
||||
it('should render logs', async () => {
|
||||
const onClose = jest.fn();
|
||||
const rendered = render(
|
||||
<TechDocsBuildLogsDrawerContent
|
||||
@@ -66,11 +68,8 @@ describe('<TechDocsBuildLogsDrawerContent />', () => {
|
||||
/>,
|
||||
);
|
||||
expect(rendered.getByText(/Build Details/i)).toBeInTheDocument();
|
||||
expect(
|
||||
rendered.queryByText(/Waiting for logs.../i),
|
||||
).not.toBeInTheDocument();
|
||||
expect(rendered.getByText(/Line 1/i)).toBeInTheDocument();
|
||||
expect(rendered.getByText(/Line 2/i)).toBeInTheDocument();
|
||||
expect(await rendered.findByText(/Line 1/i)).toBeInTheDocument();
|
||||
expect(await rendered.findByText(/Line 2/i)).toBeInTheDocument();
|
||||
|
||||
expect(onClose).toBeCalledTimes(0);
|
||||
});
|
||||
@@ -80,7 +79,7 @@ describe('<TechDocsBuildLogsDrawerContent />', () => {
|
||||
const rendered = render(
|
||||
<TechDocsBuildLogsDrawerContent buildLog={[]} onClose={onClose} />,
|
||||
);
|
||||
rendered.getByRole('button').click();
|
||||
rendered.getByTitle('Close the drawer').click();
|
||||
|
||||
expect(onClose).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Progress } from '@backstage/core-components';
|
||||
import {
|
||||
Button,
|
||||
createStyles,
|
||||
@@ -25,9 +26,9 @@ import {
|
||||
Typography,
|
||||
} from '@material-ui/core';
|
||||
import Close from '@material-ui/icons/Close';
|
||||
import * as React from 'react';
|
||||
import { useState } from 'react';
|
||||
import { LazyLog } from 'react-lazylog';
|
||||
import React, { Suspense, useState } from 'react';
|
||||
|
||||
const LazyLog = React.lazy(() => import('react-lazylog/build/LazyLog'));
|
||||
|
||||
const useDrawerStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -83,15 +84,17 @@ export const TechDocsBuildLogsDrawerContent = ({
|
||||
</IconButton>
|
||||
</Grid>
|
||||
|
||||
<LazyLog
|
||||
text={
|
||||
buildLog.length === 0 ? 'Waiting for logs...' : buildLog.join('\n')
|
||||
}
|
||||
extraLines={1}
|
||||
follow
|
||||
selectableLines
|
||||
enableSearch
|
||||
/>
|
||||
<Suspense fallback={<Progress />}>
|
||||
<LazyLog
|
||||
text={
|
||||
buildLog.length === 0 ? 'Waiting for logs...' : buildLog.join('\n')
|
||||
}
|
||||
extraLines={1}
|
||||
follow
|
||||
selectableLines
|
||||
enableSearch
|
||||
/>
|
||||
</Suspense>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user