From 35df801e094064a153b746662335f3ed00fe86b8 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 28 Oct 2023 14:10:26 +0200 Subject: [PATCH] app-next: initial app visualizer plugin Signed-off-by: Patrik Oldsberg --- packages/app-next/src/App.tsx | 2 ++ .../components/AppVisualizerPage.tsx | 21 ++++++++++++ .../src/plugins/app-visualizer/index.ts | 17 ++++++++++ .../src/plugins/app-visualizer/plugin.tsx | 33 +++++++++++++++++++ packages/app-next/src/plugins/index.ts | 19 +++++++++++ 5 files changed, 92 insertions(+) create mode 100644 packages/app-next/src/plugins/app-visualizer/components/AppVisualizerPage.tsx create mode 100644 packages/app-next/src/plugins/app-visualizer/index.ts create mode 100644 packages/app-next/src/plugins/app-visualizer/plugin.tsx create mode 100644 packages/app-next/src/plugins/index.ts diff --git a/packages/app-next/src/App.tsx b/packages/app-next/src/App.tsx index 0eca65fdda..09f454f302 100644 --- a/packages/app-next/src/App.tsx +++ b/packages/app-next/src/App.tsx @@ -32,6 +32,7 @@ import { createExtensionOverrides, } from '@backstage/frontend-plugin-api'; import techdocsPlugin from '@backstage/plugin-techdocs/alpha'; +import { plugins } from './plugins'; import { homePage } from './HomePage'; import { convertLegacyApp } from '@backstage/core-compat-api'; import { FlatRoutes } from '@backstage/core-app-api'; @@ -123,6 +124,7 @@ const app = createApp({ techdocsPlugin, userSettingsPlugin, homePlugin, + ...plugins, ...collectedLegacyPlugins, createExtensionOverrides({ extensions: [ diff --git a/packages/app-next/src/plugins/app-visualizer/components/AppVisualizerPage.tsx b/packages/app-next/src/plugins/app-visualizer/components/AppVisualizerPage.tsx new file mode 100644 index 0000000000..759b3870b9 --- /dev/null +++ b/packages/app-next/src/plugins/app-visualizer/components/AppVisualizerPage.tsx @@ -0,0 +1,21 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; + +export function AppVisualizerPage() { + return

Hello world

; +} diff --git a/packages/app-next/src/plugins/app-visualizer/index.ts b/packages/app-next/src/plugins/app-visualizer/index.ts new file mode 100644 index 0000000000..63fd16c520 --- /dev/null +++ b/packages/app-next/src/plugins/app-visualizer/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { appVisualizerPlugin } from './plugin'; diff --git a/packages/app-next/src/plugins/app-visualizer/plugin.tsx b/packages/app-next/src/plugins/app-visualizer/plugin.tsx new file mode 100644 index 0000000000..c39cb9a6c3 --- /dev/null +++ b/packages/app-next/src/plugins/app-visualizer/plugin.tsx @@ -0,0 +1,33 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + createPageExtension, + createPlugin, +} from '@backstage/frontend-plugin-api'; +import React from 'react'; + +const appVisualizerPage = createPageExtension({ + id: 'plugin.app-visualizer.page', + defaultPath: '/visualizer', + loader: () => + import('./components/AppVisualizerPage').then(m => ), +}); + +export const appVisualizerPlugin = createPlugin({ + id: 'app-visualizer', + extensions: [appVisualizerPage], +}); diff --git a/packages/app-next/src/plugins/index.ts b/packages/app-next/src/plugins/index.ts new file mode 100644 index 0000000000..baafcde889 --- /dev/null +++ b/packages/app-next/src/plugins/index.ts @@ -0,0 +1,19 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { appVisualizerPlugin } from './app-visualizer'; + +export const plugins = [appVisualizerPlugin];