Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support showing the readme on entity page #711

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backstage/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"cy:run": "cypress run --browser chrome"
},
"dependencies": {
"@axis-backstage/plugin-readme": "^0.7.1",
"@backstage/app-defaults": "^1.4.5",
"@backstage/catalog-model": "^1.4.3",
"@backstage/cli": "^0.26.2",
Expand Down
6 changes: 5 additions & 1 deletion backstage/packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import {
import { Button, Grid } from '@material-ui/core';
import React from 'react';
import { EntityAboutCard } from '../AboutCard/AboutCard';
import { ReadmeCard } from '@axis-backstage/plugin-readme';

const TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';
const ANNOTATIONS_DOCS_URL =
Expand Down Expand Up @@ -147,9 +148,12 @@ const entityWarningContent = (
const overviewContent = (
<Grid container spacing={3} alignItems="stretch">
{entityWarningContent}
<Grid item md={6}>
<Grid item xs={12} md={6}>
<EntityAboutCard variant="gridItem" />
</Grid>
<Grid item xs={12} md={4}>
<ReadmeCard />
</Grid>
<Grid item md={6} xs={12}>
<EntityCatalogGraphCard variant="gridItem" height={400} />
</Grid>
Expand Down
1 change: 1 addition & 0 deletions backstage/packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
},
"dependencies": {
"@axis-backstage/plugin-readme-backend": "^0.6.0",
"@backstage/backend-common": "^0.23.2",
"@backstage/backend-tasks": "^0.5.12",
"@backstage/catalog-client": "^1.4.6",
Expand Down
3 changes: 3 additions & 0 deletions backstage/packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import auth from './plugins/auth';
import catalog from './plugins/catalog';
import gitlab from './plugins/gitlab';
import proxy from './plugins/proxy';
import readme from './plugins/readme';
import scaffolder from './plugins/scaffolder';
import search from './plugins/search';
import techdocs from './plugins/techdocs';
Expand Down Expand Up @@ -74,6 +75,7 @@ async function main() {
const scaffolderEnv = useHotMemoize(module, () => createEnv('scaffolder'));
const authEnv = useHotMemoize(module, () => createEnv('auth'));
const proxyEnv = useHotMemoize(module, () => createEnv('proxy'));
const readmeEnv = useHotMemoize(module, () => createEnv('readme'));
const techdocsEnv = useHotMemoize(module, () => createEnv('techdocs'));
const searchEnv = useHotMemoize(module, () => createEnv('search'));
const gitlabEnv = useHotMemoize(module, () => createEnv('gitlab'));
Expand All @@ -84,6 +86,7 @@ async function main() {
apiRouter.use('/auth', await auth(authEnv));
apiRouter.use('/techdocs', await techdocs(techdocsEnv));
apiRouter.use('/proxy', await proxy(proxyEnv));
apiRouter.use('/readme', await readme(readmeEnv));
apiRouter.use('/search', await search(searchEnv));
apiRouter.use('/gitlab', await gitlab(gitlabEnv));

Expand Down
15 changes: 15 additions & 0 deletions backstage/packages/backend/src/plugins/readme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createRouter } from '@axis-backstage/plugin-readme-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
return await createRouter({
logger: env.logger,
config: env.config,
reader: env.reader,
discovery: env.discovery,
tokenManager: env.tokenManager,
});
}
126 changes: 125 additions & 1 deletion backstage/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,39 @@
"@smithy/types" "^2.10.1"
tslib "^2.5.0"

"@axis-backstage/plugin-readme-backend@^0.6.0":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@axis-backstage/plugin-readme-backend/-/plugin-readme-backend-0.6.1.tgz#a7f532ddcd1988a01109c4b840e4f961bb2e657a"
integrity sha512-hfMhtTNSVi08JJuCAn6yvKuKlV6Acq1jC1tVefhqtNiTx9KwkI9SUNFGo6nKXPJJUEHPRdPCzdM5S8cM/dvNLQ==
dependencies:
"@backstage/backend-common" "^0.21.7"
"@backstage/backend-plugin-api" "^0.6.17"
"@backstage/catalog-client" "^1.6.4"
"@backstage/catalog-model" "^1.4.5"
"@backstage/config" "^1.2.0"
"@backstage/integration" "^1.10.0"
"@backstage/plugin-permission-common" "^0.7.13"
"@types/express" "*"
express "^4.17.1"
express-promise-router "^4.1.0"
node-fetch "^2.6.7"
winston "^3.2.1"
yn "^4.0.0"

"@axis-backstage/plugin-readme@^0.7.1":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@axis-backstage/plugin-readme/-/plugin-readme-0.7.1.tgz#166326eae9cc38cd2e2f114ecd8a352866aebb24"
integrity sha512-mRZDmCDbOYT0b01ZxO9R7G36jiGqJmgRqokaeDh9Ac54rs3BhfeBU95dUFeMnjePFKllqzqYAA2Bk28TWN7ubA==
dependencies:
"@backstage/catalog-model" "^1.4.5"
"@backstage/core-components" "^0.14.4"
"@backstage/core-plugin-api" "^1.9.2"
"@backstage/plugin-catalog-react" "^1.11.3"
"@backstage/theme" "^0.5.3"
"@mui/icons-material" "^5.15.7"
"@mui/material" "^5.15.7"
react-use "^17.2.4"

"@azure/abort-controller@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@azure/abort-controller/-/abort-controller-1.1.0.tgz#788ee78457a55af8a1ad342acb182383d2119249"
Expand Down Expand Up @@ -2559,7 +2592,7 @@
winston "^3.2.1"
winston-transport "^4.5.0"

"@backstage/backend-common@^0.21.2", "@backstage/backend-common@^0.21.6":
"@backstage/backend-common@^0.21.2", "@backstage/backend-common@^0.21.6", "@backstage/backend-common@^0.21.7":
version "0.21.7"
resolved "https://registry.yarnpkg.com/@backstage/backend-common/-/backend-common-0.21.7.tgz#5ae796d8adccebc484edeeb2326464c28e14849e"
integrity sha512-wWpnjLYxEstFnAherkfwZIlAazdu1dfJ/5KjK1aSeMZYGyRWcelegs+Dz9MLZ53e/5qtSJ5+caltNfiItda86w==
Expand Down Expand Up @@ -6763,11 +6796,36 @@
clsx "^2.1.0"
prop-types "^15.8.1"

"@mui/[email protected]":
version "5.0.0-beta.40"
resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-beta.40.tgz#1f8a782f1fbf3f84a961e954c8176b187de3dae2"
integrity sha512-I/lGHztkCzvwlXpjD2+SNmvNQvB4227xBXhISPjEaJUXGImOQ9f3D2Yj/T3KasSI/h0MLWy74X0J6clhPmsRbQ==
dependencies:
"@babel/runtime" "^7.23.9"
"@floating-ui/react-dom" "^2.0.8"
"@mui/types" "^7.2.14"
"@mui/utils" "^5.15.14"
"@popperjs/core" "^2.11.8"
clsx "^2.1.0"
prop-types "^15.8.1"

"@mui/core-downloads-tracker@^5.15.12":
version "5.15.12"
resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.12.tgz#f3da6ff16c753ab8b2f8d401c1e1534ba8a8a9a9"
integrity sha512-brRO+tMFLpGyjEYHrX97bzqeF6jZmKpqqe1rY0LyIHAwP6xRVzh++zSecOQorDOCaZJg4XkGT9xfD+RWOWxZBA==

"@mui/core-downloads-tracker@^5.15.21":
version "5.15.21"
resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.21.tgz#15ffc56cef7009479229b55126176f988afba96b"
integrity sha512-dp9lXBaJZzJYeJfQY3Ow4Rb49QaCEdkl2KKYscdQHQm6bMJ+l4XPY3Cd9PCeeJTsHPIDJ60lzXbeRgs6sx/rpw==

"@mui/icons-material@^5.15.7":
version "5.15.21"
resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.15.21.tgz#1e29e1bdb90916be5b66c95c45951f441821f34a"
integrity sha512-yqkq1MbdkmX5ZHyvZTBuAaA6RkvoqkoAgwBSx9Oh0L0jAfj9T/Ih/NhMNjkl8PWVSonjfDUkKroBnjRyo/1M9Q==
dependencies:
"@babel/runtime" "^7.23.9"

"@mui/material@^5.12.2":
version "5.15.12"
resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.15.12.tgz#08d6582e4037f45df510f3bce51fa06b38a9a676"
Expand All @@ -6786,6 +6844,24 @@
react-is "^18.2.0"
react-transition-group "^4.4.5"

"@mui/material@^5.15.7":
version "5.15.21"
resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.15.21.tgz#b2c8d756af570a61cb4975acf0e71dafb110b001"
integrity sha512-nTyCcgduKwHqiuQ/B03EQUa+utSMzn2sQp0QAibsnYe4tvc3zkMbO0amKpl48vhABIY3IvT6w9615BFIgMt0YA==
dependencies:
"@babel/runtime" "^7.23.9"
"@mui/base" "5.0.0-beta.40"
"@mui/core-downloads-tracker" "^5.15.21"
"@mui/system" "^5.15.20"
"@mui/types" "^7.2.14"
"@mui/utils" "^5.15.20"
"@types/react-transition-group" "^4.4.10"
clsx "^2.1.0"
csstype "^3.1.3"
prop-types "^15.8.1"
react-is "^18.2.0"
react-transition-group "^4.4.5"

"@mui/private-theming@^5.15.12":
version "5.15.12"
resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.15.12.tgz#e3ac99b3dbfa6ecc6e914009df33a2d400432f6e"
Expand All @@ -6795,6 +6871,15 @@
"@mui/utils" "^5.15.12"
prop-types "^15.8.1"

"@mui/private-theming@^5.15.20":
version "5.15.20"
resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.15.20.tgz#028c4e3c717a13691ac2c8c98e29aa819d89001a"
integrity sha512-BK8F94AIqSrnaPYXf2KAOjGZJgWfvqAVQ2gVR3EryvQFtuBnG6RwodxrCvd3B48VuMy6Wsk897+lQMUxJyk+6g==
dependencies:
"@babel/runtime" "^7.23.9"
"@mui/utils" "^5.15.20"
prop-types "^15.8.1"

"@mui/styled-engine@^5.15.11":
version "5.15.11"
resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.11.tgz#040181f31910e0f66d43a5c44fe89da06b34212b"
Expand All @@ -6805,6 +6890,16 @@
csstype "^3.1.3"
prop-types "^15.8.1"

"@mui/styled-engine@^5.15.14":
version "5.15.14"
resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.14.tgz#168b154c4327fa4ccc1933a498331d53f61c0de2"
integrity sha512-RILkuVD8gY6PvjZjqnWhz8fu68dVkqhM5+jYWfB5yhlSQKg+2rHkmEwm75XIeAqI3qwOndK6zELK5H6Zxn4NHw==
dependencies:
"@babel/runtime" "^7.23.9"
"@emotion/cache" "^11.11.0"
csstype "^3.1.3"
prop-types "^15.8.1"

"@mui/system@^5.15.12":
version "5.15.12"
resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.15.12.tgz#852cf7c339eb61703196f56c36fc93206136eb20"
Expand All @@ -6819,11 +6914,30 @@
csstype "^3.1.3"
prop-types "^15.8.1"

"@mui/system@^5.15.20":
version "5.15.20"
resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.15.20.tgz#f1933aabc4c10f8580c7a951ca3b88542ef0f76b"
integrity sha512-LoMq4IlAAhxzL2VNUDBTQxAb4chnBe8JvRINVNDiMtHE2PiPOoHlhOPutSxEbaL5mkECPVWSv6p8JEV+uykwIA==
dependencies:
"@babel/runtime" "^7.23.9"
"@mui/private-theming" "^5.15.20"
"@mui/styled-engine" "^5.15.14"
"@mui/types" "^7.2.14"
"@mui/utils" "^5.15.20"
clsx "^2.1.0"
csstype "^3.1.3"
prop-types "^15.8.1"

"@mui/types@^7.2.13":
version "7.2.13"
resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.13.tgz#d1584912942f9dc042441ecc2d1452be39c666b8"
integrity sha512-qP9OgacN62s+l8rdDhSFRe05HWtLLJ5TGclC9I1+tQngbssu0m2dmFZs+Px53AcOs9fD7TbYd4gc9AXzVqO/+g==

"@mui/types@^7.2.14":
version "7.2.14"
resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.14.tgz#8a02ac129b70f3d82f2f9b76ded2c8d48e3fc8c9"
integrity sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ==

"@mui/utils@^5.14.15", "@mui/utils@^5.15.12":
version "5.15.12"
resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.15.12.tgz#bd00b678c16b98c543d4c6c560f9c90e6792b2a7"
Expand All @@ -6834,6 +6948,16 @@
prop-types "^15.8.1"
react-is "^18.2.0"

"@mui/utils@^5.15.14", "@mui/utils@^5.15.20":
version "5.15.20"
resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.15.20.tgz#92778d749ce5ded1598639b4e684aaedb1146e08"
integrity sha512-mAbYx0sovrnpAu1zHc3MDIhPqL8RPVC5W5xcO1b7PiSCJPtckIZmBkp8hefamAvUiAV8gpfMOM6Zb+eSisbI2A==
dependencies:
"@babel/runtime" "^7.23.9"
"@types/prop-types" "^15.7.11"
prop-types "^15.8.1"
react-is "^18.2.0"

"@mui/x-charts@^6.0.0-alpha.7":
version "6.19.5"
resolved "https://registry.yarnpkg.com/@mui/x-charts/-/x-charts-6.19.5.tgz#1c427961b87ba12ea3407ce1623e235a090828f4"
Expand Down
Loading