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. diff --git a/packages/app-next/app-config.yaml b/packages/app-next/app-config.yaml index 0dd2187418..b07f556742 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 @@ -26,6 +27,12 @@ app: - entity-content:azure-devops/pull-requests - entity-content:azure-devops/git-tags + # Org Plugin + - entity-card:org/group-profile + - entity-card:org/members-list + - entity-card:org/ownership + - entity-card:org/user-profile + # scmAuthExtension: >- # createScmAuthExtension({ # id: 'apis.scmAuth.addons.ghe', diff --git a/plugins/org/api-report-alpha.md b/plugins/org/api-report-alpha.md new file mode 100644 index 0000000000..3cee584db0 --- /dev/null +++ b/plugins/org/api-report-alpha.md @@ -0,0 +1,19 @@ +## 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 { ExternalRouteRef } from '@backstage/frontend-plugin-api'; + +// @alpha (undocumented) +const _default: BackstagePlugin< + {}, + { + catalogIndex: ExternalRouteRef; + } +>; +export default _default; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/org/package.json b/plugins/org/package.json index df3aa60c00..f437a927a4 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -4,11 +4,24 @@ "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", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" + "access": "public" }, "backstage": { "role": "frontend-plugin" @@ -31,8 +44,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..3fbf5bcc41 --- /dev/null +++ b/plugins/org/src/alpha.tsx @@ -0,0 +1,78 @@ +/* + * 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 */ +const EntityGroupProfileCard = createEntityCardExtension({ + name: 'group-profile', + filter: 'kind:group', + loader: async () => + import('./components/Cards/Group/GroupProfile/GroupProfileCard').then(m => + compatWrapper(), + ), +}); + +/** @alpha */ +const EntityMembersListCard = createEntityCardExtension({ + name: 'members-list', + filter: 'kind:group', + loader: async () => + import('./components/Cards/Group/MembersList/MembersListCard').then(m => + compatWrapper(), + ), +}); + +/** @alpha */ +const EntityOwnershipCard = createEntityCardExtension({ + name: 'ownership', + filter: 'kind:group,user', + loader: async () => + import('./components/Cards/OwnershipCard/OwnershipCard').then(m => + compatWrapper(), + ), +}); + +/** @alpha */ +const EntityUserProfileCard = createEntityCardExtension({ + name: 'user-profile', + filter: 'kind:user', + loader: async () => + import('./components/Cards/User/UserProfileCard/UserProfileCard').then(m => + compatWrapper(), + ), +}); + +/** @alpha */ +export default createPlugin({ + id: 'org', + extensions: [ + EntityGroupProfileCard, + EntityMembersListCard, + EntityOwnershipCard, + EntityUserProfileCard, + ], + externalRoutes: convertLegacyRouteRefs({ + catalogIndex: catalogIndexRouteRef, + }), +}); diff --git a/yarn.lock b/yarn.lock index c99d2de586..2220b18fef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7867,9 +7867,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:^"