Merge pull request #27056 from backstage/blam/add-integrations
NFS: Add missing default API's and `DefaultSignInPage`
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/frontend-test-utils': patch
|
||||
---
|
||||
|
||||
Disable the built-in `SignInPage` in `createExtensionTester` in order to not mess with existing tests
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-app': patch
|
||||
---
|
||||
|
||||
Added missing default `SignInPageExtension` which by default uses guest auth, missing `ApiExtensions` for `scmAuth`
|
||||
@@ -26,7 +26,6 @@ import homePlugin, {
|
||||
import {
|
||||
coreExtensionData,
|
||||
createExtension,
|
||||
ApiBlueprint,
|
||||
createFrontendModule,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import {
|
||||
@@ -41,14 +40,7 @@ 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 { signInPageModule } from './overrides/SignInPage';
|
||||
import { convertLegacyPlugin } from '@backstage/core-compat-api';
|
||||
import { convertLegacyPageExtension } from '@backstage/core-compat-api';
|
||||
import { convertLegacyEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';
|
||||
@@ -118,28 +110,6 @@ const customHomePageModule = createFrontendModule({
|
||||
],
|
||||
});
|
||||
|
||||
const scmModule = createFrontendModule({
|
||||
pluginId: 'app',
|
||||
extensions: [
|
||||
ApiBlueprint.make({
|
||||
name: 'scm-auth',
|
||||
params: {
|
||||
factory: ScmAuth.createDefaultApiFactory(),
|
||||
},
|
||||
}),
|
||||
ApiBlueprint.make({
|
||||
name: 'scm-integrations',
|
||||
params: {
|
||||
factory: createApiFactory({
|
||||
api: scmIntegrationsApiRef,
|
||||
deps: { configApi: configApiRef },
|
||||
factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),
|
||||
}),
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const notFoundErrorPageModule = createFrontendModule({
|
||||
pluginId: 'app',
|
||||
extensions: [notFoundErrorPage],
|
||||
@@ -159,8 +129,6 @@ const app = createApp({
|
||||
homePlugin,
|
||||
appVisualizerPlugin,
|
||||
kubernetesPlugin,
|
||||
signInPageModule,
|
||||
scmModule,
|
||||
notFoundErrorPageModule,
|
||||
customHomePageModule,
|
||||
...collectedLegacyPlugins,
|
||||
|
||||
@@ -15,11 +15,8 @@
|
||||
*/
|
||||
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { signInPageModule } from './overrides/SignInPage';
|
||||
import { createPublicSignInApp } from '@backstage/frontend-defaults';
|
||||
|
||||
const app = createPublicSignInApp({
|
||||
features: [signInPageModule],
|
||||
});
|
||||
const app = createPublicSignInApp();
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(app.createRoot());
|
||||
|
||||
@@ -29,9 +29,17 @@ import { CreateAppFeatureLoader, createApp } from './createApp';
|
||||
import { mockApis, renderWithEffects } from '@backstage/test-utils';
|
||||
import React from 'react';
|
||||
import { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import appPlugin from '@backstage/plugin-app';
|
||||
import { default as appPluginOriginal } from '@backstage/plugin-app';
|
||||
|
||||
describe('createApp', () => {
|
||||
const appPlugin = appPluginOriginal.withOverrides({
|
||||
extensions: [
|
||||
appPluginOriginal
|
||||
.getExtension('sign-in-page:app')
|
||||
.override({ disabled: true }),
|
||||
],
|
||||
});
|
||||
|
||||
it('should allow themes to be installed', async () => {
|
||||
const app = createApp({
|
||||
configLoader: async () => ({
|
||||
@@ -98,6 +106,7 @@ describe('createApp', () => {
|
||||
}),
|
||||
],
|
||||
}),
|
||||
appPlugin,
|
||||
],
|
||||
});
|
||||
|
||||
@@ -231,6 +240,7 @@ describe('createApp', () => {
|
||||
const app = createApp({
|
||||
configLoader: async () => ({ config: mockApis.config() }),
|
||||
features: [
|
||||
appPlugin,
|
||||
createFrontendPlugin({
|
||||
id: 'my-plugin',
|
||||
extensions: [
|
||||
@@ -277,6 +287,8 @@ describe('createApp', () => {
|
||||
<api:app/atlassian-auth out=[core.api.factory] />
|
||||
<api:app/vmware-cloud-auth out=[core.api.factory] />
|
||||
<api:app/permission out=[core.api.factory] />
|
||||
<api:app/scm-auth out=[core.api.factory] />
|
||||
<api:app/scm-integrations out=[core.api.factory] />
|
||||
<api:app/app-language out=[core.api.factory] />
|
||||
<api:app/app-theme out=[core.api.factory]>
|
||||
themes [
|
||||
@@ -317,6 +329,9 @@ describe('createApp', () => {
|
||||
<app-root-element:app/oauth-request-dialog out=[core.reactElement] />
|
||||
<app-root-element:app/alert-display out=[core.reactElement] />
|
||||
]
|
||||
signInPage [
|
||||
<sign-in-page:app />
|
||||
]
|
||||
</app/root>
|
||||
]
|
||||
</app>
|
||||
|
||||
@@ -96,6 +96,9 @@ const NavItem = (props: {
|
||||
|
||||
const appPluginOverride = appPlugin.withOverrides({
|
||||
extensions: [
|
||||
appPlugin.getExtension('sign-in-page:app').override({
|
||||
disabled: true,
|
||||
}),
|
||||
appPlugin.getExtension('app/nav').override({
|
||||
output: [coreExtensionData.reactElement],
|
||||
factory(_originalFactory, { inputs }) {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"@backstage/core-components": "workspace:^",
|
||||
"@backstage/core-plugin-api": "workspace:^",
|
||||
"@backstage/frontend-plugin-api": "workspace:^",
|
||||
"@backstage/integration-react": "workspace:^",
|
||||
"@backstage/plugin-permission-react": "workspace:^",
|
||||
"@backstage/theme": "workspace:^",
|
||||
"@material-ui/core": "^4.9.13",
|
||||
|
||||
@@ -383,6 +383,21 @@ const appPlugin: FrontendPlugin<
|
||||
factory: AnyApiFactory;
|
||||
};
|
||||
}>;
|
||||
'sign-in-page:app': ExtensionDefinition<{
|
||||
kind: 'sign-in-page';
|
||||
name: undefined;
|
||||
config: {};
|
||||
configInput: {};
|
||||
output: ConfigurableExtensionDataRef<
|
||||
ComponentType<SignInPageProps>,
|
||||
'core.sign-in-page.component',
|
||||
{}
|
||||
>;
|
||||
inputs: {};
|
||||
params: {
|
||||
loader: () => Promise<ComponentType<SignInPageProps>>;
|
||||
};
|
||||
}>;
|
||||
'app-root-element:app/oauth-request-dialog': ExtensionDefinition<{
|
||||
kind: 'app-root-element';
|
||||
name: 'oauth-request-dialog';
|
||||
@@ -705,6 +720,36 @@ const appPlugin: FrontendPlugin<
|
||||
factory: AnyApiFactory;
|
||||
};
|
||||
}>;
|
||||
'api:app/scm-auth': ExtensionDefinition<{
|
||||
kind: 'api';
|
||||
name: 'scm-auth';
|
||||
config: {};
|
||||
configInput: {};
|
||||
output: ConfigurableExtensionDataRef<
|
||||
AnyApiFactory,
|
||||
'core.api.factory',
|
||||
{}
|
||||
>;
|
||||
inputs: {};
|
||||
params: {
|
||||
factory: AnyApiFactory;
|
||||
};
|
||||
}>;
|
||||
'api:app/scm-integrations': ExtensionDefinition<{
|
||||
kind: 'api';
|
||||
name: 'scm-integrations';
|
||||
config: {};
|
||||
configInput: {};
|
||||
output: ConfigurableExtensionDataRef<
|
||||
AnyApiFactory,
|
||||
'core.api.factory',
|
||||
{}
|
||||
>;
|
||||
inputs: {};
|
||||
params: {
|
||||
factory: AnyApiFactory;
|
||||
};
|
||||
}>;
|
||||
}
|
||||
>;
|
||||
export default appPlugin;
|
||||
|
||||
@@ -61,6 +61,11 @@ import {
|
||||
vmwareCloudAuthApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { ApiBlueprint } from '@backstage/frontend-plugin-api';
|
||||
import {
|
||||
ScmAuth,
|
||||
ScmIntegrationsApi,
|
||||
scmIntegrationsApiRef,
|
||||
} from '@backstage/integration-react';
|
||||
import {
|
||||
permissionApiRef,
|
||||
IdentityPermissionApi,
|
||||
@@ -380,4 +385,20 @@ export const apis = [
|
||||
}),
|
||||
},
|
||||
}),
|
||||
ApiBlueprint.make({
|
||||
name: 'scm-auth',
|
||||
params: {
|
||||
factory: ScmAuth.createDefaultApiFactory(),
|
||||
},
|
||||
}),
|
||||
ApiBlueprint.make({
|
||||
name: 'scm-integrations',
|
||||
params: {
|
||||
factory: createApiFactory({
|
||||
api: scmIntegrationsApiRef,
|
||||
deps: { configApi: configApiRef },
|
||||
factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),
|
||||
}),
|
||||
},
|
||||
}),
|
||||
] as const;
|
||||
|
||||
+2
-12
@@ -13,23 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SignInPageBlueprint } from '@backstage/frontend-plugin-api';
|
||||
import { SignInPage } from '@backstage/core-components';
|
||||
import {
|
||||
SignInPageBlueprint,
|
||||
createFrontendModule,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
const signInPage = SignInPageBlueprint.make({
|
||||
name: 'guest',
|
||||
export const DefaultSignInPage = SignInPageBlueprint.make({
|
||||
params: {
|
||||
loader: async () => props =>
|
||||
<SignInPage {...props} providers={['guest']} />,
|
||||
},
|
||||
});
|
||||
|
||||
export const signInPageModule = createFrontendModule({
|
||||
pluginId: 'app',
|
||||
extensions: [signInPage],
|
||||
});
|
||||
@@ -24,6 +24,7 @@ export { ComponentsApi } from './ComponentsApi';
|
||||
export { IconsApi } from './IconsApi';
|
||||
export { FeatureFlagsApi } from './FeatureFlagsApi';
|
||||
export { TranslationsApi } from './TranslationsApi';
|
||||
export { DefaultSignInPage } from './DefaultSignInPage';
|
||||
export {
|
||||
DefaultProgressComponent,
|
||||
DefaultErrorBoundaryComponent,
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
DefaultErrorBoundaryComponent,
|
||||
oauthRequestDialogAppRootElement,
|
||||
alertDisplayAppRootElement,
|
||||
DefaultSignInPage,
|
||||
} from './extensions';
|
||||
import { apis } from './defaultApis';
|
||||
|
||||
@@ -58,6 +59,7 @@ export const appPlugin = createFrontendPlugin({
|
||||
DefaultProgressComponent,
|
||||
DefaultNotFoundErrorPageComponent,
|
||||
DefaultErrorBoundaryComponent,
|
||||
DefaultSignInPage,
|
||||
oauthRequestDialogAppRootElement,
|
||||
alertDisplayAppRootElement,
|
||||
],
|
||||
|
||||
@@ -4978,6 +4978,7 @@ __metadata:
|
||||
"@backstage/dev-utils": "workspace:^"
|
||||
"@backstage/frontend-plugin-api": "workspace:^"
|
||||
"@backstage/frontend-test-utils": "workspace:^"
|
||||
"@backstage/integration-react": "workspace:^"
|
||||
"@backstage/plugin-permission-react": "workspace:^"
|
||||
"@backstage/theme": "workspace:^"
|
||||
"@material-ui/core": ^4.9.13
|
||||
|
||||
Reference in New Issue
Block a user