2023-09-20 17:27:25 +02:00
|
|
|
import './App.css';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
const [datasetQuarry, setDatasetQuarry] = useState('');
|
|
|
|
const [tableQuarry, setTableQuarry] = useState('');
|
|
|
|
const [columns, setColumns] = useState('');
|
2024-01-09 21:35:53 +01:00
|
|
|
const [datasetQuarry2, setDatasetQuarry2] = useState('');
|
|
|
|
const [tableQuarry2, setTableQuarry2] = useState('');
|
|
|
|
const [columns2, setColumns2] = useState('');
|
2023-09-20 17:27:25 +02:00
|
|
|
const [results, setResults] = useState('');
|
2024-01-08 14:31:51 +01:00
|
|
|
const [isVisible, setIsVisible] = useState(true);
|
2023-09-20 17:27:25 +02:00
|
|
|
|
2024-01-12 10:57:52 +01:00
|
|
|
const fetchDataFromAPI = async (ldataset, ltable, lcolumn, tdataset, ttable, tcolumn) => {
|
2023-09-20 17:27:25 +02:00
|
|
|
try {
|
2024-01-12 10:57:52 +01:00
|
|
|
postML(entryId, ldataset, ltable, lcolumn, tdataset, ttable, tcolumn);
|
2023-09-20 17:27:25 +02:00
|
|
|
|
|
|
|
} catch (error) {
|
2024-01-12 10:57:52 +01:00
|
|
|
console.error('ERROR fetching data:', error);
|
2023-09-20 17:27:25 +02:00
|
|
|
setResults('Error fetching data');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-01-12 10:57:52 +01:00
|
|
|
|
2023-09-20 17:27:25 +02:00
|
|
|
const handleButtonClick = () => {
|
2024-01-12 10:57:52 +01:00
|
|
|
fetchDataFromAPI(datasetQuarry2, tableQuarry2, columns2, datasetQuarry, tableQuarry, columns);
|
2023-09-20 17:27:25 +02:00
|
|
|
};
|
|
|
|
|
2024-01-12 10:57:52 +01:00
|
|
|
|
2024-01-08 14:31:51 +01:00
|
|
|
const toggleVisibility = () => {
|
|
|
|
setIsVisible(!isVisible);
|
|
|
|
};
|
|
|
|
|
2023-09-20 17:27:25 +02:00
|
|
|
return (
|
2024-01-08 14:31:51 +01:00
|
|
|
<body>
|
|
|
|
{isVisible && <div className="container2">
|
|
|
|
<div className='headerlearn'>
|
|
|
|
<header>Learning tables</header>
|
|
|
|
</div>
|
|
|
|
<input
|
|
|
|
className='datasetL'
|
|
|
|
type="text"
|
|
|
|
placeholder="Dataset quarry"
|
2024-01-09 21:35:53 +01:00
|
|
|
value={datasetQuarry2}
|
|
|
|
onChange={(e) => setDatasetQuarry2(e.target.value)}
|
2024-01-08 14:31:51 +01:00
|
|
|
/>
|
|
|
|
<input
|
|
|
|
className='tableL'
|
|
|
|
type="text"
|
|
|
|
placeholder="Table quarry"
|
2024-01-09 21:35:53 +01:00
|
|
|
value={tableQuarry2}
|
|
|
|
onChange={(e) => setTableQuarry2(e.target.value)}
|
2024-01-08 14:31:51 +01:00
|
|
|
/>
|
|
|
|
<div className="columsL" id="columns-heigh">
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
placeholder="Columns"
|
2024-01-09 21:35:53 +01:00
|
|
|
value={columns2}
|
|
|
|
onChange={(e) => setColumns2(e.target.value)}
|
2024-01-08 14:31:51 +01:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>}
|
|
|
|
<div className="container">
|
|
|
|
<div className='headertest'>
|
|
|
|
<header>Test tables</header>
|
|
|
|
</div>
|
|
|
|
<input
|
|
|
|
className='dataset'
|
|
|
|
type="text"
|
|
|
|
placeholder="Dataset quarry"
|
|
|
|
value={datasetQuarry}
|
|
|
|
onChange={(e) => setDatasetQuarry(e.target.value)}
|
|
|
|
/>
|
2023-10-18 21:20:20 +02:00
|
|
|
<input
|
2024-01-08 14:31:51 +01:00
|
|
|
className='table'
|
2023-10-18 21:20:20 +02:00
|
|
|
type="text"
|
2024-01-08 14:31:51 +01:00
|
|
|
placeholder="Table quarry"
|
|
|
|
value={tableQuarry}
|
|
|
|
onChange={(e) => setTableQuarry(e.target.value)}
|
2023-10-18 21:20:20 +02:00
|
|
|
/>
|
2024-01-08 14:31:51 +01:00
|
|
|
<div className="colums" id="columns-heigh">
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
placeholder="Columns"
|
|
|
|
value={columns}
|
|
|
|
onChange={(e) => setColumns(e.target.value)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<button className='toggle' onClick={toggleVisibility}>
|
|
|
|
Toggle more
|
|
|
|
</button>
|
|
|
|
<button className="test" type="button" onClick={handleButtonClick}>
|
|
|
|
Test
|
|
|
|
</button>
|
|
|
|
<textarea
|
|
|
|
className='Resoult'
|
|
|
|
placeholder="Results"
|
|
|
|
value={results}
|
|
|
|
onChange={(e) => setResults(e.target.value)}
|
|
|
|
></textarea>
|
2023-09-20 17:27:25 +02:00
|
|
|
</div>
|
2024-01-08 14:31:51 +01:00
|
|
|
</body>
|
2023-09-20 17:27:25 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-01-08 14:31:51 +01:00
|
|
|
export default App;
|