Skip to content

Commit

Permalink
Merge pull request #5 from axelerant/new-frontend
Browse files Browse the repository at this point in the history
add support for new frontend system for platform.sh plugin
  • Loading branch information
zeshanziya authored Sep 17, 2024
2 parents 8945e5f + 9049394 commit e5c76c5
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 4 deletions.
21 changes: 19 additions & 2 deletions plugins/platformsh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@
"name": "@axelerant/backstage-plugin-platformsh",
"version": "0.1.0",
"description": "Backstage frontend plugin for Platform.sh integration!",
"license": "Apache-2.0",
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.tsx",
"./package.json": "./package.json"
},
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"typesVersions": {
"*": {
"alpha": [
"src/alpha.tsx"
],
"package.json": [
"package.json"
]
}
},
"publishConfig": {
"access": "public",
"main": "dist/index.esm.js",
Expand Down Expand Up @@ -43,13 +58,15 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@axelerant/backstage-plugin-platformsh-common": "^0.1.0",
"@backstage/catalog-model": "^1.6.0",
"@backstage/core-compat-api": "^0.2.8",
"@backstage/core-components": "^0.14.10",
"@backstage/core-plugin-api": "^1.9.3",
"@backstage/frontend-plugin-api": "^0.7.0",
"@backstage/plugin-catalog-react": "^1.12.3",
"@backstage/plugin-permission-react": "^0.4.25",
"@backstage/theme": "^0.5.6",
"@axelerant/backstage-plugin-platformsh-common": "^0.1.0",
"@material-ui/core": "^4.9.13",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.61",
Expand Down
64 changes: 64 additions & 0 deletions plugins/platformsh/src/alpha.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from 'react';
import {
ApiBlueprint,
createApiFactory,
PageBlueprint,
createFrontendPlugin,
discoveryApiRef,
fetchApiRef,
} from '@backstage/frontend-plugin-api';
import {
compatWrapper,
convertLegacyRouteRef,
} from '@backstage/core-compat-api';
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
import { platformshApiRef, PlatformshClient } from './api';
import { rootRouteRef } from './routes';
import { isPlatformshAvailable } from './utils';

/** @alpha */
export const platformshApi = ApiBlueprint.make({
params: {
factory: createApiFactory({
api: platformshApiRef,
deps: {
discoveryApi: discoveryApiRef,
fetchApi: fetchApiRef,
},
factory: ({ discoveryApi, fetchApi }) =>
new PlatformshClient(discoveryApi, fetchApi),
}),
},
});

/** @alpha */
export const platformshPage = PageBlueprint.make({
params: {
defaultPath: '/platformsh',
routeRef: convertLegacyRouteRef(rootRouteRef),
loader: () =>
import('./components/PageComponent').then(m =>
compatWrapper(<m.PageComponent />),
),
},
});

/** @alpha */
export const platformshEntityContent = EntityContentBlueprint.make({
name: 'platformsh',
params: {
defaultPath: '/platformsh',
defaultTitle: 'Platformsh',
filter: entity => isPlatformshAvailable(entity),
loader: () =>
import('./components/EntityTabComponent').then(m =>
compatWrapper(<m.EntityTabComponent />),
),
},
});

/** @alpha */
export default createFrontendPlugin({
id: 'platformsh',
extensions: [platformshApi, platformshPage, platformshEntityContent],
});
18 changes: 16 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9968,7 +9968,7 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb"
integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==

"@types/react-dom@*", "@types/react-dom@^18", "@types/react-dom@^18.0.0":
"@types/react-dom@*", "@types/react-dom@^18.0.0":
version "18.3.0"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.0.tgz#0cbc818755d87066ab6ca74fbedb2547d74a82b0"
integrity sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==
Expand Down Expand Up @@ -9999,14 +9999,23 @@
dependencies:
"@types/react" "*"

"@types/react@*", "@types/react@^16.13.1 || ^17.0.0", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0", "@types/react@^18":
"@types/react@*", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0":
version "18.3.5"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.5.tgz#5f524c2ad2089c0ff372bbdabc77ca2c4dbadf8f"
integrity sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/react@^16.13.1 || ^17.0.0":
version "17.0.81"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.81.tgz#4b5bd9dffe2a638dd1547abf73f0451c6a2bd91d"
integrity sha512-So+arrwwUFFWCX/lqv4w8z1glovD1zLE0KVP1z4eFCPU8WE4yTCotHjssKbrcnZ3W5Fcxcsl1vkKTh6k6V+/2A==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "^0.16"
csstype "^3.0.2"

"@types/request@^2.47.1", "@types/request@^2.48.8":
version "2.48.12"
resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.12.tgz#0f590f615a10f87da18e9790ac94c29ec4c5ef30"
Expand Down Expand Up @@ -10034,6 +10043,11 @@
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a"
integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==

"@types/scheduler@^0.16":
version "0.16.8"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff"
integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==

"@types/semver@^7.3.12", "@types/semver@^7.5.0":
version "7.5.8"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e"
Expand Down

0 comments on commit e5c76c5

Please sign in to comment.