Revert "added the frontend-extensions package role"
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -49,7 +49,6 @@
|
||||
"@backstage/plugin-techdocs-react": "workspace:^",
|
||||
"@backstage/plugin-user-settings": "workspace:^",
|
||||
"@backstage/theme": "workspace:^",
|
||||
"@internal/app-next-example-extensions": "workspace:^",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.61",
|
||||
|
||||
@@ -17,16 +17,33 @@
|
||||
import React from 'react';
|
||||
import { createApp } from '@backstage/frontend-app-api';
|
||||
import { pagesPlugin } from './examples/pagesPlugin';
|
||||
import notFoundErrorPage from './examples/notFoundErrorPageExtension';
|
||||
import userSettingsPlugin from '@backstage/plugin-user-settings/alpha';
|
||||
import homePlugin from '@backstage/plugin-home/alpha';
|
||||
import homePlugin, {
|
||||
titleExtensionDataRef,
|
||||
} from '@backstage/plugin-home/alpha';
|
||||
|
||||
import {
|
||||
coreExtensionData,
|
||||
createExtension,
|
||||
createApiExtension,
|
||||
createExtensionOverrides,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import techdocsPlugin from '@backstage/plugin-techdocs/alpha';
|
||||
import appVisualizerPlugin from '@backstage/plugin-app-visualizer';
|
||||
import { homePage } from './HomePage';
|
||||
import { convertLegacyApp } from '@backstage/core-compat-api';
|
||||
import { FlatRoutes } from '@backstage/core-app-api';
|
||||
import { Route } from 'react-router';
|
||||
import { CatalogImportPage } from '@backstage/plugin-catalog-import';
|
||||
import { createApiFactory, configApiRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
ScmAuth,
|
||||
ScmIntegrationsApi,
|
||||
scmIntegrationsApiRef,
|
||||
} from '@backstage/integration-react';
|
||||
import kubernetesPlugin from '@backstage/plugin-kubernetes/alpha';
|
||||
import extensions from '@internal/app-next-example-extensions';
|
||||
import { signInPageOverrides } from './overrides/SignInPage';
|
||||
|
||||
/*
|
||||
|
||||
@@ -57,6 +74,30 @@ TODO:
|
||||
|
||||
/* app.tsx */
|
||||
|
||||
const homePageExtension = createExtension({
|
||||
name: 'myhomepage',
|
||||
attachTo: { id: 'page:home', input: 'props' },
|
||||
output: {
|
||||
children: coreExtensionData.reactElement,
|
||||
title: titleExtensionDataRef,
|
||||
},
|
||||
factory() {
|
||||
return { children: homePage, title: 'just a title' };
|
||||
},
|
||||
});
|
||||
|
||||
const scmAuthExtension = createApiExtension({
|
||||
factory: ScmAuth.createDefaultApiFactory(),
|
||||
});
|
||||
|
||||
const scmIntegrationApi = createApiExtension({
|
||||
factory: createApiFactory({
|
||||
api: scmIntegrationsApiRef,
|
||||
deps: { configApi: configApiRef },
|
||||
factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),
|
||||
}),
|
||||
});
|
||||
|
||||
const collectedLegacyPlugins = convertLegacyApp(
|
||||
<FlatRoutes>
|
||||
<Route path="/catalog-import" element={<CatalogImportPage />} />
|
||||
@@ -71,8 +112,16 @@ const app = createApp({
|
||||
homePlugin,
|
||||
appVisualizerPlugin,
|
||||
kubernetesPlugin,
|
||||
extensions,
|
||||
signInPageOverrides,
|
||||
...collectedLegacyPlugins,
|
||||
createExtensionOverrides({
|
||||
extensions: [
|
||||
homePageExtension,
|
||||
scmAuthExtension,
|
||||
scmIntegrationApi,
|
||||
notFoundErrorPage,
|
||||
],
|
||||
}),
|
||||
],
|
||||
/* Handled through config instead */
|
||||
// bindRoutes({ bind }) {
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* 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 {
|
||||
ClockConfig,
|
||||
CustomHomepageGrid,
|
||||
HeaderWorldClock,
|
||||
HomePageCompanyLogo,
|
||||
HomePageRandomJoke,
|
||||
HomePageStarredEntities,
|
||||
HomePageToolkit,
|
||||
HomePageTopVisited,
|
||||
HomePageRecentlyVisited,
|
||||
WelcomeTitle,
|
||||
} from '@backstage/plugin-home';
|
||||
import { Content, Header, Page } from '@backstage/core-components';
|
||||
import React from 'react';
|
||||
import HomeIcon from '@material-ui/icons/Home';
|
||||
|
||||
const clockConfigs: ClockConfig[] = [
|
||||
{
|
||||
label: 'NYC',
|
||||
timeZone: 'America/New_York',
|
||||
},
|
||||
{
|
||||
label: 'UTC',
|
||||
timeZone: 'UTC',
|
||||
},
|
||||
{
|
||||
label: 'STO',
|
||||
timeZone: 'Europe/Stockholm',
|
||||
},
|
||||
{
|
||||
label: 'TYO',
|
||||
timeZone: 'Asia/Tokyo',
|
||||
},
|
||||
];
|
||||
|
||||
const timeFormat: Intl.DateTimeFormatOptions = {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false,
|
||||
};
|
||||
|
||||
const defaultConfig = [
|
||||
{
|
||||
component: 'CompanyLogo',
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 12,
|
||||
height: 1,
|
||||
movable: false,
|
||||
resizable: false,
|
||||
deletable: false,
|
||||
},
|
||||
{
|
||||
component: 'WelcomeTitle',
|
||||
x: 0,
|
||||
y: 1,
|
||||
width: 12,
|
||||
height: 1,
|
||||
},
|
||||
{
|
||||
component: 'HomePageSearchBar',
|
||||
x: 0,
|
||||
y: 2,
|
||||
width: 12,
|
||||
height: 2,
|
||||
},
|
||||
];
|
||||
|
||||
export const homePage = (
|
||||
<Page themeId="home">
|
||||
<Header title={<WelcomeTitle />} pageTitleOverride="Home">
|
||||
<HeaderWorldClock
|
||||
clockConfigs={clockConfigs}
|
||||
customTimeFormat={timeFormat}
|
||||
/>
|
||||
</Header>
|
||||
<Content>
|
||||
<CustomHomepageGrid config={defaultConfig}>
|
||||
<HomePageRandomJoke />
|
||||
<HomePageStarredEntities />
|
||||
<HomePageCompanyLogo />
|
||||
<WelcomeTitle />
|
||||
<HomePageToolkit
|
||||
tools={[
|
||||
{
|
||||
url: 'https://backstage.io',
|
||||
label: 'Backstage Homepage',
|
||||
icon: <HomeIcon />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<HomePageTopVisited />
|
||||
<HomePageRecentlyVisited />
|
||||
</CustomHomepageGrid>
|
||||
</Content>
|
||||
</Page>
|
||||
);
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* 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 React from 'react';
|
||||
import {
|
||||
createComponentExtension,
|
||||
coreComponentRefs,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import Box from '@material-ui/core/Box';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import { Button } from '@backstage/core-components';
|
||||
|
||||
export function CustomNotFoundErrorPage() {
|
||||
return (
|
||||
<Box
|
||||
component="article"
|
||||
width="100%"
|
||||
height="100vh"
|
||||
display="grid"
|
||||
textAlign="center"
|
||||
alignContent="center"
|
||||
justifyContent="center"
|
||||
justifyItems="center"
|
||||
>
|
||||
<Typography variant="h1">404</Typography>
|
||||
<Typography color="textSecondary" paragraph style={{ width: 300 }}>
|
||||
Unable to locate this page. Please contact your support team if this
|
||||
page used to exist.
|
||||
</Typography>
|
||||
<Button
|
||||
variant="contained"
|
||||
to="/"
|
||||
style={{ marginTop: '1rem', width: 200 }}
|
||||
>
|
||||
Go home
|
||||
</Button>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default createComponentExtension({
|
||||
ref: coreComponentRefs.notFoundErrorPage,
|
||||
loader: { sync: () => CustomNotFoundErrorPage },
|
||||
});
|
||||
@@ -18,7 +18,7 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { CookieAuthRedirect } from '@backstage/plugin-auth-react';
|
||||
import { createApp } from '@backstage/frontend-app-api';
|
||||
import { SignInPage } from '@internal/app-next-example-extensions';
|
||||
import { signInPageOverrides } from './overrides/SignInPage';
|
||||
import {
|
||||
coreExtensionData,
|
||||
createExtension,
|
||||
@@ -39,8 +39,9 @@ const authRedirectExtension = createExtension({
|
||||
|
||||
const app = createApp({
|
||||
features: [
|
||||
signInPageOverrides,
|
||||
createExtensionOverrides({
|
||||
extensions: [SignInPage, authRedirectExtension],
|
||||
extensions: [authRedirectExtension],
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* 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 React from 'react';
|
||||
import { SignInPage } from '@backstage/core-components';
|
||||
import {
|
||||
createExtensionOverrides,
|
||||
createSignInPageExtension,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
const signInPage = createSignInPageExtension({
|
||||
name: 'guest',
|
||||
loader: async () => props => <SignInPage {...props} providers={['guest']} />,
|
||||
});
|
||||
|
||||
export const signInPageOverrides = createExtensionOverrides({
|
||||
extensions: [signInPage],
|
||||
});
|
||||
Reference in New Issue
Block a user