remove apiRef register, pr fixes

Signed-off-by: Alex Rybchenko <arybchenko@box.com>
This commit is contained in:
Alex Rybchenko
2022-03-11 13:21:08 +01:00
parent 8411f85ee8
commit 7fcae219d1
6 changed files with 11 additions and 21 deletions
+2 -2
View File
@@ -76,7 +76,7 @@ import { hot } from 'react-hot-loader/root';
import { Navigate, Route } from 'react-router';
import { apis } from './apis';
import { entityPage } from './components/catalog/EntityPage';
import { HomePage } from './components/home/HomePage';
import { homePage } from './components/home/HomePage';
import { Root } from './components/Root';
import { LowerCaseValuePickerFieldExtension } from './components/scaffolder/customScaffolderExtensions';
import { searchPage } from './components/search/SearchPage';
@@ -132,7 +132,7 @@ const routes = (
<Navigate key="/" to="catalog" />
{/* TODO(rubenl): Move this to / once its more mature and components exist */}
<Route path="/home" element={<HomepageCompositionRoot />}>
<HomePage />
{homePage}
</Route>
<Route path="/catalog" element={<CatalogIndexPage />} />
<Route
+1 -12
View File
@@ -32,14 +32,8 @@ import {
configApiRef,
createApiFactory,
errorApiRef,
fetchApiRef,
githubAuthApiRef,
googleAuthApiRef,
} from '@backstage/core-plugin-api';
import {
GCalendarApiClient,
gcalendarApiRef,
} from '@backstage/plugin-gcalendar';
export const apis: AnyApiFactory[] = [
createApiFactory({
@@ -47,13 +41,8 @@ export const apis: AnyApiFactory[] = [
deps: { configApi: configApiRef },
factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),
}),
ScmAuth.createDefaultApiFactory(),
createApiFactory({
api: gcalendarApiRef,
deps: { authApi: googleAuthApiRef, fetchApi: fetchApiRef },
factory: deps => new GCalendarApiClient(deps),
}),
ScmAuth.createDefaultApiFactory(),
createApiFactory({
api: graphQlBrowseApiRef,
@@ -48,7 +48,7 @@ const clockConfigs: ClockConfig[] = [
},
];
export const HomePage = () => (
export const homePage = (
<Page themeId="home">
<Header title={<WelcomeTitle />} pageTitleOverride="Home">
<HeaderWorldClock clockConfigs={clockConfigs} />
+1 -3
View File
@@ -1,3 +1 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint')],
};
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
+2 -1
View File
@@ -4,7 +4,8 @@ Plugin displays events from google calendar
## Getting started
The plugin exports a `gcalendarApiRef`. Add this to the App's `apis.ts`:
The plugin exports `HomePageCalendar` widget for the Homepage.
If your homepage is not static JSX add `gcalendarApiRef` to the App's `apis.ts`:
```ts
import {
+4 -2
View File
@@ -9,6 +9,9 @@
"main": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "frontend-plugin"
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -16,8 +19,7 @@
"test": "backstage-cli package test",
"lint": "backstage-cli package lint",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack",
"diff": "backstage-cli plugin:diff"
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/core-components": "^0.9.1",