diff --git a/workspaces/homepage/.changeset/graduate-homepage-nfs.md b/workspaces/homepage/.changeset/graduate-homepage-nfs.md new file mode 100644 index 00000000000..ee63fc0fca6 --- /dev/null +++ b/workspaces/homepage/.changeset/graduate-homepage-nfs.md @@ -0,0 +1,8 @@ +--- +'@red-hat-developer-hub/backstage-plugin-homepage': major +--- + +**BREAKING:** Graduate NFS homepage exports from `/alpha` to the primary entry point, and move OFS exports to `./legacy`. +`/alpha` now only re-exports translations. + +Note: Dynamic plugin config must use `module: Legacy` now. diff --git a/workspaces/homepage/docs/cards/catalog-starred.md b/workspaces/homepage/docs/cards/catalog-starred.md index cf5ff8944f7..8151c68da93 100644 --- a/workspaces/homepage/docs/cards/catalog-starred.md +++ b/workspaces/homepage/docs/cards/catalog-starred.md @@ -15,8 +15,10 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: CatalogStarredEntitiesCard + module: Legacy - mountPoint: home.page/cards importName: CatalogStarredEntitiesCard + module: Legacy config: props: groupByKind: true diff --git a/workspaces/homepage/docs/cards/entity-section.md b/workspaces/homepage/docs/cards/entity-section.md index df703cb5d0c..506301676fc 100644 --- a/workspaces/homepage/docs/cards/entity-section.md +++ b/workspaces/homepage/docs/cards/entity-section.md @@ -16,6 +16,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: EntitySection + module: Legacy config: layouts: xl: { w: 12, h: 7 } diff --git a/workspaces/homepage/docs/cards/featured-docs.md b/workspaces/homepage/docs/cards/featured-docs.md index 2e07c52064e..1cd9dc32643 100644 --- a/workspaces/homepage/docs/cards/featured-docs.md +++ b/workspaces/homepage/docs/cards/featured-docs.md @@ -13,6 +13,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: FeaturedDocsCard + module: Legacy ``` ## Available props diff --git a/workspaces/homepage/docs/cards/headline.md b/workspaces/homepage/docs/cards/headline.md index 3f8873fa11a..844c05e19b4 100644 --- a/workspaces/homepage/docs/cards/headline.md +++ b/workspaces/homepage/docs/cards/headline.md @@ -13,6 +13,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: Headline + module: Legacy config: layouts: xl: { h: 1 } diff --git a/workspaces/homepage/docs/cards/markdown.md b/workspaces/homepage/docs/cards/markdown.md index 8067695a52f..6dc6e07c5d2 100644 --- a/workspaces/homepage/docs/cards/markdown.md +++ b/workspaces/homepage/docs/cards/markdown.md @@ -15,6 +15,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: MarkdownCard + module: Legacy config: layouts: xl: { w: 6, h: 4 } @@ -34,6 +35,7 @@ dynamicPlugins: * [GitHub RHDH Plugins](https://github.com/redhat-developer/rhdh-plugins) - mountPoint: home.page/cards importName: Markdown + module: Legacy config: layouts: xl: { w: 6, h: 4, x: 6 } diff --git a/workspaces/homepage/docs/cards/onboarding-section.md b/workspaces/homepage/docs/cards/onboarding-section.md index 24d724b34db..e8aeba5f35b 100644 --- a/workspaces/homepage/docs/cards/onboarding-section.md +++ b/workspaces/homepage/docs/cards/onboarding-section.md @@ -15,6 +15,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: OnboardingSection + module: Legacy config: layouts: xl: { w: 12, h: 6 } diff --git a/workspaces/homepage/docs/cards/placeholder.md b/workspaces/homepage/docs/cards/placeholder.md index 7f81bee17a3..a888f3c3f56 100644 --- a/workspaces/homepage/docs/cards/placeholder.md +++ b/workspaces/homepage/docs/cards/placeholder.md @@ -13,6 +13,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 1, h: 1 } @@ -26,6 +27,7 @@ dynamicPlugins: debugContent: '1' - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 1, h: 1, x: 1 } @@ -39,6 +41,7 @@ dynamicPlugins: debugContent: '2' - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 1, h: 1 } @@ -53,6 +56,7 @@ dynamicPlugins: - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 12, h: 1 } @@ -67,6 +71,7 @@ dynamicPlugins: - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 1, h: 1 } @@ -80,6 +85,7 @@ dynamicPlugins: debugContent: '5' - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 1, h: 1, x: 1 } diff --git a/workspaces/homepage/docs/cards/quick-access.md b/workspaces/homepage/docs/cards/quick-access.md index 3abf297e0f3..647cc0ddf64 100644 --- a/workspaces/homepage/docs/cards/quick-access.md +++ b/workspaces/homepage/docs/cards/quick-access.md @@ -13,6 +13,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: QuickAccessCard + module: Legacy config: layouts: xl: { h: 8 } diff --git a/workspaces/homepage/docs/cards/recently-visited.md b/workspaces/homepage/docs/cards/recently-visited.md index 428f9b0505c..41105735cef 100644 --- a/workspaces/homepage/docs/cards/recently-visited.md +++ b/workspaces/homepage/docs/cards/recently-visited.md @@ -16,6 +16,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: RecentlyVisitedCard + module: Legacy ``` ## Contributions diff --git a/workspaces/homepage/docs/cards/search.md b/workspaces/homepage/docs/cards/search.md index 8ffc10a5cef..87c1e92800c 100644 --- a/workspaces/homepage/docs/cards/search.md +++ b/workspaces/homepage/docs/cards/search.md @@ -13,6 +13,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: SearchBar + module: Legacy config: layouts: xl: { w: 10, h: 1, x: 1 } diff --git a/workspaces/homepage/docs/cards/template-section.md b/workspaces/homepage/docs/cards/template-section.md index 5ca78851cb3..c43b27251d9 100644 --- a/workspaces/homepage/docs/cards/template-section.md +++ b/workspaces/homepage/docs/cards/template-section.md @@ -15,6 +15,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: TemplateSection + module: Legacy config: layouts: xl: { w: 12, h: 5 } diff --git a/workspaces/homepage/docs/cards/top-visited.md b/workspaces/homepage/docs/cards/top-visited.md index 092312e9ee0..6786001c144 100644 --- a/workspaces/homepage/docs/cards/top-visited.md +++ b/workspaces/homepage/docs/cards/top-visited.md @@ -16,6 +16,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: TopVisitedCard + module: Legacy ``` ## Contributions diff --git a/workspaces/homepage/docs/cards/worldclock.md b/workspaces/homepage/docs/cards/worldclock.md index d92d4d3a7a7..53264cf7062 100644 --- a/workspaces/homepage/docs/cards/worldclock.md +++ b/workspaces/homepage/docs/cards/worldclock.md @@ -16,6 +16,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: WorldClock + module: Legacy config: layouts: xl: { w: 12, h: 1 } diff --git a/workspaces/homepage/docs/create-a-new-card.md b/workspaces/homepage/docs/create-a-new-card.md index d4be57b5555..88896336797 100644 --- a/workspaces/homepage/docs/create-a-new-card.md +++ b/workspaces/homepage/docs/create-a-new-card.md @@ -47,6 +47,7 @@ Cards commonly uses the [InfoCard](https://backstage.io/storybook/?path=/story/l mountPoints: - mountPoint: home.page/cards importName: YourHomePageCard + module: Legacy config: layout: ... props: ... diff --git a/workspaces/homepage/docs/defaults.md b/workspaces/homepage/docs/defaults.md index 1687abc23ba..792fe2d149a 100644 --- a/workspaces/homepage/docs/defaults.md +++ b/workspaces/homepage/docs/defaults.md @@ -30,9 +30,11 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage + module: Legacy mountPoints: - mountPoint: home.page/cards importName: OnboardingSection + module: Legacy config: layouts: xl: { w: 12, h: 6 } @@ -43,6 +45,7 @@ dynamicPlugins: xxs: { w: 12, h: 14 } - mountPoint: home.page/cards importName: EntitySection + module: Legacy config: layouts: xl: { w: 12, h: 7 } @@ -53,6 +56,7 @@ dynamicPlugins: xxs: { w: 12, h: 15 } - mountPoint: home.page/cards importName: TemplateSection + module: Legacy config: layouts: xl: { w: 12, h: 5 } @@ -74,9 +78,11 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicCustomizableHomePage + module: Legacy mountPoints: - mountPoint: home.page/cards importName: OnboardingSection + module: Legacy config: layouts: xl: { w: 12, h: 6 } @@ -87,6 +93,7 @@ dynamicPlugins: xxs: { w: 12, h: 14 } - mountPoint: home.page/cards importName: EntitySection + module: Legacy config: layouts: xl: { w: 12, h: 7 } @@ -97,6 +104,7 @@ dynamicPlugins: xxs: { w: 12, h: 15 } - mountPoint: home.page/cards importName: TemplateSection + module: Legacy config: layouts: xl: { w: 12, h: 5 } @@ -108,8 +116,10 @@ dynamicPlugins: # Additional cards available in "Add widget" dialog - mountPoint: home.page/cards importName: RecentlyVisitedCard + module: Legacy - mountPoint: home.page/cards importName: TopVisitedCard + module: Legacy ``` The customizable homepage provides: @@ -134,6 +144,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: Headline + module: Legacy config: layouts: xl: { h: 1 } diff --git a/workspaces/homepage/docs/header.md b/workspaces/homepage/docs/header.md index 5d75e685815..0daaed0eb92 100644 --- a/workspaces/homepage/docs/header.md +++ b/workspaces/homepage/docs/header.md @@ -46,6 +46,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage for customizable homepage + module: Legacy config: props: title: 'Howdy {{firstName}} or {{dispayName}}' @@ -73,6 +74,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: title: Our custom RHDH instance @@ -94,6 +96,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: title: Welcome to your RHDH instance! @@ -119,6 +122,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: title: Welcome back! @@ -151,6 +155,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: localClock: @@ -168,6 +173,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: localClock: @@ -187,6 +193,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: localClock: @@ -205,6 +212,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: localClock: @@ -247,6 +255,7 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicHomePage # or DynamicCustomizableHomePage + module: Legacy config: props: worldClocks: diff --git a/workspaces/homepage/docs/layout-options.md b/workspaces/homepage/docs/layout-options.md index b1ce59d13c6..a8a4b43a6f4 100644 --- a/workspaces/homepage/docs/layout-options.md +++ b/workspaces/homepage/docs/layout-options.md @@ -23,6 +23,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: props: showBorder: true @@ -64,6 +65,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 6, h: 2 } @@ -90,6 +92,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 6, h: 2 } @@ -103,6 +106,7 @@ dynamicPlugins: debugContent: left - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 6, h: 2, x: 6 } @@ -129,6 +133,7 @@ dynamicPlugins: mountPoints: - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 4, h: 2 } @@ -142,6 +147,7 @@ dynamicPlugins: debugContent: left - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 4, h: 2, x: 4 } @@ -155,6 +161,7 @@ dynamicPlugins: debugContent: center - mountPoint: home.page/cards importName: Placeholder + module: Legacy config: layouts: xl: { w: 4, h: 2, x: 8 } diff --git a/workspaces/homepage/docs/user-customization.md b/workspaces/homepage/docs/user-customization.md index 480a524e8d2..0daf2839943 100644 --- a/workspaces/homepage/docs/user-customization.md +++ b/workspaces/homepage/docs/user-customization.md @@ -11,4 +11,5 @@ dynamicPlugins: dynamicRoutes: - path: / importName: DynamicCustomizableHomePage + module: Legacy ``` diff --git a/workspaces/homepage/packages/app-legacy/src/App.tsx b/workspaces/homepage/packages/app-legacy/src/App.tsx index 3fefad22ba0..5f5812a773e 100644 --- a/workspaces/homepage/packages/app-legacy/src/App.tsx +++ b/workspaces/homepage/packages/app-legacy/src/App.tsx @@ -83,8 +83,8 @@ import { FeaturedDocsCard, WorldClock, HomePageCardMountPoint, -} from '@red-hat-developer-hub/backstage-plugin-homepage'; -import { homepageTranslations } from '@red-hat-developer-hub/backstage-plugin-homepage/alpha'; + homepageTranslations, +} from '@red-hat-developer-hub/backstage-plugin-homepage/legacy'; const identityProviders: IdentityProviders = [ 'guest', diff --git a/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageAvailableWidgets.tsx b/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageAvailableWidgets.tsx index 7b57ce4f964..6e0fde9fbc9 100644 --- a/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageAvailableWidgets.tsx +++ b/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageAvailableWidgets.tsx @@ -19,7 +19,7 @@ import { CodeSnippet, Content, Header, Page } from '@backstage/core-components'; import { stringify } from 'yaml'; // eslint-disable-next-line @backstage/no-relative-monorepo-imports -import { useDynamicHomePageCards } from '../../../../../plugins/homepage/src/hooks/useDynamicHomePageCards'; +import { useDynamicHomePageCards } from '../../../../../plugins/homepage/src/legacy/hooks/useDynamicHomePageCards'; export const DebugHomepageAvailableWidgets = () => { const mountPoints = useDynamicHomePageCards(); diff --git a/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageDefaultWidgets.tsx b/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageDefaultWidgets.tsx index acce31058cd..d20c2d24323 100644 --- a/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageDefaultWidgets.tsx +++ b/workspaces/homepage/packages/app-legacy/src/components/homepage/DebugHomepageDefaultWidgets.tsx @@ -27,7 +27,7 @@ import { import useAsync from 'react-use/lib/useAsync'; import { stringify } from 'yaml'; -import { defaultWidgetsApiRef } from '@red-hat-developer-hub/backstage-plugin-homepage'; +import { defaultWidgetsApiRef } from '@red-hat-developer-hub/backstage-plugin-homepage/legacy'; export const DebugHomepageDefaultWidgets = () => { const defaultWidgetsApi = useApi(defaultWidgetsApiRef); diff --git a/workspaces/homepage/packages/app/src/App.tsx b/workspaces/homepage/packages/app/src/App.tsx index 74a7e74af6b..8eb7bbffc89 100644 --- a/workspaces/homepage/packages/app/src/App.tsx +++ b/workspaces/homepage/packages/app/src/App.tsx @@ -20,7 +20,7 @@ import { signInModule } from './modules/signIn'; import { homePageModule, homepageTranslationsModule, -} from '@red-hat-developer-hub/backstage-plugin-homepage/alpha'; +} from '@red-hat-developer-hub/backstage-plugin-homepage'; import { rhdhThemeModule } from '@red-hat-developer-hub/backstage-plugin-theme/alpha'; export default createApp({ diff --git a/workspaces/homepage/plugins/homepage/README.md b/workspaces/homepage/plugins/homepage/README.md index ca45cdfcc01..f817d96b976 100644 --- a/workspaces/homepage/plugins/homepage/README.md +++ b/workspaces/homepage/plugins/homepage/README.md @@ -2,7 +2,7 @@ This is a dynamic version of the upstream [home page plugin](https://github.com/backstage/backstage/tree/master/plugins/home). -Instead of manually adding supported "home page cards" to a custom route, it allows dynamic plugins to expose such cards. The plugin supports both the **New Frontend System (NFS)** and the **legacy** dynamic plugin model (Scalprum). +The plugin supports both the **New Frontend System (NFS)** and the **legacy** dynamic plugin model (Scalprum / OFS). NFS is the primary package entry point. OFS exports are available only at `./legacy`. Translations remain available at `./alpha`. ## New Frontend System @@ -12,14 +12,14 @@ If you're using Backstage's new frontend system, add the plugin to your app: // packages/app/src/App.tsx import { createApp } from '@backstage/frontend-defaults'; import { - homePageDevModule, + homePageModule, homepageTranslationsModule, -} from '@red-hat-developer-hub/backstage-plugin-homepage/alpha'; +} from '@red-hat-developer-hub/backstage-plugin-homepage'; export default createApp({ features: [ // ... other plugins (nav, signIn, etc.) - homePageDevModule, + homePageModule, homepageTranslationsModule, ], }); @@ -70,16 +70,20 @@ app: ### Modules -The following modules are available from the alpha export: +The following modules are available from the primary package entry point: | Module | Description | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `homePageDevModule` | Home page layout and widgets (Onboarding, Entity, Templates, Quick Access, Search, Recently Visited, Top Visited, etc.) | +| `homePageModule` (default) | Home page layout and widgets (Onboarding, Entity, Templates, Quick Access, Search, Recently Visited, Top Visited, etc.) | | `homepageTranslationsModule` | i18n translations (en, de, es, fr, it, ja) | +`homepageTranslationsModule` (`pluginId: 'app'`) is also available as a dedicated Module Federation entry: + +- `@red-hat-developer-hub/backstage-plugin-homepage/homepage-translations-module` + ### Extensions -The `homePageDevModule` extends the `home` plugin (`@backstage/plugin-home`) with: +The `homePageModule` extends the `home` plugin (`@backstage/plugin-home`) with: - `home-page-layout:home/dynamic-homepage-layout` – Custom layout with config-driven widget arrangement and priority - `home-page-widget:home/rhdh-onboarding-section` – Onboarding section @@ -94,4 +98,18 @@ The `homePageDevModule` extends the `home` plugin (`@backstage/plugin-home`) wit ## Legacy System (Dynamic Plugins) -For the legacy Scalprum-based dynamic plugin model, use the main export and configure via `app-config.dynamic.yaml`. See `app-config.dynamic.yaml` in this package for the mount point configuration. +Legacy component imports have been removed from the main package path. OFS consumers must import from `./legacy`, and dynamic plugin config needs `module: Legacy`. See `app-config.dynamic.yaml` in this package for the mount point configuration. + +```tsx +import { + DynamicHomePage, + OnboardingSection, + homepageTranslations, +} from '@red-hat-developer-hub/backstage-plugin-homepage/legacy'; +``` + +## Migration + +- **NFS**: change imports from `@red-hat-developer-hub/backstage-plugin-homepage/alpha` to `@red-hat-developer-hub/backstage-plugin-homepage`. +- **OFS**: change imports from `@red-hat-developer-hub/backstage-plugin-homepage` to `@red-hat-developer-hub/backstage-plugin-homepage/legacy`, and set `module: Legacy` in dynamic plugin config. +- **Translations**: remain available at `./alpha` (and also on the main and legacy entry points / translations module). diff --git a/workspaces/homepage/plugins/homepage/app-config.dynamic.yaml b/workspaces/homepage/plugins/homepage/app-config.dynamic.yaml index 122c4159c09..c753aef858a 100644 --- a/workspaces/homepage/plugins/homepage/app-config.dynamic.yaml +++ b/workspaces/homepage/plugins/homepage/app-config.dynamic.yaml @@ -1,14 +1,22 @@ -# please keep this in sync with packages/app/src/App.tsx +# please keep this in sync with packages/app-legacy mount points +# Note: Legacy/OFS exports are only available from `module: Legacy`. +# The default module (PluginRoot) is NFS-only. dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-homepage: + translationResources: + - importName: homepageTranslations + module: Legacy + ref: homepageTranslationRef dynamicRoutes: - path: / importName: DynamicHomePage + module: Legacy mountPoints: # Default homepage cards - appear by default - mountPoint: home.page/cards importName: OnboardingSection + module: Legacy config: layouts: xl: { w: 12, h: 6 } @@ -19,6 +27,7 @@ dynamicPlugins: xxs: { w: 12, h: 14 } - mountPoint: home.page/cards importName: EntitySection + module: Legacy config: layouts: xl: { w: 12, h: 7 } @@ -29,6 +38,7 @@ dynamicPlugins: xxs: { w: 12, h: 15 } - mountPoint: home.page/cards importName: TemplateSection + module: Legacy config: layouts: xl: { w: 12, h: 5 } @@ -41,6 +51,7 @@ dynamicPlugins: # Additional plugin widgets - available in "Add widget" dialog - mountPoint: home.page/widgets importName: RecentlyVisitedCard + module: Legacy config: title: 'Recently Visited' description: 'Quick access to recently viewed entities and pages' @@ -54,6 +65,7 @@ dynamicPlugins: xxs: { w: 12, h: 3 } - mountPoint: home.page/widgets importName: TopVisitedCard + module: Legacy config: title: 'Most Visited' description: 'Your most frequently accessed entities and services' diff --git a/workspaces/homepage/plugins/homepage/dev/index.tsx b/workspaces/homepage/plugins/homepage/dev/index.tsx index d3d0b48617b..cd8e2180f0c 100644 --- a/workspaces/homepage/plugins/homepage/dev/index.tsx +++ b/workspaces/homepage/plugins/homepage/dev/index.tsx @@ -48,7 +48,7 @@ import { import { homePageModule, homepageTranslationsModule, -} from '@red-hat-developer-hub/backstage-plugin-homepage/alpha'; +} from '@red-hat-developer-hub/backstage-plugin-homepage'; import { rhdhThemeModule } from '@red-hat-developer-hub/backstage-plugin-theme/alpha'; import { quickAccessApiRef } from '../src/api'; import { visitsApiRef } from '@backstage/plugin-home'; diff --git a/workspaces/homepage/plugins/homepage/dev/legacy.tsx b/workspaces/homepage/plugins/homepage/dev/legacy.tsx index a4e5dba0bc7..159992b7ce9 100644 --- a/workspaces/homepage/plugins/homepage/dev/legacy.tsx +++ b/workspaces/homepage/plugins/homepage/dev/legacy.tsx @@ -55,7 +55,7 @@ import { EntitySection, TemplateSection, DynamicCustomizableHomePage, -} from '../src/plugin'; +} from '../src/legacy/plugin'; import { homepageTranslations } from '../src/translations'; import { HomePageCardMountPoint, QuickAccessLink } from '../src/types'; import defaultQuickAccess from './quickaccess-default.json'; diff --git a/workspaces/homepage/plugins/homepage/package.json b/workspaces/homepage/plugins/homepage/package.json index 6799b24c0a9..9d33b836ea7 100644 --- a/workspaces/homepage/plugins/homepage/package.json +++ b/workspaces/homepage/plugins/homepage/package.json @@ -23,7 +23,8 @@ }, "exports": { ".": "./src/index.ts", - "./alpha": "./src/alpha/index.ts", + "./alpha": "./src/alpha.ts", + "./legacy": "./src/legacy.ts", "./homepage-translations-module": "./src/homepageTranslationsModuleExport.ts", "./package.json": "./package.json" }, @@ -31,7 +32,10 @@ "typesVersions": { "*": { "alpha": [ - "src/alpha/index.ts" + "src/alpha.ts" + ], + "legacy": [ + "src/legacy.ts" ], "homepage-translations-module": [ "src/homepageTranslationsModuleExport.ts" @@ -41,6 +45,15 @@ ] } }, + "scalprum": { + "name": "red-hat-developer-hub.backstage-plugin-homepage", + "exposedModules": { + "PluginRoot": "./src/index.ts", + "Alpha": "./src/alpha.ts", + "Legacy": "./src/legacy.ts", + "HomepageTranslationsModule": "./src/homepageTranslationsModuleExport.ts" + } + }, "scripts": { "start": "backstage-cli package start", "start:legacy": "backstage-cli package start --entrypoint dev/legacy.tsx", diff --git a/workspaces/homepage/plugins/homepage/report-alpha.api.md b/workspaces/homepage/plugins/homepage/report-alpha.api.md index 8c2156fb36f..bda2d3dab0e 100644 --- a/workspaces/homepage/plugins/homepage/report-alpha.api.md +++ b/workspaces/homepage/plugins/homepage/report-alpha.api.md @@ -3,15 +3,9 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { FrontendModule } from '@backstage/frontend-plugin-api'; import { TranslationRef } from '@backstage/frontend-plugin-api'; import { TranslationResource } from '@backstage/frontend-plugin-api'; -// @alpha -const homePageModule: FrontendModule; -export default homePageModule; -export { homePageModule }; - // @public export const homepageTranslationRef: TranslationRef< 'plugin.homepage', @@ -69,9 +63,4 @@ export const homepageTranslationRef: TranslationRef< // @public export const homepageTranslations: TranslationResource<'plugin.homepage'>; - -// @alpha -export const homepageTranslationsModule: FrontendModule; - -// (No @packageDocumentation comment for this package) ``` diff --git a/workspaces/homepage/plugins/homepage/report-homepage-translations-module.api.md b/workspaces/homepage/plugins/homepage/report-homepage-translations-module.api.md index 114567bc34f..16e53893868 100644 --- a/workspaces/homepage/plugins/homepage/report-homepage-translations-module.api.md +++ b/workspaces/homepage/plugins/homepage/report-homepage-translations-module.api.md @@ -5,7 +5,7 @@ ```ts import { FrontendModule } from '@backstage/frontend-plugin-api'; -// @alpha +// @public const homepageTranslationsModule: FrontendModule; export default homepageTranslationsModule; diff --git a/workspaces/homepage/plugins/homepage/report-legacy.api.md b/workspaces/homepage/plugins/homepage/report-legacy.api.md new file mode 100644 index 00000000000..71ee832e53e --- /dev/null +++ b/workspaces/homepage/plugins/homepage/report-legacy.api.md @@ -0,0 +1,322 @@ +## API Report File for "@red-hat-developer-hub/backstage-plugin-homepage" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { ApiRef } from '@backstage/frontend-plugin-api'; +import { BackstagePlugin } from '@backstage/core-plugin-api'; +import type { CardLayout } from '@backstage/plugin-home-react'; +import type { CardSettings } from '@backstage/plugin-home-react'; +import { ClockConfig } from '@backstage/plugin-home'; +import type { ComponentType } from 'react'; +import type { DefaultWidgetsResponse } from '@red-hat-developer-hub/backstage-plugin-homepage-common'; +import { FeaturedDocsCardProps } from '@backstage/plugin-home'; +import { JSX as JSX_2 } from 'react/jsx-runtime'; +import { RouteRef } from '@backstage/core-plugin-api'; +import { StarredEntitiesProps } from '@backstage/plugin-home'; +import { TranslationRef } from '@backstage/frontend-plugin-api'; +import { TranslationResource } from '@backstage/frontend-plugin-api'; +import { VisitedByTypeProps } from '@backstage/plugin-home'; + +// @public (undocumented) +export enum Breakpoint { + // (undocumented) + lg = 'lg', + // (undocumented) + md = 'md', + // (undocumented) + sm = 'sm', + // (undocumented) + xl = 'xl', + // (undocumented) + xs = 'xs', + // (undocumented) + xxs = 'xxs', +} + +// @public (undocumented) +export const CatalogStarredEntitiesCard: ComponentType; + +// @public (undocumented) +export interface DefaultWidgetsApi { + // (undocumented) + getDefaultWidgets(): Promise; +} + +// @public (undocumented) +export const defaultWidgetsApiRef: ApiRef; + +// @public +export const DynamicCustomizableHomePage: ComponentType; + +// @public +export interface DynamicCustomizableHomePageProps { + // (undocumented) + localClock?: LocalClockProps; + // (undocumented) + pageTitle?: string; + // (undocumented) + personalizedTitle?: string; + // (undocumented) + subtitle?: string; + // (undocumented) + title?: string; + // (undocumented) + worldClocks?: ClockConfig[]; +} + +// @public +export const DynamicHomePage: ComponentType; + +// @public +export const dynamicHomePagePlugin: BackstagePlugin< + { + root: RouteRef; + }, + {}, + {} +>; + +// @public +export interface DynamicHomePageProps { + // (undocumented) + localClock?: LocalClockProps; + // (undocumented) + pageTitle?: string; + // (undocumented) + personalizedTitle?: string; + // (undocumented) + subtitle?: string; + // (undocumented) + title?: string; + // (undocumented) + worldClocks?: ClockConfig[]; +} + +// @public (undocumented) +export const EntitySection: () => JSX_2.Element; + +// @public (undocumented) +export const FeaturedDocsCard: ComponentType; + +// @public (undocumented) +export const Headline: ComponentType; + +// @public (undocumented) +export interface HeadlineProps { + // (undocumented) + align?: 'left' | 'center' | 'right'; + // (undocumented) + title?: string; +} + +// @public (undocumented) +export interface HomePageCardMountPoint { + // (undocumented) + Actions?: ComponentType; + // (undocumented) + Component: ComponentType; + // (undocumented) + config?: HomePageCardMountPointConfig & { + props?: Record; + }; + // (undocumented) + enabled?: boolean; + // (undocumented) + Settings?: ComponentType; +} + +// @public (undocumented) +export interface HomePageCardMountPointConfig { + // (undocumented) + cardLayout?: CardLayout; + // (undocumented) + description?: string; + // (undocumented) + descriptionKey?: string; + id?: string; + layouts?: Record; + // (undocumented) + priority?: number; + // (undocumented) + settings?: CardSettings; + // (undocumented) + title?: string; + // (undocumented) + titleKey?: string; +} + +// @public +export const homepageTranslationRef: TranslationRef< + 'plugin.homepage', + { + readonly 'header.local': string; + readonly 'header.welcome': string; + readonly 'header.welcomePersonalized': string; + readonly 'search.placeholder': string; + readonly 'search.clearButton': string; + readonly 'homePage.empty': string; + readonly 'quickAccess.title': string; + readonly 'quickAccess.error': string; + readonly 'quickAccess.fetchError': string; + readonly 'featuredDocs.title': string; + readonly 'featuredDocs.learnMore': string; + readonly 'starredEntities.title': string; + readonly 'recentlyVisited.title': string; + readonly 'recentlyVisited.description': string; + readonly 'topVisited.title': string; + readonly 'topVisited.description': string; + readonly 'templates.title': string; + readonly 'templates.error': string; + readonly 'templates.empty': string; + readonly 'templates.fetchError': string; + readonly 'templates.emptyDescription': string; + readonly 'templates.register': string; + readonly 'templates.viewAll': string; + readonly 'onboarding.guest': string; + readonly 'onboarding.greeting.goodMorning': string; + readonly 'onboarding.greeting.goodAfternoon': string; + readonly 'onboarding.greeting.goodEvening': string; + readonly 'onboarding.getStarted.title': string; + readonly 'onboarding.getStarted.description': string; + readonly 'onboarding.getStarted.buttonText': string; + readonly 'onboarding.getStarted.ariaLabel': string; + readonly 'onboarding.explore.title': string; + readonly 'onboarding.explore.description': string; + readonly 'onboarding.explore.buttonText': string; + readonly 'onboarding.explore.ariaLabel': string; + readonly 'onboarding.learn.title': string; + readonly 'onboarding.learn.description': string; + readonly 'onboarding.learn.buttonText': string; + readonly 'onboarding.learn.ariaLabel': string; + readonly 'entities.title': string; + readonly 'entities.error': string; + readonly 'entities.close': string; + readonly 'entities.empty': string; + readonly 'entities.fetchError': string; + readonly 'entities.description': string; + readonly 'entities.emptyDescription': string; + readonly 'entities.register': string; + readonly 'entities.browseTheCatalog': string; + } +>; + +// @public +export const homepageTranslations: TranslationResource<'plugin.homepage'>; + +// @public (undocumented) +export interface Layout { + // (undocumented) + h?: number; + // (undocumented) + w?: number; + // (undocumented) + x?: number; + // (undocumented) + y?: number; +} + +// @public (undocumented) +export interface LocalClockProps { + // (undocumented) + format?: + | 'none' + | 'full' + | 'date' + | 'datewithweekday' + | 'time' + | 'timewithseconds' + | 'both'; + // (undocumented) + label?: string; + // (undocumented) + lang?: string; +} + +// @public (undocumented) +export const Markdown: ComponentType; + +// @public (undocumented) +export const MarkdownCard: ComponentType; + +// @public (undocumented) +export interface MarkdownCardProps { + // (undocumented) + content?: string; + // (undocumented) + title?: string; +} + +// @public (undocumented) +export interface MarkdownProps { + // (undocumented) + content?: string; + // (undocumented) + title?: string; +} + +// @public (undocumented) +export const OnboardingSection: () => JSX_2.Element; + +// @public (undocumented) +export const Placeholder: ComponentType; + +// @public (undocumented) +export interface PlaceholderProps { + // (undocumented) + debugContent?: string; + // (undocumented) + showBorder?: boolean; +} + +// @public (undocumented) +export const QuickAccessCard: ComponentType; + +// @public (undocumented) +export interface QuickAccessCardProps { + // (undocumented) + path?: string; + // (undocumented) + title?: string; + // (undocumented) + titleKey?: string; +} + +// @public (undocumented) +export const RecentlyVisitedCard: ComponentType; + +// @public (undocumented) +export const SearchBar: ComponentType; + +// @public (undocumented) +export interface SearchBarProps { + // (undocumented) + path?: string; + // (undocumented) + queryParam?: string; +} + +// @public (undocumented) +export const TemplateSection: () => JSX_2.Element; + +// @public (undocumented) +export const TopVisitedCard: ComponentType; + +// @public (undocumented) +export const VisitListener: () => JSX_2.Element | null; + +// @public (undocumented) +export const WorldClock: (input: WorldClockProps) => JSX_2.Element; + +// @public (undocumented) +export interface WorldClockProps { + // (undocumented) + justifyContent?: 'space-between' | 'space-around'; + // (undocumented) + timeFormat?: Intl.DateTimeFormatOptions; + // (undocumented) + worldClocks: ClockConfig[]; +} + +// (No @packageDocumentation comment for this package) +``` diff --git a/workspaces/homepage/plugins/homepage/report.api.md b/workspaces/homepage/plugins/homepage/report.api.md index db64c8a4421..5a53855f20b 100644 --- a/workspaces/homepage/plugins/homepage/report.api.md +++ b/workspaces/homepage/plugins/homepage/report.api.md @@ -3,260 +3,75 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { ApiRef } from '@backstage/frontend-plugin-api'; -import { BackstagePlugin } from '@backstage/core-plugin-api'; -import type { CardLayout } from '@backstage/plugin-home-react'; -import type { CardSettings } from '@backstage/plugin-home-react'; -import { ClockConfig } from '@backstage/plugin-home'; -import type { ComponentType } from 'react'; -import type { DefaultWidgetsResponse } from '@red-hat-developer-hub/backstage-plugin-homepage-common'; -import { FeaturedDocsCardProps } from '@backstage/plugin-home'; -import { JSX as JSX_2 } from 'react/jsx-runtime'; -import { RouteRef } from '@backstage/core-plugin-api'; -import { StarredEntitiesProps } from '@backstage/plugin-home'; -import { VisitedByTypeProps } from '@backstage/plugin-home'; - -// @public (undocumented) -export enum Breakpoint { - // (undocumented) - lg = 'lg', - // (undocumented) - md = 'md', - // (undocumented) - sm = 'sm', - // (undocumented) - xl = 'xl', - // (undocumented) - xs = 'xs', - // (undocumented) - xxs = 'xxs', -} - -// @public (undocumented) -export const CatalogStarredEntitiesCard: ComponentType; - -// @public (undocumented) -export interface DefaultWidgetsApi { - // (undocumented) - getDefaultWidgets(): Promise; -} - -// @public (undocumented) -export const defaultWidgetsApiRef: ApiRef; +import { FrontendModule } from '@backstage/frontend-plugin-api'; +import { TranslationRef } from '@backstage/frontend-plugin-api'; +import { TranslationResource } from '@backstage/frontend-plugin-api'; // @public -export const DynamicCustomizableHomePage: ComponentType; +const homePageModule: FrontendModule; +export default homePageModule; +export { homePageModule }; // @public -export interface DynamicCustomizableHomePageProps { - // (undocumented) - localClock?: LocalClockProps; - // (undocumented) - pageTitle?: string; - // (undocumented) - personalizedTitle?: string; - // (undocumented) - subtitle?: string; - // (undocumented) - title?: string; - // (undocumented) - worldClocks?: ClockConfig[]; -} - -// @public -export const DynamicHomePage: ComponentType; - -// @public -export const dynamicHomePagePlugin: BackstagePlugin< +export const homepageTranslationRef: TranslationRef< + 'plugin.homepage', { - root: RouteRef; - }, - {}, - {} + readonly 'header.local': string; + readonly 'header.welcome': string; + readonly 'header.welcomePersonalized': string; + readonly 'search.placeholder': string; + readonly 'search.clearButton': string; + readonly 'homePage.empty': string; + readonly 'quickAccess.title': string; + readonly 'quickAccess.error': string; + readonly 'quickAccess.fetchError': string; + readonly 'featuredDocs.title': string; + readonly 'featuredDocs.learnMore': string; + readonly 'starredEntities.title': string; + readonly 'recentlyVisited.title': string; + readonly 'recentlyVisited.description': string; + readonly 'topVisited.title': string; + readonly 'topVisited.description': string; + readonly 'templates.title': string; + readonly 'templates.error': string; + readonly 'templates.empty': string; + readonly 'templates.fetchError': string; + readonly 'templates.emptyDescription': string; + readonly 'templates.register': string; + readonly 'templates.viewAll': string; + readonly 'onboarding.guest': string; + readonly 'onboarding.greeting.goodMorning': string; + readonly 'onboarding.greeting.goodAfternoon': string; + readonly 'onboarding.greeting.goodEvening': string; + readonly 'onboarding.getStarted.title': string; + readonly 'onboarding.getStarted.description': string; + readonly 'onboarding.getStarted.buttonText': string; + readonly 'onboarding.getStarted.ariaLabel': string; + readonly 'onboarding.explore.title': string; + readonly 'onboarding.explore.description': string; + readonly 'onboarding.explore.buttonText': string; + readonly 'onboarding.explore.ariaLabel': string; + readonly 'onboarding.learn.title': string; + readonly 'onboarding.learn.description': string; + readonly 'onboarding.learn.buttonText': string; + readonly 'onboarding.learn.ariaLabel': string; + readonly 'entities.title': string; + readonly 'entities.error': string; + readonly 'entities.close': string; + readonly 'entities.empty': string; + readonly 'entities.fetchError': string; + readonly 'entities.description': string; + readonly 'entities.emptyDescription': string; + readonly 'entities.register': string; + readonly 'entities.browseTheCatalog': string; + } >; // @public -export interface DynamicHomePageProps { - // (undocumented) - localClock?: LocalClockProps; - // (undocumented) - pageTitle?: string; - // (undocumented) - personalizedTitle?: string; - // (undocumented) - subtitle?: string; - // (undocumented) - title?: string; - // (undocumented) - worldClocks?: ClockConfig[]; -} - -// @public (undocumented) -export const EntitySection: () => JSX_2.Element; - -// @public (undocumented) -export const FeaturedDocsCard: ComponentType; - -// @public (undocumented) -export const Headline: ComponentType; - -// @public (undocumented) -export interface HeadlineProps { - // (undocumented) - align?: 'left' | 'center' | 'right'; - // (undocumented) - title?: string; -} - -// @public (undocumented) -export interface HomePageCardMountPoint { - // (undocumented) - Actions?: ComponentType; - // (undocumented) - Component: ComponentType; - // (undocumented) - config?: HomePageCardMountPointConfig & { - props?: Record; - }; - // (undocumented) - enabled?: boolean; - // (undocumented) - Settings?: ComponentType; -} - -// @public (undocumented) -export interface HomePageCardMountPointConfig { - // (undocumented) - cardLayout?: CardLayout; - // (undocumented) - description?: string; - // (undocumented) - descriptionKey?: string; - id?: string; - layouts?: Record; - // (undocumented) - priority?: number; - // (undocumented) - settings?: CardSettings; - // (undocumented) - title?: string; - // (undocumented) - titleKey?: string; -} - -// @public (undocumented) -export interface Layout { - // (undocumented) - h?: number; - // (undocumented) - w?: number; - // (undocumented) - x?: number; - // (undocumented) - y?: number; -} - -// @public (undocumented) -export interface LocalClockProps { - // (undocumented) - format?: - | 'none' - | 'full' - | 'date' - | 'datewithweekday' - | 'time' - | 'timewithseconds' - | 'both'; - // (undocumented) - label?: string; - // (undocumented) - lang?: string; -} - -// @public (undocumented) -export const Markdown: ComponentType; +export const homepageTranslations: TranslationResource<'plugin.homepage'>; -// @public (undocumented) -export const MarkdownCard: ComponentType; - -// @public (undocumented) -export interface MarkdownCardProps { - // (undocumented) - content?: string; - // (undocumented) - title?: string; -} - -// @public (undocumented) -export interface MarkdownProps { - // (undocumented) - content?: string; - // (undocumented) - title?: string; -} - -// @public (undocumented) -export const OnboardingSection: () => JSX_2.Element; - -// @public (undocumented) -export const Placeholder: ComponentType; - -// @public (undocumented) -export interface PlaceholderProps { - // (undocumented) - debugContent?: string; - // (undocumented) - showBorder?: boolean; -} - -// @public (undocumented) -export const QuickAccessCard: ComponentType; - -// @public (undocumented) -export interface QuickAccessCardProps { - // (undocumented) - path?: string; - // (undocumented) - title?: string; - // (undocumented) - titleKey?: string; -} - -// @public (undocumented) -export const RecentlyVisitedCard: ComponentType; - -// @public (undocumented) -export const SearchBar: ComponentType; - -// @public (undocumented) -export interface SearchBarProps { - // (undocumented) - path?: string; - // (undocumented) - queryParam?: string; -} - -// @public (undocumented) -export const TemplateSection: () => JSX_2.Element; - -// @public (undocumented) -export const TopVisitedCard: ComponentType; - -// @public (undocumented) -export const VisitListener: () => JSX_2.Element | null; - -// @public (undocumented) -export const WorldClock: (input: WorldClockProps) => JSX_2.Element; - -// @public (undocumented) -export interface WorldClockProps { - // (undocumented) - justifyContent?: 'space-between' | 'space-around'; - // (undocumented) - timeFormat?: Intl.DateTimeFormatOptions; - // (undocumented) - worldClocks: ClockConfig[]; -} +// @public +export const homepageTranslationsModule: FrontendModule; // (No @packageDocumentation comment for this package) ``` diff --git a/workspaces/homepage/plugins/homepage/src/alpha.ts b/workspaces/homepage/plugins/homepage/src/alpha.ts new file mode 100644 index 00000000000..74129991f43 --- /dev/null +++ b/workspaces/homepage/plugins/homepage/src/alpha.ts @@ -0,0 +1,24 @@ +/* + * Copyright Red Hat, Inc. + * + * 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. + */ + +/** + * Translations remain available at the `/alpha` export. + * NFS modules have graduated to the primary package entry point. + * + * @packageDocumentation + */ + +export * from './translations'; diff --git a/workspaces/homepage/plugins/homepage/src/alpha/alpha.test.ts b/workspaces/homepage/plugins/homepage/src/alpha/alpha.test.ts deleted file mode 100644 index ea0b889b321..00000000000 --- a/workspaces/homepage/plugins/homepage/src/alpha/alpha.test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright Red Hat, Inc. - * - * 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 { homepageTranslationsModule, homePageModule } from '.'; -import translationsModuleDefault from '../homepageTranslationsModuleExport'; -import { homepageTranslationRef, homepageTranslations } from '../translations'; -import { homePageLayoutExtension } from './extensions/homePageLayoutExtension'; -import { - onboardingSectionWidget, - entitySectionWidget, - templateSectionWidget, - quickAccessCardWidget, - searchBarWidget, - featuredDocsCardWidget, - catalogStarredWidget, - disableRandomJoke, - disableToolkit, - RecentlyVisitedWidget, - TopVisitedWidget, -} from './extensions/homePageCards'; -import { quickAccessApi } from './extensions/apis'; - -describe('Dynamic Home Page plugin Alpha (NFS)', () => { - describe('Modules', () => { - it('should export homePageDevModule with correct structure', () => { - expect(homePageModule).toBeDefined(); - expect(homePageModule.$$type).toBe('@backstage/FrontendModule'); - expect(homePageModule.pluginId).toBe('home'); - }); - - it('should export homepageTranslationsModule with correct structure', () => { - expect(homepageTranslationsModule).toBeDefined(); - expect(homepageTranslationsModule.$$type).toBe( - '@backstage/FrontendModule', - ); - expect(homepageTranslationsModule.pluginId).toBe('app'); - }); - - it('should export the translations module as default for NFS discovery', () => { - expect(translationsModuleDefault).toBe(homepageTranslationsModule); - }); - }); - - describe('Translations', () => { - it('should export homepageTranslationRef', () => { - expect(homepageTranslationRef).toBeDefined(); - expect(homepageTranslationRef.id).toBe('plugin.homepage'); - }); - - it('should export homepageTranslations', () => { - expect(homepageTranslations).toBeDefined(); - expect(typeof homepageTranslations).toBe('object'); - }); - }); - - describe('Layout Extension', () => { - it('should export homePageLayoutExtension', () => { - expect(homePageLayoutExtension).toBeDefined(); - }); - }); - - describe('Widget Extensions', () => { - it('should export all widget extensions', () => { - expect(onboardingSectionWidget).toBeDefined(); - expect(entitySectionWidget).toBeDefined(); - expect(templateSectionWidget).toBeDefined(); - expect(quickAccessCardWidget).toBeDefined(); - expect(searchBarWidget).toBeDefined(); - expect(featuredDocsCardWidget).toBeDefined(); - expect(catalogStarredWidget).toBeDefined(); - expect(disableToolkit).toBeDefined(); - expect(disableRandomJoke).toBeDefined(); - expect(RecentlyVisitedWidget).toBeDefined(); - expect(TopVisitedWidget).toBeDefined(); - }); - }); - - describe('APIs', () => { - it('should export quickAccessApi', () => { - expect(quickAccessApi).toBeDefined(); - }); - }); -}); diff --git a/workspaces/homepage/plugins/homepage/src/alpha/index.ts b/workspaces/homepage/plugins/homepage/src/alpha/index.ts deleted file mode 100644 index ce707c341a4..00000000000 --- a/workspaces/homepage/plugins/homepage/src/alpha/index.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright Red Hat, Inc. - * - * 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 { TranslationBlueprint } from '@backstage/plugin-app-react'; -import { createFrontendModule } from '@backstage/frontend-plugin-api'; -import { - catalogStarredWidget, - disableRandomJoke, - disableToolkit, - entitySectionWidget, - featuredDocsCardWidget, - onboardingSectionWidget, - quickAccessCardWidget, - RecentlyVisitedWidget, - searchBarWidget, - templateSectionWidget, - TopVisitedWidget, -} from './extensions/homePageCards'; -import { homepageTranslations } from '../translations'; - -import { homePageLayoutExtension } from './extensions/homePageLayoutExtension'; -import { defaultWidgetsApi, quickAccessApi } from './extensions/apis'; - -/** - * Frontend module for the Dynamic Home Page plugin (New Frontend System). - * - * Extends the `home` plugin with a custom layout and RHDH widgets: Onboarding, - * Entity Catalog, Templates, Quick Access, Search, Recently Visited, Top Visited, etc. - * Add to your app's `createApp({ features: [..., homePageDevModule] })`. - * - * @alpha - */ -export const homePageModule = createFrontendModule({ - pluginId: 'home', // upstream home! - extensions: [ - homePageLayoutExtension, - onboardingSectionWidget, - entitySectionWidget, - templateSectionWidget, - defaultWidgetsApi, - quickAccessApi, - quickAccessCardWidget, - featuredDocsCardWidget, - searchBarWidget, - TopVisitedWidget, - RecentlyVisitedWidget, - catalogStarredWidget, - disableToolkit, - disableRandomJoke, - ], -}); - -/** - * Translation module for the Dynamic Home Page plugin. - * - * @alpha - */ -export const homepageTranslationsModule = createFrontendModule({ - pluginId: 'app', - extensions: [ - TranslationBlueprint.make({ - name: 'homepage-translations', - params: { - resource: homepageTranslations, - }, - }), - ], -}); - -/** - * - * @alpha - */ -export { homepageTranslationRef, homepageTranslations } from '../translations'; - -/** - * Default export required for Module Federation to emit the `alpha` NFS expose. - * - * @alpha - */ -export default homePageModule; diff --git a/workspaces/homepage/plugins/homepage/src/alpha/components/CustomizableGridLayout.tsx b/workspaces/homepage/plugins/homepage/src/components/CustomizableGridLayout.tsx similarity index 92% rename from workspaces/homepage/plugins/homepage/src/alpha/components/CustomizableGridLayout.tsx rename to workspaces/homepage/plugins/homepage/src/components/CustomizableGridLayout.tsx index 2b33370f081..041cfd0a599 100644 --- a/workspaces/homepage/plugins/homepage/src/alpha/components/CustomizableGridLayout.tsx +++ b/workspaces/homepage/plugins/homepage/src/components/CustomizableGridLayout.tsx @@ -29,16 +29,15 @@ import { import { useTheme } from '@mui/material/styles'; import GlobalStyles from '@mui/material/GlobalStyles'; -import { cardWrapperSx } from '../../styles/cardWrapperSx'; -import { HomePageCardConfig } from '../../types'; -import { useContainerQuery } from '../../hooks/useContainerQuery'; +import { cardWrapperSx } from '../styles/cardWrapperSx'; +import { HomePageCardConfig } from '../types'; +import { useContainerQuery } from '../hooks/useContainerQuery'; import 'react-grid-layout/css/styles.css'; -import { isCardADefaultConfiguration } from '../utils'; +import { isCardADefaultConfiguration } from '../utils/nfsLayout'; /** * Props for the customizable grid layout. - * @alpha */ export interface CustomizableGridLayoutProps { homepageCards: HomePageCardConfig[]; @@ -47,7 +46,6 @@ export interface CustomizableGridLayoutProps { /** * Customizable grid layout for the NFS home page (drag, drop, resize). * - * @alpha */ export const CustomizableGridLayout = ({ homepageCards, diff --git a/workspaces/homepage/plugins/homepage/src/components/EntitySection/EntitySection.test.tsx b/workspaces/homepage/plugins/homepage/src/components/EntitySection/EntitySection.test.tsx index d001acfc33a..95b99fb68c1 100644 --- a/workspaces/homepage/plugins/homepage/src/components/EntitySection/EntitySection.test.tsx +++ b/workspaces/homepage/plugins/homepage/src/components/EntitySection/EntitySection.test.tsx @@ -19,7 +19,7 @@ import { render, screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; import { ThemeProvider, createTheme } from '@mui/material/styles'; -import { EntitySection } from '../legacy/HomePageLegacyCards'; +import { EntitySection } from '../../legacy/components/HomePageLegacyCards'; import { useEntities } from '../../hooks/useEntities'; // jsdom does not provide ResizeObserver; required by useContainerQuery in EntitySection diff --git a/workspaces/homepage/plugins/homepage/src/components/EntitySection/index.ts b/workspaces/homepage/plugins/homepage/src/components/EntitySection/index.ts index 6e6ec736d33..7890f8207ec 100644 --- a/workspaces/homepage/plugins/homepage/src/components/EntitySection/index.ts +++ b/workspaces/homepage/plugins/homepage/src/components/EntitySection/index.ts @@ -14,5 +14,3 @@ * limitations under the License. */ export { EntitySectionContent } from './EntitySection'; -export { EntitySection } from '../legacy/HomePageLegacyCards'; -export { EntitySection as default } from '../legacy/HomePageLegacyCards'; diff --git a/workspaces/homepage/plugins/homepage/src/alpha/components/HomePageLayout.tsx b/workspaces/homepage/plugins/homepage/src/components/HomePageLayout.tsx similarity index 89% rename from workspaces/homepage/plugins/homepage/src/alpha/components/HomePageLayout.tsx rename to workspaces/homepage/plugins/homepage/src/components/HomePageLayout.tsx index e1ef0d4c163..4d703290cf4 100644 --- a/workspaces/homepage/plugins/homepage/src/alpha/components/HomePageLayout.tsx +++ b/workspaces/homepage/plugins/homepage/src/components/HomePageLayout.tsx @@ -15,15 +15,14 @@ */ import { Content, EmptyState, Page } from '@backstage/core-components'; -import { useTranslation } from '../../hooks/useTranslation'; -import { HeaderProps, Header } from '../../components/Header'; +import { useTranslation } from '../hooks/useTranslation'; +import { HeaderProps, Header } from './Header'; import { ReadOnlyGridLayout } from './ReadOnlyGirdLayout'; import { CustomizableGridLayout } from './CustomizableGridLayout'; -import { HomePageCardConfig } from '../../types'; +import { HomePageCardConfig } from '../types'; /** * Props for the NFS home page layout component. - * @alpha */ export interface HomePageProps extends HeaderProps { widgets: HomePageCardConfig[]; @@ -34,7 +33,6 @@ export interface HomePageProps extends HeaderProps { * NFS home page layout that renders widgets in a read-only or customizable grid. * Used by the dynamic-homepage-layout extension. * - * @alpha */ export const HomePageLayout = ({ widgets, customizable }: HomePageProps) => { const { t } = useTranslation(); diff --git a/workspaces/homepage/plugins/homepage/src/components/OnboardingSection/index.ts b/workspaces/homepage/plugins/homepage/src/components/OnboardingSection/index.ts index adfcf610011..f4c140feadd 100644 --- a/workspaces/homepage/plugins/homepage/src/components/OnboardingSection/index.ts +++ b/workspaces/homepage/plugins/homepage/src/components/OnboardingSection/index.ts @@ -14,5 +14,3 @@ * limitations under the License. */ export { OnboardingSectionContent } from './OnboardingSection'; -export { OnboardingSection } from '../legacy/HomePageLegacyCards'; -export { OnboardingSection as default } from '../legacy/HomePageLegacyCards'; diff --git a/workspaces/homepage/plugins/homepage/src/alpha/components/ReadOnlyGirdLayout.tsx b/workspaces/homepage/plugins/homepage/src/components/ReadOnlyGirdLayout.tsx similarity index 96% rename from workspaces/homepage/plugins/homepage/src/alpha/components/ReadOnlyGirdLayout.tsx rename to workspaces/homepage/plugins/homepage/src/components/ReadOnlyGirdLayout.tsx index f24d9a2f30f..fb1f2c8cb1f 100644 --- a/workspaces/homepage/plugins/homepage/src/alpha/components/ReadOnlyGirdLayout.tsx +++ b/workspaces/homepage/plugins/homepage/src/components/ReadOnlyGirdLayout.tsx @@ -38,8 +38,8 @@ import Box from '@mui/material/Box'; import 'react-grid-layout/css/styles.css'; import useMeasure from 'react-use/lib/useMeasure'; -import { HomePageCardConfig } from '../../types'; -import { isCardADefaultConfiguration } from '../utils'; +import { HomePageCardConfig } from '../types'; +import { isCardADefaultConfiguration } from '../utils/nfsLayout'; interface Card { id: string; @@ -79,10 +79,9 @@ const defaultProps: ResponsiveProps = { compactType: null, }; -import { cardWrapperSx } from '../../styles/cardWrapperSx'; +import { cardWrapperSx } from '../styles/cardWrapperSx'; /** * Props for the read-only grid layout. - * @alpha */ export interface ReadOnlyGridLayoutProps { homepageCards: HomePageCardConfig[]; @@ -92,7 +91,6 @@ export interface ReadOnlyGridLayoutProps { * Read-only grid layout for the NFS home page. * Respects layout configuration (breakpoints) when provided via app config. * - * @alpha */ export const ReadOnlyGridLayout = ({ homepageCards, diff --git a/workspaces/homepage/plugins/homepage/src/components/TemplateSection/index.ts b/workspaces/homepage/plugins/homepage/src/components/TemplateSection/index.ts index 8f67864941b..23f1b46cd93 100644 --- a/workspaces/homepage/plugins/homepage/src/components/TemplateSection/index.ts +++ b/workspaces/homepage/plugins/homepage/src/components/TemplateSection/index.ts @@ -14,5 +14,3 @@ * limitations under the License. */ export { TemplateSectionContent } from './TemplateSection'; -export { TemplateSection } from '../legacy/HomePageLegacyCards'; -export { TemplateSection as default } from '../legacy/HomePageLegacyCards'; diff --git a/workspaces/homepage/plugins/homepage/src/components/legacy/TranslatedUpstreamHomePageCards.tsx b/workspaces/homepage/plugins/homepage/src/components/TranslatedUpstreamHomePageCards.tsx similarity index 97% rename from workspaces/homepage/plugins/homepage/src/components/legacy/TranslatedUpstreamHomePageCards.tsx rename to workspaces/homepage/plugins/homepage/src/components/TranslatedUpstreamHomePageCards.tsx index b82651cf598..11fb3f08680 100644 --- a/workspaces/homepage/plugins/homepage/src/components/legacy/TranslatedUpstreamHomePageCards.tsx +++ b/workspaces/homepage/plugins/homepage/src/components/TranslatedUpstreamHomePageCards.tsx @@ -25,7 +25,7 @@ import { import { TranslatableCardTitleProps, useHomePageCardTitle, -} from '../../utils/useHomePageCardTitle'; +} from '../utils/useHomePageCardTitle'; /** @public */ export type CatalogStarredEntitiesCardProps = StarredEntitiesProps & diff --git a/workspaces/homepage/plugins/homepage/src/alpha/extensions/apis.ts b/workspaces/homepage/plugins/homepage/src/extensions/apis.ts similarity index 98% rename from workspaces/homepage/plugins/homepage/src/alpha/extensions/apis.ts rename to workspaces/homepage/plugins/homepage/src/extensions/apis.ts index cd588b47bbe..c0da2588e3d 100644 --- a/workspaces/homepage/plugins/homepage/src/alpha/extensions/apis.ts +++ b/workspaces/homepage/plugins/homepage/src/extensions/apis.ts @@ -26,13 +26,12 @@ import { defaultWidgetsApiRef, QuickAccessApiClient, quickAccessApiRef, -} from '../../api'; +} from '../api'; /** * Quick access API for the New Frontend System. * Provides access to quick access links from app config. * - * @alpha */ const quickAccessApi = ApiBlueprint.make({ name: 'quickaccess', @@ -54,7 +53,6 @@ const quickAccessApi = ApiBlueprint.make({ * Default cards API for the New Frontend System. * Provides access to permission-filtered homepage cards from the backend. * - * @alpha */ const defaultWidgetsApi = ApiBlueprint.make({ name: 'default-widgets', diff --git a/workspaces/homepage/plugins/homepage/src/alpha/extensions/homePageCards.tsx b/workspaces/homepage/plugins/homepage/src/extensions/homePageCards.tsx similarity index 82% rename from workspaces/homepage/plugins/homepage/src/alpha/extensions/homePageCards.tsx rename to workspaces/homepage/plugins/homepage/src/extensions/homePageCards.tsx index 800dd85be4d..90137ffb86c 100644 --- a/workspaces/homepage/plugins/homepage/src/alpha/extensions/homePageCards.tsx +++ b/workspaces/homepage/plugins/homepage/src/extensions/homePageCards.tsx @@ -17,7 +17,7 @@ import { HomePageWidgetBlueprint } from '@backstage/plugin-home-react/alpha'; import homePlugin from '@backstage/plugin-home/alpha'; import { compatWrapper } from '@backstage/core-compat-api'; -import { createTranslatedCardRenderer } from '../../utils/translatedCardRenderer'; +import { createTranslatedCardRenderer } from '../utils/translatedCardRenderer'; /** * NFS homepage widgets. @@ -46,7 +46,6 @@ const defaultCardLayout = { /** * NFS widget: OnboardingSection (migrated from mountPoint home.page/cards). - * @alpha */ export const onboardingSectionWidget = HomePageWidgetBlueprint.make({ name: 'rhdh-onboarding-section', @@ -54,17 +53,14 @@ export const onboardingSectionWidget = HomePageWidgetBlueprint.make({ name: 'Red Hat Developer Hub - Onboarding', layout: defaultCardLayout, components: () => - import('../../components/OnboardingSection/OnboardingSection').then( - m => ({ - Content: m.OnboardingSectionContent, - }), - ), + import('../components/OnboardingSection/OnboardingSection').then(m => ({ + Content: m.OnboardingSectionContent, + })), }, }); /** * NFS widget: EntitySection (migrated from mountPoint home.page/cards). - * @alpha */ export const entitySectionWidget = HomePageWidgetBlueprint.make({ name: 'rhdh-entity-section', @@ -74,7 +70,7 @@ export const entitySectionWidget = HomePageWidgetBlueprint.make({ 'Browse the Systems, Components, Resources, and APIs that are available in your organization.', layout: defaultCardLayout, components: () => - import('../../components/EntitySection/EntitySection').then(m => ({ + import('../components/EntitySection/EntitySection').then(m => ({ Content: m.EntitySectionContent, Renderer: createTranslatedCardRenderer('entities.title'), })), @@ -83,7 +79,6 @@ export const entitySectionWidget = HomePageWidgetBlueprint.make({ /** * NFS widget: TemplateSection (migrated from mountPoint home.page/cards). - * @alpha */ export const templateSectionWidget = HomePageWidgetBlueprint.make({ name: 'rhdh-template-section', @@ -91,7 +86,7 @@ export const templateSectionWidget = HomePageWidgetBlueprint.make({ name: 'Red Hat Developer Hub - Explore templates', layout: defaultCardLayout, components: () => - import('../../components/TemplateSection/TemplateSection').then(m => ({ + import('../components/TemplateSection/TemplateSection').then(m => ({ Content: m.TemplateSectionContent, Renderer: createTranslatedCardRenderer('templates.title'), })), @@ -100,7 +95,6 @@ export const templateSectionWidget = HomePageWidgetBlueprint.make({ /** * NFS widget: QuickAccessCard (migrated from mountPoint home.page/cards). - * @alpha */ export const quickAccessCardWidget = HomePageWidgetBlueprint.make({ name: 'quick-access-card', @@ -109,7 +103,7 @@ export const quickAccessCardWidget = HomePageWidgetBlueprint.make({ title: 'Quick Access', layout: defaultCardLayout, components: () => - import('../../components/QuickAccessCard').then(m => ({ + import('../components/QuickAccessCard').then(m => ({ Content: m.QuickAccessCardContent, Renderer: createTranslatedCardRenderer('quickAccess.title', { quickAccessStyle: true, @@ -120,7 +114,6 @@ export const quickAccessCardWidget = HomePageWidgetBlueprint.make({ /** * NFS widget: SearchBar (migrated from mountPoint home.page/cards). - * @alpha */ export const searchBarWidget = HomePageWidgetBlueprint.make({ name: 'search-bar', @@ -136,7 +129,7 @@ export const searchBarWidget = HomePageWidgetBlueprint.make({ }, }, components: () => - import('../../components/SearchBar').then(m => ({ + import('../components/SearchBar').then(m => ({ Content: m.SearchBar, Renderer: ({ Content }: { Content: React.ComponentType }) => compatWrapper(), @@ -146,7 +139,6 @@ export const searchBarWidget = HomePageWidgetBlueprint.make({ /** * Renders upstream home cards that include their own InfoCard shell. - * @alpha */ const upstreamHomeCardRenderer = ({ Content, @@ -156,7 +148,6 @@ const upstreamHomeCardRenderer = ({ /** * NFS widget: FeaturedDocsCard (migrated from mountPoint home.page/cards). - * @alpha */ export const featuredDocsCardWidget = HomePageWidgetBlueprint.make({ name: 'featured-docs-card', @@ -165,7 +156,7 @@ export const featuredDocsCardWidget = HomePageWidgetBlueprint.make({ title: 'Featured Docs', layout: defaultCardLayout, components: () => - import('../../components/FeaturedDocsCard').then(m => ({ + import('../components/FeaturedDocsCard').then(m => ({ Content: m.FeaturedDocsCard, Renderer: upstreamHomeCardRenderer, })), @@ -174,7 +165,6 @@ export const featuredDocsCardWidget = HomePageWidgetBlueprint.make({ /** * NFS widget: CatalogStarred (migrated from mountPoint home.page/cards). - * @alpha */ export const catalogStarredWidget = homePlugin .getExtension('home-page-widget:home/starred-entities') @@ -183,18 +173,15 @@ export const catalogStarredWidget = homePlugin name: 'Catalog starred', title: 'Starred Catalog Entities', components: () => - import('../../components/legacy/TranslatedUpstreamHomePageCards').then( - m => ({ - Content: m.CatalogStarredEntitiesCard, - Renderer: upstreamHomeCardRenderer, - }), - ), + import('../components/TranslatedUpstreamHomePageCards').then(m => ({ + Content: m.CatalogStarredEntitiesCard, + Renderer: upstreamHomeCardRenderer, + })), }, }); /** * Disables the default home plugin toolkit widget. - * @alpha */ export const disableToolkit = homePlugin .getExtension('home-page-widget:home/toolkit') @@ -204,7 +191,6 @@ export const disableToolkit = homePlugin /** * Disables the upstream demo random-joke widget. - * @alpha */ export const disableRandomJoke = homePlugin .getExtension('home-page-widget:home/random-joke') @@ -214,7 +200,6 @@ export const disableRandomJoke = homePlugin /** * NFS widget: RecentlyVisited (migrated from mountPoint home.page/cards). - * @alpha */ export const RecentlyVisitedWidget = HomePageWidgetBlueprint.make({ name: 'recently-visited', @@ -224,18 +209,15 @@ export const RecentlyVisitedWidget = HomePageWidgetBlueprint.make({ title: 'Recently Visited', description: 'Quick access to recently viewed entities and pages', components: () => - import('../../components/legacy/TranslatedUpstreamHomePageCards').then( - m => ({ - Content: m.RecentlyVisitedCard, - Renderer: upstreamHomeCardRenderer, - }), - ), + import('../components/TranslatedUpstreamHomePageCards').then(m => ({ + Content: m.RecentlyVisitedCard, + Renderer: upstreamHomeCardRenderer, + })), }, }); /** * NFS widget: TopVisited (migrated from mountPoint home.page/cards). - * @alpha */ export const TopVisitedWidget = HomePageWidgetBlueprint.make({ name: 'top-visited', @@ -245,11 +227,9 @@ export const TopVisitedWidget = HomePageWidgetBlueprint.make({ title: 'Top Visited', description: 'Your most frequently accessed entities and services', components: () => - import('../../components/legacy/TranslatedUpstreamHomePageCards').then( - m => ({ - Content: m.TopVisitedCard, - Renderer: upstreamHomeCardRenderer, - }), - ), + import('../components/TranslatedUpstreamHomePageCards').then(m => ({ + Content: m.TopVisitedCard, + Renderer: upstreamHomeCardRenderer, + })), }, }); diff --git a/workspaces/homepage/plugins/homepage/src/alpha/extensions/homePageLayoutExtension.tsx b/workspaces/homepage/plugins/homepage/src/extensions/homePageLayoutExtension.tsx similarity index 98% rename from workspaces/homepage/plugins/homepage/src/alpha/extensions/homePageLayoutExtension.tsx rename to workspaces/homepage/plugins/homepage/src/extensions/homePageLayoutExtension.tsx index d413e98d332..4ce05d22db3 100644 --- a/workspaces/homepage/plugins/homepage/src/alpha/extensions/homePageLayoutExtension.tsx +++ b/workspaces/homepage/plugins/homepage/src/extensions/homePageLayoutExtension.tsx @@ -15,7 +15,7 @@ */ import { HomePageLayoutBlueprint } from '@backstage/plugin-home-react/alpha'; -import { HomePageCardConfig } from '../../types'; +import { HomePageCardConfig } from '../types'; /** * Custom home page layout extension for the New Frontend System. @@ -26,7 +26,6 @@ import { HomePageCardConfig } from '../../types'; * The layout component is loaded via dynamic `import()` inside the async * loader so it stays out of the Module Federation sync chunk graph. * - * @alpha */ export const homePageLayoutExtension = HomePageLayoutBlueprint.makeWithOverrides({ diff --git a/workspaces/homepage/plugins/homepage/src/homepageTranslationsModuleExport.ts b/workspaces/homepage/plugins/homepage/src/homepageTranslationsModuleExport.ts index 0ac23e438f5..28660969156 100644 --- a/workspaces/homepage/plugins/homepage/src/homepageTranslationsModuleExport.ts +++ b/workspaces/homepage/plugins/homepage/src/homepageTranslationsModuleExport.ts @@ -13,4 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { homepageTranslationsModule as default } from './alpha'; +export { homepageTranslationsModule as default } from './index'; diff --git a/workspaces/homepage/plugins/homepage/src/index.ts b/workspaces/homepage/plugins/homepage/src/index.ts index 2ac7613f90b..7bb0867fafb 100644 --- a/workspaces/homepage/plugins/homepage/src/index.ts +++ b/workspaces/homepage/plugins/homepage/src/index.ts @@ -15,7 +15,9 @@ */ /** - * Dynamic Home Page plugin based on the upstream `home` plugin that can be extended and customized with the RHDH dynamic plugin feature. + * Dynamic Home Page plugin for the New Frontend System. + * + * Extends the upstream `home` plugin with a custom layout and RHDH widgets. * * @packageDocumentation */ @@ -28,4 +30,69 @@ ClassNameGenerator.configure(componentName => { : `v5-${componentName}`; }); -export * from './plugin'; +import { TranslationBlueprint } from '@backstage/plugin-app-react'; +import { createFrontendModule } from '@backstage/frontend-plugin-api'; +import { + catalogStarredWidget, + disableRandomJoke, + disableToolkit, + entitySectionWidget, + featuredDocsCardWidget, + onboardingSectionWidget, + quickAccessCardWidget, + RecentlyVisitedWidget, + searchBarWidget, + templateSectionWidget, + TopVisitedWidget, +} from './extensions/homePageCards'; +import { homepageTranslations } from './translations'; +import { homePageLayoutExtension } from './extensions/homePageLayoutExtension'; +import { defaultWidgetsApi, quickAccessApi } from './extensions/apis'; + +/** + * Frontend module for the Dynamic Home Page plugin (New Frontend System). + * + * Extends the `home` plugin with a custom layout and RHDH widgets: Onboarding, + * Entity Catalog, Templates, Quick Access, Search, Recently Visited, Top Visited, etc. + * Add to your app's `createApp({ features: [..., homePageModule] })`. + * + * @public + */ +export default createFrontendModule({ + pluginId: 'home', // upstream home! + extensions: [ + homePageLayoutExtension, + onboardingSectionWidget, + entitySectionWidget, + templateSectionWidget, + defaultWidgetsApi, + quickAccessApi, + quickAccessCardWidget, + featuredDocsCardWidget, + searchBarWidget, + TopVisitedWidget, + RecentlyVisitedWidget, + catalogStarredWidget, + disableToolkit, + disableRandomJoke, + ], +}); + +/** + * Translation module for the Dynamic Home Page plugin. + * + * @public + */ +export const homepageTranslationsModule = createFrontendModule({ + pluginId: 'app', + extensions: [ + TranslationBlueprint.make({ + name: 'homepage-translations', + params: { + resource: homepageTranslations, + }, + }), + ], +}); + +export { homepageTranslationRef, homepageTranslations } from './translations'; diff --git a/workspaces/homepage/plugins/homepage/src/legacy.ts b/workspaces/homepage/plugins/homepage/src/legacy.ts new file mode 100644 index 00000000000..0a88755f7dc --- /dev/null +++ b/workspaces/homepage/plugins/homepage/src/legacy.ts @@ -0,0 +1,35 @@ +/* + * Copyright Red Hat, Inc. + * + * 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. + */ + +/** + * Legacy frontend system API surface for the Dynamic Home Page plugin. + * + * OFS consumers must import from this subpath. NFS uses the package root. + * + * @packageDocumentation + */ + +import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className'; + +ClassNameGenerator.configure(componentName => { + return componentName.startsWith('v5-') + ? componentName + : `v5-${componentName}`; +}); + +export * from './legacy/plugin'; + +export { homepageTranslations, homepageTranslationRef } from './translations'; diff --git a/workspaces/homepage/plugins/homepage/src/components/CustomizableGrid.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/CustomizableGrid.tsx similarity index 95% rename from workspaces/homepage/plugins/homepage/src/components/CustomizableGrid.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/CustomizableGrid.tsx index deaf5233be1..34a24028b2d 100644 --- a/workspaces/homepage/plugins/homepage/src/components/CustomizableGrid.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/CustomizableGrid.tsx @@ -38,15 +38,15 @@ import { useTheme } from '@mui/material/styles'; // Removes the doubled scrollbar import 'react-grid-layout/css/styles.css'; -import { HomePageCardMountPoint } from '../types'; +import { HomePageCardMountPoint } from '../../types'; import { dynamicHomePagePlugin } from '../plugin'; -import { useTranslation } from '../hooks/useTranslation'; -import { useContainerQuery } from '../hooks/useContainerQuery'; +import { useTranslation } from '../../hooks/useTranslation'; +import { useContainerQuery } from '../../hooks/useContainerQuery'; import { isCardADefaultConfiguration, getCardTitle, getCardDescription, -} from '../utils/customizable-cards'; +} from '../../utils/customizable-cards'; /** * @public diff --git a/workspaces/homepage/plugins/homepage/src/components/DefaultWidgetsCustomizableGrid.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/DefaultWidgetsCustomizableGrid.tsx similarity index 94% rename from workspaces/homepage/plugins/homepage/src/components/DefaultWidgetsCustomizableGrid.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/DefaultWidgetsCustomizableGrid.tsx index 137ce79634c..c3827b4b9e1 100644 --- a/workspaces/homepage/plugins/homepage/src/components/DefaultWidgetsCustomizableGrid.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/DefaultWidgetsCustomizableGrid.tsx @@ -31,13 +31,16 @@ import { useTheme } from '@mui/material/styles'; import 'react-grid-layout/css/styles.css'; -import type { VisibleDefaultWidget } from '../api/DefaultWidgetsApiClient'; -import { HomePageCardMountPoint } from '../types'; +import type { VisibleDefaultWidget } from '../../api/DefaultWidgetsApiClient'; +import { HomePageCardMountPoint } from '../../types'; import { dynamicHomePagePlugin } from '../plugin'; -import { useTranslation } from '../hooks/useTranslation'; -import { useContainerQuery } from '../hooks/useContainerQuery'; -import { getCardTitle, getCardDescription } from '../utils/customizable-cards'; -import { getTranslatedTextWithFallback } from '../translations/utils'; +import { useTranslation } from '../../hooks/useTranslation'; +import { useContainerQuery } from '../../hooks/useContainerQuery'; +import { + getCardTitle, + getCardDescription, +} from '../../utils/customizable-cards'; +import { getTranslatedTextWithFallback } from '../../translations/utils'; export interface DefaultWidgetsCustomizableGridProps { defaultWidgets: VisibleDefaultWidget[]; diff --git a/workspaces/homepage/plugins/homepage/src/components/DefaultWidgetsReadOnlyGrid.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/DefaultWidgetsReadOnlyGrid.tsx similarity index 97% rename from workspaces/homepage/plugins/homepage/src/components/DefaultWidgetsReadOnlyGrid.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/DefaultWidgetsReadOnlyGrid.tsx index 66f6035023e..9d7aa96898f 100644 --- a/workspaces/homepage/plugins/homepage/src/components/DefaultWidgetsReadOnlyGrid.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/DefaultWidgetsReadOnlyGrid.tsx @@ -32,8 +32,8 @@ import 'react-grid-layout/css/styles.css'; import useMeasure from 'react-use/lib/useMeasure'; -import type { VisibleDefaultWidget } from '../api/DefaultWidgetsApiClient'; -import { HomePageCardMountPoint } from '../types'; +import type { VisibleDefaultWidget } from '../../api/DefaultWidgetsApiClient'; +import { HomePageCardMountPoint } from '../../types'; interface Card { id: string; diff --git a/workspaces/homepage/plugins/homepage/src/components/DynamicCustomizableHomePage.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/DynamicCustomizableHomePage.tsx similarity index 95% rename from workspaces/homepage/plugins/homepage/src/components/DynamicCustomizableHomePage.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/DynamicCustomizableHomePage.tsx index 83b2978ad48..f41464a1e00 100644 --- a/workspaces/homepage/plugins/homepage/src/components/DynamicCustomizableHomePage.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/DynamicCustomizableHomePage.tsx @@ -18,7 +18,7 @@ import type { ClockConfig } from '@backstage/plugin-home'; import { useDynamicHomePageCards } from '../hooks/useDynamicHomePageCards'; import { HomePage } from './HomePage'; -import type { LocalClockProps } from './LocalClock'; +import type { LocalClockProps } from '../../components/LocalClock'; /** * This type is similar to Omit<HomePageProps, 'cards'>. diff --git a/workspaces/homepage/plugins/homepage/src/components/DynamicHomePage.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/DynamicHomePage.tsx similarity index 95% rename from workspaces/homepage/plugins/homepage/src/components/DynamicHomePage.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/DynamicHomePage.tsx index 9c2f5bd2280..68d99b884f7 100644 --- a/workspaces/homepage/plugins/homepage/src/components/DynamicHomePage.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/DynamicHomePage.tsx @@ -18,7 +18,7 @@ import type { ClockConfig } from '@backstage/plugin-home'; import { useDynamicHomePageCards } from '../hooks/useDynamicHomePageCards'; import { HomePage } from './HomePage'; -import type { LocalClockProps } from './LocalClock'; +import type { LocalClockProps } from '../../components/LocalClock'; /** * This type is similar to Omit<HomePageProps, 'cards'>. diff --git a/workspaces/homepage/plugins/homepage/src/components/Headline.test.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/Headline.test.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/Headline.test.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/Headline.test.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/Headline.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/Headline.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/Headline.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/Headline.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/HomePage.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/HomePage.tsx similarity index 92% rename from workspaces/homepage/plugins/homepage/src/components/HomePage.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/HomePage.tsx index eac2acb94ee..bc71f116c1e 100644 --- a/workspaces/homepage/plugins/homepage/src/components/HomePage.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/HomePage.tsx @@ -22,12 +22,12 @@ import { } from '@backstage/core-components'; import { useDefaultWidgets } from '../hooks/useDefaultWidgets'; -import { useTranslation } from '../hooks/useTranslation'; -import { HomePageCardMountPoint } from '../types'; +import { useTranslation } from '../../hooks/useTranslation'; +import { HomePageCardMountPoint } from '../../types'; import { CustomizableGrid } from './CustomizableGrid'; import { DefaultWidgetsCustomizableGrid } from './DefaultWidgetsCustomizableGrid'; import { DefaultWidgetsReadOnlyGrid } from './DefaultWidgetsReadOnlyGrid'; -import { Header, HeaderProps } from './Header'; +import { Header, HeaderProps } from '../../components/Header'; import { ReadOnlyGrid } from './ReadOnlyGrid'; export interface HomePageProps extends HeaderProps { diff --git a/workspaces/homepage/plugins/homepage/src/components/legacy/HomePageLegacyCards.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/HomePageLegacyCards.tsx similarity index 87% rename from workspaces/homepage/plugins/homepage/src/components/legacy/HomePageLegacyCards.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/HomePageLegacyCards.tsx index 8a5d2a98f59..4f5ee469f72 100644 --- a/workspaces/homepage/plugins/homepage/src/components/legacy/HomePageLegacyCards.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/HomePageLegacyCards.tsx @@ -18,9 +18,9 @@ import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import Typography from '@mui/material/Typography'; -import { useOnboardingSection } from '../OnboardingSection/OnboardingSection'; -import { EntitySectionContent } from '../EntitySection/EntitySection'; -import { TemplateSectionContent } from '../TemplateSection/TemplateSection'; +import { useOnboardingSection } from '../../components/OnboardingSection/OnboardingSection'; +import { EntitySectionContent } from '../../components/EntitySection/EntitySection'; +import { TemplateSectionContent } from '../../components/TemplateSection/TemplateSection'; import { useTranslation } from '../../hooks/useTranslation'; import { sectionCardSx, diff --git a/workspaces/homepage/plugins/homepage/src/components/Markdown.test.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/Markdown.test.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/Markdown.test.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/Markdown.test.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/Markdown.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/Markdown.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/Markdown.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/Markdown.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/MarkdownCard.test.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/MarkdownCard.test.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/MarkdownCard.test.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/MarkdownCard.test.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/MarkdownCard.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/MarkdownCard.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/MarkdownCard.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/MarkdownCard.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/Placeholder.test.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/Placeholder.test.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/Placeholder.test.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/Placeholder.test.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/Placeholder.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/Placeholder.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/Placeholder.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/Placeholder.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/legacy/QuickAccessCardLegacy.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/QuickAccessCardLegacy.tsx similarity index 97% rename from workspaces/homepage/plugins/homepage/src/components/legacy/QuickAccessCardLegacy.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/QuickAccessCardLegacy.tsx index 5cdde9940c6..fadb1af66ab 100644 --- a/workspaces/homepage/plugins/homepage/src/components/legacy/QuickAccessCardLegacy.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/QuickAccessCardLegacy.tsx @@ -21,7 +21,7 @@ import { styled } from '@mui/material/styles'; import { QuickAccessCardContent, type QuickAccessCardProps, -} from '../QuickAccessCard'; +} from '../../components/QuickAccessCard'; import { useTranslation } from '../../hooks/useTranslation'; import { getTranslatedTextWithFallback } from '../../translations/utils'; diff --git a/workspaces/homepage/plugins/homepage/src/components/ReadOnlyGrid.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/ReadOnlyGrid.tsx similarity index 97% rename from workspaces/homepage/plugins/homepage/src/components/ReadOnlyGrid.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/ReadOnlyGrid.tsx index 939fe651b18..bd20979078f 100644 --- a/workspaces/homepage/plugins/homepage/src/components/ReadOnlyGrid.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/components/ReadOnlyGrid.tsx @@ -39,8 +39,8 @@ import 'react-grid-layout/css/styles.css'; import useMeasure from 'react-use/lib/useMeasure'; -import { HomePageCardMountPoint } from '../types'; -import { isCardADefaultConfiguration } from '../utils/customizable-cards'; +import { HomePageCardMountPoint } from '../../types'; +import { isCardADefaultConfiguration } from '../../utils/customizable-cards'; interface Card { id: string; diff --git a/workspaces/homepage/plugins/homepage/src/components/VisitListener.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/VisitListener.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/VisitListener.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/VisitListener.tsx diff --git a/workspaces/homepage/plugins/homepage/src/components/WorldClock.tsx b/workspaces/homepage/plugins/homepage/src/legacy/components/WorldClock.tsx similarity index 100% rename from workspaces/homepage/plugins/homepage/src/components/WorldClock.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/components/WorldClock.tsx diff --git a/workspaces/homepage/plugins/homepage/src/hooks/useDefaultWidgets.ts b/workspaces/homepage/plugins/homepage/src/legacy/hooks/useDefaultWidgets.ts similarity index 96% rename from workspaces/homepage/plugins/homepage/src/hooks/useDefaultWidgets.ts rename to workspaces/homepage/plugins/homepage/src/legacy/hooks/useDefaultWidgets.ts index 5e77ba45031..7fe10b6626c 100644 --- a/workspaces/homepage/plugins/homepage/src/hooks/useDefaultWidgets.ts +++ b/workspaces/homepage/plugins/homepage/src/legacy/hooks/useDefaultWidgets.ts @@ -20,7 +20,7 @@ import useAsync from 'react-use/lib/useAsync'; import { defaultWidgetsApiRef, type VisibleDefaultWidget, -} from '../api/DefaultWidgetsApiClient'; +} from '../../api/DefaultWidgetsApiClient'; export const useDefaultWidgets = (): { defaultWidgets: VisibleDefaultWidget[] | undefined; diff --git a/workspaces/homepage/plugins/homepage/src/hooks/useDynamicHomePageCards.test.tsx b/workspaces/homepage/plugins/homepage/src/legacy/hooks/useDynamicHomePageCards.test.tsx similarity index 98% rename from workspaces/homepage/plugins/homepage/src/hooks/useDynamicHomePageCards.test.tsx rename to workspaces/homepage/plugins/homepage/src/legacy/hooks/useDynamicHomePageCards.test.tsx index 9bf25c3a173..7a745715b48 100644 --- a/workspaces/homepage/plugins/homepage/src/hooks/useDynamicHomePageCards.test.tsx +++ b/workspaces/homepage/plugins/homepage/src/legacy/hooks/useDynamicHomePageCards.test.tsx @@ -19,7 +19,7 @@ import { renderHook } from '@testing-library/react'; import { ScalprumContext } from '@scalprum/react-core'; import { PluginStore } from '@openshift/dynamic-plugin-sdk'; -import { HomePageCardMountPoint } from '../types'; +import { HomePageCardMountPoint } from '../../types'; import { useDynamicHomePageCards } from './useDynamicHomePageCards'; // Mock component for testing diff --git a/workspaces/homepage/plugins/homepage/src/hooks/useDynamicHomePageCards.ts b/workspaces/homepage/plugins/homepage/src/legacy/hooks/useDynamicHomePageCards.ts similarity index 96% rename from workspaces/homepage/plugins/homepage/src/hooks/useDynamicHomePageCards.ts rename to workspaces/homepage/plugins/homepage/src/legacy/hooks/useDynamicHomePageCards.ts index a44092c7e14..5288fa3ca0f 100644 --- a/workspaces/homepage/plugins/homepage/src/hooks/useDynamicHomePageCards.ts +++ b/workspaces/homepage/plugins/homepage/src/legacy/hooks/useDynamicHomePageCards.ts @@ -17,7 +17,7 @@ import { useMemo } from 'react'; import { useScalprum } from '@scalprum/react-core'; -import { HomePageCardMountPoint } from '../types'; +import { HomePageCardMountPoint } from '../../types'; interface ScalprumState { api?: { diff --git a/workspaces/homepage/plugins/homepage/src/plugin.test.ts b/workspaces/homepage/plugins/homepage/src/legacy/plugin.test.ts similarity index 100% rename from workspaces/homepage/plugins/homepage/src/plugin.test.ts rename to workspaces/homepage/plugins/homepage/src/legacy/plugin.test.ts diff --git a/workspaces/homepage/plugins/homepage/src/plugin.ts b/workspaces/homepage/plugins/homepage/src/legacy/plugin.ts similarity index 86% rename from workspaces/homepage/plugins/homepage/src/plugin.ts rename to workspaces/homepage/plugins/homepage/src/legacy/plugin.ts index fe030ec6880..71800021a0d 100644 --- a/workspaces/homepage/plugins/homepage/src/plugin.ts +++ b/workspaces/homepage/plugins/homepage/src/legacy/plugin.ts @@ -36,42 +36,42 @@ import { VisitsStorageApi, } from '@backstage/plugin-home'; -import { rootRouteRef } from './routes'; +import { rootRouteRef } from '../routes'; import { DefaultWidgetsApiClient, defaultWidgetsApiRef, QuickAccessApiClient, quickAccessApiRef, -} from './api'; +} from '../api'; import type { DynamicHomePageProps } from './components/DynamicHomePage'; import type { DynamicCustomizableHomePageProps } from './components/DynamicCustomizableHomePage'; -import type { SearchBarProps } from './components/SearchBar'; -import type { QuickAccessCardProps } from './components/QuickAccessCard'; +import type { SearchBarProps } from '../components/SearchBar'; +import type { QuickAccessCardProps } from '../components/QuickAccessCard'; import type { HeadlineProps } from './components/Headline'; import type { MarkdownProps } from './components/Markdown'; import type { MarkdownCardProps } from './components/MarkdownCard'; import type { PlaceholderProps } from './components/Placeholder'; -export { defaultWidgetsApiRef } from './api'; -export type { DefaultWidgetsApi } from './api'; +export { defaultWidgetsApiRef } from '../api'; +export type { DefaultWidgetsApi } from '../api'; export type { DynamicHomePageProps } from './components/DynamicHomePage'; export type { DynamicCustomizableHomePageProps } from './components/DynamicCustomizableHomePage'; -export type { SearchBarProps } from './components/SearchBar'; -export type { QuickAccessCardProps } from './components/QuickAccessCard'; +export type { SearchBarProps } from '../components/SearchBar'; +export type { QuickAccessCardProps } from '../components/QuickAccessCard'; export type { HeadlineProps } from './components/Headline'; export type { MarkdownProps } from './components/Markdown'; export type { MarkdownCardProps } from './components/MarkdownCard'; export type { PlaceholderProps } from './components/Placeholder'; -export type { LocalClockProps } from './components/LocalClock'; +export type { LocalClockProps } from '../components/LocalClock'; export type { WorldClockProps } from './components/WorldClock'; export type { HomePageCardMountPoint, HomePageCardMountPointConfig, Breakpoint, Layout, -} from './types'; +} from '../types'; /** * Dynamic Home Page Plugin @@ -152,7 +152,7 @@ export const SearchBar: ComponentType = createComponentExtension({ name: 'SearchBar', component: { - lazy: () => import('./components/SearchBar').then(m => m.SearchBar), + lazy: () => import('../components/SearchBar').then(m => m.SearchBar), }, }), ); @@ -166,7 +166,7 @@ export const QuickAccessCard: ComponentType = name: 'QuickAccessCard', component: { lazy: () => - import('./components/legacy/QuickAccessCardLegacy').then( + import('./components/QuickAccessCardLegacy').then( m => m.QuickAccessCard, ), }, @@ -235,7 +235,7 @@ export const CatalogStarredEntitiesCard: ComponentType = name: 'CatalogStarredEntitiesCard', component: { lazy: () => - import('./components/legacy/TranslatedUpstreamHomePageCards').then( + import('../components/TranslatedUpstreamHomePageCards').then( m => m.CatalogStarredEntitiesCard, ), }, @@ -251,7 +251,7 @@ export const RecentlyVisitedCard: ComponentType = name: 'RecentlyVisitedCard', component: { lazy: () => - import('./components/legacy/TranslatedUpstreamHomePageCards').then( + import('../components/TranslatedUpstreamHomePageCards').then( m => m.RecentlyVisitedCard, ), }, @@ -267,7 +267,7 @@ export const TopVisitedCard: ComponentType = name: 'TopVisitedCard', component: { lazy: () => - import('./components/legacy/TranslatedUpstreamHomePageCards').then( + import('../components/TranslatedUpstreamHomePageCards').then( m => m.TopVisitedCard, ), }, @@ -283,7 +283,9 @@ export const FeaturedDocsCard: ComponentType = name: 'FeaturedDocsCard', component: { lazy: () => - import('./components/FeaturedDocsCard').then(m => m.FeaturedDocsCard), + import('../components/FeaturedDocsCard').then( + m => m.FeaturedDocsCard, + ), }, }), ); @@ -321,7 +323,9 @@ export const OnboardingSection = dynamicHomePagePlugin.provide( name: 'OnboardingSection', component: { lazy: () => - import('./components/OnboardingSection').then(m => m.OnboardingSection), + import('./components/HomePageLegacyCards').then( + m => m.OnboardingSection, + ), }, }), ); @@ -334,7 +338,7 @@ export const EntitySection = dynamicHomePagePlugin.provide( name: 'EntitySection', component: { lazy: () => - import('./components/EntitySection').then(m => m.EntitySection), + import('./components/HomePageLegacyCards').then(m => m.EntitySection), }, }), ); @@ -347,7 +351,7 @@ export const TemplateSection = dynamicHomePagePlugin.provide( name: 'TemplateSection', component: { lazy: () => - import('./components/TemplateSection').then(m => m.TemplateSection), + import('./components/HomePageLegacyCards').then(m => m.TemplateSection), }, }), ); diff --git a/workspaces/homepage/plugins/homepage/src/nfsExports.test.ts b/workspaces/homepage/plugins/homepage/src/nfsExports.test.ts new file mode 100644 index 00000000000..aab0a46fe3f --- /dev/null +++ b/workspaces/homepage/plugins/homepage/src/nfsExports.test.ts @@ -0,0 +1,60 @@ +/* + * Copyright Red Hat, Inc. + * + * 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 homePageModuleDefault, { + homepageTranslationsModule, + homePageModule, +} from '.'; +import translationsModuleDefault from './homepageTranslationsModuleExport'; +import { homepageTranslationRef, homepageTranslations } from './translations'; + +describe('Dynamic Home Page plugin (NFS)', () => { + describe('Modules', () => { + it('should export homePageModule with correct structure', () => { + expect(homePageModule).toBeDefined(); + expect(homePageModule.$$type).toBe('@backstage/FrontendModule'); + expect(homePageModule.pluginId).toBe('home'); + }); + + it('should export homepageTranslationsModule with correct structure', () => { + expect(homepageTranslationsModule).toBeDefined(); + expect(homepageTranslationsModule.$$type).toBe( + '@backstage/FrontendModule', + ); + expect(homepageTranslationsModule.pluginId).toBe('app'); + }); + + it('should export homePageModule as the package default', () => { + expect(homePageModuleDefault).toBe(homePageModule); + }); + + it('should default-export app modules for NFS discovery', () => { + expect(translationsModuleDefault).toBe(homepageTranslationsModule); + }); + }); + + describe('Translations', () => { + it('should export homepageTranslationRef', () => { + expect(homepageTranslationRef).toBeDefined(); + expect(homepageTranslationRef.id).toBe('plugin.homepage'); + }); + + it('should export homepageTranslations', () => { + expect(homepageTranslations).toBeDefined(); + expect(typeof homepageTranslations).toBe('object'); + }); + }); +}); diff --git a/workspaces/homepage/plugins/homepage/src/alpha/utils.ts b/workspaces/homepage/plugins/homepage/src/utils/nfsLayout.ts similarity index 100% rename from workspaces/homepage/plugins/homepage/src/alpha/utils.ts rename to workspaces/homepage/plugins/homepage/src/utils/nfsLayout.ts