wip
Signed-off-by: blam <ben@blam.sh> Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -6,6 +6,7 @@ metadata:
|
||||
spec:
|
||||
targets:
|
||||
- ./remote-templates.yaml
|
||||
- ./template.yaml
|
||||
# For local development of a template, you can reference your local templates here.
|
||||
# Examples:
|
||||
#
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: scaffolder.backstage.io/v1beta3
|
||||
kind: Template
|
||||
metadata:
|
||||
name: test
|
||||
title: Test template
|
||||
spec:
|
||||
parameters:
|
||||
- title: Do something
|
||||
properties:
|
||||
myKey:
|
||||
title: My key
|
||||
description: asd
|
||||
type: string
|
||||
ui:field: Secret
|
||||
ui:options:
|
||||
required: true
|
||||
steps: []
|
||||
type: service
|
||||
|
||||
@@ -14,3 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
export * from './Secret';
|
||||
export * from './validation';
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { CustomFieldValidator } from '@backstage/plugin-scaffolder-react';
|
||||
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const secretFieldValidation: CustomFieldValidator<string> = (
|
||||
value,
|
||||
errors,
|
||||
{ uiSchema },
|
||||
) => {
|
||||
console.log(uiSchema);
|
||||
if (uiSchema['ui:options'].required && !value) {
|
||||
errors.addError('Required');
|
||||
}
|
||||
};
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
MyGroupsPicker,
|
||||
MyGroupsPickerSchema,
|
||||
} from '../components/fields/MyGroupsPicker/MyGroupsPicker';
|
||||
import { Secret } from '../components';
|
||||
import { Secret, secretFieldValidation } from '../components';
|
||||
|
||||
export const DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS = [
|
||||
{
|
||||
@@ -86,5 +86,6 @@ export const DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS = [
|
||||
{
|
||||
component: Secret,
|
||||
name: 'Secret',
|
||||
validation: secretFieldValidation,
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user