feat(home): register default alpha homepage widgets
Signed-off-by: Adam Kunicki <kunickiaj@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import { ExtensionBlueprintParams } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionInput } from '@backstage/frontend-plugin-api';
|
||||
import { HomePageLayoutProps } from '@backstage/plugin-home-react/alpha';
|
||||
import { HomePageWidgetBlueprintParams } from '@backstage/plugin-home-react/alpha';
|
||||
import { HomePageWidgetData } from '@backstage/plugin-home-react/alpha';
|
||||
import { IconComponent } from '@backstage/frontend-plugin-api';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
@@ -52,6 +53,33 @@ const _default: OverridableFrontendPlugin<
|
||||
element: JSX.Element;
|
||||
};
|
||||
}>;
|
||||
'home-page-widget:home/random-joke': OverridableExtensionDefinition<{
|
||||
kind: 'home-page-widget';
|
||||
name: 'random-joke';
|
||||
config: {};
|
||||
configInput: {};
|
||||
output: ExtensionDataRef<HomePageWidgetData, 'home.widget.data', {}>;
|
||||
inputs: {};
|
||||
params: HomePageWidgetBlueprintParams;
|
||||
}>;
|
||||
'home-page-widget:home/starred-entities': OverridableExtensionDefinition<{
|
||||
kind: 'home-page-widget';
|
||||
name: 'starred-entities';
|
||||
config: {};
|
||||
configInput: {};
|
||||
output: ExtensionDataRef<HomePageWidgetData, 'home.widget.data', {}>;
|
||||
inputs: {};
|
||||
params: HomePageWidgetBlueprintParams;
|
||||
}>;
|
||||
'home-page-widget:home/toolkit': OverridableExtensionDefinition<{
|
||||
kind: 'home-page-widget';
|
||||
name: 'toolkit';
|
||||
config: {};
|
||||
configInput: {};
|
||||
output: ExtensionDataRef<HomePageWidgetData, 'home.widget.data', {}>;
|
||||
inputs: {};
|
||||
params: HomePageWidgetBlueprintParams;
|
||||
}>;
|
||||
'nav-item:home': OverridableExtensionDefinition<{
|
||||
kind: 'nav-item';
|
||||
name: undefined;
|
||||
@@ -133,6 +161,7 @@ export default _default;
|
||||
export const homeTranslationRef: TranslationRef<
|
||||
'home',
|
||||
{
|
||||
readonly 'starredEntities.noStarredEntitiesMessage': 'Click the star beside an entity name to add it to this list!';
|
||||
readonly 'addWidgetDialog.title': 'Add new widget to dashboard';
|
||||
readonly 'customHomepageButtons.cancel': 'Cancel';
|
||||
readonly 'customHomepageButtons.clearAll': 'Clear all';
|
||||
@@ -141,22 +170,21 @@ export const homeTranslationRef: TranslationRef<
|
||||
readonly 'customHomepageButtons.addWidget': 'Add widget';
|
||||
readonly 'customHomepageButtons.save': 'Save';
|
||||
readonly 'customHomepage.noWidgets': "No widgets added. Start by clicking the 'Add widget' button.";
|
||||
readonly 'widgetSettingsOverlay.cancelButtonTitle': 'Cancel';
|
||||
readonly 'widgetSettingsOverlay.editSettingsTooptip': 'Edit settings';
|
||||
readonly 'widgetSettingsOverlay.deleteWidgetTooltip': 'Delete widget';
|
||||
readonly 'widgetSettingsOverlay.submitButtonTitle': 'Submit';
|
||||
readonly 'widgetSettingsOverlay.cancelButtonTitle': 'Cancel';
|
||||
readonly 'starredEntityListItem.removeFavoriteEntityTitle': 'Remove entity from favorites';
|
||||
readonly 'visitList.empty.title': 'There are no visits to show yet.';
|
||||
readonly 'visitList.empty.description': 'Once you start using Backstage, your visits will appear here as a quick link to carry on where you left off.';
|
||||
readonly 'visitList.few.title': 'The more pages you visit, the more pages will appear here.';
|
||||
readonly 'quickStart.title': 'Onboarding';
|
||||
readonly 'visitList.empty.description': 'Once you start using Backstage, your visits will appear here as a quick link to carry on where you left off.';
|
||||
readonly 'visitList.empty.title': 'There are no visits to show yet.';
|
||||
readonly 'quickStart.description': 'Get started with Backstage';
|
||||
readonly 'quickStart.title': 'Onboarding';
|
||||
readonly 'quickStart.learnMoreLinkTitle': 'Learn more';
|
||||
readonly 'starredEntities.noStarredEntitiesMessage': 'Click the star beside an entity name to add it to this list!';
|
||||
readonly 'visitedByType.action.viewMore': 'View more';
|
||||
readonly 'visitedByType.action.viewLess': 'View less';
|
||||
readonly 'featuredDocsCard.empty.title': 'No documents to show';
|
||||
readonly 'featuredDocsCard.empty.description': 'Create your own document. Check out our Getting Started Information';
|
||||
readonly 'featuredDocsCard.empty.title': 'No documents to show';
|
||||
readonly 'featuredDocsCard.empty.learnMoreLinkTitle': 'DOCS';
|
||||
readonly 'featuredDocsCard.learnMoreTitle': 'LEARN MORE';
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import {
|
||||
homePageWidgetDataRef,
|
||||
homePageLayoutComponentDataRef,
|
||||
HomePageLayoutBlueprint,
|
||||
HomePageWidgetBlueprint,
|
||||
type HomePageLayoutProps,
|
||||
} from '@backstage/plugin-home-react/alpha';
|
||||
|
||||
@@ -128,6 +129,74 @@ const homeNavItem = NavItemBlueprint.make({
|
||||
},
|
||||
});
|
||||
|
||||
const homePageToolkitWidget = HomePageWidgetBlueprint.make({
|
||||
name: 'toolkit',
|
||||
params: {
|
||||
name: 'HomePageToolkit',
|
||||
title: 'Toolkit',
|
||||
components: () =>
|
||||
import('./homePageComponents/Toolkit').then(m => ({
|
||||
Content: m.Content,
|
||||
ContextProvider: m.ContextProvider,
|
||||
})),
|
||||
componentProps: {
|
||||
tools: [
|
||||
{
|
||||
url: 'https://backstage.io',
|
||||
label: 'Backstage Docs',
|
||||
icon: <HomeIcon />,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const homePageStarredEntitiesWidget = HomePageWidgetBlueprint.make({
|
||||
name: 'starred-entities',
|
||||
params: {
|
||||
name: 'HomePageStarredEntities',
|
||||
title: 'Your Starred Entities',
|
||||
components: () =>
|
||||
import('./homePageComponents/StarredEntities').then(m => ({
|
||||
Content: m.Content,
|
||||
})),
|
||||
},
|
||||
});
|
||||
|
||||
const homePageRandomJokeWidget = HomePageWidgetBlueprint.make({
|
||||
name: 'random-joke',
|
||||
params: {
|
||||
name: 'HomePageRandomJoke',
|
||||
title: 'Random Joke',
|
||||
description: 'Shows a random programming joke',
|
||||
components: () =>
|
||||
import('./homePageComponents/RandomJoke').then(m => ({
|
||||
Content: m.Content,
|
||||
Settings: m.Settings,
|
||||
Actions: m.Actions,
|
||||
ContextProvider: m.ContextProvider,
|
||||
})),
|
||||
layout: {
|
||||
height: { minRows: 4 },
|
||||
width: { minColumns: 3 },
|
||||
},
|
||||
settings: {
|
||||
schema: {
|
||||
title: 'Random Joke settings',
|
||||
type: 'object',
|
||||
properties: {
|
||||
defaultCategory: {
|
||||
title: 'Category',
|
||||
type: 'string',
|
||||
enum: ['any', 'programming', 'dad'],
|
||||
default: 'any',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Home plugin for the new frontend system.
|
||||
*
|
||||
@@ -139,7 +208,15 @@ const homeNavItem = NavItemBlueprint.make({
|
||||
export default createFrontendPlugin({
|
||||
pluginId: 'home',
|
||||
info: { packageJson: () => import('../package.json') },
|
||||
extensions: [homePage, homeNavItem, visitsApi, visitListenerAppRootElement],
|
||||
extensions: [
|
||||
homePage,
|
||||
homeNavItem,
|
||||
visitsApi,
|
||||
visitListenerAppRootElement,
|
||||
homePageToolkitWidget,
|
||||
homePageStarredEntitiesWidget,
|
||||
homePageRandomJokeWidget,
|
||||
],
|
||||
routes: {
|
||||
root: rootRouteRef,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user