file component almost ready, need to implemente backend connection
This commit is contained in:
parent
a38d71bc4f
commit
7529892ebc
3 changed files with 12 additions and 2 deletions
|
|
@ -159,7 +159,9 @@ export default function ParameterComponent({
|
|||
disabled={disabled}
|
||||
value={data.node.template[name]?.value ?? ""}
|
||||
onChange={(t: string) => {
|
||||
data.node.template[name].value = t;
|
||||
if(data.node.template[name]?.value){
|
||||
data.node.template[name].value = t;
|
||||
}
|
||||
}}
|
||||
></InputFileComponent>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ export default function GenericNode({
|
|||
const showError = useRef(true);
|
||||
const { types, deleteNode } = useContext(typesContext);
|
||||
const Icon = nodeIcons[types[data.type]];
|
||||
console.log(data)
|
||||
if (!Icon) {
|
||||
if (showError.current) {
|
||||
setErrorData({
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@ export default function InputFileComponent({
|
|||
}
|
||||
}, [disabled, onChange]);
|
||||
|
||||
function attachFile(fileReadEvent: ProgressEvent<FileReader>) {
|
||||
fileReadEvent.preventDefault();
|
||||
const file = fileReadEvent.target.result;
|
||||
console.log(file);
|
||||
}
|
||||
|
||||
const handleButtonClick = () => {
|
||||
const input = document.createElement("input");
|
||||
input.type = "file";
|
||||
|
|
@ -25,7 +31,10 @@ export default function InputFileComponent({
|
|||
input.multiple = false;
|
||||
input.onchange = (e: Event) => {
|
||||
const file = (e.target as HTMLInputElement).files?.[0];
|
||||
const fileData = new FileReader();
|
||||
fileData.onload = attachFile;
|
||||
if (file && file.name.endsWith(".json")) {
|
||||
fileData.readAsDataURL(file);
|
||||
setMyValue(file.name);
|
||||
onChange(file.name);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue