From 00c04eee41309720af1250c8b7420782f573e80a Mon Sep 17 00:00:00 2001 From: Davide Briani Date: Fri, 23 Feb 2024 18:22:33 +0100 Subject: [PATCH] wip Signed-off-by: Davide Briani --- package-lock.json | 452 +++++++-------------------------- package.json | 6 +- src/NewPipelinePage.tsx | 1 + src/RegisterDevicePage.tsx | 23 +- src/components/modals/Form.tsx | 181 +++++-------- src/index.tsx | 11 +- 6 files changed, 164 insertions(+), 510 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0bcae84d..dce1b9a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,9 +16,6 @@ "@projectstorm/react-canvas-core": "^7.0.2", "@projectstorm/react-diagrams": "^7.0.3", "@reduxjs/toolkit": "^2.1.0", - "@rjsf/bootstrap-4": "^5.17.0", - "@rjsf/core": "^5.17.0", - "@rjsf/validator-ajv8": "^5.17.0", "@testing-library/react": "^14.2.1", "@testing-library/user-event": "^14.5.2", "@types/color": "^3.0.6", @@ -65,6 +62,9 @@ "resize-observer-polyfill": "^1.5.1", "sass": "^1.70.0", "typescript": "^5.3.3", + "uniforms": "^4.0.0-alpha.5", + "uniforms-bootstrap5": "^4.0.0-alpha.5", + "uniforms-bridge-json-schema": "^4.0.0-alpha.5", "uuid": "^9.0.1", "vite": "^5.0.12", "vite-plugin-eslint": "^1.8.1", @@ -3034,14 +3034,6 @@ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0" } }, - "node_modules/@react-icons/all-files": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@react-icons/all-files/-/all-files-4.1.0.tgz", - "integrity": "sha512-hxBI2UOuVaI3O/BhQfhtb4kcGn9ft12RWAFVMUeNjqqhLsHvFtzIkFaptBJpFDANTKoDfdVoHTKZDlwKCACbMQ==", - "peerDependencies": { - "react": "*" - } - }, "node_modules/@reduxjs/toolkit": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.1.0.tgz", @@ -3112,84 +3104,6 @@ "react": ">=16.14.0" } }, - "node_modules/@rjsf/bootstrap-4": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/bootstrap-4/-/bootstrap-4-5.17.0.tgz", - "integrity": "sha512-JrwfZv5R+nC0gpfRC83VbWfemOMsM94dAuRUJZGUMg9IeQnSXH4hxoKXkypRUpJjpkNCi52YQhJKyo1ALgf6pg==", - "dependencies": { - "@react-icons/all-files": "^4.1.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@rjsf/core": "^5.16.x", - "@rjsf/utils": "^5.16.x", - "react": "^16.14.0 || >=17", - "react-bootstrap": "^1.6.5" - } - }, - "node_modules/@rjsf/core": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/core/-/core-5.17.0.tgz", - "integrity": "sha512-0woSU+VU+t2kbDNSyMQhjxJOXJbk3F6lSHxf8XmS4yV3sXP/yr/vo7J3qcvXbSvCLPYMQHvskBFhCIaQqyHWBg==", - "dependencies": { - "lodash": "^4.17.21", - "lodash-es": "^4.17.21", - "markdown-to-jsx": "^7.4.1", - "nanoid": "^3.3.7", - "prop-types": "^15.8.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@rjsf/utils": "^5.16.x", - "react": "^16.14.0 || >=17" - } - }, - "node_modules/@rjsf/utils": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/utils/-/utils-5.17.0.tgz", - "integrity": "sha512-Hy2uAxMKWZIZSMzc2AiHrdACYvHj9GDynrdApMgUTxfjpzj5DT7Rghl/FGj7gg8Zy8VtdVNTCbkIzfS8xt4x7g==", - "peer": true, - "dependencies": { - "json-schema-merge-allof": "^0.8.1", - "jsonpointer": "^5.0.1", - "lodash": "^4.17.21", - "lodash-es": "^4.17.21", - "react-is": "^18.2.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "react": "^16.14.0 || >=17" - } - }, - "node_modules/@rjsf/utils/node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true - }, - "node_modules/@rjsf/validator-ajv8": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/validator-ajv8/-/validator-ajv8-5.17.0.tgz", - "integrity": "sha512-ZLTpvZDzBt1+Wftao2AkpRaSvxaVRrutvFX3/oy640/KsWUfl0ofV33ai9O4aptKSnOPjfRiLqPJgbPHgQAhmw==", - "dependencies": { - "ajv": "^8.12.0", - "ajv-formats": "^2.1.1", - "lodash": "^4.17.21", - "lodash-es": "^4.17.21" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@rjsf/utils": "^5.16.x" - } - }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.9.6", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.6.tgz", @@ -4234,22 +4148,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "dependencies": { - "ajv": "^8.0.0" - }, - "peerDependencies": { - "ajv": "^8.0.0" - }, - "peerDependenciesMeta": { - "ajv": { - "optional": true - } - } - }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -5170,29 +5068,6 @@ "node": ">=4.0.0" } }, - "node_modules/compute-gcd": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/compute-gcd/-/compute-gcd-1.2.1.tgz", - "integrity": "sha512-TwMbxBNz0l71+8Sc4czv13h4kEqnchV9igQZBi6QUaz09dnz13juGnnaWWJTRsP3brxOoxeB4SA2WELLw1hCtg==", - "peer": true, - "dependencies": { - "validate.io-array": "^1.0.3", - "validate.io-function": "^1.0.2", - "validate.io-integer-array": "^1.0.0" - } - }, - "node_modules/compute-lcm": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/compute-lcm/-/compute-lcm-1.1.2.tgz", - "integrity": "sha512-OFNPdQAXnQhDSKioX8/XYT6sdUlXwpeMjfd6ApxMJfyZ4GxmLR1xvMERctlYhlHwIiz6CSpBc2+qYKjHGZw4TQ==", - "peer": true, - "dependencies": { - "compute-gcd": "^1.2.1", - "validate.io-array": "^1.0.3", - "validate.io-function": "^1.0.2", - "validate.io-integer-array": "^1.0.0" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -7815,29 +7690,6 @@ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, - "node_modules/json-schema-compare": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/json-schema-compare/-/json-schema-compare-0.2.2.tgz", - "integrity": "sha512-c4WYmDKyJXhs7WWvAWm3uIYnfyWFoIp+JEoX34rctVvEkMYCPGhXtvmFFXiffBbxfZsvQ0RNnV5H7GvDF5HCqQ==", - "peer": true, - "dependencies": { - "lodash": "^4.17.4" - } - }, - "node_modules/json-schema-merge-allof": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/json-schema-merge-allof/-/json-schema-merge-allof-0.8.1.tgz", - "integrity": "sha512-CTUKmIlPJbsWfzRRnOXz+0MjIqvnleIXwFTzz+t9T86HnYX/Rozria6ZVGLktAU9e+NygNljveP+yxqtQp/Q4w==", - "peer": true, - "dependencies": { - "compute-lcm": "^1.1.2", - "json-schema-compare": "^0.2.2", - "lodash": "^4.17.20" - }, - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", @@ -7883,15 +7735,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsonpointer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", - "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/jsrsasign": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-11.1.0.tgz", @@ -8264,17 +8107,6 @@ "lz-string": "bin/bin.js" } }, - "node_modules/markdown-to-jsx": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.4.1.tgz", - "integrity": "sha512-GbrbkTnHp9u6+HqbPRFJbObi369AgJNXi/sGqq5HRsoZW063xR1XDCaConqq+whfEIAlzB1YPnOgsPc7B7bc/A==", - "engines": { - "node": ">= 10" - }, - "peerDependencies": { - "react": ">= 0.14.0" - } - }, "node_modules/matches-selector": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/matches-selector/-/matches-selector-0.0.1.tgz", @@ -10329,6 +10161,55 @@ "node": ">=4" } }, + "node_modules/uniforms": { + "version": "4.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/uniforms/-/uniforms-4.0.0-alpha.5.tgz", + "integrity": "sha512-e4GdyrAFkvgN2VmX8lUsAw96seCYalBzlSpdfSz9dsBqxpXNM++yAueRS63klu+bCAG849K1CJjGdf63XdkG2g==", + "dependencies": { + "invariant": "^2.0.0", + "lodash": "^4.0.0", + "tslib": "^2.2.0" + }, + "funding": { + "url": "https://github.com/vazco/uniforms?sponsor=1" + }, + "peerDependencies": { + "react": "^18.0.0 || ^17.0.0 || ^16.8.0" + } + }, + "node_modules/uniforms-bootstrap5": { + "version": "4.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/uniforms-bootstrap5/-/uniforms-bootstrap5-4.0.0-alpha.5.tgz", + "integrity": "sha512-P4VkcriOG4gM8EIKBVrKmqxj7blaTWGXBlXg3cuD7KMt4cPFniPmCTzcLSyzOJj9o2PVN/yowmSM1ka46NtOLw==", + "dependencies": { + "classnames": "^2.0.0", + "invariant": "^2.0.0", + "lodash": "^4.0.0", + "tslib": "^2.2.0", + "uniforms": "^4.0.0-alpha.5", + "warning": "^4.0.0" + }, + "funding": { + "url": "https://github.com/vazco/uniforms?sponsor=1" + }, + "peerDependencies": { + "react": "^18.0.0 || ^17.0.0 || ^16.8.0" + } + }, + "node_modules/uniforms-bridge-json-schema": { + "version": "4.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/uniforms-bridge-json-schema/-/uniforms-bridge-json-schema-4.0.0-alpha.5.tgz", + "integrity": "sha512-uez38fXgXoPKx0FZDsAfRvQiVWd4RRsICjuD16fZ7sKESq7a1911/5f6kbneJRpXskwTiXzaLeLacG6a7BmbVA==", + "dependencies": { + "invariant": "^2.0.0", + "lodash": "^4.0.0", + "tslib": "^2.2.0", + "uniforms": "^4.0.0-alpha.5" + }, + "funding": { + "url": "https://github.com/vazco/uniforms?sponsor=1" + } + }, "node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -10418,43 +10299,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/validate.io-array": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/validate.io-array/-/validate.io-array-1.0.6.tgz", - "integrity": "sha512-DeOy7CnPEziggrOO5CZhVKJw6S3Yi7e9e65R1Nl/RTN1vTQKnzjfvks0/8kQ40FP/dsjRAOd4hxmJ7uLa6vxkg==", - "peer": true - }, - "node_modules/validate.io-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/validate.io-function/-/validate.io-function-1.0.2.tgz", - "integrity": "sha512-LlFybRJEriSuBnUhQyG5bwglhh50EpTL2ul23MPIuR1odjO7XaMLFV8vHGwp7AZciFxtYOeiSCT5st+XSPONiQ==", - "peer": true - }, - "node_modules/validate.io-integer": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/validate.io-integer/-/validate.io-integer-1.0.5.tgz", - "integrity": "sha512-22izsYSLojN/P6bppBqhgUDjCkr5RY2jd+N2a3DCAUey8ydvrZ/OkGvFPR7qfOpwR2LC5p4Ngzxz36g5Vgr/hQ==", - "peer": true, - "dependencies": { - "validate.io-number": "^1.0.3" - } - }, - "node_modules/validate.io-integer-array": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/validate.io-integer-array/-/validate.io-integer-array-1.0.0.tgz", - "integrity": "sha512-mTrMk/1ytQHtCY0oNO3dztafHYyGU88KL+jRxWuzfOmQb+4qqnWmI+gykvGp8usKZOM0H7keJHEbRaFiYA0VrA==", - "peer": true, - "dependencies": { - "validate.io-array": "^1.0.3", - "validate.io-integer": "^1.0.4" - } - }, - "node_modules/validate.io-number": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/validate.io-number/-/validate.io-number-1.0.3.tgz", - "integrity": "sha512-kRAyotcbNaSYoDnXvb4MHg/0a1egJdLwS6oJ38TJY7aw9n93Fl/3blIXdyYvPOp55CNxywooG/3BcrwNrBpcSg==", - "peer": true - }, "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -13173,12 +13017,6 @@ "@swc/helpers": "^0.5.0" } }, - "@react-icons/all-files": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@react-icons/all-files/-/all-files-4.1.0.tgz", - "integrity": "sha512-hxBI2UOuVaI3O/BhQfhtb4kcGn9ft12RWAFVMUeNjqqhLsHvFtzIkFaptBJpFDANTKoDfdVoHTKZDlwKCACbMQ==", - "requires": {} - }, "@reduxjs/toolkit": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.1.0.tgz", @@ -13227,58 +13065,6 @@ } } }, - "@rjsf/bootstrap-4": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/bootstrap-4/-/bootstrap-4-5.17.0.tgz", - "integrity": "sha512-JrwfZv5R+nC0gpfRC83VbWfemOMsM94dAuRUJZGUMg9IeQnSXH4hxoKXkypRUpJjpkNCi52YQhJKyo1ALgf6pg==", - "requires": { - "@react-icons/all-files": "^4.1.0" - } - }, - "@rjsf/core": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/core/-/core-5.17.0.tgz", - "integrity": "sha512-0woSU+VU+t2kbDNSyMQhjxJOXJbk3F6lSHxf8XmS4yV3sXP/yr/vo7J3qcvXbSvCLPYMQHvskBFhCIaQqyHWBg==", - "requires": { - "lodash": "^4.17.21", - "lodash-es": "^4.17.21", - "markdown-to-jsx": "^7.4.1", - "nanoid": "^3.3.7", - "prop-types": "^15.8.1" - } - }, - "@rjsf/utils": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/utils/-/utils-5.17.0.tgz", - "integrity": "sha512-Hy2uAxMKWZIZSMzc2AiHrdACYvHj9GDynrdApMgUTxfjpzj5DT7Rghl/FGj7gg8Zy8VtdVNTCbkIzfS8xt4x7g==", - "peer": true, - "requires": { - "json-schema-merge-allof": "^0.8.1", - "jsonpointer": "^5.0.1", - "lodash": "^4.17.21", - "lodash-es": "^4.17.21", - "react-is": "^18.2.0" - }, - "dependencies": { - "react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "peer": true - } - } - }, - "@rjsf/validator-ajv8": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@rjsf/validator-ajv8/-/validator-ajv8-5.17.0.tgz", - "integrity": "sha512-ZLTpvZDzBt1+Wftao2AkpRaSvxaVRrutvFX3/oy640/KsWUfl0ofV33ai9O4aptKSnOPjfRiLqPJgbPHgQAhmw==", - "requires": { - "ajv": "^8.12.0", - "ajv-formats": "^2.1.1", - "lodash": "^4.17.21", - "lodash-es": "^4.17.21" - } - }, "@rollup/rollup-android-arm-eabi": { "version": "4.9.6", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.6.tgz", @@ -14034,14 +13820,6 @@ "uri-js": "^4.2.2" } }, - "ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "requires": { - "ajv": "^8.0.0" - } - }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -14691,29 +14469,6 @@ "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==", "dev": true }, - "compute-gcd": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/compute-gcd/-/compute-gcd-1.2.1.tgz", - "integrity": "sha512-TwMbxBNz0l71+8Sc4czv13h4kEqnchV9igQZBi6QUaz09dnz13juGnnaWWJTRsP3brxOoxeB4SA2WELLw1hCtg==", - "peer": true, - "requires": { - "validate.io-array": "^1.0.3", - "validate.io-function": "^1.0.2", - "validate.io-integer-array": "^1.0.0" - } - }, - "compute-lcm": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/compute-lcm/-/compute-lcm-1.1.2.tgz", - "integrity": "sha512-OFNPdQAXnQhDSKioX8/XYT6sdUlXwpeMjfd6ApxMJfyZ4GxmLR1xvMERctlYhlHwIiz6CSpBc2+qYKjHGZw4TQ==", - "peer": true, - "requires": { - "compute-gcd": "^1.2.1", - "validate.io-array": "^1.0.3", - "validate.io-function": "^1.0.2", - "validate.io-integer-array": "^1.0.0" - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -16615,26 +16370,6 @@ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, - "json-schema-compare": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/json-schema-compare/-/json-schema-compare-0.2.2.tgz", - "integrity": "sha512-c4WYmDKyJXhs7WWvAWm3uIYnfyWFoIp+JEoX34rctVvEkMYCPGhXtvmFFXiffBbxfZsvQ0RNnV5H7GvDF5HCqQ==", - "peer": true, - "requires": { - "lodash": "^4.17.4" - } - }, - "json-schema-merge-allof": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/json-schema-merge-allof/-/json-schema-merge-allof-0.8.1.tgz", - "integrity": "sha512-CTUKmIlPJbsWfzRRnOXz+0MjIqvnleIXwFTzz+t9T86HnYX/Rozria6ZVGLktAU9e+NygNljveP+yxqtQp/Q4w==", - "peer": true, - "requires": { - "compute-lcm": "^1.1.2", - "json-schema-compare": "^0.2.2", - "lodash": "^4.17.20" - } - }, "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", @@ -16672,12 +16407,6 @@ "universalify": "^2.0.0" } }, - "jsonpointer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", - "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", - "peer": true - }, "jsrsasign": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-11.1.0.tgz", @@ -16951,12 +16680,6 @@ "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==" }, - "markdown-to-jsx": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.4.1.tgz", - "integrity": "sha512-GbrbkTnHp9u6+HqbPRFJbObi369AgJNXi/sGqq5HRsoZW063xR1XDCaConqq+whfEIAlzB1YPnOgsPc7B7bc/A==", - "requires": {} - }, "matches-selector": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/matches-selector/-/matches-selector-0.0.1.tgz", @@ -18463,6 +18186,40 @@ "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==" }, + "uniforms": { + "version": "4.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/uniforms/-/uniforms-4.0.0-alpha.5.tgz", + "integrity": "sha512-e4GdyrAFkvgN2VmX8lUsAw96seCYalBzlSpdfSz9dsBqxpXNM++yAueRS63klu+bCAG849K1CJjGdf63XdkG2g==", + "requires": { + "invariant": "^2.0.0", + "lodash": "^4.0.0", + "tslib": "^2.2.0" + } + }, + "uniforms-bootstrap5": { + "version": "4.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/uniforms-bootstrap5/-/uniforms-bootstrap5-4.0.0-alpha.5.tgz", + "integrity": "sha512-P4VkcriOG4gM8EIKBVrKmqxj7blaTWGXBlXg3cuD7KMt4cPFniPmCTzcLSyzOJj9o2PVN/yowmSM1ka46NtOLw==", + "requires": { + "classnames": "^2.0.0", + "invariant": "^2.0.0", + "lodash": "^4.0.0", + "tslib": "^2.2.0", + "uniforms": "^4.0.0-alpha.5", + "warning": "^4.0.0" + } + }, + "uniforms-bridge-json-schema": { + "version": "4.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/uniforms-bridge-json-schema/-/uniforms-bridge-json-schema-4.0.0-alpha.5.tgz", + "integrity": "sha512-uez38fXgXoPKx0FZDsAfRvQiVWd4RRsICjuD16fZ7sKESq7a1911/5f6kbneJRpXskwTiXzaLeLacG6a7BmbVA==", + "requires": { + "invariant": "^2.0.0", + "lodash": "^4.0.0", + "tslib": "^2.2.0", + "uniforms": "^4.0.0-alpha.5" + } + }, "universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -18519,43 +18276,6 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" }, - "validate.io-array": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/validate.io-array/-/validate.io-array-1.0.6.tgz", - "integrity": "sha512-DeOy7CnPEziggrOO5CZhVKJw6S3Yi7e9e65R1Nl/RTN1vTQKnzjfvks0/8kQ40FP/dsjRAOd4hxmJ7uLa6vxkg==", - "peer": true - }, - "validate.io-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/validate.io-function/-/validate.io-function-1.0.2.tgz", - "integrity": "sha512-LlFybRJEriSuBnUhQyG5bwglhh50EpTL2ul23MPIuR1odjO7XaMLFV8vHGwp7AZciFxtYOeiSCT5st+XSPONiQ==", - "peer": true - }, - "validate.io-integer": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/validate.io-integer/-/validate.io-integer-1.0.5.tgz", - "integrity": "sha512-22izsYSLojN/P6bppBqhgUDjCkr5RY2jd+N2a3DCAUey8ydvrZ/OkGvFPR7qfOpwR2LC5p4Ngzxz36g5Vgr/hQ==", - "peer": true, - "requires": { - "validate.io-number": "^1.0.3" - } - }, - "validate.io-integer-array": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/validate.io-integer-array/-/validate.io-integer-array-1.0.0.tgz", - "integrity": "sha512-mTrMk/1ytQHtCY0oNO3dztafHYyGU88KL+jRxWuzfOmQb+4qqnWmI+gykvGp8usKZOM0H7keJHEbRaFiYA0VrA==", - "peer": true, - "requires": { - "validate.io-array": "^1.0.3", - "validate.io-integer": "^1.0.4" - } - }, - "validate.io-number": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/validate.io-number/-/validate.io-number-1.0.3.tgz", - "integrity": "sha512-kRAyotcbNaSYoDnXvb4MHg/0a1egJdLwS6oJ38TJY7aw9n93Fl/3blIXdyYvPOp55CNxywooG/3BcrwNrBpcSg==", - "peer": true - }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", diff --git a/package.json b/package.json index 46aca6b4..74bb6e81 100644 --- a/package.json +++ b/package.json @@ -51,9 +51,6 @@ "@projectstorm/react-canvas-core": "^7.0.2", "@projectstorm/react-diagrams": "^7.0.3", "@reduxjs/toolkit": "^2.1.0", - "@rjsf/bootstrap-4": "^5.17.0", - "@rjsf/core": "^5.17.0", - "@rjsf/validator-ajv8": "^5.17.0", "@testing-library/react": "^14.2.1", "@testing-library/user-event": "^14.5.2", "@types/color": "^3.0.6", @@ -100,6 +97,9 @@ "resize-observer-polyfill": "^1.5.1", "sass": "^1.70.0", "typescript": "^5.3.3", + "uniforms": "^4.0.0-alpha.5", + "uniforms-bootstrap5": "^4.0.0-alpha.5", + "uniforms-bridge-json-schema": "^4.0.0-alpha.5", "uuid": "^9.0.1", "vite": "^5.0.12", "vite-plugin-eslint": "^1.8.1", diff --git a/src/NewPipelinePage.tsx b/src/NewPipelinePage.tsx index 12815ef6..03456797 100644 --- a/src/NewPipelinePage.tsx +++ b/src/NewPipelinePage.tsx @@ -128,6 +128,7 @@ const NewPipelinePage = (): React.ReactElement => { schemaObject, ]); + console.log(schemaObject); const isValidSchema = useMemo(() => { if (!schemaObject) { return false; diff --git a/src/RegisterDevicePage.tsx b/src/RegisterDevicePage.tsx index 121f0bd5..db133106 100644 --- a/src/RegisterDevicePage.tsx +++ b/src/RegisterDevicePage.tsx @@ -219,6 +219,7 @@ const NamespaceModal = ({ onCancel, onConfirm }: NamespaceModalProps) => { onCancel={onCancel} onConfirm={handleConfirm} schema={{ + $schema: 'http://json-schema.org/draft-07/schema', type: 'object', required: ['userNamespace'], properties: { @@ -227,30 +228,18 @@ const NamespaceModal = ({ onCancel, onConfirm }: NamespaceModalProps) => { type: 'string', pattern: '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$', + uniforms: { + placeholder: 'e.g.: 753ffc99-dd9d-4a08-a07e-9b0d6ce0bc82', + errorMessage: 'The namespace must be a valid UUID', + }, }, userString: { title: 'Name', type: 'string', + uniforms: { placeholder: 'e.g.: my device' }, }, }, }} - uiSchema={{ - userNamespace: { - 'ui:autofocus': true, - 'ui:placeholder': 'e.g.: 753ffc99-dd9d-4a08-a07e-9b0d6ce0bc82', - }, - userString: { - 'ui:placeholder': 'e.g.: my device', - }, - }} - transformErrors={(errors) => - errors.map((error) => { - if (error.property === '.userNamespace' && error.name === 'pattern') { - return { ...error, message: 'The namespace must be a valid UUID' }; - } - return error; - }) - } /> ); }; diff --git a/src/components/modals/Form.tsx b/src/components/modals/Form.tsx index 86b7d31a..b22c64d7 100644 --- a/src/components/modals/Form.tsx +++ b/src/components/modals/Form.tsx @@ -16,84 +16,28 @@ limitations under the License. */ -import React, { useState } from 'react'; -import { Button, Form, Modal, Spinner } from 'react-bootstrap'; +import { useState } from 'react'; +import { Button, Modal, Spinner } from 'react-bootstrap'; import type { ModalProps } from 'react-bootstrap'; -import JsonSchemaForm from '@rjsf/bootstrap-4'; -import validator from '@rjsf/validator-ajv8'; -import type { IChangeEvent } from '@rjsf/core'; -import type { WidgetProps } from '@rjsf/utils'; -import type { ComponentProps } from 'react'; - -export interface TextWidgetProps extends WidgetProps { - type?: string; -} - -const TextWidget = ({ - id, - required, - readonly, - disabled, - placeholder, - type, - label, - value, - onChange, - onBlur, - onFocus, - autofocus, - options, - schema, - rawErrors = [], -}: TextWidgetProps) => { - const handleChange = ({ target: { value: v } }: React.ChangeEvent) => - onChange(v === '' ? options.emptyValue : v); - const handleBlur = ({ target: { value: v } }: React.FocusEvent) => - onBlur(id, v); - const handleFocus = ({ target: { value: v } }: React.FocusEvent) => - onFocus(id, v); +import { useForm } from 'uniforms'; +import { AutoForm } from 'uniforms-bootstrap5'; +import { JSONSchemaBridge } from 'uniforms-bridge-json-schema'; +import Ajv, { JSONSchemaType } from 'ajv'; - return ( - - 0 ? 'text-danger' : ''}> - {label || schema.title} - - 0 ? 'is-invalid' : ''} - list={schema.examples ? `examples_${id}` : undefined} - type={type || (schema.type as string)} - value={value || value === 0 ? value : ''} - onChange={handleChange} - onBlur={handleBlur} - onFocus={handleFocus} - /> - {schema.examples ? ( - - {(schema.examples as string[]) - .concat(schema.default ? ([schema.default] as string[]) : []) - .map((example) => ( - // eslint-disable-next-line jsx-a11y/control-has-associated-label - - ) : null} - - ); -}; +const ajv = new Ajv({ + allErrors: true, + useDefaults: true, +}); +ajv.addKeyword('uniforms'); -// Delete custom widgets when this is issue is solved and 'placeholder' is supported -// https://github.com/rjsf-team/react-jsonschema-form/issues/1998 -const widgets = { - TextWidget, -}; +function createValidator(schema: JSONSchemaType) { + const validator = ajv.compile(schema); -type JsonSchemaFormProps = ComponentProps; + return (model: Record) => { + validator(model); + return validator.errors?.length ? { details: validator.errors } : null; + }; +} type BoostrapVariant = | 'primary' @@ -110,16 +54,14 @@ interface Props { cancelLabel?: string; confirmLabel?: string; confirmVariant?: BoostrapVariant; - initialData?: JsonSchemaFormProps['formData']; + initialData?: any; isConfirming?: boolean; liveValidate?: boolean; onCancel: () => void; - onConfirm: (formData: IChangeEvent['formData']) => void; - schema: JsonSchemaFormProps['schema']; + onConfirm: (formData: any) => void; + schema: any; size?: ModalProps['size']; title: React.ReactNode; - transformErrors?: JsonSchemaFormProps['transformErrors']; - uiSchema?: JsonSchemaFormProps['uiSchema']; } const FormModal = ({ @@ -134,11 +76,41 @@ const FormModal = ({ schema, size = 'lg', title, - transformErrors, - uiSchema, }: Props): React.ReactElement => { - const [formData, setFormData] = React.useState(initialData || null); - const [hasSubmit, setHasSubmit] = useState(false); + const [formData, setFormData] = useState(initialData || null); + + const schemaValidator = createValidator(schema); + + const bridge = new JSONSchemaBridge({ + schema, + validator: schemaValidator, + }); + + function SubmitField() { + const { + error, + state: { disabled }, + submitting, + validating, + } = useForm(); + + return ( +
+ + +
+ ); + } return ( @@ -146,41 +118,14 @@ const FormModal = ({ {title} -
- { - setFormData(event.formData); - }} - onSubmit={(event) => onConfirm(event.formData)} - showErrorList={false} - transformErrors={transformErrors} - > -
-
- - -
-
-
+ +
); diff --git a/src/index.tsx b/src/index.tsx index 831c10a6..74ad496f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -16,7 +16,6 @@ limitations under the License. */ -import React from 'react'; import { createRoot } from 'react-dom/client'; import './styles/main.scss'; @@ -41,9 +40,9 @@ fetch('/user-config/config.json') const container = document.getElementById('root')!; const root = createRoot(container); - root.render( - - - , - ); + // TODO: the is usually wrapped within a , however + // Uniforms has issues running in strict mode. + // Strict mode can be enabled again once this is fixed: + // https://github.com/vazco/uniforms/issues/1194 + root.render(); });