@backstage/plugin-scaffolder-react 1.14.2-next.0 → 1.14.2-next.2
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 +37 -0
- package/dist/alpha.d.ts +85 -59
- package/dist/alpha.esm.js +2 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/hooks/useCustomFieldExtensions.esm.js +59 -2
- package/dist/hooks/useCustomFieldExtensions.esm.js.map +1 -1
- package/dist/next/api/FormFieldsApi.esm.js +40 -0
- package/dist/next/api/FormFieldsApi.esm.js.map +1 -0
- package/dist/next/api/ref.esm.js +8 -0
- package/dist/next/api/ref.esm.js.map +1 -0
- package/dist/next/components/Form/DescriptionFieldTemplate.esm.js +1 -0
- package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Workflow/Workflow.esm.js +1 -0
- package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-react
|
|
2
2
|
|
|
3
|
+
## 1.14.2-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 184161f: Scaffolder field extensions registered with `FormFieldBlueprint` are now collected in the `useCustomFieldExtensions` hook, enabling them for use in the scaffolder.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-react@1.14.3-next.2
|
|
10
|
+
- @backstage/catalog-client@1.9.0-next.2
|
|
11
|
+
- @backstage/catalog-model@1.7.2-next.0
|
|
12
|
+
- @backstage/core-components@0.16.2-next.2
|
|
13
|
+
- @backstage/core-plugin-api@1.10.2-next.0
|
|
14
|
+
- @backstage/frontend-plugin-api@0.9.3-next.2
|
|
15
|
+
- @backstage/theme@0.6.3-next.0
|
|
16
|
+
- @backstage/types@1.2.0
|
|
17
|
+
- @backstage/version-bridge@1.0.10
|
|
18
|
+
- @backstage/plugin-permission-react@0.4.29-next.0
|
|
19
|
+
- @backstage/plugin-scaffolder-common@1.5.8-next.1
|
|
20
|
+
|
|
21
|
+
## 1.14.2-next.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- c846d76: Updated dependency `flatted` to `3.3.2`.
|
|
26
|
+
- b21a5ae: Open links in the scaffolder entity and step descriptions in a new tab, to ensure consistency and improve user experience
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @backstage/plugin-catalog-react@1.14.3-next.1
|
|
29
|
+
- @backstage/catalog-client@1.9.0-next.1
|
|
30
|
+
- @backstage/core-components@0.16.2-next.1
|
|
31
|
+
- @backstage/catalog-model@1.7.1
|
|
32
|
+
- @backstage/core-plugin-api@1.10.1
|
|
33
|
+
- @backstage/frontend-plugin-api@0.9.3-next.1
|
|
34
|
+
- @backstage/theme@0.6.3-next.0
|
|
35
|
+
- @backstage/types@1.2.0
|
|
36
|
+
- @backstage/version-bridge@1.0.10
|
|
37
|
+
- @backstage/plugin-permission-react@0.4.28
|
|
38
|
+
- @backstage/plugin-scaffolder-common@1.5.8-next.0
|
|
39
|
+
|
|
3
40
|
## 1.14.2-next.0
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,15 +1,96 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { FieldExtensionComponentProps, CustomFieldValidator, FieldSchema, TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep } from '@backstage/plugin-scaffolder-react';
|
|
2
5
|
import { JsonObject, JsonValue } from '@backstage/types';
|
|
3
6
|
import * as React from 'react';
|
|
4
7
|
import React__default, { ComponentType, ReactNode, PropsWithChildren, ReactElement } from 'react';
|
|
5
8
|
import { TemplatePresentationV1beta3, TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
|
|
6
9
|
import { UiSchema, FieldValidation, WidgetProps } from '@rjsf/utils';
|
|
7
|
-
import { TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, CustomFieldValidator, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep, FieldExtensionComponentProps, FieldSchema } from '@backstage/plugin-scaffolder-react';
|
|
8
10
|
import { ApiHolder, IconComponent, AnyApiRef } from '@backstage/core-plugin-api';
|
|
9
11
|
import { Overrides } from '@material-ui/core/styles/overrides';
|
|
10
12
|
import { StyleRules } from '@material-ui/core/styles/withStyles';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2024 The Backstage Authors
|
|
16
|
+
*
|
|
17
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License.
|
|
19
|
+
* You may obtain a copy of the License at
|
|
20
|
+
*
|
|
21
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
+
* See the License for the specific language governing permissions and
|
|
27
|
+
* limitations under the License.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/** @alpha */
|
|
33
|
+
interface FormField {
|
|
34
|
+
readonly $$type: '@backstage/scaffolder/FormField';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @alpha */
|
|
38
|
+
declare const formFieldsApi: _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
39
|
+
config: {};
|
|
40
|
+
configInput: {};
|
|
41
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
|
|
42
|
+
inputs: {
|
|
43
|
+
formFields: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>, {
|
|
44
|
+
singleton: false;
|
|
45
|
+
optional: false;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
kind: "api";
|
|
49
|
+
name: "form-fields";
|
|
50
|
+
params: {
|
|
51
|
+
factory: _backstage_frontend_plugin_api.AnyApiFactory;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
|
|
55
|
+
/** @alpha */
|
|
56
|
+
type FormFieldExtensionData<TReturnValue extends z.ZodType = z.ZodType, TUiOptions extends z.ZodType = z.ZodType> = {
|
|
57
|
+
name: string;
|
|
58
|
+
component: (props: FieldExtensionComponentProps<z.output<TReturnValue>, z.output<TUiOptions>>) => JSX.Element | null;
|
|
59
|
+
validation?: CustomFieldValidator<z.output<TReturnValue>, z.output<TUiOptions>>;
|
|
60
|
+
schema?: FieldSchema<z.output<TReturnValue>, z.output<TUiOptions>>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @alpha
|
|
65
|
+
* Creates extensions that are Field Extensions for the Scaffolder
|
|
66
|
+
* */
|
|
67
|
+
declare const FormFieldBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
68
|
+
kind: "scaffolder-form-field";
|
|
69
|
+
name: undefined;
|
|
70
|
+
params: {
|
|
71
|
+
field: () => Promise<FormField>;
|
|
72
|
+
};
|
|
73
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
|
|
74
|
+
inputs: {};
|
|
75
|
+
config: {};
|
|
76
|
+
configInput: {};
|
|
77
|
+
dataRefs: {
|
|
78
|
+
formFieldLoader: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* @alpha
|
|
83
|
+
* Used to create a form field binding with typechecking for compliance
|
|
84
|
+
*/
|
|
85
|
+
declare function createFormField<TReturnValue extends z.ZodType, TUiOptions extends z.ZodType>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField;
|
|
86
|
+
|
|
87
|
+
/** @alpha */
|
|
88
|
+
interface ScaffolderFormFieldsApi {
|
|
89
|
+
getFormFields(): Promise<FormFieldExtensionData[]>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** @alpha */
|
|
93
|
+
declare const formFieldsApiRef: _backstage_frontend_plugin_api.ApiRef<ScaffolderFormFieldsApi>;
|
|
13
94
|
|
|
14
95
|
/**
|
|
15
96
|
* This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.
|
|
@@ -319,61 +400,6 @@ declare module '@backstage/theme' {
|
|
|
319
400
|
}
|
|
320
401
|
}
|
|
321
402
|
|
|
322
|
-
/*
|
|
323
|
-
* Copyright 2024 The Backstage Authors
|
|
324
|
-
*
|
|
325
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
326
|
-
* you may not use this file except in compliance with the License.
|
|
327
|
-
* You may obtain a copy of the License at
|
|
328
|
-
*
|
|
329
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
330
|
-
*
|
|
331
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
332
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
333
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
334
|
-
* See the License for the specific language governing permissions and
|
|
335
|
-
* limitations under the License.
|
|
336
|
-
*/
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
/** @alpha */
|
|
341
|
-
interface FormField {
|
|
342
|
-
readonly $$type: '@backstage/scaffolder/FormField';
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/** @alpha */
|
|
346
|
-
type FormFieldExtensionData<TReturnValue extends z.ZodType = z.ZodType, TUiOptions extends z.ZodType = z.ZodType> = {
|
|
347
|
-
name: string;
|
|
348
|
-
component: (props: FieldExtensionComponentProps<z.output<TReturnValue>, z.output<TUiOptions>>) => JSX.Element | null;
|
|
349
|
-
validation?: CustomFieldValidator<z.output<TReturnValue>, z.output<TUiOptions>>;
|
|
350
|
-
schema?: FieldSchema<z.output<TReturnValue>, z.output<TUiOptions>>;
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* @alpha
|
|
355
|
-
* Creates extensions that are Field Extensions for the Scaffolder
|
|
356
|
-
* */
|
|
357
|
-
declare const FormFieldBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
358
|
-
kind: "scaffolder-form-field";
|
|
359
|
-
name: undefined;
|
|
360
|
-
params: {
|
|
361
|
-
field: () => Promise<FormField>;
|
|
362
|
-
};
|
|
363
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
|
|
364
|
-
inputs: {};
|
|
365
|
-
config: {};
|
|
366
|
-
configInput: {};
|
|
367
|
-
dataRefs: {
|
|
368
|
-
formFieldLoader: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<FormField>, "scaffolder.form-field-loader", {}>;
|
|
369
|
-
};
|
|
370
|
-
}>;
|
|
371
|
-
/**
|
|
372
|
-
* @alpha
|
|
373
|
-
* Used to create a form field binding with typechecking for compliance
|
|
374
|
-
*/
|
|
375
|
-
declare function createFormField<TReturnValue extends z.ZodType, TUiOptions extends z.ZodType>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField;
|
|
376
|
-
|
|
377
403
|
/** @alpha */
|
|
378
404
|
type ScaffolderFormDecoratorContext<TInput extends JsonObject = JsonObject> = {
|
|
379
405
|
input: TInput;
|
|
@@ -415,4 +441,4 @@ declare function createScaffolderFormDecorator<TInputSchema extends {
|
|
|
415
441
|
} : never) => Promise<void>;
|
|
416
442
|
}): ScaffolderFormDecorator<TInput>;
|
|
417
443
|
|
|
418
|
-
export { type BackstageOverrides, type BackstageTemplateStepperClassKey, DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormFieldBlueprint, type FormFieldExtensionData, type FormValidation, type ParsedTemplateSchema, ReviewState, type ReviewStateProps, ScaffolderField, type ScaffolderFieldProps, type ScaffolderFormDecorator, type ScaffolderFormDecoratorContext, ScaffolderPageContextMenu, type ScaffolderPageContextMenuProps, type ScaffolderReactComponentsNameToClassKey, type ScaffolderReactTemplateCategoryPickerClassKey, SecretWidget, Stepper, type StepperProps, TaskLogStream, TaskSteps, type TaskStepsProps, TemplateCard, type TemplateCardProps, TemplateCategoryPicker, TemplateGroup, type TemplateGroupProps, TemplateGroups, type TemplateGroupsProps, Workflow, type WorkflowProps, createAsyncValidators, createFieldValidation, createFormField, createScaffolderFormDecorator, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
|
|
444
|
+
export { type BackstageOverrides, type BackstageTemplateStepperClassKey, DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormFieldBlueprint, type FormFieldExtensionData, type FormValidation, type ParsedTemplateSchema, ReviewState, type ReviewStateProps, ScaffolderField, type ScaffolderFieldProps, type ScaffolderFormDecorator, type ScaffolderFormDecoratorContext, type ScaffolderFormFieldsApi, ScaffolderPageContextMenu, type ScaffolderPageContextMenuProps, type ScaffolderReactComponentsNameToClassKey, type ScaffolderReactTemplateCategoryPickerClassKey, SecretWidget, Stepper, type StepperProps, TaskLogStream, TaskSteps, type TaskStepsProps, TemplateCard, type TemplateCardProps, TemplateCategoryPicker, TemplateGroup, type TemplateGroupProps, TemplateGroups, type TemplateGroupsProps, Workflow, type WorkflowProps, createAsyncValidators, createFieldValidation, createFormField, createScaffolderFormDecorator, extractSchemaFromStep, formFieldsApi, formFieldsApiRef, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { formFieldsApi } from './next/api/FormFieldsApi.esm.js';
|
|
2
|
+
export { formFieldsApiRef } from './next/api/ref.esm.js';
|
|
1
3
|
export { Stepper } from './next/components/Stepper/Stepper.esm.js';
|
|
2
4
|
export { createAsyncValidators } from './next/components/Stepper/createAsyncValidators.esm.js';
|
|
3
5
|
export { TemplateCard } from './next/components/TemplateCard/TemplateCard.esm.js';
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useAsync, useMountEffect } from '@react-hookz/web';
|
|
2
|
+
import { useApiHolder, useElementFilter } from '@backstage/core-plugin-api';
|
|
3
|
+
import '../next/api/FormFieldsApi.esm.js';
|
|
4
|
+
import { formFieldsApiRef } from '../next/api/ref.esm.js';
|
|
5
|
+
import '../next/components/Stepper/Stepper.esm.js';
|
|
6
|
+
import 'json-schema-library';
|
|
7
|
+
import 'flatted';
|
|
8
|
+
import '../next/components/TemplateCard/TemplateCard.esm.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@backstage/core-components';
|
|
11
|
+
import 'lodash';
|
|
12
|
+
import '@backstage/catalog-model';
|
|
13
|
+
import '@backstage/plugin-catalog-react';
|
|
14
|
+
import '@backstage/plugin-scaffolder-common';
|
|
15
|
+
import '@material-ui/core/Typography';
|
|
16
|
+
import '../next/components/Workflow/Workflow.esm.js';
|
|
17
|
+
import '@material-ui/core/Box';
|
|
18
|
+
import '@material-ui/core/Paper';
|
|
19
|
+
import '../next/components/TemplateOutputs/LinkOutputs.esm.js';
|
|
20
|
+
import '@material-ui/core/Button';
|
|
21
|
+
import '@material-ui/icons/Description';
|
|
22
|
+
import '../next/components/Form/Form.esm.js';
|
|
23
|
+
import '@material-ui/core/Stepper';
|
|
24
|
+
import '@material-ui/core/Step';
|
|
25
|
+
import '@material-ui/core/StepButton';
|
|
26
|
+
import '@material-ui/core/StepLabel';
|
|
27
|
+
import '../next/components/TaskSteps/StepIcon.esm.js';
|
|
28
|
+
import 'react-use/esm/useInterval';
|
|
29
|
+
import 'luxon';
|
|
30
|
+
import 'humanize-duration';
|
|
31
|
+
import '../next/components/TaskSteps/TaskBorder.esm.js';
|
|
32
|
+
import '../next/components/TaskLogStream/TaskLogStream.esm.js';
|
|
33
|
+
import '../next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js';
|
|
34
|
+
import '../next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js';
|
|
35
|
+
import '../next/components/ScaffolderField/ScaffolderField.esm.js';
|
|
36
|
+
import '@backstage/plugin-scaffolder-react';
|
|
37
|
+
import '@material-ui/core/TextField';
|
|
38
|
+
import 'qs';
|
|
39
|
+
import 'react-use/esm/useAsync';
|
|
40
|
+
import '../api/ref.esm.js';
|
|
41
|
+
import 'lodash/cloneDeep';
|
|
42
|
+
import '../next/blueprints/FormFieldBlueprint.esm.js';
|
|
2
43
|
import { FIELD_EXTENSION_WRAPPER_KEY, FIELD_EXTENSION_KEY } from '../extensions/keys.esm.js';
|
|
3
44
|
|
|
4
45
|
const useCustomFieldExtensions = (outlet) => {
|
|
5
|
-
|
|
46
|
+
const apiHolder = useApiHolder();
|
|
47
|
+
const formFieldsApi = apiHolder.get(formFieldsApiRef);
|
|
48
|
+
const [{ result: blueprintFields }, methods] = useAsync(
|
|
49
|
+
formFieldsApi?.getFormFields ?? (async () => []),
|
|
50
|
+
[]
|
|
51
|
+
);
|
|
52
|
+
useMountEffect(methods.execute);
|
|
53
|
+
const outletFields = useElementFilter(
|
|
6
54
|
outlet,
|
|
7
55
|
(elements) => elements.selectByComponentData({
|
|
8
56
|
key: FIELD_EXTENSION_WRAPPER_KEY
|
|
@@ -10,6 +58,15 @@ const useCustomFieldExtensions = (outlet) => {
|
|
|
10
58
|
key: FIELD_EXTENSION_KEY
|
|
11
59
|
})
|
|
12
60
|
);
|
|
61
|
+
const blueprintsToLegacy = blueprintFields?.map(
|
|
62
|
+
(field) => ({
|
|
63
|
+
component: field.component,
|
|
64
|
+
name: field.name,
|
|
65
|
+
validation: field.validation,
|
|
66
|
+
schema: field.schema?.schema
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
return [...blueprintsToLegacy, ...outletFields];
|
|
13
70
|
};
|
|
14
71
|
|
|
15
72
|
export { useCustomFieldExtensions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomFieldExtensions.esm.js","sources":["../../src/hooks/useCustomFieldExtensions.ts"],"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 */\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
|
|
1
|
+
{"version":3,"file":"useCustomFieldExtensions.esm.js","sources":["../../src/hooks/useCustomFieldExtensions.ts"],"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 */\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { useApiHolder, useElementFilter } from '@backstage/core-plugin-api';\nimport { formFieldsApiRef } from '../next';\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 // todo(blam): this shouldn't be here, should remove this, but this is a breaking change to remove the generic.\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n // Get custom fields created with FormFieldBlueprint\n const apiHolder = useApiHolder();\n const formFieldsApi = apiHolder.get(formFieldsApiRef);\n const [{ result: blueprintFields }, methods] = useAsync(\n formFieldsApi?.getFormFields ?? (async () => []),\n [],\n );\n useMountEffect(methods.execute);\n\n // Get custom fields created with ScaffolderFieldExtensions\n const outletFields = 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 // This should really be a different type moving foward, but we do this to keep type compatibility.\n // should probably also move the defaults into the API eventually too, but that will come with the move\n // to the new frontend system.\n const blueprintsToLegacy: FieldExtensionOptions[] = blueprintFields?.map(\n field => ({\n component: field.component,\n name: field.name,\n validation: field.validation,\n schema: field.schema?.schema,\n }),\n );\n\n return [...blueprintsToLegacy, ...outletFields] as TComponentDataType[];\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Ba,MAAA,wBAAA,GAA2B,CAItC,MACG,KAAA;AAEH,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAM,MAAA,aAAA,GAAgB,SAAU,CAAA,GAAA,CAAI,gBAAgB,CAAA;AACpD,EAAA,MAAM,CAAC,EAAE,MAAA,EAAQ,eAAgB,EAAA,EAAG,OAAO,CAAI,GAAA,QAAA;AAAA,IAC7C,aAAA,EAAe,aAAkB,KAAA,YAAY,EAAC,CAAA;AAAA,IAC9C;AAAC,GACH;AACA,EAAA,cAAA,CAAe,QAAQ,OAAO,CAAA;AAG9B,EAAA,MAAM,YAAe,GAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC5C,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA;AAAA,KACN;AAAA,GACL;AAKA,EAAA,MAAM,qBAA8C,eAAiB,EAAA,GAAA;AAAA,IACnE,CAAU,KAAA,MAAA;AAAA,MACR,WAAW,KAAM,CAAA,SAAA;AAAA,MACjB,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,YAAY,KAAM,CAAA,UAAA;AAAA,MAClB,MAAA,EAAQ,MAAM,MAAQ,EAAA;AAAA,KACxB;AAAA,GACF;AAEA,EAAA,OAAO,CAAC,GAAG,kBAAoB,EAAA,GAAG,YAAY,CAAA;AAChD;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApiBlueprint, createExtensionInput, createApiFactory } from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { formFieldsApiRef } from './ref.esm.js';
|
|
3
|
+
import { FormFieldBlueprint } from '../blueprints/FormFieldBlueprint.esm.js';
|
|
4
|
+
import { OpaqueFormField } from '../../packages/scaffolder-internal/src/wiring/InternalFormField.esm.js';
|
|
5
|
+
|
|
6
|
+
class DefaultScaffolderFormFieldsApi {
|
|
7
|
+
constructor(formFieldLoaders = []) {
|
|
8
|
+
this.formFieldLoaders = formFieldLoaders;
|
|
9
|
+
}
|
|
10
|
+
async getFormFields() {
|
|
11
|
+
const formFields = await Promise.all(
|
|
12
|
+
this.formFieldLoaders.map((loader) => loader())
|
|
13
|
+
);
|
|
14
|
+
const internalFormFields = formFields.map(OpaqueFormField.toInternal);
|
|
15
|
+
return internalFormFields;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const formFieldsApi = ApiBlueprint.makeWithOverrides({
|
|
19
|
+
name: "form-fields",
|
|
20
|
+
inputs: {
|
|
21
|
+
formFields: createExtensionInput([
|
|
22
|
+
FormFieldBlueprint.dataRefs.formFieldLoader
|
|
23
|
+
])
|
|
24
|
+
},
|
|
25
|
+
factory(originalFactory, { inputs }) {
|
|
26
|
+
const formFieldLoaders = inputs.formFields.map(
|
|
27
|
+
(e) => e.get(FormFieldBlueprint.dataRefs.formFieldLoader)
|
|
28
|
+
);
|
|
29
|
+
return originalFactory({
|
|
30
|
+
factory: createApiFactory({
|
|
31
|
+
api: formFieldsApiRef,
|
|
32
|
+
deps: {},
|
|
33
|
+
factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders)
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { formFieldsApi };
|
|
40
|
+
//# sourceMappingURL=FormFieldsApi.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldsApi.esm.js","sources":["../../../src/next/api/FormFieldsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 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 ApiBlueprint,\n createApiFactory,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { formFieldsApiRef } from './ref';\nimport { ScaffolderFormFieldsApi } from './types';\nimport { FormFieldBlueprint } from '../blueprints';\nimport { FormField, OpaqueFormField } from '@internal/scaffolder';\n\nclass DefaultScaffolderFormFieldsApi implements ScaffolderFormFieldsApi {\n constructor(\n private readonly formFieldLoaders: Array<() => Promise<FormField>> = [],\n ) {}\n\n async getFormFields() {\n const formFields = await Promise.all(\n this.formFieldLoaders.map(loader => loader()),\n );\n\n const internalFormFields = formFields.map(OpaqueFormField.toInternal);\n\n return internalFormFields;\n }\n}\n\n/** @alpha */\nexport const formFieldsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-fields',\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(e =>\n e.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n\n return originalFactory({\n factory: createApiFactory({\n api: formFieldsApiRef,\n deps: {},\n factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders),\n }),\n });\n },\n});\n"],"names":[],"mappings":";;;;;AA0BA,MAAM,8BAAkE,CAAA;AAAA,EACtE,WAAA,CACmB,gBAAoD,GAAA,EACrE,EAAA;AADiB,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA;AAChB,EAEH,MAAM,aAAgB,GAAA;AACpB,IAAM,MAAA,UAAA,GAAa,MAAM,OAAQ,CAAA,GAAA;AAAA,MAC/B,IAAK,CAAA,gBAAA,CAAiB,GAAI,CAAA,CAAA,MAAA,KAAU,QAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAqB,GAAA,UAAA,CAAW,GAAI,CAAA,eAAA,CAAgB,UAAU,CAAA;AAEpE,IAAO,OAAA,kBAAA;AAAA;AAEX;AAGa,MAAA,aAAA,GAAgB,aAAa,iBAAkB,CAAA;AAAA,EAC1D,IAAM,EAAA,aAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AAEA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,gBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAS,EAAA,MAAM,IAAI,8BAAA,CAA+B,gBAAgB;AAAA,OACnE;AAAA,KACF,CAAA;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.esm.js","sources":["../../../src/next/api/ref.ts"],"sourcesContent":["/*\n * Copyright 2024 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/frontend-plugin-api';\nimport { ScaffolderFormFieldsApi } from './types';\n\n/** @alpha */\nexport const formFieldsApiRef = createApiRef<ScaffolderFormFieldsApi>({\n id: 'plugin.scaffolder.form-fields',\n});\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,YAAsC,CAAA;AAAA,EACpE,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.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 */\nimport React from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,mBAAqB,EAAA;AAAA,IACnB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,IACnC,MAAQ,EAAA,CAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,CAAA;AAAA,MACR,SAAW,EAAA;AAAA;AAAA;AACb;AAEJ,CAAE,CAAA,CAAA;AAMW,MAAA,wBAAA,GAA2B,CAKtC,KACG,KAAA;AACH,EAAM,MAAA,EAAE,EAAI,EAAA,WAAA,EAAgB,GAAA,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,WAAA;AAAA,UACT,WAAW,OAAQ,CAAA;AAAA;AAAA,OACrB;AAAA;AAIJ,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAQ,OAAQ,EAAA,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAM,EAAA,EAAA,EAC/D,WACH,CAAA;AAAA;AAIJ,EAAO,OAAA,IAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.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 */\nimport React from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,mBAAqB,EAAA;AAAA,IACnB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,IACnC,MAAQ,EAAA,CAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,CAAA;AAAA,MACR,SAAW,EAAA;AAAA;AAAA;AACb;AAEJ,CAAE,CAAA,CAAA;AAMW,MAAA,wBAAA,GAA2B,CAKtC,KACG,KAAA;AACH,EAAM,MAAA,EAAE,EAAI,EAAA,WAAA,EAAgB,GAAA,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,WAAA;AAAA,UACT,UAAW,EAAA,QAAA;AAAA,UACX,WAAW,OAAQ,CAAA;AAAA;AAAA,OACrB;AAAA;AAIJ,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAQ,OAAQ,EAAA,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAM,EAAA,EAAA,EAC/D,WACH,CAAA;AAAA;AAIJ,EAAO,OAAA,IAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workflow.esm.js","sources":["../../../../src/next/components/Workflow/Workflow.tsx"],"sourcesContent":["/*\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, { useCallback, 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/styles';\nimport { errorApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { useTemplateParameterSchema } from '../../hooks/useTemplateParameterSchema';\nimport { Stepper, type StepperProps } from '../Stepper/Stepper';\nimport { SecretsContextProvider } from '../../../secrets/SecretsContext';\nimport { useFilteredSchemaProperties } from '../../hooks/useFilteredSchemaProperties';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { useTemplateTimeSavedMinutes } from '../../hooks/useTemplateTimeSaved';\nimport { JsonValue } from '@backstage/types';\n\nconst useStyles = makeStyles({\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 components?: {\n ReviewStepComponent?: React.ComponentType<ReviewStepProps>;\n };\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, onCreate, ...props } =\n workflowProps;\n\n const analytics = useAnalytics();\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 const sortedManifest = useFilteredSchemaProperties(manifest);\n\n const minutesSaved = useTemplateTimeSavedMinutes(templateRef);\n\n const workflowOnCreate = useCallback(\n async (formState: Record<string, JsonValue>) => {\n onCreate(formState);\n\n const name =\n typeof formState.name === 'string' ? formState.name : undefined;\n analytics.captureEvent('create', name ?? templateName ?? 'unknown', {\n value: minutesSaved,\n });\n },\n [onCreate, analytics, templateName, minutesSaved],\n );\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 {sortedManifest && (\n <InfoCard\n title={title ?? sortedManifest.title}\n subheader={\n <MarkdownContent\n className={styles.markdown}\n content={\n description ?? sortedManifest.description ?? 'No description'\n }\n />\n }\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Stepper\n manifest={sortedManifest}\n onCreate={workflowOnCreate}\n {...props}\n />\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"],"names":[],"mappings":";;;;;;;;;;;AAkCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,QAAU,EAAA;AAAA;AAAA,IAER,gBAAkB,EAAA;AAAA,MAChB,SAAW,EAAA;AAAA,KACb;AAAA,IACA,eAAiB,EAAA;AAAA,MACf,YAAc,EAAA;AAAA;AAChB;AAEJ,CAAC,CAAA;AA2BY,MAAA,QAAA,GAAW,CAAC,aAAqD,KAAA;AAC5E,EAAM,MAAA,EAAE,OAAO,WAAa,EAAA,SAAA,EAAW,cAAc,QAAU,EAAA,GAAG,OAChE,GAAA,aAAA;AAEF,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAA,MAAM,SAAS,SAAU,EAAA;AACzB,EAAA,MAAM,cAAc,kBAAmB,CAAA;AAAA,IACrC,IAAM,EAAA,UAAA;AAAA,IACN,SAAA;AAAA,IACA,IAAM,EAAA;AAAA,GACP,CAAA;AAED,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,EAAE,OAAS,EAAA,QAAA,EAAU,KAAM,EAAA,GAAI,2BAA2B,WAAW,CAAA;AAE3E,EAAM,MAAA,cAAA,GAAiB,4BAA4B,QAAQ,CAAA;AAE3D,EAAM,MAAA,YAAA,GAAe,4BAA4B,WAAW,CAAA;AAE5D,EAAA,MAAM,gBAAmB,GAAA,WAAA;AAAA,IACvB,OAAO,SAAyC,KAAA;AAC9C,MAAA,QAAA,CAAS,SAAS,CAAA;AAElB,MAAA,MAAM,OACJ,OAAO,SAAA,CAAU,IAAS,KAAA,QAAA,GAAW,UAAU,IAAO,GAAA,KAAA,CAAA;AACxD,MAAA,SAAA,CAAU,YAAa,CAAA,QAAA,EAAU,IAAQ,IAAA,YAAA,IAAgB,SAAW,EAAA;AAAA,QAClE,KAAO,EAAA;AAAA,OACR,CAAA;AAAA,KACH;AAAA,IACA,CAAC,QAAA,EAAU,SAAW,EAAA,YAAA,EAAc,YAAY;AAAA,GAClD;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,QAAA,CAAS,KAAK,IAAI,KAAA,CAAM,CAA4B,yBAAA,EAAA,KAAK,EAAE,CAAC,CAAA;AAAA;AAC9D,GACC,EAAA,CAAC,KAAO,EAAA,QAAQ,CAAC,CAAA;AAEpB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,OAAA,KAAA,CAAM,QAAQ,KAAK,CAAA;AAAA;AAG5B,EAAA,2CACG,OACE,EAAA,IAAA,EAAA,OAAA,oBAAY,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAS,GACrB,cACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,SAAS,cAAe,CAAA,KAAA;AAAA,MAC/B,SACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAO,CAAA,QAAA;AAAA,UAClB,OAAA,EACE,WAAe,IAAA,cAAA,CAAe,WAAe,IAAA;AAAA;AAAA,OAEjD;AAAA,MAEF,SAAS,EAAA,IAAA;AAAA,MACT,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAK;AAAA,KAAA;AAAA,oBAExC,KAAA,CAAA,aAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,QAAU,EAAA,cAAA;AAAA,QACV,QAAU,EAAA,gBAAA;AAAA,QACT,GAAG;AAAA;AAAA;AACN,GAGN,CAAA;AAEJ;AAKa,MAAA,kBAAA,GAAqB,CAAC,KACjC,qBAAA,KAAA,CAAA,aAAA,CAAC,8CACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CACvB;;;;"}
|
|
1
|
+
{"version":3,"file":"Workflow.esm.js","sources":["../../../../src/next/components/Workflow/Workflow.tsx"],"sourcesContent":["/*\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, { useCallback, 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/styles';\nimport { errorApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { useTemplateParameterSchema } from '../../hooks/useTemplateParameterSchema';\nimport { Stepper, type StepperProps } from '../Stepper/Stepper';\nimport { SecretsContextProvider } from '../../../secrets/SecretsContext';\nimport { useFilteredSchemaProperties } from '../../hooks/useFilteredSchemaProperties';\nimport { ReviewStepProps } from '@backstage/plugin-scaffolder-react';\nimport { useTemplateTimeSavedMinutes } from '../../hooks/useTemplateTimeSaved';\nimport { JsonValue } from '@backstage/types';\n\nconst useStyles = makeStyles({\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 components?: {\n ReviewStepComponent?: React.ComponentType<ReviewStepProps>;\n };\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, onCreate, ...props } =\n workflowProps;\n\n const analytics = useAnalytics();\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 const sortedManifest = useFilteredSchemaProperties(manifest);\n\n const minutesSaved = useTemplateTimeSavedMinutes(templateRef);\n\n const workflowOnCreate = useCallback(\n async (formState: Record<string, JsonValue>) => {\n onCreate(formState);\n\n const name =\n typeof formState.name === 'string' ? formState.name : undefined;\n analytics.captureEvent('create', name ?? templateName ?? 'unknown', {\n value: minutesSaved,\n });\n },\n [onCreate, analytics, templateName, minutesSaved],\n );\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 {sortedManifest && (\n <InfoCard\n title={title ?? sortedManifest.title}\n subheader={\n <MarkdownContent\n className={styles.markdown}\n linkTarget=\"_blank\"\n content={\n description ?? sortedManifest.description ?? 'No description'\n }\n />\n }\n noPadding\n titleTypographyProps={{ component: 'h2' }}\n >\n <Stepper\n manifest={sortedManifest}\n onCreate={workflowOnCreate}\n {...props}\n />\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"],"names":[],"mappings":";;;;;;;;;;;AAkCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,QAAU,EAAA;AAAA;AAAA,IAER,gBAAkB,EAAA;AAAA,MAChB,SAAW,EAAA;AAAA,KACb;AAAA,IACA,eAAiB,EAAA;AAAA,MACf,YAAc,EAAA;AAAA;AAChB;AAEJ,CAAC,CAAA;AA2BY,MAAA,QAAA,GAAW,CAAC,aAAqD,KAAA;AAC5E,EAAM,MAAA,EAAE,OAAO,WAAa,EAAA,SAAA,EAAW,cAAc,QAAU,EAAA,GAAG,OAChE,GAAA,aAAA;AAEF,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAA,MAAM,SAAS,SAAU,EAAA;AACzB,EAAA,MAAM,cAAc,kBAAmB,CAAA;AAAA,IACrC,IAAM,EAAA,UAAA;AAAA,IACN,SAAA;AAAA,IACA,IAAM,EAAA;AAAA,GACP,CAAA;AAED,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,EAAE,OAAS,EAAA,QAAA,EAAU,KAAM,EAAA,GAAI,2BAA2B,WAAW,CAAA;AAE3E,EAAM,MAAA,cAAA,GAAiB,4BAA4B,QAAQ,CAAA;AAE3D,EAAM,MAAA,YAAA,GAAe,4BAA4B,WAAW,CAAA;AAE5D,EAAA,MAAM,gBAAmB,GAAA,WAAA;AAAA,IACvB,OAAO,SAAyC,KAAA;AAC9C,MAAA,QAAA,CAAS,SAAS,CAAA;AAElB,MAAA,MAAM,OACJ,OAAO,SAAA,CAAU,IAAS,KAAA,QAAA,GAAW,UAAU,IAAO,GAAA,KAAA,CAAA;AACxD,MAAA,SAAA,CAAU,YAAa,CAAA,QAAA,EAAU,IAAQ,IAAA,YAAA,IAAgB,SAAW,EAAA;AAAA,QAClE,KAAO,EAAA;AAAA,OACR,CAAA;AAAA,KACH;AAAA,IACA,CAAC,QAAA,EAAU,SAAW,EAAA,YAAA,EAAc,YAAY;AAAA,GAClD;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,QAAA,CAAS,KAAK,IAAI,KAAA,CAAM,CAA4B,yBAAA,EAAA,KAAK,EAAE,CAAC,CAAA;AAAA;AAC9D,GACC,EAAA,CAAC,KAAO,EAAA,QAAQ,CAAC,CAAA;AAEpB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,OAAA,KAAA,CAAM,QAAQ,KAAK,CAAA;AAAA;AAG5B,EAAA,2CACG,OACE,EAAA,IAAA,EAAA,OAAA,oBAAY,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAS,GACrB,cACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,SAAS,cAAe,CAAA,KAAA;AAAA,MAC/B,SACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAO,CAAA,QAAA;AAAA,UAClB,UAAW,EAAA,QAAA;AAAA,UACX,OAAA,EACE,WAAe,IAAA,cAAA,CAAe,WAAe,IAAA;AAAA;AAAA,OAEjD;AAAA,MAEF,SAAS,EAAA,IAAA;AAAA,MACT,oBAAA,EAAsB,EAAE,SAAA,EAAW,IAAK;AAAA,KAAA;AAAA,oBAExC,KAAA,CAAA,aAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,QAAU,EAAA,cAAA;AAAA,QACV,QAAU,EAAA,gBAAA;AAAA,QACT,GAAG;AAAA;AAAA;AACN,GAGN,CAAA;AAEJ;AAKa,MAAA,kBAAA,GAAqB,CAAC,KACjC,qBAAA,KAAA,CAAA,aAAA,CAAC,8CACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CACvB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-react",
|
|
3
|
-
"version": "1.14.2-next.
|
|
3
|
+
"version": "1.14.2-next.2",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the Scaffolder",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"test": "backstage-cli package test"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@backstage/catalog-client": "1.
|
|
70
|
-
"@backstage/catalog-model": "1.7.
|
|
71
|
-
"@backstage/core-components": "0.16.2-next.
|
|
72
|
-
"@backstage/core-plugin-api": "1.10.
|
|
73
|
-
"@backstage/frontend-plugin-api": "0.9.3-next.
|
|
74
|
-
"@backstage/plugin-catalog-react": "1.14.3-next.
|
|
75
|
-
"@backstage/plugin-permission-react": "0.4.
|
|
76
|
-
"@backstage/plugin-scaffolder-common": "1.5.8-next.
|
|
69
|
+
"@backstage/catalog-client": "1.9.0-next.2",
|
|
70
|
+
"@backstage/catalog-model": "1.7.2-next.0",
|
|
71
|
+
"@backstage/core-components": "0.16.2-next.2",
|
|
72
|
+
"@backstage/core-plugin-api": "1.10.2-next.0",
|
|
73
|
+
"@backstage/frontend-plugin-api": "0.9.3-next.2",
|
|
74
|
+
"@backstage/plugin-catalog-react": "1.14.3-next.2",
|
|
75
|
+
"@backstage/plugin-permission-react": "0.4.29-next.0",
|
|
76
|
+
"@backstage/plugin-scaffolder-common": "1.5.8-next.1",
|
|
77
77
|
"@backstage/theme": "0.6.3-next.0",
|
|
78
78
|
"@backstage/types": "1.2.0",
|
|
79
79
|
"@backstage/version-bridge": "1.0.10",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@types/json-schema": "^7.0.9",
|
|
89
89
|
"ajv-errors": "^3.0.0",
|
|
90
90
|
"classnames": "^2.2.6",
|
|
91
|
-
"flatted": "3.3.
|
|
91
|
+
"flatted": "3.3.2",
|
|
92
92
|
"humanize-duration": "^3.25.1",
|
|
93
93
|
"json-schema": "^0.4.0",
|
|
94
94
|
"json-schema-library": "^9.0.0",
|
|
@@ -102,12 +102,12 @@
|
|
|
102
102
|
"zod-to-json-schema": "^3.20.4"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@backstage/cli": "0.29.3-next.
|
|
106
|
-
"@backstage/core-app-api": "1.15.3-next.
|
|
107
|
-
"@backstage/plugin-catalog": "1.
|
|
108
|
-
"@backstage/plugin-catalog-common": "1.1.
|
|
109
|
-
"@backstage/plugin-permission-common": "0.8.
|
|
110
|
-
"@backstage/test-utils": "1.7.3-next.
|
|
105
|
+
"@backstage/cli": "0.29.3-next.2",
|
|
106
|
+
"@backstage/core-app-api": "1.15.3-next.1",
|
|
107
|
+
"@backstage/plugin-catalog": "1.26.0-next.2",
|
|
108
|
+
"@backstage/plugin-catalog-common": "1.1.2-next.0",
|
|
109
|
+
"@backstage/plugin-permission-common": "0.8.3-next.0",
|
|
110
|
+
"@backstage/test-utils": "1.7.3-next.1",
|
|
111
111
|
"@testing-library/dom": "^10.0.0",
|
|
112
112
|
"@testing-library/jest-dom": "^6.0.0",
|
|
113
113
|
"@testing-library/react": "^16.0.0",
|