Skip to content

Commit

Permalink
backstage: add todo-plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Login <batazor@evrone.com>
  • Loading branch information
batazor committed Jan 15, 2023
1 parent 1365896 commit 60e0ad4
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 3 deletions.
1 change: 1 addition & 0 deletions internal/services/backstage/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@backstage/plugin-techdocs": "^1.4.2",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.0.8",
"@backstage/plugin-techdocs-react": "^1.1.1",
"@backstage/plugin-todo": "^0.2.15",
"@backstage/plugin-user-settings": "^0.6.1",
"@backstage/theme": "^0.2.16",
"@material-ui/core": "^4.12.4",
Expand Down
1 change: 1 addition & 0 deletions internal/services/backstage/packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const routes = (
path="/docs/:namespace/:kind/:name/*"
element={<TechDocsReaderPage />}
>
{/* @ts-ignore */}
<TechDocsAddons>
<ReportIssue />
</TechDocsAddons>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
import { EntityKubernetesContent } from '@backstage/plugin-kubernetes';
import { EntityAdrContent, isAdrAvailable } from '@backstage/plugin-adr';
// eslint-disable-next-line import/no-extraneous-dependencies
import { EntityTodoContent } from '@backstage/plugin-todo';

const techdocsContent = (
<EntityTechdocsContent>
{/* @ts-ignore */}
<TechDocsAddons>
<ReportIssue />
</TechDocsAddons>
Expand Down Expand Up @@ -154,6 +157,10 @@ const serviceEntityPage = (
<EntityKubernetesContent refreshIntervalMs={30000} />
</EntityLayout.Route>

<EntityLayout.Route path="/todo" title="Todo">
<EntityTodoContent />
</EntityLayout.Route>

<EntityLayout.Route path="/ci-cd" title="CI/CD">
{cicdContent}
</EntityLayout.Route>
Expand Down
1 change: 1 addition & 0 deletions internal/services/backstage/packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@backstage/plugin-search-backend-module-pg": "^0.5.0",
"@backstage/plugin-search-backend-node": "^1.1.0",
"@backstage/plugin-techdocs-backend": "^1.5.0",
"@backstage/plugin-todo-backend": "^0.1.36",
"app": "link:../app",
"better-sqlite3": "^8.0.1",
"dockerode": "^3.3.4",
Expand Down
3 changes: 3 additions & 0 deletions internal/services/backstage/packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import proxy from './plugins/proxy';
import techdocs from './plugins/techdocs';
import search from './plugins/search';
import kubernetes from './plugins/kubernetes';
import todo from './plugins/todo';
import { PluginEnvironment } from './types';
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
import { DefaultIdentityClient } from '@backstage/plugin-auth-node';
Expand Down Expand Up @@ -87,6 +88,7 @@ async function main() {
const searchEnv = useHotMemoize(module, () => createEnv('search'));
const appEnv = useHotMemoize(module, () => createEnv('app'));
const kubernetesEnv = useHotMemoize(module, () => createEnv('kubernetes'));
const todoEnv = useHotMemoize(module, () => createEnv('todo'));

const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
Expand All @@ -96,6 +98,7 @@ async function main() {
apiRouter.use('/proxy', await proxy(proxyEnv));
apiRouter.use('/search', await search(searchEnv));
apiRouter.use('/kubernetes', await kubernetes(kubernetesEnv));
apiRouter.use('/todo', await todo(todoEnv));

// Add backends ABOVE this line; this 404 handler is the catch-all fallback
apiRouter.use(notFoundHandler());
Expand Down
28 changes: 28 additions & 0 deletions internal/services/backstage/packages/backend/src/plugins/todo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Router } from 'express';
import { CatalogClient } from '@backstage/catalog-client';
import {
createRouter,
TodoReaderService,
TodoScmReader,
} from '@backstage/plugin-todo-backend';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const todoReader = TodoScmReader.fromConfig(env.config, {
logger: env.logger,
reader: env.reader,
});

const catalogClient = new CatalogClient({
discoveryApi: env.discovery,
});

const todoService = new TodoReaderService({
todoReader,
catalogClient,
});

return await createRouter({ todoService });
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ metadata:
annotations:
'backstage.io/kubernetes-namespace': shortlink
'backstage.io/kubernetes-label-selector': 'app.kubernetes.io/name=shortlink-api'
backstage.io/techdocs-ref: dir:.
backstage.io/source-location: url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/api
backstage.io/techdocs-ref: url:url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/api
spec:
type: service
lifecycle: production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ metadata:
- go
annotations:
'backstage.io/kubernetes-label-selector': 'app.kubernetes.io/name=shortlink-billing'
backstage.io/techdocs-ref: dir:.
backstage.io/source-location: url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/billing
backstage.io/techdocs-ref: url:url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/billing
spec:
type: service
lifecycle: production
Expand Down
69 changes: 68 additions & 1 deletion internal/services/backstage/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3533,6 +3533,40 @@
react-helmet "6.1.0"
react-use "^17.2.4"

"@backstage/plugin-todo-backend@^0.1.36":
version "0.1.36"
resolved "https://registry.yarnpkg.com/@backstage/plugin-todo-backend/-/plugin-todo-backend-0.1.36.tgz#21282d3630f7c30eb73f6b554794e6e3ed0ce6dc"
integrity sha512-fVi4GSnlTpdU6YLcpVbocKRuY/h0BAGTu5a57xYeduaaVOUhH4lZKMBhgjFXx79Osq1z4LwciZhEBuTAVNZEog==
dependencies:
"@backstage/backend-common" "^0.17.0"
"@backstage/catalog-client" "^1.2.0"
"@backstage/catalog-model" "^1.1.4"
"@backstage/config" "^1.0.5"
"@backstage/errors" "^1.1.4"
"@backstage/integration" "^1.4.1"
"@types/express" "^4.17.6"
express "^4.17.1"
express-promise-router "^4.1.0"
leasot "^12.0.0"
winston "^3.2.1"
yn "^4.0.0"

"@backstage/plugin-todo@^0.2.15":
version "0.2.15"
resolved "https://registry.yarnpkg.com/@backstage/plugin-todo/-/plugin-todo-0.2.15.tgz#85bef0846a854ce4e590f7f6dfd097a3ccd7718a"
integrity sha512-2L8YPFu0j4FkepX3xDb0kkogiEW6z3sPCPpZKj5z51LkkiNvBgJOH9ya237i13khUCuX1QBctcJVN3ECN0D40Q==
dependencies:
"@backstage/catalog-model" "^1.1.4"
"@backstage/core-components" "^0.12.2"
"@backstage/core-plugin-api" "^1.2.0"
"@backstage/errors" "^1.1.4"
"@backstage/plugin-catalog-react" "^1.2.3"
"@backstage/theme" "^0.2.16"
"@material-ui/core" "^4.12.2"
"@material-ui/icons" "^4.9.1"
"@material-ui/lab" "4.0.0-alpha.57"
react-use "^17.2.4"

"@backstage/plugin-user-settings@^0.6.1":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@backstage/plugin-user-settings/-/plugin-user-settings-0.6.1.tgz#215fb7a7c081d0e3af4e5fa074c3fb3ef96c83f3"
Expand Down Expand Up @@ -7615,6 +7649,7 @@ anymatch@^3.0.3, anymatch@~3.1.2:
"@backstage/plugin-techdocs" "^1.4.2"
"@backstage/plugin-techdocs-module-addons-contrib" "^1.0.8"
"@backstage/plugin-techdocs-react" "^1.1.1"
"@backstage/plugin-todo" "^0.2.15"
"@backstage/plugin-user-settings" "^0.6.1"
"@backstage/theme" "^0.2.16"
"@material-ui/core" "^4.12.4"
Expand Down Expand Up @@ -10491,6 +10526,11 @@ envinfo@^7.7.4:
resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475"
integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==

eol@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/eol/-/eol-0.9.1.tgz#f701912f504074be35c6117a5c4ade49cd547acd"
integrity sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg==

err-code@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9"
Expand Down Expand Up @@ -11774,6 +11814,11 @@ get-port@^5.1.1:
resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193"
integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==

get-stdin@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"
integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==

get-stream@^5.0.0, get-stream@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
Expand Down Expand Up @@ -11990,7 +12035,7 @@ globalthis@^1.0.1, globalthis@^1.0.3:
dependencies:
define-properties "^1.1.3"

globby@^11.0.0, globby@^11.0.2, globby@^11.0.4, globby@^11.1.0:
globby@^11.0.0, globby@^11.0.2, globby@^11.0.3, globby@^11.0.4, globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
Expand Down Expand Up @@ -14016,6 +14061,11 @@ json-to-ast@^2.1.0:
code-error-fragment "0.0.230"
grapheme-splitter "^1.0.4"

json2xml@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/json2xml/-/json2xml-0.1.3.tgz#9ae7c220bedd7c66a668e26f7ac182f6704eca21"
integrity sha512-yfTe9HnbrE3oRUEQL9mn7BueLd7RCTb7ig/mAFI6xY4RNYOEXF26x0qHFR7mb8ZrKgfE57wxkq0N3TboyFm6UA==

json5@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
Expand Down Expand Up @@ -14311,6 +14361,23 @@ lazystream@^1.0.0:
dependencies:
readable-stream "^2.0.5"

leasot@^12.0.0:
version "12.5.0"
resolved "https://registry.yarnpkg.com/leasot/-/leasot-12.5.0.tgz#d2b0273d0eaa3fc20ded2ede81b46b9c6f158451"
integrity sha512-bx2hqCDZ6EVzdaM+aIBNO12Ff0BscGVWPf23Wzj5FLCEXZuJR729Wn5Naom8dJcqpEbsk2XXzvdHus/3WZqW5w==
dependencies:
async "^3.2.0"
chalk "^4.1.0"
commander "^7.2.0"
eol "^0.9.1"
get-stdin "^8.0.0"
globby "^11.0.3"
json2xml "^0.1.3"
lodash "^4.17.21"
log-symbols "^4.1.0"
strip-ansi "^6.0.0"
text-table "^0.2.0"

lerna@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/lerna/-/lerna-4.0.0.tgz#b139d685d50ea0ca1be87713a7c2f44a5b678e9e"
Expand Down

0 comments on commit 60e0ad4

Please sign in to comment.