107 lines
3.0 KiB
JavaScript
107 lines
3.0 KiB
JavaScript
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('');
|
|
const [datasetQuarry2, setDatasetQuarry2] = useState('');
|
|
const [tableQuarry2, setTableQuarry2] = useState('');
|
|
const [columns2, setColumns2] = useState('');
|
|
const [results, setResults] = useState('');
|
|
const [isVisible, setIsVisible] = useState(true);
|
|
|
|
const fetchDataFromAPI = async (ldataset, ltable, lcolumn, tdataset, ttable, tcolumn) => {
|
|
try {
|
|
postML(entryId, ldataset, ltable, lcolumn, tdataset, ttable, tcolumn);
|
|
|
|
} catch (error) {
|
|
console.error('ERROR fetching data:', error);
|
|
setResults('Error fetching data');
|
|
}
|
|
};
|
|
|
|
|
|
const handleButtonClick = () => {
|
|
fetchDataFromAPI(datasetQuarry2, tableQuarry2, columns2, datasetQuarry, tableQuarry, columns);
|
|
};
|
|
|
|
|
|
const toggleVisibility = () => {
|
|
setIsVisible(!isVisible);
|
|
};
|
|
|
|
return (
|
|
<body>
|
|
{isVisible && <div className="container2">
|
|
<div className='headerlearn'>
|
|
<header>Learning tables</header>
|
|
</div>
|
|
<input
|
|
className='datasetL'
|
|
type="text"
|
|
placeholder="Dataset quarry"
|
|
value={datasetQuarry2}
|
|
onChange={(e) => setDatasetQuarry2(e.target.value)}
|
|
/>
|
|
<input
|
|
className='tableL'
|
|
type="text"
|
|
placeholder="Table quarry"
|
|
value={tableQuarry2}
|
|
onChange={(e) => setTableQuarry2(e.target.value)}
|
|
/>
|
|
<div className="columsL" id="columns-heigh">
|
|
<input
|
|
type="text"
|
|
placeholder="Columns"
|
|
value={columns2}
|
|
onChange={(e) => setColumns2(e.target.value)}
|
|
/>
|
|
</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)}
|
|
/>
|
|
<input
|
|
className='table'
|
|
type="text"
|
|
placeholder="Table quarry"
|
|
value={tableQuarry}
|
|
onChange={(e) => setTableQuarry(e.target.value)}
|
|
/>
|
|
<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>
|
|
</div>
|
|
</body>
|
|
);
|
|
}
|
|
|
|
export default App; |