run api-report

Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
Paul Cowan
2023-01-12 17:54:29 +00:00
parent b965a83a1f
commit 693695ee46
6 changed files with 69 additions and 119 deletions
+1
View File
@@ -1,5 +1,6 @@
---
'@backstage/plugin-scaffolder': minor
'@backstage/plugin-scaffolder-react': minor
---
Embed scaffolder workflow in other components
+4 -9
View File
@@ -27,7 +27,7 @@ import {
RELATION_PROVIDES_API,
} from '@backstage/catalog-model';
import { createApp } from '@backstage/app-defaults';
import { FlatRoutes } from '@backstage/core-app-api';
import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
import {
AlertDisplay,
OAuthRequestDialog,
@@ -149,9 +149,6 @@ const app = createApp({
},
});
const AppProvider = app.getProvider();
const AppRouter = app.getRouter();
const routes = (
<FlatRoutes>
<Route path="/" element={<Navigate to="catalog" />} />
@@ -282,14 +279,12 @@ const routes = (
</FlatRoutes>
);
const App = () => (
<AppProvider>
export default app.createRoot(
<>
<AlertDisplay transientTimeoutMs={2500} />
<OAuthRequestDialog />
<AppRouter>
<Root>{routes}</Root>
</AppRouter>
</AppProvider>
</>,
);
export default App;
+58 -4
View File
@@ -8,6 +8,7 @@
import { ApiHolder } from '@backstage/core-plugin-api';
import { ApiRef } from '@backstage/core-plugin-api';
import { Dispatch } from 'react';
import type { ErrorTransformer } from '@rjsf/utils';
import { Extension } from '@backstage/core-plugin-api';
import { FieldProps } from '@rjsf/core';
import { FieldProps as FieldProps_2 } from '@rjsf/utils';
@@ -79,6 +80,9 @@ export type CustomFieldValidator<TFieldReturnValue> = (
},
) => void | Promise<void>;
// @alpha (undocumented)
export const EmbeddableWorkflow: (props: WorkflowProps) => JSX.Element;
// @alpha
export const extractSchemaFromStep: (inputStep: JsonObject) => {
uiSchema: UiSchema;
@@ -186,10 +190,12 @@ export interface ParsedTemplateSchema {
export const ReviewState: (props: ReviewStateProps) => JSX.Element;
// @alpha
export type ReviewStateProps = {
schemas: ParsedTemplateSchema[];
export interface ReviewStateProps {
// (undocumented)
formState: JsonObject;
};
// (undocumented)
schemas: ParsedTemplateSchema[];
}
// @public
export interface ScaffolderApi {
@@ -342,7 +348,12 @@ export const SecretsContextProvider: ({
}: PropsWithChildren<{}>) => JSX.Element;
// @alpha
export const Stepper: (props: StepperProps) => JSX.Element;
export const Stepper: ({
ReviewStateWrapper,
createButtonText,
reviewButtonText,
...props
}: StepperProps) => JSX.Element;
// @alpha
export type StepperProps = {
@@ -352,6 +363,9 @@ export type StepperProps = {
FormProps?: FormProps;
initialState?: Record<string, JsonValue>;
onComplete: (values: Record<string, JsonValue>) => Promise<void>;
ReviewStateWrapper?: (props: ReviewStateProps) => JSX.Element;
createButtonText?: string;
reviewButtonText?: string;
};
// @alpha
@@ -418,6 +432,13 @@ export const useFormDataFromQuery: (
initialState?: Record<string, JsonValue>,
) => [Record<string, any>, Dispatch<SetStateAction<Record<string, any>>>];
// @alpha (undocumented)
export const useTemplateParameterSchema: (templateRef: string) => {
manifest: TemplateParameterSchema | undefined;
loading: boolean;
error: Error | undefined;
};
// @alpha
export const useTemplateSchema: (manifest: TemplateParameterSchema) => {
steps: ParsedTemplateSchema[];
@@ -426,5 +447,38 @@ export const useTemplateSchema: (manifest: TemplateParameterSchema) => {
// @public
export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
// @alpha (undocumented)
export const Workflow: ({
ReviewStateWrapper,
FormProps,
...props
}: WorkflowProps) => JSX.Element | null;
// @alpha (undocumented)
export interface WorkflowProps {
// (undocumented)
customFieldExtensions: NextFieldExtensionOptions<any, any>[];
// (undocumented)
description?: string;
// (undocumented)
FormProps?: FormProps;
// (undocumented)
initialFormState?: Record<string, JsonValue>;
// (undocumented)
namespace: string;
// (undocumented)
onComplete: (values: Record<string, JsonValue>) => Promise<void>;
// (undocumented)
onError(error: Error | undefined): JSX.Element | null;
// (undocumented)
ReviewStateWrapper?: (props: ReviewStateProps) => JSX.Element;
// (undocumented)
templateName: string;
// (undocumented)
title?: string;
// (undocumented)
transformErrors?: ErrorTransformer;
}
// (No @packageDocumentation comment for this package)
```
+4 -104
View File
@@ -22,7 +22,8 @@ import { FieldExtensionComponentProps as FieldExtensionComponentProps_2 } from '
import { FieldExtensionOptions as FieldExtensionOptions_2 } from '@backstage/plugin-scaffolder-react';
import { FieldValidation } from '@rjsf/core';
import type { FormProps as FormProps_2 } from '@rjsf/core';
import type { FormProps as FormProps_3 } from '@rjsf/core-v5';
import type { FormProps as FormProps_3 } from '@backstage/plugin-scaffolder-react';
import type { FormProps as FormProps_4 } from '@rjsf/core-v5';
import { IdentityApi } from '@backstage/core-plugin-api';
import { JsonObject } from '@backstage/types';
import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-scaffolder-react';
@@ -31,11 +32,7 @@ import { Observable } from '@backstage/types';
import { PathParams } from '@backstage/core-plugin-api';
import { PropsWithChildren } from 'react';
import { default as React_2 } from 'react';
<<<<<<< HEAD
import { ReactNode } from 'react';
=======
import type { ReactNode } from 'react';
>>>>>>> 1a12ad8e8d (fix api-reports)
import { RouteRef } from '@backstage/core-plugin-api';
import { ScaffolderApi as ScaffolderApi_2 } from '@backstage/plugin-scaffolder-react';
import { ScaffolderDryRunOptions as ScaffolderDryRunOptions_2 } from '@backstage/plugin-scaffolder-react';
@@ -73,45 +70,7 @@ export type CustomFieldValidator<TReturnFieldData> =
CustomFieldValidator_2<TReturnFieldData>;
// @public
<<<<<<< HEAD
export const EntityNamePickerFieldExtension: FieldExtensionComponent_2<
=======
export type CustomFieldValidator<TFieldReturnValue> = (
data: TFieldReturnValue,
field: FieldValidation,
context: {
apiHolder: ApiHolder;
},
) => void | Promise<void>;
// @alpha
export function EmbeddedScaffolderWorkflow({
namespace,
templateName,
customExtensionsElement,
frontPage,
finishPage,
onComplete,
onError,
title,
description,
ReviewStateWrapper,
initialFormState,
}: EmbeddedScaffolderWorkflowProps): JSX.Element;
// @alpha (undocumented)
export type EmbeddedScaffolderWorkflowProps = Omit<
WorkflowProps,
'customFieldExtensions' | 'onComplete'
> & {
customExtensionsElement?: React_2.ReactNode;
frontPage: ReactNode;
finishPage: ReactNode;
} & Partial<Pick<WorkflowProps, 'onComplete'>>;
// @public
export const EntityNamePickerFieldExtension: FieldExtensionComponent<
>>>>>>> b2747a3f35 (api-reports)
string,
{}
>;
@@ -199,7 +158,7 @@ export interface FieldSchema<TReturn, TUiOptions> {
// @alpha @deprecated
export type FormProps = Pick<
FormProps_3,
FormProps_4,
'transformErrors' | 'noHtml5Validate'
>;
@@ -249,7 +208,7 @@ export type NextRouterProps = {
TaskPageComponent?: React_2.ComponentType<{}>;
};
groups?: TemplateGroupFilter[];
FormProps?: FormProps;
FormProps?: FormProps_3;
};
// @alpha
@@ -324,20 +283,6 @@ export const OwnerPickerFieldSchema: FieldSchema<
// @public
export type OwnerPickerUiOptions = typeof OwnerPickerFieldSchema.uiOptionsType;
// @alpha (undocumented)
export interface ParsedTemplateSchema {
// (undocumented)
description?: string;
// (undocumented)
mergedSchema: JsonObject;
// (undocumented)
schema: JsonObject;
// (undocumented)
title: string;
// (undocumented)
uiSchema: UiSchema;
}
// @public
export const repoPickerValidation: (
value: string,
@@ -403,14 +348,6 @@ export const RepoUrlPickerFieldSchema: FieldSchema<
export type RepoUrlPickerUiOptions =
typeof RepoUrlPickerFieldSchema.uiOptionsType;
// @alpha (undocumented)
export interface ReviewStateProps {
// (undocumented)
formState: JsonObject;
// (undocumented)
schemas: ParsedTemplateSchema[];
}
// @public
export type ReviewStepProps = {
disableButtons: boolean;
@@ -590,43 +527,6 @@ export type TemplateParameterSchema = TemplateParameterSchema_2;
// @public
export const TemplateTypePicker: () => JSX.Element | null;
<<<<<<< HEAD
<<<<<<< HEAD
// @public @deprecated (undocumented)
export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets_2;
=======
// @alpha
export const useGetCustomFields: (
element: React_2.ReactNode,
) => NextFieldExtensionOptions<unknown, unknown>[];
=======
>>>>>>> 1a12ad8e8d (fix api-reports)
// @public
export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
// @alpha (undocumented)
export interface WorkflowProps {
// (undocumented)
customFieldExtensions: NextFieldExtensionOptions<any, any>[];
// (undocumented)
description?: string;
// (undocumented)
initialFormState?: Record<string, JsonValue>;
// (undocumented)
namespace: string;
// (undocumented)
onComplete: (values: Record<string, JsonValue>) => Promise<void>;
// (undocumented)
onError(error: Error | undefined): JSX.Element | null;
// (undocumented)
ReviewStateWrapper?: (props: ReviewStateProps) => JSX.Element;
// (undocumented)
templateName: string;
// (undocumented)
title?: string;
// (undocumented)
transformErrors?: ErrorTransformer;
}
>>>>>>> b2747a3f35 (api-reports)
```
+2
View File
@@ -49,5 +49,7 @@ export {
nextRouteRef,
nextScaffolderTaskRouteRef,
nextSelectedTemplateRouteRef,
type TemplateGroupFilter,
type NextRouterProps,
type FormProps,
} from './next';
@@ -52,9 +52,7 @@ export type NextRouterProps = {
*/
export const Router = (props: PropsWithChildren<NextRouterProps>) => {
const { components: { TemplateCardComponent } = {} } = props;
const outlet = useOutlet() || props.children;
const customFieldExtensions =
useCustomFieldExtensions<NextFieldExtensionOptions>(outlet);
const fieldExtensions = [