= ({constraints, parentKeyPath=["DPF"]}) => {
- const { t } = useTranslation();
-
- return (<>
- {Object.entries(constraints.record).map(([fieldName, value]) => {
- console.log(fieldName, value);
- const globallyUniqueId = joinKeyPath([...parentKeyPath, fieldName]);
- return
-
- {fieldConstraintToElement(fieldName, parentKeyPath, globallyUniqueId, value)}
-
;
- })}
- >);
-};
-
-function joinKeyPath(keyPath: string[]) {
- return keyPath.join(".");
-}
-
-function fieldConstraintToElement(fieldName: string, parentKeyPath: string[], globallyUniqueId: string, fieldConstraint: FieldConstraint) {
- if (Array.isArray(fieldConstraint.type)) {
- if (fieldConstraint.type.every(e => typeof e == "string" || typeof e == "number")) {
- return (
-
-
- {fieldConstraint.type.map((option) => )}
-
- );
- } else {
- return Error: Field type '{fieldConstraint.type}' not supported
;
- }
- } else if (typeof fieldConstraint.type == "string") {
- switch (fieldConstraint.type) {
- case "file.pdf":
- return ;
- case "files.pdf":
- return ;
- case "string":
- return ;
- case "number":
- return ;
- default:
- return Error: Field type '{fieldConstraint.type}' not supported
;
- }
- } else if (fieldConstraint.type instanceof RecordConstraint) {
- //return
- return Error: Field type 'RecordConstraint' not supported yet!
;
- }
-
- return Error: Field type '{fieldConstraint.type}' not supported
;
-}
-
-export default DynamicParameterFields;
\ No newline at end of file
diff --git a/client-tauri/src/components/fields/BuildFields.tsx b/client-tauri/src/components/fields/BuildFields.tsx
index e07bc8840..c85b1a09a 100644
--- a/client-tauri/src/components/fields/BuildFields.tsx
+++ b/client-tauri/src/components/fields/BuildFields.tsx
@@ -20,7 +20,7 @@ export function BuildFields({ schemaDescription, onSubmit }: BuildFieldsProps) {