frontend-plugin-api: extension ID updates for nav-logo and sign-in-page
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -593,7 +593,8 @@ export function createSignInPageExtension<
|
||||
TConfig extends {},
|
||||
TInputs extends AnyExtensionInputMap,
|
||||
>(options: {
|
||||
id: string;
|
||||
namespace?: string;
|
||||
name?: string;
|
||||
attachTo?: {
|
||||
id: string;
|
||||
input: string;
|
||||
@@ -605,7 +606,7 @@ export function createSignInPageExtension<
|
||||
config: TConfig;
|
||||
inputs: Expand<ExtensionInputValues<TInputs>>;
|
||||
}) => Promise<ComponentType<SignInPageProps>>;
|
||||
}): Extension<TConfig>;
|
||||
}): ExtensionDefinition<TConfig>;
|
||||
|
||||
// @public
|
||||
export function createSubRouteRef<
|
||||
|
||||
@@ -25,14 +25,15 @@ describe('createNavLogoExtension', () => {
|
||||
it('creates the extension properly', () => {
|
||||
expect(
|
||||
createNavLogoExtension({
|
||||
id: 'test',
|
||||
name: 'test',
|
||||
logoFull: <div>Logo Full</div>,
|
||||
logoIcon: <div>Logo Icon</div>,
|
||||
}),
|
||||
).toEqual({
|
||||
$$type: '@backstage/Extension',
|
||||
id: 'test',
|
||||
attachTo: { id: 'core.nav', input: 'logos' },
|
||||
$$type: '@backstage/ExtensionDefinition',
|
||||
kind: 'nav-logo',
|
||||
name: 'test',
|
||||
attachTo: { id: 'core/nav', input: 'logos' },
|
||||
disabled: false,
|
||||
inputs: {},
|
||||
output: {
|
||||
|
||||
@@ -21,14 +21,17 @@ import { coreExtensionData, createExtension } from '../wiring';
|
||||
* @public
|
||||
*/
|
||||
export function createNavLogoExtension(options: {
|
||||
id: string;
|
||||
name?: string;
|
||||
namespace?: string;
|
||||
logoIcon: JSX.Element;
|
||||
logoFull: JSX.Element;
|
||||
}) {
|
||||
const { id, logoIcon, logoFull } = options;
|
||||
const { logoIcon, logoFull } = options;
|
||||
return createExtension({
|
||||
id,
|
||||
attachTo: { id: 'core.nav', input: 'logos' },
|
||||
kind: 'nav-logo',
|
||||
name: options?.name,
|
||||
namespace: options?.namespace,
|
||||
attachTo: { id: 'core/nav', input: 'logos' },
|
||||
output: {
|
||||
logos: coreExtensionData.logoElements,
|
||||
},
|
||||
|
||||
@@ -23,13 +23,13 @@ import { coreExtensionData, createExtension } from '../wiring';
|
||||
describe('createSignInPageExtension', () => {
|
||||
it('renders a sign-in page', async () => {
|
||||
const SignInPage = createSignInPageExtension({
|
||||
id: 'test',
|
||||
name: 'test',
|
||||
loader: async () => () => <div data-testid="sign-in-page" />,
|
||||
});
|
||||
|
||||
createExtensionTester(
|
||||
createExtension({
|
||||
id: 'dummy',
|
||||
name: 'dummy',
|
||||
attachTo: { id: 'ignored', input: 'ignored' },
|
||||
output: {
|
||||
element: coreExtensionData.reactElement,
|
||||
|
||||
@@ -19,10 +19,10 @@ import { ExtensionBoundary } from '../components';
|
||||
import { PortableSchema } from '../schema';
|
||||
import {
|
||||
createExtension,
|
||||
Extension,
|
||||
ExtensionInputValues,
|
||||
AnyExtensionInputMap,
|
||||
createExtensionDataRef,
|
||||
ExtensionDefinition,
|
||||
} from '../wiring';
|
||||
import { Expand } from '../types';
|
||||
import { SignInPageProps } from '@backstage/core-plugin-api';
|
||||
@@ -39,7 +39,8 @@ export function createSignInPageExtension<
|
||||
TConfig extends {},
|
||||
TInputs extends AnyExtensionInputMap,
|
||||
>(options: {
|
||||
id: string;
|
||||
namespace?: string;
|
||||
name?: string;
|
||||
attachTo?: { id: string; input: string };
|
||||
configSchema?: PortableSchema<TConfig>;
|
||||
disabled?: boolean;
|
||||
@@ -48,12 +49,12 @@ export function createSignInPageExtension<
|
||||
config: TConfig;
|
||||
inputs: Expand<ExtensionInputValues<TInputs>>;
|
||||
}) => Promise<ComponentType<SignInPageProps>>;
|
||||
}): Extension<TConfig> {
|
||||
const { id } = options;
|
||||
|
||||
}): ExtensionDefinition<TConfig> {
|
||||
return createExtension({
|
||||
id,
|
||||
attachTo: options.attachTo ?? { id: 'core.router', input: 'signInPage' },
|
||||
kind: 'sign-in-page',
|
||||
namespace: options?.namespace,
|
||||
name: options?.name,
|
||||
attachTo: options.attachTo ?? { id: 'core/router', input: 'signInPage' },
|
||||
configSchema: options.configSchema,
|
||||
inputs: options.inputs,
|
||||
disabled: options.disabled,
|
||||
|
||||
Reference in New Issue
Block a user