fix schema modals

This commit is contained in:
dswbx
2025-07-07 16:38:39 +02:00
parent 88ec3432a0
commit ea46dc8df0
4 changed files with 7 additions and 11 deletions
@@ -33,7 +33,7 @@ export class PasswordStrategy extends Strategy<typeof schema> {
private getPayloadSchema() { private getPayloadSchema() {
return s.object({ return s.object({
email: s.string({ email: s.string({
pattern: /^[\w-\.\+_]+@([\w-]+\.)+[\w-]{2,4}$/, format: "email",
}), }),
password: s.string({ password: s.string({
minLength: 8, // @todo: this should be configurable minLength: 8, // @todo: this should be configurable
@@ -23,7 +23,7 @@ export class JsonvTsValidator<T = any, S extends StrictRJSFSchema = RJSFSchema>
return { errors: [], validationError: null as any }; return { errors: [], validationError: null as any };
} }
const jsSchema = s.fromSchema(schema as any); const jsSchema = s.fromSchema(JSON.parse(JSON.stringify(schema)) as any);
const result = jsSchema.validate(formData); const result = jsSchema.validate(formData);
if (result.valid) { if (result.valid) {
+1 -1
View File
@@ -65,7 +65,7 @@ export function SchemaFormModal({
<JsonSchemaForm <JsonSchemaForm
tagName="form" tagName="form"
ref={formRef} ref={formRef}
schema={schema} schema={JSON.parse(JSON.stringify(schema))}
uiSchema={uiSchema} uiSchema={uiSchema}
className="legacy hide-required-mark fieldset-alternative mute-root" className="legacy hide-required-mark fieldset-alternative mute-root"
onChange={handleChange} onChange={handleChange}
+4 -8
View File
@@ -6,7 +6,7 @@ import { Button } from "../../components/buttons/Button";
import { CellValue, DataTable } from "../../components/table/DataTable"; import { CellValue, DataTable } from "../../components/table/DataTable";
import * as AppShell from "../../layouts/AppShell/AppShell"; import * as AppShell from "../../layouts/AppShell/AppShell";
import { routes, useNavigate } from "../../lib/routes"; import { routes, useNavigate } from "../../lib/routes";
import { stringIdentifier } from "bknd/core"; import { s, stringIdentifier } from "bknd/core";
export function AuthRolesList() { export function AuthRolesList() {
const [navigate] = useNavigate(); const [navigate] = useNavigate();
@@ -29,13 +29,9 @@ export function AuthRolesList() {
bkndModals.open( bkndModals.open(
"form", "form",
{ {
schema: { schema: s.strictObject({
type: "object", name: stringIdentifier,
properties: { }),
name: stringIdentifier,
},
required: ["name"],
},
uiSchema: { uiSchema: {
name: { name: {
"ui:title": "Role name", "ui:title": "Role name",