Skip to content

Commit

Permalink
download button wip
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Hildebrandt <[email protected]>
  • Loading branch information
paulphys committed Oct 30, 2024
1 parent d13b900 commit cf4f032
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/form/custom/SubmitButton/SubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function SubmitButton<
if (norender) {
return null;
}
console.log(props);
//console.log(props);

return (
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/download-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
21 changes: 16 additions & 5 deletions src/components/form/form.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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;
Expand All @@ -54,6 +56,14 @@ export const ClusterForm = (schemas: any) => {
.slice(0, 1)[0]
.trimEnd();


const formRef = createRef<any>();
console.log(formRef.current);
const onError = (errors: any) => {
console.log(errors);
};
//console.log(formRef?.current?.formElement?.reportValidity());

return (
<>
<div className="flex space-x-8 mt-8">
Expand Down Expand Up @@ -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 } }}
>
{/*<DownloadButton formStatus={validator} formData={yaml_out}/> */}
{/*<SubmitButton
<SubmitButton
registry={{
...getDefaultRegistry(),
schemaUtils: validator,
schemaUtils: validator.schemaUtils,
}}
formStatus={validator}
formData={yaml_out}
/>
*/}

</RJSForm>
</CardContent>
</Card>
Expand Down

0 comments on commit cf4f032

Please sign in to comment.