Skip to content

Commit

Permalink
refactor(homepage): migrate from internal dynamic-home-page to rhdh p…
Browse files Browse the repository at this point in the history
…lugin (#1944)

* refactor(homepage): remove internal dynamic-home-page plugin

Signed-off-by: Christoph Jerolimov <[email protected]>

* refactor(homepage): add wrapper for rhdh plugin

Signed-off-by: Christoph Jerolimov <[email protected]>

---------

Signed-off-by: Christoph Jerolimov <[email protected]>
  • Loading branch information
christoph-jerolimov authored Nov 26, 2024
1 parent 058a609 commit 9fdcab3
Show file tree
Hide file tree
Showing 80 changed files with 214 additions and 2,957 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
**/node_modules
plugins
!plugins/auth-backend-module-oidc-provider
!plugins/dynamic-home-page
!plugins/dynamic-plugins-info
!plugins/dynamic-plugins-info-backend
!plugins/licensed-users-info-backend
Expand Down
6 changes: 4 additions & 2 deletions .ibm/pipelines/value_files/values_showcase-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ global:
disabled: false
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import
disabled: false
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-dynamic-home-page
disabled: true
# Enable tech-radar plugin.
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar
disabled: false
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
disabled: true
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
disabled: true
- package: ./dynamic-plugins/dist/backstage-community-plugin-rbac
disabled: false
- package: ./dynamic-plugins/dist/backstage-community-plugin-analytics-provider-segment
Expand Down
2 changes: 1 addition & 1 deletion .rhdh/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ COPY $EXTERNAL_SOURCE_NESTED/plugins/scalprum-backend/package.json ./plugins/sca
COPY $EXTERNAL_SOURCE_NESTED/plugins/licensed-users-info-backend/package.json ./plugins/licensed-users-info-backend/package.json
COPY $EXTERNAL_SOURCE_NESTED/plugins/dynamic-plugins-info/package.json ./plugins/dynamic-plugins-info/package.json
COPY $EXTERNAL_SOURCE_NESTED/plugins/dynamic-plugins-info-backend/package.json ./plugins/dynamic-plugins-info-backend/package.json
COPY $EXTERNAL_SOURCE_NESTED/plugins/dynamic-home-page/package.json ./plugins/dynamic-home-page/package.json
COPY $EXTERNAL_SOURCE_NESTED/packages/backend/package.json ./packages/backend/package.json
COPY $EXTERNAL_SOURCE_NESTED/packages/app/package.json ./packages/app/package.json
COPY $EXTERNAL_SOURCE_NESTED/package.json ./package.json
Expand All @@ -76,6 +75,7 @@ COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd/package.json ./dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/package.json ./dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/dist-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-dynamic-home-page/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-dynamic-home-page/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/dist-dynamic/package.json
Expand Down
35 changes: 35 additions & 0 deletions app-config.dynamic-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,41 @@ dynamicPlugins:
menuItem:
icon: bulkImportIcon
text: Bulk import
red-hat-developer-hub.backstage-plugin-dynamic-home-page:
dynamicRoutes:
- path: /
importName: DynamicHomePage
mountPoints:
- mountPoint: home.page/cards
importName: SearchBar
config:
layouts:
xl: { w: 10, h: 1, x: 1 }
lg: { w: 10, h: 1, x: 1 }
md: { w: 10, h: 1, x: 1 }
sm: { w: 10, h: 1, x: 1 }
xs: { w: 12, h: 1 }
xxs: { w: 12, h: 1 }
- mountPoint: home.page/cards
importName: QuickAccessCard
config:
layouts:
xl: { w: 7, h: 8 }
lg: { w: 7, h: 8 }
md: { w: 7, h: 8 }
sm: { w: 12, h: 8 }
xs: { w: 12, h: 8 }
xxs: { w: 12, h: 8 }
- mountPoint: home.page/cards
importName: CatalogStarredEntitiesCard
config:
layouts:
xl: { w: 5, h: 4, x: 7 }
lg: { w: 5, h: 4, x: 7 }
md: { w: 5, h: 4, x: 7 }
sm: { w: 12, h: 4 }
xs: { w: 12, h: 4 }
xxs: { w: 12, h: 4 }
backstage-community.plugin-tekton:
mountPoints:
- mountPoint: entity.page.ci/cards
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ COPY $EXTERNAL_SOURCE_NESTED/plugins/scalprum-backend/package.json ./plugins/sca
COPY $EXTERNAL_SOURCE_NESTED/plugins/licensed-users-info-backend/package.json ./plugins/licensed-users-info-backend/package.json
COPY $EXTERNAL_SOURCE_NESTED/plugins/dynamic-plugins-info/package.json ./plugins/dynamic-plugins-info/package.json
COPY $EXTERNAL_SOURCE_NESTED/plugins/dynamic-plugins-info-backend/package.json ./plugins/dynamic-plugins-info-backend/package.json
COPY $EXTERNAL_SOURCE_NESTED/plugins/dynamic-home-page/package.json ./plugins/dynamic-home-page/package.json
COPY $EXTERNAL_SOURCE_NESTED/packages/backend/package.json ./packages/backend/package.json
COPY $EXTERNAL_SOURCE_NESTED/packages/app/package.json ./packages/app/package.json
COPY $EXTERNAL_SOURCE_NESTED/package.json ./package.json
Expand All @@ -77,6 +76,7 @@ COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd/package.json ./dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/package.json ./dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/roadiehq-backstage-plugin-argo-cd-backend-dynamic/dist-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-dynamic-home-page/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-dynamic-home-page/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic/dist-dynamic/package.json
Expand Down
42 changes: 42 additions & 0 deletions dynamic-plugins.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,48 @@ plugins:
icon: bulkImportIcon
text: Bulk import

# Homepage
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-dynamic-home-page
disabled: false
pluginConfig:
dynamicPlugins:
frontend:
red-hat-developer-hub.backstage-plugin-dynamic-home-page:
dynamicRoutes:
- path: /
importName: DynamicHomePage
mountPoints:
- mountPoint: home.page/cards
importName: SearchBar
config:
layouts:
xl: { w: 10, h: 1, x: 1 }
lg: { w: 10, h: 1, x: 1 }
md: { w: 10, h: 1, x: 1 }
sm: { w: 10, h: 1, x: 1 }
xs: { w: 12, h: 1 }
xxs: { w: 12, h: 1 }
- mountPoint: home.page/cards
importName: QuickAccessCard
config:
layouts:
xl: { w: 7, h: 8 }
lg: { w: 7, h: 8 }
md: { w: 7, h: 8 }
sm: { w: 12, h: 8 }
xs: { w: 12, h: 8 }
xxs: { w: 12, h: 8 }
- mountPoint: home.page/cards
importName: CatalogStarredEntitiesCard
config:
layouts:
xl: { w: 5, h: 4, x: 7 }
lg: { w: 5, h: 4, x: 7 }
md: { w: 5, h: 4, x: 7 }
sm: { w: 12, h: 4 }
xs: { w: 12, h: 4 }
xxs: { w: 12, h: 4 }

# Techdocs
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs-backend-dynamic
disabled: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "red-hat-developer-hub-backstage-plugin-dynamic-home-page",
"version": "1.0.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "frontend-plugin",
"supported-versions": "1.32.5",
"pluginId": "red-hat-developer-hub-backstage-plugin-dynamic-home-page",
"pluginPackages": [
"red-hat-developer-hub-backstage-plugin-dynamic-home-page"
]
},
"sideEffects": false,
"scripts": {
"tsc": "tsc",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test --passWithNoTests --coverage",
"clean": "backstage-cli package clean",
"export-dynamic": "janus-cli package export-dynamic-plugin --in-place",
"export-dynamic:clean": "janus-cli package export-dynamic-plugin --in-place --clean"
},
"dependencies": {
"@red-hat-developer-hub/backstage-plugin-dynamic-home-page": "^1.0.0"
},
"devDependencies": {
"@backstage/cli": "0.28.2",
"@janus-idp/cli": "1.17.0",
"typescript": "^5.6.3"
},
"files": [
"dist",
"dist-scalprum"
],
"scalprum": {
"name": "red-hat-developer-hub.backstage-plugin-dynamic-home-page",
"exposedModules": {
"PluginRoot": "./src/index.ts"
}
},
"repository": {
"type": "git",
"url": "https://github.com/janus-idp/backstage-showcase",
"directory": "dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-dynamic-home-page"
},
"maintainers": [
"@janus-idp/maintainers-showcase"
],
"author": "Red Hat",
"homepage": "https://red.ht/rhdh",
"bugs": "https://issues.redhat.com/browse/RHIDP",
"keywords": [
"support:production",
"lifecycle:active"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from '@red-hat-developer-hub/backstage-plugin-dynamic-home-page';

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"include": ["src", "dev", "migrations"],
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "../../dist-types/plugins/dynamic-home-page",
"rootDir": ".",
"jsx": "preserve"
"outDir": "../../../dist-types/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-dynamic-home-page",
"rootDir": "."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["//"],
"tasks": {
"tsc": {
"outputs": [
"../../../dist-types/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-dynamic-home-page/**"
]
}
}
}
1 change: 0 additions & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@backstage/theme": "0.6.0",
"@emotion/react": "11.13.3",
"@emotion/styled": "11.13.0",
"@internal/backstage-plugin-dynamic-home-page": "*",
"@internal/plugin-dynamic-plugins-info": "*",
"@janus-idp/backstage-plugin-rbac-common": "1.12.0",
"@mui/icons-material": "5.16.7",
Expand Down
64 changes: 0 additions & 64 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import { DefaultMainMenuItems } from './consts';
const { dynamicPluginsInfoPlugin, ...dynamicPluginsInfoPluginModule } =
await import('@internal/plugin-dynamic-plugins-info');

const { dynamicHomePagePlugin, ...dynamicHomePagePluginModule } = await import(
'@internal/backstage-plugin-dynamic-home-page'
);

// The base UI configuration, these values can be overridden by values
// specified in external configuration files
const baseFrontendConfig = {
Expand Down Expand Up @@ -44,62 +40,6 @@ const baseFrontendConfig = {
},
},
},
// please keep this in sync with plugins/dynamic-home-page/app-config.janus-idp.yaml
'janus-idp.backstage-plugin-dynamic-home-page': {
dynamicRoutes: [
{
path: '/',
importName: 'DynamicHomePage',
},
],
mountPoints: [
{
mountPoint: 'home.page/cards',
importName: 'SearchBar',
config: {
// prettier-ignore
layouts: {
xl: { w: 10, h: 1, x: 1 },
lg: { w: 10, h: 1, x: 1 },
md: { w: 10, h: 1, x: 1 },
sm: { w: 10, h: 1, x: 1 },
xs: { w: 12, h: 1 },
xxs: { w: 12, h: 1 },
},
},
},
{
mountPoint: 'home.page/cards',
importName: 'QuickAccessCard',
config: {
// prettier-ignore
layouts: {
xl: { w: 7, h: 8 },
lg: { w: 7, h: 8 },
md: { w: 7, h: 8 },
sm: { w: 12, h: 8 },
xs: { w: 12, h: 8 },
xxs: { w: 12, h: 8 },
},
},
},
{
mountPoint: 'home.page/cards',
importName: 'CatalogStarredEntitiesCard',
config: {
// prettier-ignore
layouts: {
xl: { w: 5, h: 4, x: 7 },
lg: { w: 5, h: 4, x: 7 },
md: { w: 5, h: 4, x: 7 },
sm: { w: 12, h: 4 },
xs: { w: 12, h: 4 },
xxs: { w: 12, h: 4 },
},
},
},
],
},
},
},
},
Expand All @@ -111,10 +51,6 @@ const staticPlugins: StaticPlugins = {
plugin: dynamicPluginsInfoPlugin,
module: dynamicPluginsInfoPluginModule,
},
'janus-idp.backstage-plugin-dynamic-home-page': {
plugin: dynamicHomePagePlugin,
module: dynamicHomePagePluginModule,
},
};

const AppRoot = () => (
Expand Down
4 changes: 0 additions & 4 deletions packages/app/src/components/AppBase/AppBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import { ScaffolderFieldExtensions } from '@backstage/plugin-scaffolder-react';
import { SearchPage as BackstageSearchPage } from '@backstage/plugin-search';
import { UserSettingsPage } from '@backstage/plugin-user-settings';

import { VisitListener } from '@internal/backstage-plugin-dynamic-home-page';

import { entityPage } from '../catalog/EntityPage';
import DynamicRootContext from '../DynamicRoot/DynamicRootContext';
import { LearningPaths } from '../learningPaths/LearningPathsPage';
Expand Down Expand Up @@ -76,8 +74,6 @@ const AppBase = () => {
<OAuthRequestDialog />
<AppRouter>
<ConfigUpdater />
{/* RHIDP-4234: VisitListener should be replaced with a mount point */}
<VisitListener />
<Root>
<FlatRoutes>
<Route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { RemotePlugins } from '../../components/DynamicRoot/DynamicRootContext';
const ignoreStaticPlugins = [
'default.main-menu-items',
'internal.plugin-dynamic-plugins-info',
'janus-idp.backstage-plugin-dynamic-home-page',
];

const initializeRemotePlugins = async (
Expand Down
12 changes: 0 additions & 12 deletions plugins/dynamic-home-page/.eslintrc.js

This file was deleted.

4 changes: 0 additions & 4 deletions plugins/dynamic-home-page/.lintstagedrc.json

This file was deleted.

2 changes: 0 additions & 2 deletions plugins/dynamic-home-page/.prettierignore

This file was deleted.

20 changes: 0 additions & 20 deletions plugins/dynamic-home-page/.prettierrc.js

This file was deleted.

Loading

0 comments on commit 9fdcab3

Please sign in to comment.