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}
|
disabled={disabled}
|
||||||
value={data.node.template[name]?.value ?? ""}
|
value={data.node.template[name]?.value ?? ""}
|
||||||
onChange={(t: string) => {
|
onChange={(t: string) => {
|
||||||
data.node.template[name].value = t;
|
if(data.node.template[name]?.value){
|
||||||
|
data.node.template[name].value = t;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
></InputFileComponent>
|
></InputFileComponent>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ export default function GenericNode({
|
||||||
const showError = useRef(true);
|
const showError = useRef(true);
|
||||||
const { types, deleteNode } = useContext(typesContext);
|
const { types, deleteNode } = useContext(typesContext);
|
||||||
const Icon = nodeIcons[types[data.type]];
|
const Icon = nodeIcons[types[data.type]];
|
||||||
console.log(data)
|
|
||||||
if (!Icon) {
|
if (!Icon) {
|
||||||
if (showError.current) {
|
if (showError.current) {
|
||||||
setErrorData({
|
setErrorData({
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,12 @@ export default function InputFileComponent({
|
||||||
}
|
}
|
||||||
}, [disabled, onChange]);
|
}, [disabled, onChange]);
|
||||||
|
|
||||||
|
function attachFile(fileReadEvent: ProgressEvent<FileReader>) {
|
||||||
|
fileReadEvent.preventDefault();
|
||||||
|
const file = fileReadEvent.target.result;
|
||||||
|
console.log(file);
|
||||||
|
}
|
||||||
|
|
||||||
const handleButtonClick = () => {
|
const handleButtonClick = () => {
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
input.type = "file";
|
input.type = "file";
|
||||||
|
|
@ -25,7 +31,10 @@ export default function InputFileComponent({
|
||||||
input.multiple = false;
|
input.multiple = false;
|
||||||
input.onchange = (e: Event) => {
|
input.onchange = (e: Event) => {
|
||||||
const file = (e.target as HTMLInputElement).files?.[0];
|
const file = (e.target as HTMLInputElement).files?.[0];
|
||||||
|
const fileData = new FileReader();
|
||||||
|
fileData.onload = attachFile;
|
||||||
if (file && file.name.endsWith(".json")) {
|
if (file && file.name.endsWith(".json")) {
|
||||||
|
fileData.readAsDataURL(file);
|
||||||
setMyValue(file.name);
|
setMyValue(file.name);
|
||||||
onChange(file.name);
|
onChange(file.name);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue