@backstage/plugin-scaffolder-react 1.0.1 → 1.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,38 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
- ## 1.0.1
3
+ ## 1.1.0-next.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 021233c215: lock versions of `@rjsf/*-beta` packages
7
+ - 04f717a8e1: `scaffolder/next`: bump `react-jsonschema-form` libraries to `v5-stable`
8
+ - 346d6b6630: Upgrade `@rjsf` version 5 dependencies to `beta.18`
9
+ - Updated dependencies
10
+ - @backstage/core-components@0.12.4-next.0
11
+ - @backstage/plugin-catalog-react@1.3.0-next.1
12
+ - @backstage/catalog-client@1.3.1-next.0
13
+ - @backstage/catalog-model@1.1.6-next.0
14
+ - @backstage/core-plugin-api@1.3.0
15
+ - @backstage/errors@1.1.4
16
+ - @backstage/theme@0.2.16
17
+ - @backstage/types@1.0.2
18
+ - @backstage/version-bridge@1.0.3
19
+ - @backstage/plugin-scaffolder-common@1.2.5-next.0
20
+
21
+ ## 1.1.0-next.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 8c2966536b: Embed scaffolder workflow in other components
26
+
27
+ ### Patch Changes
28
+
29
+ - cbab8ac107: lock versions of `@rjsf/*-beta` packages
30
+ - d2ddde2108: Add `ScaffolderLayouts` to `NextScaffolderPage`
31
+ - Updated dependencies
32
+ - @backstage/plugin-catalog-react@1.3.0-next.0
33
+ - @backstage/catalog-model@1.1.6-next.0
34
+ - @backstage/catalog-client@1.3.1-next.0
35
+ - @backstage/plugin-scaffolder-common@1.2.5-next.0
8
36
 
9
37
  ## 1.0.0
10
38
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-next.1",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -16,6 +16,7 @@ import { JsonValue } from '@backstage/types';
16
16
  import { Observable } from '@backstage/types';
17
17
  import { PropsWithChildren } from 'react';
18
18
  import { default as React_2 } from 'react';
19
+ import { ReactNode } from 'react';
19
20
  import { SetStateAction } from 'react';
20
21
  import { TaskSpec } from '@backstage/plugin-scaffolder-common';
21
22
  import { TaskStep } from '@backstage/plugin-scaffolder-common';
@@ -68,6 +69,13 @@ export declare function createNextScaffolderFieldExtension<TReturnValue = unknow
68
69
  */
69
70
  export declare function createScaffolderFieldExtension<TReturnValue = unknown, TInputProps = unknown>(options: FieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
70
71
 
72
+ /**
73
+ * Method for creating custom Layouts that can be used in the scaffolder frontend form
74
+ *
75
+ * @public
76
+ */
77
+ export declare function createScaffolderLayout<TInputProps = unknown>(options: LayoutOptions): Extension<LayoutComponent<TInputProps>>;
78
+
71
79
  /**
72
80
  * Type for the Custom Field Extension schema.
73
81
  *
@@ -87,6 +95,11 @@ export declare type CustomFieldValidator<TFieldReturnValue> = (data: TFieldRetur
87
95
  apiHolder: ApiHolder;
88
96
  }) => void | Promise<void>;
89
97
 
98
+ /**
99
+ * @alpha
100
+ */
101
+ export declare const EmbeddableWorkflow: (props: WorkflowProps) => JSX.Element;
102
+
90
103
  /**
91
104
  * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf
92
105
  * @alpha
@@ -97,7 +110,8 @@ export declare const extractSchemaFromStep: (inputStep: JsonObject) => {
97
110
  };
98
111
 
99
112
  /**
100
- * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
113
+ * The type used to wrap up the Layout and embed the input props
114
+ *
101
115
  * @public
102
116
  */
103
117
  export declare type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;
@@ -130,10 +144,33 @@ export declare type FieldExtensionOptions<TFieldReturnValue = unknown, TInputPro
130
144
  /**
131
145
  * Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
132
146
  *
133
- * @alpha
147
+ * @public
134
148
  */
135
149
  export declare type FormProps = Pick<FormProps_2, 'transformErrors' | 'noHtml5Validate'>;
136
150
 
151
+ /**
152
+ * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
153
+ * @public
154
+ */
155
+ export declare type LayoutComponent<_TInputProps> = () => null;
156
+
157
+ /**
158
+ * The type of layouts that is passed to the TemplateForms
159
+ *
160
+ * @public
161
+ */
162
+ export declare interface LayoutOptions<P = any> {
163
+ name: string;
164
+ component: LayoutTemplate<P>;
165
+ }
166
+
167
+ /**
168
+ * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.
169
+ *
170
+ * @public
171
+ */
172
+ export declare type LayoutTemplate<T = any> = NonNullable<FormProps_2<T>['uiSchema']>['ui:ObjectFieldTemplate'];
173
+
137
174
  /**
138
175
  * The response shape for the `listActions` call to the `scaffolder-backend`
139
176
  *
@@ -303,6 +340,13 @@ export declare interface ScaffolderGetIntegrationsListResponse {
303
340
  }[];
304
341
  }
305
342
 
343
+ /**
344
+ * The wrapping component for defining scaffolder layouts as children
345
+ *
346
+ * @public
347
+ */
348
+ export declare const ScaffolderLayouts: React.ComponentType;
349
+
306
350
  /** @public */
307
351
  export declare type ScaffolderOutputLink = {
308
352
  title?: string;
@@ -387,7 +431,7 @@ export declare const SecretsContextProvider: ({ children }: PropsWithChildren<{}
387
431
  * The `Stepper` component is the Wizard that is rendered when a user selects a template
388
432
  * @alpha
389
433
  */
390
- export declare const Stepper: (props: StepperProps) => JSX.Element;
434
+ export declare const Stepper: (stepperProps: StepperProps) => JSX.Element;
391
435
 
392
436
  /**
393
437
  * The Props for {@link Stepper} component
@@ -399,7 +443,13 @@ export declare type StepperProps = {
399
443
  templateName?: string;
400
444
  FormProps?: FormProps;
401
445
  initialState?: Record<string, JsonValue>;
402
- onComplete: (values: Record<string, JsonValue>) => Promise<void>;
446
+ onCreate: (values: Record<string, JsonValue>) => Promise<void>;
447
+ components?: {
448
+ ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;
449
+ createButtonText?: ReactNode;
450
+ reviewButtonText?: ReactNode;
451
+ };
452
+ layouts?: LayoutOptions[];
403
453
  };
404
454
 
405
455
  /**
@@ -470,12 +520,27 @@ export declare type TemplateParameterSchema = {
470
520
  */
471
521
  export declare const useCustomFieldExtensions: <TComponentDataType = FieldExtensionOptions<unknown, unknown>>(outlet: React.ReactNode) => TComponentDataType[];
472
522
 
523
+ /**
524
+ * Hook that returns all custom field extensions from the current outlet.
525
+ * @public
526
+ */
527
+ export declare const useCustomLayouts: <TComponentDataType = LayoutOptions<any>>(outlet: React.ReactNode) => TComponentDataType[];
528
+
473
529
  /**
474
530
  * This hook is used to get the formData from the query string.
475
531
  * @alpha
476
532
  */
477
533
  export declare const useFormDataFromQuery: (initialState?: Record<string, JsonValue>) => [Record<string, any>, Dispatch<SetStateAction<Record<string, any>>>];
478
534
 
535
+ /**
536
+ * @alpha
537
+ */
538
+ export declare const useTemplateParameterSchema: (templateRef: string) => {
539
+ manifest: TemplateParameterSchema | undefined;
540
+ loading: boolean;
541
+ error: Error | undefined;
542
+ };
543
+
479
544
  /**
480
545
  * This hook will parse the template schema and return the steps with the
481
546
  * parsed schema and uiSchema. Filtering out any steps or properties that
@@ -493,4 +558,20 @@ export declare const useTemplateSchema: (manifest: TemplateParameterSchema) => {
493
558
  */
494
559
  export declare const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
495
560
 
561
+ /**
562
+ * @alpha
563
+ */
564
+ export declare const Workflow: (workflowProps: WorkflowProps) => JSX.Element | null;
565
+
566
+ /**
567
+ * @alpha
568
+ */
569
+ export declare type WorkflowProps = {
570
+ title?: string;
571
+ description?: string;
572
+ namespace: string;
573
+ templateName: string;
574
+ onError(error: Error | undefined): JSX.Element | null;
575
+ } & Pick<StepperProps, 'extensions' | 'FormProps' | 'components' | 'onCreate' | 'initialState' | 'layouts'>;
576
+
496
577
  export { }
@@ -16,6 +16,7 @@ import { JsonValue } from '@backstage/types';
16
16
  import { Observable } from '@backstage/types';
17
17
  import { PropsWithChildren } from 'react';
18
18
  import { default as React_2 } from 'react';
19
+ import { ReactNode } from 'react';
19
20
  import { SetStateAction } from 'react';
20
21
  import { TaskSpec } from '@backstage/plugin-scaffolder-common';
21
22
  import { TaskStep } from '@backstage/plugin-scaffolder-common';
@@ -59,6 +60,13 @@ export declare type ActionExample = {
59
60
  */
60
61
  export declare function createScaffolderFieldExtension<TReturnValue = unknown, TInputProps = unknown>(options: FieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
61
62
 
63
+ /**
64
+ * Method for creating custom Layouts that can be used in the scaffolder frontend form
65
+ *
66
+ * @public
67
+ */
68
+ export declare function createScaffolderLayout<TInputProps = unknown>(options: LayoutOptions): Extension<LayoutComponent<TInputProps>>;
69
+
62
70
  /**
63
71
  * Type for the Custom Field Extension schema.
64
72
  *
@@ -78,10 +86,13 @@ export declare type CustomFieldValidator<TFieldReturnValue> = (data: TFieldRetur
78
86
  apiHolder: ApiHolder;
79
87
  }) => void | Promise<void>;
80
88
 
89
+ /* Excluded from this release type: EmbeddableWorkflow */
90
+
81
91
  /* Excluded from this release type: extractSchemaFromStep */
82
92
 
83
93
  /**
84
- * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
94
+ * The type used to wrap up the Layout and embed the input props
95
+ *
85
96
  * @public
86
97
  */
87
98
  export declare type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;
@@ -111,7 +122,35 @@ export declare type FieldExtensionOptions<TFieldReturnValue = unknown, TInputPro
111
122
  schema?: CustomFieldExtensionSchema;
112
123
  };
113
124
 
114
- /* Excluded from this release type: FormProps */
125
+ /**
126
+ * Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
127
+ *
128
+ * @public
129
+ */
130
+ export declare type FormProps = Pick<FormProps_2, 'transformErrors' | 'noHtml5Validate'>;
131
+
132
+ /**
133
+ * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
134
+ * @public
135
+ */
136
+ export declare type LayoutComponent<_TInputProps> = () => null;
137
+
138
+ /**
139
+ * The type of layouts that is passed to the TemplateForms
140
+ *
141
+ * @public
142
+ */
143
+ export declare interface LayoutOptions<P = any> {
144
+ name: string;
145
+ component: LayoutTemplate<P>;
146
+ }
147
+
148
+ /**
149
+ * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.
150
+ *
151
+ * @public
152
+ */
153
+ export declare type LayoutTemplate<T = any> = NonNullable<FormProps_2<T>['uiSchema']>['ui:ObjectFieldTemplate'];
115
154
 
116
155
  /**
117
156
  * The response shape for the `listActions` call to the `scaffolder-backend`
@@ -233,6 +272,13 @@ export declare interface ScaffolderGetIntegrationsListResponse {
233
272
  }[];
234
273
  }
235
274
 
275
+ /**
276
+ * The wrapping component for defining scaffolder layouts as children
277
+ *
278
+ * @public
279
+ */
280
+ export declare const ScaffolderLayouts: React.ComponentType;
281
+
236
282
  /** @public */
237
283
  export declare type ScaffolderOutputLink = {
238
284
  title?: string;
@@ -347,8 +393,16 @@ export declare type TemplateParameterSchema = {
347
393
  */
348
394
  export declare const useCustomFieldExtensions: <TComponentDataType = FieldExtensionOptions<unknown, unknown>>(outlet: React.ReactNode) => TComponentDataType[];
349
395
 
396
+ /**
397
+ * Hook that returns all custom field extensions from the current outlet.
398
+ * @public
399
+ */
400
+ export declare const useCustomLayouts: <TComponentDataType = LayoutOptions<any>>(outlet: React.ReactNode) => TComponentDataType[];
401
+
350
402
  /* Excluded from this release type: useFormDataFromQuery */
351
403
 
404
+ /* Excluded from this release type: useTemplateParameterSchema */
405
+
352
406
  /* Excluded from this release type: useTemplateSchema */
353
407
 
354
408
  /**
@@ -358,4 +412,8 @@ export declare const useCustomFieldExtensions: <TComponentDataType = FieldExtens
358
412
  */
359
413
  export declare const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
360
414
 
415
+ /* Excluded from this release type: Workflow */
416
+
417
+ /* Excluded from this release type: WorkflowProps */
418
+
361
419
  export { }
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ import { JsonValue } from '@backstage/types';
16
16
  import { Observable } from '@backstage/types';
17
17
  import { PropsWithChildren } from 'react';
18
18
  import { default as React_2 } from 'react';
19
+ import { ReactNode } from 'react';
19
20
  import { SetStateAction } from 'react';
20
21
  import { TaskSpec } from '@backstage/plugin-scaffolder-common';
21
22
  import { TaskStep } from '@backstage/plugin-scaffolder-common';
@@ -59,6 +60,13 @@ export declare type ActionExample = {
59
60
  */
60
61
  export declare function createScaffolderFieldExtension<TReturnValue = unknown, TInputProps = unknown>(options: FieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
61
62
 
63
+ /**
64
+ * Method for creating custom Layouts that can be used in the scaffolder frontend form
65
+ *
66
+ * @public
67
+ */
68
+ export declare function createScaffolderLayout<TInputProps = unknown>(options: LayoutOptions): Extension<LayoutComponent<TInputProps>>;
69
+
62
70
  /**
63
71
  * Type for the Custom Field Extension schema.
64
72
  *
@@ -78,10 +86,13 @@ export declare type CustomFieldValidator<TFieldReturnValue> = (data: TFieldRetur
78
86
  apiHolder: ApiHolder;
79
87
  }) => void | Promise<void>;
80
88
 
89
+ /* Excluded from this release type: EmbeddableWorkflow */
90
+
81
91
  /* Excluded from this release type: extractSchemaFromStep */
82
92
 
83
93
  /**
84
- * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
94
+ * The type used to wrap up the Layout and embed the input props
95
+ *
85
96
  * @public
86
97
  */
87
98
  export declare type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;
@@ -111,7 +122,35 @@ export declare type FieldExtensionOptions<TFieldReturnValue = unknown, TInputPro
111
122
  schema?: CustomFieldExtensionSchema;
112
123
  };
113
124
 
114
- /* Excluded from this release type: FormProps */
125
+ /**
126
+ * Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
127
+ *
128
+ * @public
129
+ */
130
+ export declare type FormProps = Pick<FormProps_2, 'transformErrors' | 'noHtml5Validate'>;
131
+
132
+ /**
133
+ * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
134
+ * @public
135
+ */
136
+ export declare type LayoutComponent<_TInputProps> = () => null;
137
+
138
+ /**
139
+ * The type of layouts that is passed to the TemplateForms
140
+ *
141
+ * @public
142
+ */
143
+ export declare interface LayoutOptions<P = any> {
144
+ name: string;
145
+ component: LayoutTemplate<P>;
146
+ }
147
+
148
+ /**
149
+ * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.
150
+ *
151
+ * @public
152
+ */
153
+ export declare type LayoutTemplate<T = any> = NonNullable<FormProps_2<T>['uiSchema']>['ui:ObjectFieldTemplate'];
115
154
 
116
155
  /**
117
156
  * The response shape for the `listActions` call to the `scaffolder-backend`
@@ -233,6 +272,13 @@ export declare interface ScaffolderGetIntegrationsListResponse {
233
272
  }[];
234
273
  }
235
274
 
275
+ /**
276
+ * The wrapping component for defining scaffolder layouts as children
277
+ *
278
+ * @public
279
+ */
280
+ export declare const ScaffolderLayouts: React.ComponentType;
281
+
236
282
  /** @public */
237
283
  export declare type ScaffolderOutputLink = {
238
284
  title?: string;
@@ -347,8 +393,16 @@ export declare type TemplateParameterSchema = {
347
393
  */
348
394
  export declare const useCustomFieldExtensions: <TComponentDataType = FieldExtensionOptions<unknown, unknown>>(outlet: React.ReactNode) => TComponentDataType[];
349
395
 
396
+ /**
397
+ * Hook that returns all custom field extensions from the current outlet.
398
+ * @public
399
+ */
400
+ export declare const useCustomLayouts: <TComponentDataType = LayoutOptions<any>>(outlet: React.ReactNode) => TComponentDataType[];
401
+
350
402
  /* Excluded from this release type: useFormDataFromQuery */
351
403
 
404
+ /* Excluded from this release type: useTemplateParameterSchema */
405
+
352
406
  /* Excluded from this release type: useTemplateSchema */
353
407
 
354
408
  /**
@@ -358,4 +412,8 @@ export declare const useCustomFieldExtensions: <TComponentDataType = FieldExtens
358
412
  */
359
413
  export declare const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
360
414
 
415
+ /* Excluded from this release type: Workflow */
416
+
417
+ /* Excluded from this release type: WorkflowProps */
418
+
361
419
  export { }
package/dist/index.esm.js CHANGED
@@ -1,12 +1,13 @@
1
- import { attachComponentData, createApiRef, useElementFilter, useApi, featureFlagsApiRef, useAnalytics, useApiHolder, useApp } from '@backstage/core-plugin-api';
1
+ import { attachComponentData, createApiRef, useElementFilter, useApi, featureFlagsApiRef, useAnalytics, useApiHolder, useApp, errorApiRef } from '@backstage/core-plugin-api';
2
2
  import { createVersionedContext, createVersionedValueMap, getOrCreateGlobalSingleton } from '@backstage/version-bridge';
3
- import React, { useState, useContext, useCallback, useMemo } from 'react';
3
+ import React, { useState, useContext, useCallback, useMemo, useEffect } from 'react';
4
4
  import { makeStyles, Stepper as Stepper$1, Step, StepLabel, Button, useTheme, Card, CardContent, Grid, Box, Divider, Chip, CardActions, Typography } from '@material-ui/core';
5
5
  import { withTheme } from '@rjsf/core-v5';
6
6
  import { Draft07 } from 'json-schema-library';
7
- import { StructuredMetadataTable, ItemCardHeader, Link, MarkdownContent, UserIcon, Content, ItemCardGrid, ContentHeader } from '@backstage/core-components';
8
- import validator from '@rjsf/validator-ajv6';
7
+ import { StructuredMetadataTable, ItemCardHeader, Link, MarkdownContent, UserIcon, Content, ItemCardGrid, ContentHeader, Progress, InfoCard } from '@backstage/core-components';
8
+ import validator from '@rjsf/validator-ajv8';
9
9
  import qs from 'qs';
10
+ import useAsync from 'react-use/lib/useAsync';
10
11
  import { RELATION_OWNED_BY, stringifyEntityRef } from '@backstage/catalog-model';
11
12
  import { FavoriteEntity, getEntityRelations, EntityRefLinks } from '@backstage/plugin-catalog-react';
12
13
  import LanguageIcon from '@material-ui/icons/Language';
@@ -81,6 +82,32 @@ const useCustomFieldExtensions = (outlet) => {
81
82
  );
82
83
  };
83
84
 
85
+ const LAYOUTS_KEY = "scaffolder.layout.v1";
86
+ const LAYOUTS_WRAPPER_KEY = "scaffolder.layouts.wrapper.v1";
87
+
88
+ const useCustomLayouts = (outlet) => {
89
+ return useElementFilter(
90
+ outlet,
91
+ (elements) => elements.selectByComponentData({
92
+ key: LAYOUTS_WRAPPER_KEY
93
+ }).findComponentData({
94
+ key: LAYOUTS_KEY
95
+ })
96
+ );
97
+ };
98
+
99
+ function createScaffolderLayout(options) {
100
+ return {
101
+ expose() {
102
+ const LayoutDataHolder = () => null;
103
+ attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);
104
+ return LayoutDataHolder;
105
+ }
106
+ };
107
+ }
108
+ const ScaffolderLayouts = () => null;
109
+ attachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);
110
+
84
111
  function isObject(value) {
85
112
  return typeof value === "object" && value !== null && !Array.isArray(value);
86
113
  }
@@ -197,6 +224,37 @@ const createAsyncValidators = (rootSchema, validators, context) => {
197
224
  };
198
225
  };
199
226
 
227
+ const ReviewState = (props) => {
228
+ const reviewData = Object.fromEntries(
229
+ Object.entries(props.formState).map(([key, value]) => {
230
+ var _a;
231
+ for (const step of props.schemas) {
232
+ const parsedSchema = new Draft07(step.mergedSchema);
233
+ const definitionInSchema = parsedSchema.getSchema(
234
+ `#/${key}`,
235
+ props.formState
236
+ );
237
+ if (definitionInSchema) {
238
+ const backstageReviewOptions = (_a = definitionInSchema["ui:backstage"]) == null ? void 0 : _a.review;
239
+ if (backstageReviewOptions) {
240
+ if (backstageReviewOptions.mask) {
241
+ return [key, backstageReviewOptions.mask];
242
+ }
243
+ if (backstageReviewOptions.show === false) {
244
+ return [];
245
+ }
246
+ }
247
+ if (definitionInSchema["ui:widget"] === "password") {
248
+ return [key, "******"];
249
+ }
250
+ }
251
+ }
252
+ return [key, value];
253
+ })
254
+ );
255
+ return /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: reviewData });
256
+ };
257
+
200
258
  const useTemplateSchema = (manifest) => {
201
259
  const featureFlags = useApi(featureFlagsApiRef);
202
260
  const steps = manifest.steps.map(({ title, description, schema }) => ({
@@ -231,37 +289,6 @@ const useTemplateSchema = (manifest) => {
231
289
  };
232
290
  };
233
291
 
234
- const ReviewState = (props) => {
235
- const reviewData = Object.fromEntries(
236
- Object.entries(props.formState).map(([key, value]) => {
237
- var _a;
238
- for (const step of props.schemas) {
239
- const parsedSchema = new Draft07(step.mergedSchema);
240
- const definitionInSchema = parsedSchema.getSchema(
241
- `#/${key}`,
242
- props.formState
243
- );
244
- if (definitionInSchema) {
245
- const backstageReviewOptions = (_a = definitionInSchema["ui:backstage"]) == null ? void 0 : _a.review;
246
- if (backstageReviewOptions) {
247
- if (backstageReviewOptions.mask) {
248
- return [key, backstageReviewOptions.mask];
249
- }
250
- if (backstageReviewOptions.show === false) {
251
- return [];
252
- }
253
- }
254
- if (definitionInSchema["ui:widget"] === "password") {
255
- return [key, "******"];
256
- }
257
- }
258
- }
259
- return [key, value];
260
- })
261
- );
262
- return /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: reviewData });
263
- };
264
-
265
292
  const useFormDataFromQuery = (initialState) => {
266
293
  return useState(() => {
267
294
  if (initialState) {
@@ -278,7 +305,38 @@ const useFormDataFromQuery = (initialState) => {
278
305
  });
279
306
  };
280
307
 
281
- const useStyles$3 = makeStyles((theme) => ({
308
+ const useTemplateParameterSchema = (templateRef) => {
309
+ const scaffolderApi = useApi(scaffolderApiRef);
310
+ const { value, loading, error } = useAsync(
311
+ () => scaffolderApi.getTemplateParameterSchema(templateRef),
312
+ [scaffolderApi, templateRef]
313
+ );
314
+ return { manifest: value, loading, error };
315
+ };
316
+
317
+ const useTransformSchemaToProps = (step, options = {}) => {
318
+ var _a;
319
+ const { layouts = [] } = options;
320
+ const objectFieldTemplate = step == null ? void 0 : step.uiSchema["ui:ObjectFieldTemplate"];
321
+ if (typeof objectFieldTemplate !== "string") {
322
+ return step;
323
+ }
324
+ const Layout = (_a = layouts.find(
325
+ (layout) => layout.name === objectFieldTemplate
326
+ )) == null ? void 0 : _a.component;
327
+ if (!Layout) {
328
+ return step;
329
+ }
330
+ return {
331
+ ...step,
332
+ uiSchema: {
333
+ ...step.uiSchema,
334
+ ["ui:ObjectFieldTemplate"]: Layout
335
+ }
336
+ };
337
+ };
338
+
339
+ const useStyles$4 = makeStyles((theme) => ({
282
340
  backButton: {
283
341
  marginRight: theme.spacing(1)
284
342
  },
@@ -292,15 +350,21 @@ const useStyles$3 = makeStyles((theme) => ({
292
350
  }
293
351
  }));
294
352
  const Form = withTheme(require("@rjsf/material-ui-v5").Theme);
295
- const Stepper = (props) => {
353
+ const Stepper = (stepperProps) => {
296
354
  var _a;
355
+ const { layouts = [], components = {}, ...props } = stepperProps;
356
+ const {
357
+ ReviewStateComponent = ReviewState,
358
+ createButtonText = "Create",
359
+ reviewButtonText = "Review"
360
+ } = components;
297
361
  const analytics = useAnalytics();
298
362
  const { steps } = useTemplateSchema(props.manifest);
299
363
  const apiHolder = useApiHolder();
300
364
  const [activeStep, setActiveStep] = useState(0);
301
365
  const [formState, setFormState] = useFormDataFromQuery(props.initialState);
302
366
  const [errors, setErrors] = useState();
303
- const styles = useStyles$3();
367
+ const styles = useStyles$4();
304
368
  const extensions = useMemo(() => {
305
369
  return Object.fromEntries(
306
370
  props.extensions.map(({ name, component }) => [name, component])
@@ -325,7 +389,7 @@ const Stepper = (props) => {
325
389
  [setFormState]
326
390
  );
327
391
  const handleNext = async ({
328
- formData
392
+ formData = {}
329
393
  }) => {
330
394
  setErrors(void 0);
331
395
  const returnedValidation = await validation(formData);
@@ -347,6 +411,7 @@ const Stepper = (props) => {
347
411
  }
348
412
  setFormState((current) => ({ ...current, ...formData }));
349
413
  };
414
+ const currentStep = useTransformSchemaToProps(steps[activeStep], { layouts });
350
415
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Stepper$1, { activeStep, alternativeLabel: true, variant: "elevation" }, steps.map((step, index) => /* @__PURE__ */ React.createElement(Step, { key: index }, /* @__PURE__ */ React.createElement(StepLabel, null, step.title))), /* @__PURE__ */ React.createElement(Step, null, /* @__PURE__ */ React.createElement(StepLabel, null, "Review"))), /* @__PURE__ */ React.createElement("div", { className: styles.formWrapper }, activeStep < steps.length ? /* @__PURE__ */ React.createElement(
351
416
  Form,
352
417
  {
@@ -354,8 +419,8 @@ const Stepper = (props) => {
354
419
  extraErrors: errors,
355
420
  formData: formState,
356
421
  formContext: { formData: formState },
357
- schema: steps[activeStep].schema,
358
- uiSchema: steps[activeStep].uiSchema,
422
+ schema: currentStep.schema,
423
+ uiSchema: currentStep.uiSchema,
359
424
  onSubmit: handleNext,
360
425
  fields: extensions,
361
426
  showErrorList: false,
@@ -370,8 +435,8 @@ const Stepper = (props) => {
370
435
  disabled: activeStep < 1
371
436
  },
372
437
  "Back"
373
- ), /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "primary", type: "submit" }, activeStep === steps.length - 1 ? "Review" : "Next"))
374
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ReviewState, { formState, schemas: steps }), /* @__PURE__ */ React.createElement("div", { className: styles.footer }, /* @__PURE__ */ React.createElement(
438
+ ), /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "primary", type: "submit" }, activeStep === steps.length - 1 ? reviewButtonText : "Next"))
439
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ReviewStateComponent, { formState, schemas: steps }), /* @__PURE__ */ React.createElement("div", { className: styles.footer }, /* @__PURE__ */ React.createElement(
375
440
  Button,
376
441
  {
377
442
  onClick: handleBack,
@@ -385,7 +450,7 @@ const Stepper = (props) => {
385
450
  variant: "contained",
386
451
  onClick: () => {
387
452
  var _a2;
388
- props.onComplete(formState);
453
+ props.onCreate(formState);
389
454
  const name = typeof formState.name === "string" ? formState.name : void 0;
390
455
  analytics.captureEvent(
391
456
  "create",
@@ -393,11 +458,11 @@ const Stepper = (props) => {
393
458
  );
394
459
  }
395
460
  },
396
- "Create"
461
+ createButtonText
397
462
  )))));
398
463
  };
399
464
 
400
- const useStyles$2 = makeStyles(
465
+ const useStyles$3 = makeStyles(
401
466
  () => ({
402
467
  header: {
403
468
  backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage
@@ -417,7 +482,7 @@ const CardHeader = (props) => {
417
482
  } = props;
418
483
  const { getPageTheme } = useTheme();
419
484
  const themeForType = getPageTheme({ themeId: type });
420
- const styles = useStyles$2({
485
+ const styles = useStyles$3({
421
486
  cardBackgroundImage: themeForType.backgroundImage
422
487
  });
423
488
  const SubtitleComponent = /* @__PURE__ */ React.createElement("div", { className: styles.subtitleWrapper }, /* @__PURE__ */ React.createElement("div", null, type), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(FavoriteEntity, { entity: props.template, style: { padding: 0 } })));
@@ -431,18 +496,18 @@ const CardHeader = (props) => {
431
496
  );
432
497
  };
433
498
 
434
- const useStyles$1 = makeStyles(() => ({
499
+ const useStyles$2 = makeStyles(() => ({
435
500
  linkText: {
436
501
  display: "inline-flex",
437
502
  alignItems: "center"
438
503
  }
439
504
  }));
440
505
  const CardLink = ({ icon: Icon, text, url }) => {
441
- const styles = useStyles$1();
506
+ const styles = useStyles$2();
442
507
  return /* @__PURE__ */ React.createElement("div", { className: styles.linkText }, /* @__PURE__ */ React.createElement(Icon, { fontSize: "small" }), /* @__PURE__ */ React.createElement(Link, { style: { marginLeft: "8px" }, to: url }, text || url));
443
508
  };
444
509
 
445
- const useStyles = makeStyles((theme) => ({
510
+ const useStyles$1 = makeStyles((theme) => ({
446
511
  box: {
447
512
  overflow: "hidden",
448
513
  textOverflow: "ellipsis",
@@ -480,7 +545,7 @@ const useStyles = makeStyles((theme) => ({
480
545
  const TemplateCard = (props) => {
481
546
  var _a, _b, _c, _d, _e, _f, _g;
482
547
  const { template } = props;
483
- const styles = useStyles();
548
+ const styles = useStyles$1();
484
549
  const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);
485
550
  const app = useApp();
486
551
  const iconResolver = (key) => {
@@ -553,6 +618,55 @@ const TemplateGroup = (props) => {
553
618
  ))));
554
619
  };
555
620
 
621
+ const useStyles = makeStyles(() => ({
622
+ markdown: {
623
+ /** to make the styles for React Markdown not leak into the description */
624
+ "& :first-child": {
625
+ marginTop: 0
626
+ },
627
+ "& :last-child": {
628
+ marginBottom: 0
629
+ }
630
+ }
631
+ }));
632
+ const Workflow = (workflowProps) => {
633
+ var _a;
634
+ const { title, description, namespace, templateName, ...props } = workflowProps;
635
+ const styles = useStyles();
636
+ const templateRef = stringifyEntityRef({
637
+ kind: "Template",
638
+ namespace,
639
+ name: templateName
640
+ });
641
+ const errorApi = useApi(errorApiRef);
642
+ const { loading, manifest, error } = useTemplateParameterSchema(templateRef);
643
+ useEffect(() => {
644
+ if (error) {
645
+ errorApi.post(new Error(`Failed to load template, ${error}`));
646
+ }
647
+ }, [error, errorApi]);
648
+ if (error) {
649
+ return props.onError(error);
650
+ }
651
+ return /* @__PURE__ */ React.createElement(Content, null, loading && /* @__PURE__ */ React.createElement(Progress, null), manifest && /* @__PURE__ */ React.createElement(
652
+ InfoCard,
653
+ {
654
+ title: title != null ? title : manifest.title,
655
+ subheader: /* @__PURE__ */ React.createElement(
656
+ MarkdownContent,
657
+ {
658
+ className: styles.markdown,
659
+ content: (_a = description != null ? description : manifest.description) != null ? _a : "No description"
660
+ }
661
+ ),
662
+ noPadding: true,
663
+ titleTypographyProps: { component: "h2" }
664
+ },
665
+ /* @__PURE__ */ React.createElement(Stepper, { manifest, ...props })
666
+ ));
667
+ };
668
+ const EmbeddableWorkflow = (props) => /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(Workflow, { ...props }));
669
+
556
670
  function createNextScaffolderFieldExtension(options) {
557
671
  return {
558
672
  expose() {
@@ -567,5 +681,5 @@ function createNextScaffolderFieldExtension(options) {
567
681
  };
568
682
  }
569
683
 
570
- export { ReviewState, ScaffolderFieldExtensions, SecretsContextProvider, Stepper, TemplateCard, TemplateGroup, createFieldValidation, createNextScaffolderFieldExtension, createScaffolderFieldExtension, extractSchemaFromStep, scaffolderApiRef, useCustomFieldExtensions, useFormDataFromQuery, useTemplateSchema, useTemplateSecrets };
684
+ export { EmbeddableWorkflow, ReviewState, ScaffolderFieldExtensions, ScaffolderLayouts, SecretsContextProvider, Stepper, TemplateCard, TemplateGroup, Workflow, createFieldValidation, createNextScaffolderFieldExtension, createScaffolderFieldExtension, createScaffolderLayout, extractSchemaFromStep, scaffolderApiRef, useCustomFieldExtensions, useCustomLayouts, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema, useTemplateSecrets };
571
685
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/extensions/keys.ts","../src/extensions/index.tsx","../src/secrets/SecretsContext.tsx","../src/api/ref.ts","../src/hooks/useCustomFieldExtensions.ts","../src/next/lib/schema.ts","../src/next/components/Stepper/createAsyncValidators.ts","../src/next/hooks/useTemplateSchema.ts","../src/next/components/ReviewState/ReviewState.tsx","../src/next/hooks/useFormDataFromQuery.ts","../src/next/components/Stepper/Stepper.tsx","../src/next/components/TemplateCard/CardHeader.tsx","../src/next/components/TemplateCard/CardLink.tsx","../src/next/components/TemplateCard/TemplateCard.tsx","../src/next/components/TemplateGroup/TemplateGroup.tsx","../src/next/extensions/index.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\n/**\n * The key used to store the field extension data for any `<FieldExtension />` component\n */\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps = unknown,\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\nexport type {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport React, {\n useState,\n useCallback,\n useContext,\n PropsWithChildren,\n} from 'react';\n\n/**\n * The contents of the `SecretsContext`\n */\ntype SecretsContextContents = {\n secrets: Record<string, string>;\n setSecrets: React.Dispatch<React.SetStateAction<Record<string, string>>>;\n};\n\n/**\n * The context to hold the Secrets.\n */\nconst SecretsContext = createVersionedContext<{\n 1: SecretsContextContents;\n}>('secrets-context');\n\n/**\n * The Context Provider that holds the state for the secrets.\n * @public\n */\nexport const SecretsContextProvider = ({ children }: PropsWithChildren<{}>) => {\n const [secrets, setSecrets] = useState<Record<string, string>>({});\n\n return (\n <SecretsContext.Provider\n value={createVersionedValueMap({ 1: { secrets, setSecrets } })}\n >\n {children}\n </SecretsContext.Provider>\n );\n};\n\n/**\n * The return type from the useTemplateSecrets hook.\n * @public\n */\nexport interface ScaffolderUseTemplateSecrets {\n setSecrets: (input: Record<string, string>) => void;\n secrets: Record<string, string>;\n}\n\n/**\n * Hook to access the secrets context to be able to set secrets that are\n * passed to the Scaffolder backend.\n * @public\n */\nexport const useTemplateSecrets = (): ScaffolderUseTemplateSecrets => {\n const value = useContext(SecretsContext)?.atVersion(1);\n\n if (!value) {\n throw new Error(\n 'useTemplateSecrets must be used within a SecretsContextProvider',\n );\n }\n\n const { setSecrets: updateSecrets, secrets = {} } = value;\n\n const setSecrets = useCallback(\n (input: Record<string, string>) => {\n updateSecrets(currentSecrets => ({ ...currentSecrets, ...input }));\n },\n [updateSecrets],\n );\n\n return { setSecrets, secrets };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { ScaffolderApi } from './types';\nimport { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\n\n/** @public */\nexport const scaffolderApiRef = getOrCreateGlobalSingleton(\n 'scaffolder:scaffolder-api-ref',\n () =>\n createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n }),\n);\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { JsonObject } from '@backstage/types';\nimport { FieldValidation, UiSchema } from '@rjsf/utils';\n\nfunction isObject(value: unknown): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction extractUiSchema(schema: JsonObject, uiSchema: JsonObject) {\n if (!isObject(schema)) {\n return;\n }\n\n const { properties, items, anyOf, oneOf, allOf, dependencies } = schema;\n\n for (const propName in schema) {\n if (!schema.hasOwnProperty(propName)) {\n continue;\n }\n\n if (propName.startsWith('ui:')) {\n uiSchema[propName] = schema[propName];\n delete schema[propName];\n }\n }\n\n if (isObject(properties)) {\n for (const propName in properties) {\n if (!properties.hasOwnProperty(propName)) {\n continue;\n }\n\n const schemaNode = properties[propName];\n if (!isObject(schemaNode)) {\n continue;\n }\n const innerUiSchema = {};\n uiSchema[propName] = innerUiSchema;\n extractUiSchema(schemaNode, innerUiSchema);\n }\n }\n\n if (isObject(items)) {\n const innerUiSchema = {};\n uiSchema.items = innerUiSchema;\n extractUiSchema(items, innerUiSchema);\n }\n\n if (Array.isArray(anyOf)) {\n for (const schemaNode of anyOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(oneOf)) {\n for (const schemaNode of oneOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(allOf)) {\n for (const schemaNode of allOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (isObject(dependencies)) {\n for (const depName of Object.keys(dependencies)) {\n const schemaNode = dependencies[depName];\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n}\n\n/**\n * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf\n * @alpha\n */\nexport const extractSchemaFromStep = (\n inputStep: JsonObject,\n): { uiSchema: UiSchema; schema: JsonObject } => {\n const uiSchema: UiSchema = {};\n const returnSchema: JsonObject = JSON.parse(JSON.stringify(inputStep));\n extractUiSchema(returnSchema, uiSchema);\n return { uiSchema, schema: returnSchema };\n};\n\n/**\n * Creates a field validation object for use in react jsonschema form\n * @alpha\n */\nexport const createFieldValidation = (): FieldValidation => {\n const fieldValidation: FieldValidation = {\n __errors: [] as string[],\n addError: (message: string) => {\n fieldValidation.__errors?.push(message);\n },\n };\n\n return fieldValidation;\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport { JsonObject } from '@backstage/types';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { createFieldValidation } from '../../lib';\nimport { NextCustomFieldValidator } from '../../extensions';\n\nexport const createAsyncValidators = (\n rootSchema: JsonObject,\n validators: Record<string, undefined | NextCustomFieldValidator<unknown>>,\n context: {\n apiHolder: ApiHolder;\n },\n) => {\n async function validate(formData: JsonObject, pathPrefix: string = '#') {\n const parsedSchema = new JSONSchema(rootSchema);\n const formValidation: Record<string, FieldValidation> = {};\n for (const [key, value] of Object.entries(formData)) {\n const definitionInSchema = parsedSchema.getSchema(\n `${pathPrefix}/${key}`,\n formData,\n );\n\n if (definitionInSchema && 'ui:field' in definitionInSchema) {\n const validator = validators[definitionInSchema['ui:field']];\n if (validator) {\n const fieldValidation = createFieldValidation();\n try {\n await validator(value, fieldValidation, { ...context, formData });\n } catch (ex) {\n fieldValidation.addError(ex.message);\n }\n formValidation[key] = fieldValidation;\n }\n }\n }\n\n return formValidation;\n }\n\n return async (formData: JsonObject) => {\n return await validate(formData);\n };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '../../types';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): { steps: ParsedTemplateSchema[] } => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => ({\n ...step,\n schema: {\n ...step.schema,\n // Title is rendered at the top of the page, so let's ignore this from jsonschemaform\n title: undefined,\n properties: Object.fromEntries(\n Object.entries(step.schema.properties as JsonObject).filter(\n ([key]) => {\n const stepFeatureFlag =\n step.uiSchema[key]?.['ui:backstage']?.featureFlag;\n return stepFeatureFlag\n ? featureFlags.isActive(stepFeatureFlag)\n : true;\n },\n ),\n ),\n },\n }));\n\n return {\n steps: returningSteps,\n };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState).map(([key, value]) => {\n for (const step of props.schemas) {\n const parsedSchema = new JSONSchema(step.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema(\n `#/${key}`,\n props.formState,\n );\n if (definitionInSchema) {\n const backstageReviewOptions =\n definitionInSchema['ui:backstage']?.review;\n\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [key, backstageReviewOptions.mask];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (definitionInSchema['ui:widget'] === 'password') {\n return [key, '******'];\n }\n }\n }\n return [key, value];\n }),\n );\n return <StructuredMetadataTable metadata={reviewData} />;\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonValue } from '@backstage/types';\nimport qs from 'qs';\nimport { useState } from 'react';\n\n/**\n * This hook is used to get the formData from the query string.\n * @alpha\n */\nexport const useFormDataFromQuery = (\n initialState?: Record<string, JsonValue>,\n) => {\n return useState<Record<string, any>>(() => {\n if (initialState) {\n return initialState;\n }\n\n const query = qs.parse(window.location.search, {\n ignoreQueryPrefix: true,\n });\n\n try {\n return JSON.parse(query.formData as string);\n } catch (e) {\n return {};\n }\n });\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useAnalytics, useApiHolder } from '@backstage/core-plugin-api';\nimport { JsonValue } from '@backstage/types';\nimport {\n Stepper as MuiStepper,\n Step as MuiStep,\n StepLabel as MuiStepLabel,\n Button,\n makeStyles,\n} from '@material-ui/core';\nimport { type IChangeEvent, withTheme } from '@rjsf/core-v5';\nimport { ErrorSchema, FieldValidation } from '@rjsf/utils';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { NextFieldExtensionOptions } from '../../extensions';\nimport { TemplateParameterSchema } from '../../../types';\nimport { createAsyncValidators } from './createAsyncValidators';\nimport { useTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { ReviewState } from '../ReviewState';\nimport validator from '@rjsf/validator-ajv6';\n\nimport { useFormDataFromQuery } from '../../hooks';\nimport { FormProps } from '../../types';\n\nconst useStyles = makeStyles(theme => ({\n backButton: {\n marginRight: theme.spacing(1),\n },\n\n footer: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'right',\n },\n formWrapper: {\n padding: theme.spacing(2),\n },\n}));\n\n/**\n * The Props for {@link Stepper} component\n * @alpha\n */\nexport type StepperProps = {\n manifest: TemplateParameterSchema;\n extensions: NextFieldExtensionOptions<any, any>[];\n templateName?: string;\n FormProps?: FormProps;\n initialState?: Record<string, JsonValue>;\n\n onComplete: (values: Record<string, JsonValue>) => Promise<void>;\n};\n\n// TODO(blam): We require here, as the types in this package depend on @rjsf/core explicitly\n// which is what we're using here as the default types, it needs to depend on @rjsf/core-v5 because\n// of the re-writing we're doing. Once we've migrated, we can import this the exact same as before.\nconst Form = withTheme(require('@rjsf/material-ui-v5').Theme);\n\n/**\n * The `Stepper` component is the Wizard that is rendered when a user selects a template\n * @alpha\n */\nexport const Stepper = (props: StepperProps) => {\n const analytics = useAnalytics();\n const { steps } = useTemplateSchema(props.manifest);\n const apiHolder = useApiHolder();\n const [activeStep, setActiveStep] = useState(0);\n const [formState, setFormState] = useFormDataFromQuery(props.initialState);\n\n const [errors, setErrors] = useState<\n undefined | Record<string, FieldValidation>\n >();\n const styles = useStyles();\n\n const extensions = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, component }) => [name, component]),\n );\n }, [props.extensions]);\n\n const validators = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, validation }) => [name, validation]),\n );\n }, [props.extensions]);\n\n const validation = useMemo(() => {\n return createAsyncValidators(steps[activeStep]?.mergedSchema, validators, {\n apiHolder,\n });\n }, [steps, activeStep, validators, apiHolder]);\n\n const handleBack = () => {\n setActiveStep(prevActiveStep => prevActiveStep - 1);\n };\n\n const handleChange = useCallback(\n (e: IChangeEvent) =>\n setFormState(current => ({ ...current, ...e.formData })),\n [setFormState],\n );\n\n const handleNext = async ({\n formData,\n }: {\n formData: Record<string, JsonValue>;\n }) => {\n // TODO(blam): What do we do about loading states, does each field extension get a chance\n // to display it's own loading? Or should we grey out the entire form.\n setErrors(undefined);\n\n const returnedValidation = await validation(formData);\n\n const hasErrors = Object.values(returnedValidation).some(\n i => i.__errors?.length,\n );\n\n if (hasErrors) {\n setErrors(returnedValidation);\n } else {\n setErrors(undefined);\n setActiveStep(prevActiveStep => {\n const stepNum = prevActiveStep + 1;\n analytics.captureEvent('click', `Next Step (${stepNum})`);\n return stepNum;\n });\n }\n setFormState(current => ({ ...current, ...formData }));\n };\n\n return (\n <>\n <MuiStepper activeStep={activeStep} alternativeLabel variant=\"elevation\">\n {steps.map((step, index) => (\n <MuiStep key={index}>\n <MuiStepLabel>{step.title}</MuiStepLabel>\n </MuiStep>\n ))}\n <MuiStep>\n <MuiStepLabel>Review</MuiStepLabel>\n </MuiStep>\n </MuiStepper>\n <div className={styles.formWrapper}>\n {activeStep < steps.length ? (\n <Form\n validator={validator}\n extraErrors={errors as unknown as ErrorSchema}\n formData={formState}\n formContext={{ formData: formState }}\n schema={steps[activeStep].schema}\n uiSchema={steps[activeStep].uiSchema}\n onSubmit={handleNext}\n fields={extensions}\n showErrorList={false}\n onChange={handleChange}\n {...(props.FormProps ?? {})}\n >\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1}\n >\n Back\n </Button>\n <Button variant=\"contained\" color=\"primary\" type=\"submit\">\n {activeStep === steps.length - 1 ? 'Review' : 'Next'}\n </Button>\n </div>\n </Form>\n ) : (\n <>\n <ReviewState formState={formState} schemas={steps} />\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1}\n >\n Back\n </Button>\n <Button\n variant=\"contained\"\n onClick={() => {\n props.onComplete(formState);\n const name =\n typeof formState.name === 'string'\n ? formState.name\n : undefined;\n analytics.captureEvent(\n 'create',\n name ?? props.templateName ?? 'unknown',\n );\n }}\n >\n Create\n </Button>\n </div>\n </>\n )}\n </div>\n </>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles, useTheme } from '@material-ui/core';\nimport { ItemCardHeader } from '@backstage/core-components';\nimport { BackstageTheme } from '@backstage/theme';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { FavoriteEntity } from '@backstage/plugin-catalog-react';\n\nconst useStyles = makeStyles<BackstageTheme, { cardBackgroundImage: string }>(\n () => ({\n header: {\n backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,\n },\n subtitleWrapper: {\n display: 'flex',\n justifyContent: 'space-between',\n },\n }),\n);\n\n/**\n * Props for the CardHeader component\n */\nexport interface CardHeaderProps {\n template: TemplateEntityV1beta3;\n}\n\n/**\n * The Card Header with the background for the TemplateCard.\n */\nexport const CardHeader = (props: CardHeaderProps) => {\n const {\n template: {\n metadata: { title, name },\n spec: { type },\n },\n } = props;\n const { getPageTheme } = useTheme<BackstageTheme>();\n const themeForType = getPageTheme({ themeId: type });\n\n const styles = useStyles({\n cardBackgroundImage: themeForType.backgroundImage,\n });\n\n const SubtitleComponent = (\n <div className={styles.subtitleWrapper}>\n <div>{type}</div>\n <div>\n <FavoriteEntity entity={props.template} style={{ padding: 0 }} />\n </div>\n </div>\n );\n\n return (\n <ItemCardHeader\n title={title ?? name}\n subtitle={SubtitleComponent}\n classes={{ root: styles.header }}\n />\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport { BackstageTheme } from '@backstage/theme';\nimport { Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core';\nimport React from 'react';\n\ninterface CardLinkProps {\n icon: IconComponent;\n text: string;\n url: string;\n}\n\nconst useStyles = makeStyles<BackstageTheme>(() => ({\n linkText: {\n display: 'inline-flex',\n alignItems: 'center',\n },\n}));\n\nexport const CardLink = ({ icon: Icon, text, url }: CardLinkProps) => {\n const styles = useStyles();\n\n return (\n <div className={styles.linkText}>\n <Icon fontSize=\"small\" />\n <Link style={{ marginLeft: '8px' }} to={url}>\n {text || url}\n </Link>\n </div>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { MarkdownContent, UserIcon } from '@backstage/core-components';\nimport { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { BackstageTheme } from '@backstage/theme';\nimport {\n Box,\n Card,\n CardActions,\n CardContent,\n Chip,\n Divider,\n Button,\n Grid,\n makeStyles,\n} from '@material-ui/core';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport React from 'react';\nimport { CardHeader } from './CardHeader';\nimport { CardLink } from './CardLink';\n\nconst useStyles = makeStyles<BackstageTheme>(theme => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n },\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n margin: 0,\n },\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n lineHeight: 1,\n fontSize: '0.75rem',\n },\n footer: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: 1,\n alignItems: 'center',\n },\n ownedBy: {\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n color: theme.palette.link,\n },\n}));\n\n/**\n * The Props for the {@link TemplateCard} component\n * @alpha\n */\nexport interface TemplateCardProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n\n onSelected?: (template: TemplateEntityV1beta3) => void;\n}\n\n/**\n * The `TemplateCard` component that is rendered in a list for each template\n * @alpha\n */\nexport const TemplateCard = (props: TemplateCardProps) => {\n const { template } = props;\n const styles = useStyles();\n const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);\n const app = useApp();\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n\n return (\n <Card>\n <CardHeader template={template} />\n <CardContent>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Box className={styles.box}>\n <MarkdownContent\n className={styles.markdown}\n content={template.metadata.description ?? 'No description'}\n />\n </Box>\n </Grid>\n {(template.metadata.tags?.length ?? 0) > 0 && (\n <>\n <Grid item xs={12}>\n <Divider />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2}>\n {template.metadata.tags?.map(tag => (\n <Grid item>\n <Chip\n style={{ margin: 0 }}\n size=\"small\"\n label={tag}\n key={tag}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n )}\n {(props.additionalLinks || template.metadata.links?.length) && (\n <>\n <Grid item xs={12}>\n <Divider />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2}>\n {props.additionalLinks?.map(({ icon, text, url }) => (\n <Grid className={styles.linkText} item xs={6}>\n <CardLink icon={icon} text={text} url={url} />\n </Grid>\n ))}\n {template.metadata.links?.map(({ url, icon, title }) => (\n <Grid className={styles.linkText} item xs={6}>\n <CardLink\n icon={iconResolver(icon)}\n text={title || url}\n url={url}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n )}\n </Grid>\n </CardContent>\n <CardActions style={{ padding: '16px' }}>\n <div className={styles.footer}>\n <div className={styles.ownedBy}>\n {ownedByRelations.length > 0 && (\n <>\n <UserIcon fontSize=\"small\" />\n <EntityRefLinks\n style={{ marginLeft: '8px' }}\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n />\n </>\n )}\n </div>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => props.onSelected?.(template)}\n >\n Choose\n </Button>\n </div>\n </CardActions>\n </Card>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport React from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n Link,\n} from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateCardProps, TemplateCard } from '../TemplateCard';\nimport { IconComponent } from '@backstage/core-plugin-api';\n\n/**\n * The props for the {@link TemplateGroup} component.\n * @alpha\n */\nexport interface TemplateGroupProps {\n templates: {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n }[];\n onSelected: (template: TemplateEntityV1beta3) => void;\n title: React.ReactNode;\n components?: {\n CardComponent?: React.ComponentType<TemplateCardProps>;\n };\n}\n\n/**\n * The `TemplateGroup` component is used to display a group of templates with a title.\n * @alpha\n */\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const {\n templates,\n title,\n components: { CardComponent } = {},\n onSelected,\n } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return (\n <Content>\n {titleComponent}\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n </Content>\n );\n }\n\n const Card = CardComponent || TemplateCard;\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(({ template, additionalLinks }) => (\n <Card\n key={stringifyEntityRef(template)}\n additionalLinks={additionalLinks}\n template={template}\n onSelected={onSelected}\n />\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n NextCustomFieldValidator,\n NextFieldExtensionOptions,\n NextFieldExtensionComponentProps,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { UIOptionsType } from '@rjsf/utils';\nimport { FieldExtensionComponent } from '../../extensions';\nimport { FIELD_EXTENSION_KEY } from '../../extensions/keys';\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @alpha\n */\nexport function createNextScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps extends UIOptionsType = {},\n>(\n options: NextFieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\nexport type {\n NextCustomFieldValidator,\n NextFieldExtensionOptions,\n NextFieldExtensionComponentProps,\n};\n"],"names":["JSONSchema","useStyles","validation","_a","MuiStepper","MuiStep","MuiStepLabel"],"mappings":";;;;;;;;;;;;;AAgBO,MAAM,2BAA8B,GAAA,kCAAA,CAAA;AAIpC,MAAM,mBAAsB,GAAA,gCAAA;;ACiB5B,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA,CAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA,OAAA;AAAA,OACF,CAAA;AAEA,MAAO,OAAA,wBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF,CAAA;AAOO,MAAM,4BAET,MAA0B,KAAA;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,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA,OAAA;AAAA,OACF,CAAA;AAEA,MAAO,OAAA,wBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/extensions/keys.ts","../src/extensions/index.tsx","../src/secrets/SecretsContext.tsx","../src/api/ref.ts","../src/hooks/useCustomFieldExtensions.ts","../src/layouts/keys.ts","../src/hooks/useCustomLayouts.ts","../src/layouts/createScaffolderLayout.ts","../src/next/lib/schema.ts","../src/next/components/Stepper/createAsyncValidators.ts","../src/next/components/ReviewState/ReviewState.tsx","../src/next/hooks/useTemplateSchema.ts","../src/next/hooks/useFormDataFromQuery.ts","../src/next/hooks/useTemplateParameterSchema.ts","../src/next/hooks/useTransformSchemaToProps.ts","../src/next/components/Stepper/Stepper.tsx","../src/next/components/TemplateCard/CardHeader.tsx","../src/next/components/TemplateCard/CardLink.tsx","../src/next/components/TemplateCard/TemplateCard.tsx","../src/next/components/TemplateGroup/TemplateGroup.tsx","../src/next/components/Workflow/Workflow.tsx","../src/next/extensions/index.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\n/**\n * The key used to store the field extension data for any `<FieldExtension />` component\n */\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * The type used to wrap up the Layout and embed the input props\n *\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps = unknown,\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\nexport type {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport React, {\n useState,\n useCallback,\n useContext,\n PropsWithChildren,\n} from 'react';\n\n/**\n * The contents of the `SecretsContext`\n */\ntype SecretsContextContents = {\n secrets: Record<string, string>;\n setSecrets: React.Dispatch<React.SetStateAction<Record<string, string>>>;\n};\n\n/**\n * The context to hold the Secrets.\n */\nconst SecretsContext = createVersionedContext<{\n 1: SecretsContextContents;\n}>('secrets-context');\n\n/**\n * The Context Provider that holds the state for the secrets.\n * @public\n */\nexport const SecretsContextProvider = ({ children }: PropsWithChildren<{}>) => {\n const [secrets, setSecrets] = useState<Record<string, string>>({});\n\n return (\n <SecretsContext.Provider\n value={createVersionedValueMap({ 1: { secrets, setSecrets } })}\n >\n {children}\n </SecretsContext.Provider>\n );\n};\n\n/**\n * The return type from the useTemplateSecrets hook.\n * @public\n */\nexport interface ScaffolderUseTemplateSecrets {\n setSecrets: (input: Record<string, string>) => void;\n secrets: Record<string, string>;\n}\n\n/**\n * Hook to access the secrets context to be able to set secrets that are\n * passed to the Scaffolder backend.\n * @public\n */\nexport const useTemplateSecrets = (): ScaffolderUseTemplateSecrets => {\n const value = useContext(SecretsContext)?.atVersion(1);\n\n if (!value) {\n throw new Error(\n 'useTemplateSecrets must be used within a SecretsContextProvider',\n );\n }\n\n const { setSecrets: updateSecrets, secrets = {} } = value;\n\n const setSecrets = useCallback(\n (input: Record<string, string>) => {\n updateSecrets(currentSecrets => ({ ...currentSecrets, ...input }));\n },\n [updateSecrets],\n );\n\n return { setSecrets, secrets };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { ScaffolderApi } from './types';\nimport { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\n\n/** @public */\nexport const scaffolderApiRef = getOrCreateGlobalSingleton(\n 'scaffolder:scaffolder-api-ref',\n () =>\n createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n }),\n);\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../layouts/keys';\nimport { LayoutOptions } from '../layouts';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomLayouts = <TComponentDataType = LayoutOptions>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUTS_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: LAYOUTS_KEY,\n }),\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core-v5';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: React.ComponentType = (): JSX.Element | null =>\n null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { JsonObject } from '@backstage/types';\nimport { FieldValidation, UiSchema } from '@rjsf/utils';\n\nfunction isObject(value: unknown): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction extractUiSchema(schema: JsonObject, uiSchema: JsonObject) {\n if (!isObject(schema)) {\n return;\n }\n\n const { properties, items, anyOf, oneOf, allOf, dependencies } = schema;\n\n for (const propName in schema) {\n if (!schema.hasOwnProperty(propName)) {\n continue;\n }\n\n if (propName.startsWith('ui:')) {\n uiSchema[propName] = schema[propName];\n delete schema[propName];\n }\n }\n\n if (isObject(properties)) {\n for (const propName in properties) {\n if (!properties.hasOwnProperty(propName)) {\n continue;\n }\n\n const schemaNode = properties[propName];\n if (!isObject(schemaNode)) {\n continue;\n }\n const innerUiSchema = {};\n uiSchema[propName] = innerUiSchema;\n extractUiSchema(schemaNode, innerUiSchema);\n }\n }\n\n if (isObject(items)) {\n const innerUiSchema = {};\n uiSchema.items = innerUiSchema;\n extractUiSchema(items, innerUiSchema);\n }\n\n if (Array.isArray(anyOf)) {\n for (const schemaNode of anyOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(oneOf)) {\n for (const schemaNode of oneOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (Array.isArray(allOf)) {\n for (const schemaNode of allOf) {\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n\n if (isObject(dependencies)) {\n for (const depName of Object.keys(dependencies)) {\n const schemaNode = dependencies[depName];\n if (!isObject(schemaNode)) {\n continue;\n }\n extractUiSchema(schemaNode, uiSchema);\n }\n }\n}\n\n/**\n * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf\n * @alpha\n */\nexport const extractSchemaFromStep = (\n inputStep: JsonObject,\n): { uiSchema: UiSchema; schema: JsonObject } => {\n const uiSchema: UiSchema = {};\n const returnSchema: JsonObject = JSON.parse(JSON.stringify(inputStep));\n extractUiSchema(returnSchema, uiSchema);\n return { uiSchema, schema: returnSchema };\n};\n\n/**\n * Creates a field validation object for use in react jsonschema form\n * @alpha\n */\nexport const createFieldValidation = (): FieldValidation => {\n const fieldValidation: FieldValidation = {\n __errors: [] as string[],\n addError: (message: string) => {\n fieldValidation.__errors?.push(message);\n },\n };\n\n return fieldValidation;\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport { JsonObject } from '@backstage/types';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { createFieldValidation } from '../../lib';\nimport { NextCustomFieldValidator } from '../../extensions';\n\nexport const createAsyncValidators = (\n rootSchema: JsonObject,\n validators: Record<string, undefined | NextCustomFieldValidator<unknown>>,\n context: {\n apiHolder: ApiHolder;\n },\n) => {\n async function validate(formData: JsonObject, pathPrefix: string = '#') {\n const parsedSchema = new JSONSchema(rootSchema);\n const formValidation: Record<string, FieldValidation> = {};\n for (const [key, value] of Object.entries(formData)) {\n const definitionInSchema = parsedSchema.getSchema(\n `${pathPrefix}/${key}`,\n formData,\n );\n\n if (definitionInSchema && 'ui:field' in definitionInSchema) {\n const validator = validators[definitionInSchema['ui:field']];\n if (validator) {\n const fieldValidation = createFieldValidation();\n try {\n await validator(value, fieldValidation, { ...context, formData });\n } catch (ex) {\n fieldValidation.addError(ex.message);\n }\n formValidation[key] = fieldValidation;\n }\n }\n }\n\n return formValidation;\n }\n\n return async (formData: JsonObject) => {\n return await validate(formData);\n };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState).map(([key, value]) => {\n for (const step of props.schemas) {\n const parsedSchema = new JSONSchema(step.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema(\n `#/${key}`,\n props.formState,\n );\n if (definitionInSchema) {\n const backstageReviewOptions =\n definitionInSchema['ui:backstage']?.review;\n\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [key, backstageReviewOptions.mask];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (definitionInSchema['ui:widget'] === 'password') {\n return [key, '******'];\n }\n }\n }\n return [key, value];\n }),\n );\n return <StructuredMetadataTable metadata={reviewData} />;\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';\nimport { JsonObject } from '@backstage/types';\nimport { UiSchema } from '@rjsf/utils';\nimport { TemplateParameterSchema } from '../../types';\nimport { extractSchemaFromStep } from '../lib';\n\n/**\n * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.\n * @alpha\n */\nexport interface ParsedTemplateSchema {\n uiSchema: UiSchema;\n mergedSchema: JsonObject;\n schema: JsonObject;\n title: string;\n description?: string;\n}\n\n/**\n * This hook will parse the template schema and return the steps with the\n * parsed schema and uiSchema. Filtering out any steps or properties that\n * are not enabled with feature flags.\n * @alpha\n */\nexport const useTemplateSchema = (\n manifest: TemplateParameterSchema,\n): { steps: ParsedTemplateSchema[] } => {\n const featureFlags = useApi(featureFlagsApiRef);\n const steps = manifest.steps.map(({ title, description, schema }) => ({\n title,\n description,\n mergedSchema: schema,\n ...extractSchemaFromStep(schema),\n }));\n\n const returningSteps = steps\n // Filter out steps that are not enabled with the feature flags\n .filter(step => {\n const stepFeatureFlag = step.uiSchema['ui:backstage']?.featureFlag;\n return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;\n })\n // Then filter out the properties that are not enabled with feature flag\n .map(step => ({\n ...step,\n schema: {\n ...step.schema,\n // Title is rendered at the top of the page, so let's ignore this from jsonschemaform\n title: undefined,\n properties: Object.fromEntries(\n Object.entries(step.schema.properties as JsonObject).filter(\n ([key]) => {\n const stepFeatureFlag =\n step.uiSchema[key]?.['ui:backstage']?.featureFlag;\n return stepFeatureFlag\n ? featureFlags.isActive(stepFeatureFlag)\n : true;\n },\n ),\n ),\n },\n }));\n\n return {\n steps: returningSteps,\n };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonValue } from '@backstage/types';\nimport qs from 'qs';\nimport { useState } from 'react';\n\n/**\n * This hook is used to get the formData from the query string.\n * @alpha\n */\nexport const useFormDataFromQuery = (\n initialState?: Record<string, JsonValue>,\n) => {\n return useState<Record<string, any>>(() => {\n if (initialState) {\n return initialState;\n }\n\n const query = qs.parse(window.location.search, {\n ignoreQueryPrefix: true,\n });\n\n try {\n return JSON.parse(query.formData as string);\n } catch (e) {\n return {};\n }\n });\n};\n","import { useApi } from '@backstage/core-plugin-api';\n\n/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/lib/useAsync';\nimport { scaffolderApiRef } from '../../api/ref';\n\n/**\n * @alpha\n */\nexport const useTemplateParameterSchema = (templateRef: string) => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const { value, loading, error } = useAsync(\n () => scaffolderApi.getTemplateParameterSchema(templateRef),\n [scaffolderApi, templateRef],\n );\n\n return { manifest: value, loading, error };\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { type ParsedTemplateSchema } from './useTemplateSchema';\nimport { type LayoutOptions } from '../../layouts';\n\ninterface Options {\n layouts?: LayoutOptions[];\n}\n\nexport const useTransformSchemaToProps = (\n step: ParsedTemplateSchema,\n options: Options = {},\n): ParsedTemplateSchema => {\n const { layouts = [] } = options;\n const objectFieldTemplate = step?.uiSchema['ui:ObjectFieldTemplate'] as\n | string\n | undefined;\n\n if (typeof objectFieldTemplate !== 'string') {\n return step;\n }\n\n const Layout = layouts.find(\n layout => layout.name === objectFieldTemplate,\n )?.component;\n\n if (!Layout) {\n return step;\n }\n\n return {\n ...step,\n uiSchema: {\n ...step.uiSchema,\n ['ui:ObjectFieldTemplate']: Layout,\n },\n };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useAnalytics, useApiHolder } from '@backstage/core-plugin-api';\nimport { JsonValue } from '@backstage/types';\nimport {\n Stepper as MuiStepper,\n Step as MuiStep,\n StepLabel as MuiStepLabel,\n Button,\n makeStyles,\n} from '@material-ui/core';\nimport { type IChangeEvent, withTheme } from '@rjsf/core-v5';\nimport { ErrorSchema, FieldValidation } from '@rjsf/utils';\nimport React, { useCallback, useMemo, useState, type ReactNode } from 'react';\nimport { NextFieldExtensionOptions } from '../../extensions';\nimport { TemplateParameterSchema } from '../../../types';\nimport { createAsyncValidators } from './createAsyncValidators';\nimport { ReviewState, type ReviewStateProps } from '../ReviewState';\nimport { useTemplateSchema } from '../../hooks/useTemplateSchema';\nimport validator from '@rjsf/validator-ajv8';\nimport { useFormDataFromQuery } from '../../hooks';\nimport { FormProps } from '../../types';\nimport { LayoutOptions } from '../../../layouts';\nimport { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';\n\nconst useStyles = makeStyles(theme => ({\n backButton: {\n marginRight: theme.spacing(1),\n },\n\n footer: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'right',\n },\n formWrapper: {\n padding: theme.spacing(2),\n },\n}));\n\n/**\n * The Props for {@link Stepper} component\n * @alpha\n */\nexport type StepperProps = {\n manifest: TemplateParameterSchema;\n extensions: NextFieldExtensionOptions<any, any>[];\n templateName?: string;\n FormProps?: FormProps;\n initialState?: Record<string, JsonValue>;\n onCreate: (values: Record<string, JsonValue>) => Promise<void>;\n components?: {\n ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;\n createButtonText?: ReactNode;\n reviewButtonText?: ReactNode;\n };\n layouts?: LayoutOptions[];\n};\n\n// TODO(blam): We require here, as the types in this package depend on @rjsf/core explicitly\n// which is what we're using here as the default types, it needs to depend on @rjsf/core-v5 because\n// of the re-writing we're doing. Once we've migrated, we can import this the exact same as before.\nconst Form = withTheme(require('@rjsf/material-ui-v5').Theme);\n\n/**\n * The `Stepper` component is the Wizard that is rendered when a user selects a template\n * @alpha\n */\nexport const Stepper = (stepperProps: StepperProps) => {\n const { layouts = [], components = {}, ...props } = stepperProps;\n const {\n ReviewStateComponent = ReviewState,\n createButtonText = 'Create',\n reviewButtonText = 'Review',\n } = components;\n const analytics = useAnalytics();\n const { steps } = useTemplateSchema(props.manifest);\n const apiHolder = useApiHolder();\n const [activeStep, setActiveStep] = useState(0);\n const [formState, setFormState] = useFormDataFromQuery(props.initialState);\n\n const [errors, setErrors] = useState<\n undefined | Record<string, FieldValidation>\n >();\n const styles = useStyles();\n\n const extensions = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, component }) => [name, component]),\n );\n }, [props.extensions]);\n\n const validators = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, validation }) => [name, validation]),\n );\n }, [props.extensions]);\n\n const validation = useMemo(() => {\n return createAsyncValidators(steps[activeStep]?.mergedSchema, validators, {\n apiHolder,\n });\n }, [steps, activeStep, validators, apiHolder]);\n\n const handleBack = () => {\n setActiveStep(prevActiveStep => prevActiveStep - 1);\n };\n\n const handleChange = useCallback(\n (e: IChangeEvent) =>\n setFormState(current => ({ ...current, ...e.formData })),\n [setFormState],\n );\n\n const handleNext = async ({\n formData = {},\n }: {\n formData?: Record<string, JsonValue>;\n }) => {\n // TODO(blam): What do we do about loading states, does each field extension get a chance\n // to display it's own loading? Or should we grey out the entire form.\n setErrors(undefined);\n\n const returnedValidation = await validation(formData);\n\n const hasErrors = Object.values(returnedValidation).some(\n i => i.__errors?.length,\n );\n\n if (hasErrors) {\n setErrors(returnedValidation);\n } else {\n setErrors(undefined);\n setActiveStep(prevActiveStep => {\n const stepNum = prevActiveStep + 1;\n analytics.captureEvent('click', `Next Step (${stepNum})`);\n return stepNum;\n });\n }\n setFormState(current => ({ ...current, ...formData }));\n };\n\n const currentStep = useTransformSchemaToProps(steps[activeStep], { layouts });\n\n return (\n <>\n <MuiStepper activeStep={activeStep} alternativeLabel variant=\"elevation\">\n {steps.map((step, index) => (\n <MuiStep key={index}>\n <MuiStepLabel>{step.title}</MuiStepLabel>\n </MuiStep>\n ))}\n <MuiStep>\n <MuiStepLabel>Review</MuiStepLabel>\n </MuiStep>\n </MuiStepper>\n <div className={styles.formWrapper}>\n {activeStep < steps.length ? (\n <Form\n validator={validator}\n extraErrors={errors as unknown as ErrorSchema}\n formData={formState}\n formContext={{ formData: formState }}\n schema={currentStep.schema}\n uiSchema={currentStep.uiSchema}\n onSubmit={handleNext}\n fields={extensions}\n showErrorList={false}\n onChange={handleChange}\n {...(props.FormProps ?? {})}\n >\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1}\n >\n Back\n </Button>\n <Button variant=\"contained\" color=\"primary\" type=\"submit\">\n {activeStep === steps.length - 1 ? reviewButtonText : 'Next'}\n </Button>\n </div>\n </Form>\n ) : (\n <>\n <ReviewStateComponent formState={formState} schemas={steps} />\n <div className={styles.footer}>\n <Button\n onClick={handleBack}\n className={styles.backButton}\n disabled={activeStep < 1}\n >\n Back\n </Button>\n <Button\n variant=\"contained\"\n onClick={() => {\n props.onCreate(formState);\n const name =\n typeof formState.name === 'string'\n ? formState.name\n : undefined;\n analytics.captureEvent(\n 'create',\n name ?? props.templateName ?? 'unknown',\n );\n }}\n >\n {createButtonText}\n </Button>\n </div>\n </>\n )}\n </div>\n </>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles, useTheme } from '@material-ui/core';\nimport { ItemCardHeader } from '@backstage/core-components';\nimport { BackstageTheme } from '@backstage/theme';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { FavoriteEntity } from '@backstage/plugin-catalog-react';\n\nconst useStyles = makeStyles<BackstageTheme, { cardBackgroundImage: string }>(\n () => ({\n header: {\n backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,\n },\n subtitleWrapper: {\n display: 'flex',\n justifyContent: 'space-between',\n },\n }),\n);\n\n/**\n * Props for the CardHeader component\n */\nexport interface CardHeaderProps {\n template: TemplateEntityV1beta3;\n}\n\n/**\n * The Card Header with the background for the TemplateCard.\n */\nexport const CardHeader = (props: CardHeaderProps) => {\n const {\n template: {\n metadata: { title, name },\n spec: { type },\n },\n } = props;\n const { getPageTheme } = useTheme<BackstageTheme>();\n const themeForType = getPageTheme({ themeId: type });\n\n const styles = useStyles({\n cardBackgroundImage: themeForType.backgroundImage,\n });\n\n const SubtitleComponent = (\n <div className={styles.subtitleWrapper}>\n <div>{type}</div>\n <div>\n <FavoriteEntity entity={props.template} style={{ padding: 0 }} />\n </div>\n </div>\n );\n\n return (\n <ItemCardHeader\n title={title ?? name}\n subtitle={SubtitleComponent}\n classes={{ root: styles.header }}\n />\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport { BackstageTheme } from '@backstage/theme';\nimport { Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core';\nimport React from 'react';\n\ninterface CardLinkProps {\n icon: IconComponent;\n text: string;\n url: string;\n}\n\nconst useStyles = makeStyles<BackstageTheme>(() => ({\n linkText: {\n display: 'inline-flex',\n alignItems: 'center',\n },\n}));\n\nexport const CardLink = ({ icon: Icon, text, url }: CardLinkProps) => {\n const styles = useStyles();\n\n return (\n <div className={styles.linkText}>\n <Icon fontSize=\"small\" />\n <Link style={{ marginLeft: '8px' }} to={url}>\n {text || url}\n </Link>\n </div>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { MarkdownContent, UserIcon } from '@backstage/core-components';\nimport { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { BackstageTheme } from '@backstage/theme';\nimport {\n Box,\n Card,\n CardActions,\n CardContent,\n Chip,\n Divider,\n Button,\n Grid,\n makeStyles,\n} from '@material-ui/core';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport React from 'react';\nimport { CardHeader } from './CardHeader';\nimport { CardLink } from './CardLink';\n\nconst useStyles = makeStyles<BackstageTheme>(theme => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n },\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n margin: 0,\n },\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n lineHeight: 1,\n fontSize: '0.75rem',\n },\n footer: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: 1,\n alignItems: 'center',\n },\n ownedBy: {\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n color: theme.palette.link,\n },\n}));\n\n/**\n * The Props for the {@link TemplateCard} component\n * @alpha\n */\nexport interface TemplateCardProps {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n\n onSelected?: (template: TemplateEntityV1beta3) => void;\n}\n\n/**\n * The `TemplateCard` component that is rendered in a list for each template\n * @alpha\n */\nexport const TemplateCard = (props: TemplateCardProps) => {\n const { template } = props;\n const styles = useStyles();\n const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);\n const app = useApp();\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n\n return (\n <Card>\n <CardHeader template={template} />\n <CardContent>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Box className={styles.box}>\n <MarkdownContent\n className={styles.markdown}\n content={template.metadata.description ?? 'No description'}\n />\n </Box>\n </Grid>\n {(template.metadata.tags?.length ?? 0) > 0 && (\n <>\n <Grid item xs={12}>\n <Divider />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2}>\n {template.metadata.tags?.map(tag => (\n <Grid item>\n <Chip\n style={{ margin: 0 }}\n size=\"small\"\n label={tag}\n key={tag}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n )}\n {(props.additionalLinks || template.metadata.links?.length) && (\n <>\n <Grid item xs={12}>\n <Divider />\n </Grid>\n <Grid item xs={12}>\n <Grid container spacing={2}>\n {props.additionalLinks?.map(({ icon, text, url }) => (\n <Grid className={styles.linkText} item xs={6}>\n <CardLink icon={icon} text={text} url={url} />\n </Grid>\n ))}\n {template.metadata.links?.map(({ url, icon, title }) => (\n <Grid className={styles.linkText} item xs={6}>\n <CardLink\n icon={iconResolver(icon)}\n text={title || url}\n url={url}\n />\n </Grid>\n ))}\n </Grid>\n </Grid>\n </>\n )}\n </Grid>\n </CardContent>\n <CardActions style={{ padding: '16px' }}>\n <div className={styles.footer}>\n <div className={styles.ownedBy}>\n {ownedByRelations.length > 0 && (\n <>\n <UserIcon fontSize=\"small\" />\n <EntityRefLinks\n style={{ marginLeft: '8px' }}\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n />\n </>\n )}\n </div>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => props.onSelected?.(template)}\n >\n Choose\n </Button>\n </div>\n </CardActions>\n </Card>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport React from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n Link,\n} from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateCardProps, TemplateCard } from '../TemplateCard';\nimport { IconComponent } from '@backstage/core-plugin-api';\n\n/**\n * The props for the {@link TemplateGroup} component.\n * @alpha\n */\nexport interface TemplateGroupProps {\n templates: {\n template: TemplateEntityV1beta3;\n additionalLinks?: {\n icon: IconComponent;\n text: string;\n url: string;\n }[];\n }[];\n onSelected: (template: TemplateEntityV1beta3) => void;\n title: React.ReactNode;\n components?: {\n CardComponent?: React.ComponentType<TemplateCardProps>;\n };\n}\n\n/**\n * The `TemplateGroup` component is used to display a group of templates with a title.\n * @alpha\n */\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const {\n templates,\n title,\n components: { CardComponent } = {},\n onSelected,\n } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return (\n <Content>\n {titleComponent}\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n </Content>\n );\n }\n\n const Card = CardComponent || TemplateCard;\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(({ template, additionalLinks }) => (\n <Card\n key={stringifyEntityRef(template)}\n additionalLinks={additionalLinks}\n template={template}\n onSelected={onSelected}\n />\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect } from 'react';\nimport {\n Content,\n InfoCard,\n MarkdownContent,\n Progress,\n} from '@backstage/core-components';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { makeStyles } from '@material-ui/core';\nimport { BackstageTheme } from '@backstage/theme';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useTemplateParameterSchema } from '../../hooks/useTemplateParameterSchema';\nimport { Stepper, type StepperProps } from '../Stepper/Stepper';\nimport { SecretsContextProvider } from '../../../secrets/SecretsContext';\n\nconst useStyles = makeStyles<BackstageTheme>(() => ({\n markdown: {\n /** to make the styles for React Markdown not leak into the description */\n '& :first-child': {\n marginTop: 0,\n },\n '& :last-child': {\n marginBottom: 0,\n },\n },\n}));\n\n/**\n * @alpha\n */\nexport type WorkflowProps = {\n title?: string;\n description?: string;\n namespace: string;\n templateName: string;\n onError(error: Error | undefined): JSX.Element | null;\n} & Pick<\n StepperProps,\n | 'extensions'\n | 'FormProps'\n | 'components'\n | 'onCreate'\n | 'initialState'\n | 'layouts'\n>;\n\n/**\n * @alpha\n */\nexport const Workflow = (workflowProps: WorkflowProps): JSX.Element | null => {\n const { title, description, namespace, templateName, ...props } =\n workflowProps;\n\n const styles = useStyles();\n const templateRef = stringifyEntityRef({\n kind: 'Template',\n namespace: namespace,\n name: templateName,\n });\n\n const errorApi = useApi(errorApiRef);\n\n const { loading, manifest, error } = useTemplateParameterSchema(templateRef);\n\n useEffect(() => {\n if (error) {\n errorApi.post(new Error(`Failed to load template, ${error}`));\n }\n }, [error, errorApi]);\n\n if (error) {\n return props.onError(error);\n }\n\n return (\n <Content>\n {loading && <Progress />}\n {manifest && (\n <InfoCard\n title={title ?? manifest.title}\n subheader={\n <MarkdownContent\n className={styles.markdown}\n content={description ?? manifest.description ?? 'No description'}\n />\n }\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Stepper manifest={manifest} {...props} />\n </InfoCard>\n )}\n </Content>\n );\n};\n\n/**\n * @alpha\n */\nexport const EmbeddableWorkflow = (props: WorkflowProps) => (\n <SecretsContextProvider>\n <Workflow {...props} />\n </SecretsContextProvider>\n);\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n NextCustomFieldValidator,\n NextFieldExtensionOptions,\n NextFieldExtensionComponentProps,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { UIOptionsType } from '@rjsf/utils';\nimport { FieldExtensionComponent } from '../../extensions';\nimport { FIELD_EXTENSION_KEY } from '../../extensions/keys';\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @alpha\n */\nexport function createNextScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps extends UIOptionsType = {},\n>(\n options: NextFieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\nexport type {\n NextCustomFieldValidator,\n NextFieldExtensionOptions,\n NextFieldExtensionComponentProps,\n};\n"],"names":["JSONSchema","useStyles","validation","_a","MuiStepper","MuiStep","MuiStepLabel"],"mappings":";;;;;;;;;;;;;;AAgBO,MAAM,2BAA8B,GAAA,kCAAA,CAAA;AAIpC,MAAM,mBAAsB,GAAA,gCAAA;;ACkB5B,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,O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WAAA,GAAe,QAAS,CAAA,WAAA,KAAxB,IAAuC,GAAA,EAAA,GAAA,gBAAA;AAAA,SAAA;AAAA,OAClD;AAAA,MAEF,SAAS,EAAA,IAAA;AAAA,MACT,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAK,EAAA;AAAA,KAAA;AAAA,oBAEvC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,QAAqB,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,GAG9C,CAAA,CAAA;AAEJ,EAAA;AAKa,MAAA,kBAAA,GAAqB,CAAC,KACjC,qBAAA,KAAA,CAAA,aAAA,CAAC,8CACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CACvB;;ACtFK,SAAS,mCAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA,CAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA,OAAA;AAAA,OACF,CAAA;AAEA,MAAO,OAAA,wBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
3
  "description": "A frontend library that helps other Backstage plugins interact with the Scaffolder",
4
- "version": "1.0.1",
4
+ "version": "1.1.0-next.1",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -33,13 +33,13 @@
33
33
  "start": "backstage-cli package start"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/catalog-client": "^1.3.0",
37
- "@backstage/catalog-model": "^1.1.5",
38
- "@backstage/core-components": "^0.12.3",
36
+ "@backstage/catalog-client": "^1.3.1-next.0",
37
+ "@backstage/catalog-model": "^1.1.6-next.0",
38
+ "@backstage/core-components": "^0.12.4-next.0",
39
39
  "@backstage/core-plugin-api": "^1.3.0",
40
40
  "@backstage/errors": "^1.1.4",
41
- "@backstage/plugin-catalog-react": "^1.2.4",
42
- "@backstage/plugin-scaffolder-common": "^1.2.4",
41
+ "@backstage/plugin-catalog-react": "^1.3.0-next.1",
42
+ "@backstage/plugin-scaffolder-common": "^1.2.5-next.0",
43
43
  "@backstage/theme": "^0.2.16",
44
44
  "@backstage/types": "^1.0.2",
45
45
  "@backstage/version-bridge": "^1.0.3",
@@ -47,17 +47,18 @@
47
47
  "@material-ui/icons": "^4.9.1",
48
48
  "@material-ui/lab": "4.0.0-alpha.57",
49
49
  "@rjsf/core": "^3.2.1",
50
- "@rjsf/core-v5": "npm:@rjsf/core@5.0.0-beta.16",
50
+ "@rjsf/core-v5": "npm:@rjsf/core@5.0.1",
51
51
  "@rjsf/material-ui": "^3.2.1",
52
- "@rjsf/material-ui-v5": "npm:@rjsf/material-ui@5.0.0-beta.16",
53
- "@rjsf/utils": "5.0.0-beta.16",
54
- "@rjsf/validator-ajv6": "5.0.0-beta.16",
52
+ "@rjsf/material-ui-v5": "npm:@rjsf/material-ui@5.0.1",
53
+ "@rjsf/utils": "5.0.1",
54
+ "@rjsf/validator-ajv8": "5.0.1",
55
55
  "@types/json-schema": "^7.0.9",
56
56
  "classnames": "^2.2.6",
57
57
  "json-schema": "^0.4.0",
58
58
  "json-schema-library": "^7.3.9",
59
59
  "lodash": "^4.17.21",
60
60
  "qs": "^6.9.4",
61
+ "react-use": "^17.2.4",
61
62
  "zen-observable": "^0.10.0",
62
63
  "zod": "~3.18.0",
63
64
  "zod-to-json-schema": "~3.18.0"
@@ -68,11 +69,11 @@
68
69
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
69
70
  },
70
71
  "devDependencies": {
71
- "@backstage/cli": "^0.22.1",
72
- "@backstage/core-app-api": "^1.4.0",
73
- "@backstage/plugin-catalog": "^1.7.2",
74
- "@backstage/plugin-catalog-common": "^1.0.10",
75
- "@backstage/test-utils": "^1.2.4",
72
+ "@backstage/cli": "^0.22.2-next.0",
73
+ "@backstage/core-app-api": "^1.4.1-next.0",
74
+ "@backstage/plugin-catalog": "^1.8.0-next.1",
75
+ "@backstage/plugin-catalog-common": "^1.0.11-next.0",
76
+ "@backstage/test-utils": "^1.2.5-next.0",
76
77
  "@testing-library/jest-dom": "^5.10.1",
77
78
  "@testing-library/react": "^12.1.3",
78
79
  "@testing-library/react-hooks": "^8.0.0",