第8章 Red Hat Developer Hub のフローティングアクションボタンの設定
フローティングアクションボタンプラグインを使用すると、Developer Hub インスタンス内の任意のアクションをフローティングボタンとして設定できます。フローティングアクションボタンプラグインは、デフォルトで有効になっています。また、フローティングアクションボタンを dynamic-plugins.yaml
ファイルの同じ slot
フィールドに割り当てることで、フローティングアクションボタンを、メインのフローティングアクションボタン内のサブメニューオプションとして表示するように設定することもできます。
8.1. フローティングアクションボタンを動的プラグインとして設定する リンクのコピーリンクがクリップボードにコピーされました!
フローティングアクションボタンを動的プラグインとして設定して、アクションを実行したり、内部リンクまたは外部リンクを開いたりすることができます。
前提条件
プラットフォームエンジニアとして十分な権限を持っている。
手順
フローティングアクションボタンを動的プラグインとして設定するには、次のいずれかのタスクを実行します。
app-config-dynamic.yaml
ファイルでglobal.floatingactionbutton/config
マウントポイントを指定します。以下に例を示します。一括インポートプラグインをフローティングアクションボタンとして設定する例
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of the floating action button configuration mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # End of the floating action button configuration appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of the floating action button configuration mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg>
2 label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # End of the floating action button configuration appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 外部リンクを開くフローティングアクションボタンとしてアクションを設定するには、
backstage-plugin-global-floating-action-button
プラグイン内のdynamic-plugins.yaml
ファイルでglobal.floatingactionbutton/config
マウントポイントを指定します。以下に例を示します。GitHub を開くフローティングアクションボタンの例
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>' label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io' - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent
1 config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>'
2 label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io' - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins
Copy to Clipboard Copied! Toggle word wrap Toggle overflow サブメニューを備えたフローティングアクションボタンを設定するには、複数のアクションの
dynamic-plugins.yaml
ファイルで、同じslot
フィールドにglobal.floatingactionbutton/config
マウントポイントを定義します。指定されていない場合、デフォルトのスロットはpage-end
になります。以下に例を示します。サブメニューアクションを備えたフローティングアクションボタンの例
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import - package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>' label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io'
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import - package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent
2 config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins - mountPoint: global.floatingactionbutton/config importName: NullComponent
3 config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>' label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow フローティングアクションボタンを特定のページにのみ表示するように設定するには、
backstage-plugin-global-floating-action-button
プラグインでglobal.floatingactionbutton/config
マウントポイントを設定し、次の例に示すようにvisibleOnPaths
プロパティーを設定します。特定のページで表示するフローティングアクションボタンの例
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories visibleOnPaths: ['/catalog', '/settings'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories visibleOnPaths: ['/catalog', '/settings'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- (必須) マウントポイントに関連するコンポーネントを含むインポート名。
特定のページでフローティングアクションボタンを非表示にするには、
backstage-plugin-global-floating-action-button
プラグインでglobal.floatingactionbutton/config
マウントポイントを設定し、次の例に示すようにexcludeOnPaths
プロパティーを設定します。特定のページで非表示にするフローティングアクションボタンの例
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories excludeOnPaths: ['/bulk-import'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories excludeOnPaths: ['/bulk-import'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- (必須) マウントポイントに関連するコンポーネントを含むインポート名。