Incorporated a feedback
Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/plugin-circleci': patch
|
||||
---
|
||||
|
||||
Making workflow a link
|
||||
Making workflow a link
|
||||
|
||||
@@ -32,17 +32,20 @@ describe('createValidator', () => {
|
||||
}
|
||||
},
|
||||
TagPicker: (
|
||||
value: unknown,
|
||||
values: unknown,
|
||||
fieldValidation: FieldValidation,
|
||||
_context: { apiHolder: ApiHolder },
|
||||
) => {
|
||||
if (!value) {
|
||||
const input = values as string[];
|
||||
if (input.length === 0) {
|
||||
fieldValidation.addError('A tag name can not be empty');
|
||||
}
|
||||
if (!/^[a-z0-9-]+$/.test(value as string)) {
|
||||
fieldValidation.addError(
|
||||
'A tag name can only contain lowercase letters, numeric characters or dashes',
|
||||
);
|
||||
for (const item of input) {
|
||||
if (!/^[a-z0-9-]+$/.test(item)) {
|
||||
fieldValidation.addError(
|
||||
'A tag name can only contain lowercase letters, numeric characters or dashes',
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -63,15 +63,13 @@ export const createValidator = (
|
||||
if (isObject(propSchemaProps)) {
|
||||
const { items } = propSchemaProps;
|
||||
if (isObject(items)) {
|
||||
for (const propItem of propData as JsonObject[]) {
|
||||
const fieldName = items['ui:field'] as string;
|
||||
if (fieldName && typeof validators[fieldName] === 'function') {
|
||||
validators[fieldName]!(
|
||||
propItem as JsonValue,
|
||||
propValidation,
|
||||
context,
|
||||
);
|
||||
}
|
||||
const fieldName = items['ui:field'] as string;
|
||||
if (fieldName && typeof validators[fieldName] === 'function') {
|
||||
validators[fieldName]!(
|
||||
propData as JsonObject[],
|
||||
propValidation,
|
||||
context,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user