From 12afbbc8dc77aa77cf6a0eb6a9025f2a4dd548ff Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Wed, 31 Jan 2024 15:14:44 +0100 Subject: [PATCH 1/5] Add alpha export for new fe system Signed-off-by: Philipp Hugenroth --- plugins/org/api-report-alpha.md | 25 ++++++++++++++++ plugins/org/package.json | 17 +++++++++++ plugins/org/src/alpha.tsx | 52 +++++++++++++++++++++++++++++++++ yarn.lock | 2 ++ 4 files changed, 96 insertions(+) create mode 100644 plugins/org/api-report-alpha.md create mode 100644 plugins/org/src/alpha.tsx diff --git a/plugins/org/api-report-alpha.md b/plugins/org/api-report-alpha.md new file mode 100644 index 0000000000..b9605a45f5 --- /dev/null +++ b/plugins/org/api-report-alpha.md @@ -0,0 +1,25 @@ +## API Report File for "@backstage/plugin-org" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackstagePlugin } from '@backstage/frontend-plugin-api'; +import { ExtensionDefinition } from '@backstage/frontend-plugin-api'; +import { ExternalRouteRef } from '@backstage/frontend-plugin-api'; + +// @alpha (undocumented) +const _default: BackstagePlugin< + {}, + { + catalogIndex: ExternalRouteRef; + } +>; +export default _default; + +// @alpha (undocumented) +export const EntityGroupProfileCard: ExtensionDefinition<{ + filter?: string | undefined; +}>; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/org/package.json b/plugins/org/package.json index 4355e265aa..01aa872e32 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -4,6 +4,21 @@ "version": "0.6.20-next.1", "main": "src/index.ts", "types": "src/index.ts", + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.tsx", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.tsx" + ], + "package.json": [ + "package.json" + ] + } + }, "license": "Apache-2.0", "publishConfig": { "access": "public", @@ -31,8 +46,10 @@ }, "dependencies": { "@backstage/catalog-model": "workspace:^", + "@backstage/core-compat-api": "workspace:^", "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", + "@backstage/frontend-plugin-api": "workspace:^", "@backstage/plugin-catalog-common": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", "@material-ui/core": "^4.12.2", diff --git a/plugins/org/src/alpha.tsx b/plugins/org/src/alpha.tsx new file mode 100644 index 0000000000..30cda2a4c7 --- /dev/null +++ b/plugins/org/src/alpha.tsx @@ -0,0 +1,52 @@ +/* + * 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 { + compatWrapper, + convertLegacyRouteRefs, +} from '@backstage/core-compat-api'; +import { createPlugin } from '@backstage/frontend-plugin-api'; +import React from 'react'; +import { catalogIndexRouteRef } from './routes'; +import { createEntityCardExtension } from '@backstage/plugin-catalog-react/alpha'; + +/** @alpha */ +export const EntityGroupProfileCard = createEntityCardExtension({ + name: 'group-profile', + loader: async () => + import('./components/Cards/Group/GroupProfile/GroupProfileCard').then(m => + compatWrapper(), + ), +}); + +/** @alpha */ +/* export const EntityMembersListCard = createEntityCardExtension({ + name: 'members-list', + loader: async () => + import('./components/').then(m => + compatWrapper(), + ), + }); + */ + +/** @alpha */ +export default createPlugin({ + id: 'org', + extensions: [EntityGroupProfileCard], + externalRoutes: convertLegacyRouteRefs({ + catalogIndex: catalogIndexRouteRef, + }), +}); diff --git a/yarn.lock b/yarn.lock index 75fde2bc1b..bd654c7dad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7839,9 +7839,11 @@ __metadata: "@backstage/catalog-model": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/core-app-api": "workspace:^" + "@backstage/core-compat-api": "workspace:^" "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" + "@backstage/frontend-plugin-api": "workspace:^" "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-common": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" From 491e0705c23b70628f79c5545c4944dac0d34a84 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Wed, 31 Jan 2024 15:38:45 +0100 Subject: [PATCH 2/5] Add catalog cards Signed-off-by: Philipp Hugenroth --- packages/app-next/app-config.yaml | 9 +++++++ packages/app-next/src/App.tsx | 2 ++ plugins/org/src/alpha.tsx | 40 ++++++++++++++++++++++++------- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/packages/app-next/app-config.yaml b/packages/app-next/app-config.yaml index a79bb866db..0b842a0b91 100644 --- a/packages/app-next/app-config.yaml +++ b/packages/app-next/app-config.yaml @@ -5,6 +5,7 @@ app: bindings: catalog.viewTechDoc: techdocs.docRoot catalog.createComponent: catalog-import.importPage + # org.catalogIndex: catalog.catalogIndex extensions: # - apis.plugin.graphiql.browse.gitlab: true @@ -19,6 +20,14 @@ app: # Entity page content - entity-content:techdocs + # Org Plugin + - entity-card:org/group-profile: + config: + filter: kind:group + # - entity-card:org/members-list + # - entity-card:org/ownership + # - entity-card:org/user-profile + # scmAuthExtension: >- # createScmAuthExtension({ # id: 'apis.scmAuth.addons.ghe', diff --git a/packages/app-next/src/App.tsx b/packages/app-next/src/App.tsx index 03a6649c27..bb39d8d40e 100644 --- a/packages/app-next/src/App.tsx +++ b/packages/app-next/src/App.tsx @@ -24,6 +24,7 @@ import userSettingsPlugin from '@backstage/plugin-user-settings/alpha'; import homePlugin, { titleExtensionDataRef, } from '@backstage/plugin-home/alpha'; +import orgPlugin from '@backstage/plugin-org/alpha'; import { coreExtensionData, @@ -125,6 +126,7 @@ const app = createApp({ userSettingsPlugin, homePlugin, appVisualizerPlugin, + orgPlugin, ...collectedLegacyPlugins, createExtensionOverrides({ extensions: [ diff --git a/plugins/org/src/alpha.tsx b/plugins/org/src/alpha.tsx index 30cda2a4c7..3d02aec88b 100644 --- a/plugins/org/src/alpha.tsx +++ b/plugins/org/src/alpha.tsx @@ -33,19 +33,41 @@ export const EntityGroupProfileCard = createEntityCardExtension({ }); /** @alpha */ -/* export const EntityMembersListCard = createEntityCardExtension({ - name: 'members-list', - loader: async () => - import('./components/').then(m => - compatWrapper(), - ), - }); - */ +export const EntityMembersListCard = createEntityCardExtension({ + name: 'members-list', + loader: async () => + import('./components/Cards/Group/MembersList/MembersListCard').then(m => + compatWrapper(), + ), +}); + +/** @alpha */ +export const EntityOwnershipCard = createEntityCardExtension({ + name: 'ownership', + loader: async () => + import('./components/Cards/OwnershipCard/OwnershipCard').then(m => + compatWrapper(), + ), +}); + +/** @alpha */ +export const EntityUserProfileCard = createEntityCardExtension({ + name: 'user-profile', + loader: async () => + import('./components/Cards/User/UserProfileCard/UserProfileCard').then(m => + compatWrapper(), + ), +}); /** @alpha */ export default createPlugin({ id: 'org', - extensions: [EntityGroupProfileCard], + extensions: [ + EntityGroupProfileCard, + EntityMembersListCard, + EntityOwnershipCard, + EntityUserProfileCard, + ], externalRoutes: convertLegacyRouteRefs({ catalogIndex: catalogIndexRouteRef, }), From 6e1bf50fe0dd29e5c79fc896ae1a35a4b5746090 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Wed, 31 Jan 2024 15:48:33 +0100 Subject: [PATCH 3/5] Add changeset Signed-off-by: Philipp Hugenroth --- .changeset/slimy-rats-fly.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/slimy-rats-fly.md diff --git a/.changeset/slimy-rats-fly.md b/.changeset/slimy-rats-fly.md new file mode 100644 index 0000000000..81fcae5bb2 --- /dev/null +++ b/.changeset/slimy-rats-fly.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-org': patch +--- + +Added basic support for the new frontend system, exported from the `/alpha` subpath. From c3ec819026179a4b99c74318c34cfdd0d66d8579 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Mon, 5 Feb 2024 15:54:54 +0100 Subject: [PATCH 4/5] Adjust to review Signed-off-by: Philipp Hugenroth --- packages/app-next/app-config.yaml | 12 +++++------- packages/app-next/src/App.tsx | 2 -- plugins/org/api-report-alpha.md | 6 ------ plugins/org/src/alpha.tsx | 12 ++++++++---- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/packages/app-next/app-config.yaml b/packages/app-next/app-config.yaml index 0b842a0b91..4e54d96d7c 100644 --- a/packages/app-next/app-config.yaml +++ b/packages/app-next/app-config.yaml @@ -5,7 +5,7 @@ app: bindings: catalog.viewTechDoc: techdocs.docRoot catalog.createComponent: catalog-import.importPage - # org.catalogIndex: catalog.catalogIndex + org.catalogIndex: catalog.catalogIndex extensions: # - apis.plugin.graphiql.browse.gitlab: true @@ -21,12 +21,10 @@ app: - entity-content:techdocs # Org Plugin - - entity-card:org/group-profile: - config: - filter: kind:group - # - entity-card:org/members-list - # - entity-card:org/ownership - # - entity-card:org/user-profile + - entity-card:org/group-profile + - entity-card:org/members-list + - entity-card:org/ownership + - entity-card:org/user-profile # scmAuthExtension: >- # createScmAuthExtension({ diff --git a/packages/app-next/src/App.tsx b/packages/app-next/src/App.tsx index bb39d8d40e..03a6649c27 100644 --- a/packages/app-next/src/App.tsx +++ b/packages/app-next/src/App.tsx @@ -24,7 +24,6 @@ import userSettingsPlugin from '@backstage/plugin-user-settings/alpha'; import homePlugin, { titleExtensionDataRef, } from '@backstage/plugin-home/alpha'; -import orgPlugin from '@backstage/plugin-org/alpha'; import { coreExtensionData, @@ -126,7 +125,6 @@ const app = createApp({ userSettingsPlugin, homePlugin, appVisualizerPlugin, - orgPlugin, ...collectedLegacyPlugins, createExtensionOverrides({ extensions: [ diff --git a/plugins/org/api-report-alpha.md b/plugins/org/api-report-alpha.md index b9605a45f5..3cee584db0 100644 --- a/plugins/org/api-report-alpha.md +++ b/plugins/org/api-report-alpha.md @@ -4,7 +4,6 @@ ```ts import { BackstagePlugin } from '@backstage/frontend-plugin-api'; -import { ExtensionDefinition } from '@backstage/frontend-plugin-api'; import { ExternalRouteRef } from '@backstage/frontend-plugin-api'; // @alpha (undocumented) @@ -16,10 +15,5 @@ const _default: BackstagePlugin< >; export default _default; -// @alpha (undocumented) -export const EntityGroupProfileCard: ExtensionDefinition<{ - filter?: string | undefined; -}>; - // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/org/src/alpha.tsx b/plugins/org/src/alpha.tsx index 3d02aec88b..3fbf5bcc41 100644 --- a/plugins/org/src/alpha.tsx +++ b/plugins/org/src/alpha.tsx @@ -24,8 +24,9 @@ import { catalogIndexRouteRef } from './routes'; import { createEntityCardExtension } from '@backstage/plugin-catalog-react/alpha'; /** @alpha */ -export const EntityGroupProfileCard = createEntityCardExtension({ +const EntityGroupProfileCard = createEntityCardExtension({ name: 'group-profile', + filter: 'kind:group', loader: async () => import('./components/Cards/Group/GroupProfile/GroupProfileCard').then(m => compatWrapper(), @@ -33,8 +34,9 @@ export const EntityGroupProfileCard = createEntityCardExtension({ }); /** @alpha */ -export const EntityMembersListCard = createEntityCardExtension({ +const EntityMembersListCard = createEntityCardExtension({ name: 'members-list', + filter: 'kind:group', loader: async () => import('./components/Cards/Group/MembersList/MembersListCard').then(m => compatWrapper(), @@ -42,8 +44,9 @@ export const EntityMembersListCard = createEntityCardExtension({ }); /** @alpha */ -export const EntityOwnershipCard = createEntityCardExtension({ +const EntityOwnershipCard = createEntityCardExtension({ name: 'ownership', + filter: 'kind:group,user', loader: async () => import('./components/Cards/OwnershipCard/OwnershipCard').then(m => compatWrapper(), @@ -51,8 +54,9 @@ export const EntityOwnershipCard = createEntityCardExtension({ }); /** @alpha */ -export const EntityUserProfileCard = createEntityCardExtension({ +const EntityUserProfileCard = createEntityCardExtension({ name: 'user-profile', + filter: 'kind:user', loader: async () => import('./components/Cards/User/UserProfileCard/UserProfileCard').then(m => compatWrapper(), From c809d14362ea7e519ffe05ae8a3b988d83219f02 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 6 Feb 2024 11:35:16 +0100 Subject: [PATCH 5/5] org: run yarn fix Signed-off-by: Patrik Oldsberg --- plugins/org/package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/org/package.json b/plugins/org/package.json index 01aa872e32..cd39dc345a 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -21,9 +21,7 @@ }, "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" + "access": "public" }, "backstage": { "role": "frontend-plugin"