Make it possible to configure certain tings per template
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -91,7 +91,7 @@ export const Stepper = (stepperProps: StepperProps) => {
|
||||
reviewButtonText = 'Review',
|
||||
} = components;
|
||||
const analytics = useAnalytics();
|
||||
const { steps } = useTemplateSchema(props.manifest);
|
||||
const { configurations, steps } = useTemplateSchema(props.manifest);
|
||||
const apiHolder = useApiHolder();
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
const [isValidating, setIsValidating] = useState(false);
|
||||
@@ -229,7 +229,7 @@ export const Stepper = (stepperProps: StepperProps) => {
|
||||
);
|
||||
}}
|
||||
>
|
||||
{createButtonText}
|
||||
{configurations.kickOffButtonText ?? createButtonText}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { TemplateConfigurationsV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { UiSchema } from '@rjsf/utils';
|
||||
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
|
||||
@@ -39,7 +40,10 @@ export interface ParsedTemplateSchema {
|
||||
*/
|
||||
export const useTemplateSchema = (
|
||||
manifest: TemplateParameterSchema,
|
||||
): { steps: ParsedTemplateSchema[] } => {
|
||||
): {
|
||||
steps: ParsedTemplateSchema[];
|
||||
configurations: TemplateConfigurationsV1beta3;
|
||||
} => {
|
||||
const featureFlags = useApi(featureFlagsApiRef);
|
||||
const steps = manifest.steps.map(({ title, description, schema }) => ({
|
||||
title,
|
||||
@@ -76,6 +80,7 @@ export const useTemplateSchema = (
|
||||
}));
|
||||
|
||||
return {
|
||||
configurations: manifest.configurations,
|
||||
steps: returningSteps,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
import { JsonObject } from '@backstage/types';
|
||||
|
||||
import { TemplateConfigurationsV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
|
||||
/**
|
||||
* The shape of each entry of parameters which gets rendered
|
||||
* as a separate step in the wizard input
|
||||
@@ -25,6 +27,7 @@ import { JsonObject } from '@backstage/types';
|
||||
export type TemplateParameterSchema = {
|
||||
title: string;
|
||||
description?: string;
|
||||
configurations?: TemplateConfigurationsV1beta3;
|
||||
steps: Array<{
|
||||
title: string;
|
||||
description?: string;
|
||||
|
||||
Reference in New Issue
Block a user