From cf4f03263ef05c241a94079fed1274dbab2714d6 Mon Sep 17 00:00:00 2001 From: Paul Hildebrandt Date: Wed, 30 Oct 2024 17:11:00 +0100 Subject: [PATCH] download button wip Signed-off-by: Paul Hildebrandt --- .../form/custom/SubmitButton/SubmitButton.tsx | 2 +- src/components/form/download-button.tsx | 2 +- src/components/form/form.tsx | 21 ++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/components/form/custom/SubmitButton/SubmitButton.tsx b/src/components/form/custom/SubmitButton/SubmitButton.tsx index b7aee82..72f5cfe 100644 --- a/src/components/form/custom/SubmitButton/SubmitButton.tsx +++ b/src/components/form/custom/SubmitButton/SubmitButton.tsx @@ -20,7 +20,7 @@ export default function SubmitButton< if (norender) { return null; } - console.log(props); + //console.log(props); return (
diff --git a/src/components/form/download-button.tsx b/src/components/form/download-button.tsx index 09d5ef5..c5e7775 100644 --- a/src/components/form/download-button.tsx +++ b/src/components/form/download-button.tsx @@ -16,7 +16,7 @@ export function DownloadButton( formData: any, formStatus: any, ) { - // console.log(props) + console.log(props) const { uiSchema } = props; const { norender } = getSubmitButtonOptions(uiSchema); if (norender) { diff --git a/src/components/form/form.tsx b/src/components/form/form.tsx index 2a8515b..ed0ec60 100644 --- a/src/components/form/form.tsx +++ b/src/components/form/form.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState } from "react"; +import { useState, useEffect } from "react"; import React from "react"; import validator from "@rjsf/validator-ajv8"; @@ -36,6 +36,8 @@ import { } from "@/components/ui/select"; import { convertYamlFormat } from "@/lib/utils"; +import { createRef } from 'react'; + export const ClusterForm = (schemas: any) => { const schema = schemas?.schemas; @@ -54,6 +56,14 @@ export const ClusterForm = (schemas: any) => { .slice(0, 1)[0] .trimEnd(); + + const formRef = createRef(); + console.log(formRef.current); + const onError = (errors: any) => { + console.log(errors); + }; + //console.log(formRef?.current?.formElement?.reportValidity()); + return ( <>
@@ -100,19 +110,20 @@ export const ClusterForm = (schemas: any) => { widgets={widgets} formData={formData} onChange={(e: any) => setFormData(e.formData)} + ref={formRef} + onError={onError} // templates={{ ButtonTemplates: { SubmitButton } }} > {/* */} - {/* - - */} +