From 1c8034fc795f4c3d2e89d6be726699cd11c616f2 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 12 Sep 2023 19:56:04 +0100 Subject: [PATCH] add example of templating scaffolder fields in select box --- .../scaffolder/writing-templates/index.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/content/docs/scaffolder/writing-templates/index.md b/content/docs/scaffolder/writing-templates/index.md index 8a5aedd89..1d9a437ff 100644 --- a/content/docs/scaffolder/writing-templates/index.md +++ b/content/docs/scaffolder/writing-templates/index.md @@ -254,6 +254,39 @@ parameters: labelSelector: 'value' ``` +Some of the `SelectFieldFromApi` options allow using parameters from earlier parameter pages to be used to template the options. The templated options are `params`, `path`, `valueSelector` and `labelSelector`. e.g. + +```yaml +parameters: + - title: Select an Entity kind + required: + - kind + properties: + kind: + title: Kind + type: string + enum: + - template + - location + default: template + ui:autofocus: true + ui:options: + rows: 5 + - title: Select the specific entity you want + properties: + obj: + title: custom + type: string + description: Entity Selector + ui:field: SelectFieldFromApi + ui:options: + path: "catalog/entities" + params: + filter: "kind={{ parameters.kind }}" + valueSelector: "metadata.name" + labelSelector: "metadata.description" +``` + ### `number` You can allow the user to enter a number using the `number` type: