-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(global-header): added mount points for global header (#2168)
* feat(global-header): added mount points for global header Signed-off-by: Yi Cai <[email protected]> * fixed prettier check Signed-off-by: Yi Cai <[email protected]> * Added wrapper for global header Signed-off-by: Yi Cai <[email protected]> * Updated global header plugin version Signed-off-by: Yi Cai <[email protected]> * updated yarn.lock for global header plugin Signed-off-by: Yi Cai <[email protected]> * added global header plugin in dockerfiles Signed-off-by: Yi Cai <[email protected]> * added global header plugin in InternalPluginsMap Signed-off-by: Yi Cai <[email protected]> * added global header plugin to app-config.dynamic-plugins Signed-off-by: Yi Cai <[email protected]> * addressed review comments Signed-off-by: Yi Cai <[email protected]> * code improvement Signed-off-by: Yi Cai <[email protected]> * some improvements Signed-off-by: Yi Cai <[email protected]> * addressed comments Signed-off-by: Yi Cai <[email protected]> * Addressed review comments Signed-off-by: Yi Cai <[email protected]> * prettier fix Signed-off-by: Yi Cai <[email protected]> * fixed merge conflicts and addressed review comments Signed-off-by: Yi Cai <[email protected]> * Addressed review comments Signed-off-by: Yi Cai <[email protected]> * yarn dedupe Signed-off-by: Yi Cai <[email protected]> * updated md and resolved failed ci check Signed-off-by: Yi Cai <[email protected]> --------- Signed-off-by: Yi Cai <[email protected]>
- Loading branch information
Showing
14 changed files
with
349 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-global-header/.eslintignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist-dynamic | ||
dist-scalprum |
1 change: 1 addition & 0 deletions
1
dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-global-header/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
65 changes: 65 additions & 0 deletions
65
dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-global-header/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"name": "red-hat-developer-hub-backstage-plugin-global-header", | ||
"version": "0.0.2", | ||
"main": "src/index.ts", | ||
"types": "src/index.ts", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "dist/index.cjs.js", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"backstage": { | ||
"role": "frontend-plugin", | ||
"supported-versions": "1.32.6", | ||
"pluginId": "red-hat-developer-hub-backstage-plugin-global-header", | ||
"pluginPackages": [ | ||
"red-hat-developer-hub-backstage-plugin-global-header" | ||
] | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"tsc": "tsc", | ||
"build": "backstage-cli package build", | ||
"lint:check": "backstage-cli package lint", | ||
"test": "backstage-cli package test --passWithNoTests --coverage", | ||
"clean": "backstage-cli package clean", | ||
"export-dynamic": "janus-cli package export-dynamic-plugin --in-place", | ||
"export-dynamic:clean": "run export-dynamic --clean" | ||
}, | ||
"dependencies": { | ||
"@mui/material": "5.16.14", | ||
"@red-hat-developer-hub/backstage-plugin-global-header": "0.0.2" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "0.28.2", | ||
"@janus-idp/cli": "1.18.5", | ||
"typescript": "5.7.3" | ||
}, | ||
"files": [ | ||
"dist", | ||
"dist-scalprum" | ||
], | ||
"scalprum": { | ||
"name": "red-hat-developer-hub.backstage-plugin-global-header", | ||
"exposedModules": { | ||
"PluginRoot": "./src/index.ts" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/redhat-developer/rhdh", | ||
"directory": "dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-global-header" | ||
}, | ||
"maintainers": [ | ||
"christoph-jerolimov", | ||
"ciiay" | ||
], | ||
"author": "Red Hat", | ||
"homepage": "https://red.ht/rhdh", | ||
"bugs": "https://issues.redhat.com/browse/RHIDP", | ||
"keywords": [ | ||
"support:production", | ||
"lifecycle:active" | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-global-header/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from '@red-hat-developer-hub/backstage-plugin-global-header'; |
9 changes: 9 additions & 0 deletions
9
dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-global-header/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "@backstage/cli/config/tsconfig.json", | ||
"include": ["src", "dev", "migrations"], | ||
"exclude": ["node_modules"], | ||
"compilerOptions": { | ||
"outDir": "../../../dist-types/dynamic-plugins/wrappers/red-hat-developer-hub-backstage-plugin-global-header", | ||
"rootDir": "." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React, { useContext } from 'react'; | ||
|
||
import { ErrorBoundary } from '@backstage/core-components'; | ||
|
||
import DynamicRootContext from '../DynamicRoot/DynamicRootContext'; | ||
|
||
export const ApplicationHeaders = ({ position }: { position: string }) => { | ||
const { mountPoints } = useContext(DynamicRootContext); | ||
const appHeaderMountPoints = mountPoints['application/header'] ?? []; | ||
return appHeaderMountPoints | ||
?.filter(({ config }) => config?.layout?.position === position) | ||
.map(({ Component, config }, index) => ( | ||
// eslint-disable-next-line react/no-array-index-key | ||
<ErrorBoundary key={index}> | ||
<Component {...config?.props} /> | ||
</ErrorBoundary> | ||
)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.