-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from DocShow-AI/implement_base_DataProfiling_page
Implement base data profiling page
- Loading branch information
Showing
8 changed files
with
207 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React, { useState } from 'react'; | ||
import { Box, TextField, Button, Typography } from '@mui/material'; | ||
import axios from 'axios'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { API_URL } from '../../utils/constants'; | ||
|
||
const CreateDataProfile = () => { | ||
const [name, setName] = useState(''); | ||
const [description, setDescription] = useState(''); | ||
const navigate = useNavigate(); | ||
|
||
const handleSubmit = (event) => { | ||
event.preventDefault(); | ||
axios.post(`${API_URL}data-profile/`, { name, description }) | ||
.then(response => { | ||
// Handle successful data profile creation | ||
console.log('Data Profile created:', response.data); | ||
navigate('/data-profiling') | ||
}) | ||
.catch(error => { | ||
console.error('Error creating data profile:', error); | ||
}); | ||
}; | ||
|
||
const handleBack = () => { | ||
navigate('/data-profiling') | ||
} | ||
|
||
return ( | ||
<Box component="form" onSubmit={handleSubmit} noValidate sx={{ mt: 1 }}> | ||
<Typography variant="h6">Create New Data Profile</Typography> | ||
<TextField | ||
required | ||
fullWidth | ||
label="Name" | ||
value={name} | ||
onChange={e => setName(e.target.value)} | ||
margin="normal" | ||
/> | ||
<TextField | ||
required | ||
fullWidth | ||
label="Description" | ||
value={description} | ||
onChange={e => setDescription(e.target.value)} | ||
margin="normal" | ||
/> | ||
<Button type="submit" fullWidth variant="contained" sx={{ mt: 3, mb: 2 }}> | ||
Create Data Profile | ||
</Button> | ||
<Button fullWidth variant="outlined" sx={{ mt: 1 }} onClick={handleBack}> | ||
Back to Data Profiling | ||
</Button> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default CreateDataProfile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
frontend/src/pages/DataProfiling/SpecificDataProfilePage.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import axios from 'axios'; | ||
import { Box, Typography, CircularProgress, Table, TableBody, TableCell, TableRow, TableContainer, Paper } from '@mui/material'; | ||
import { API_URL } from '../../utils/constants'; | ||
|
||
function SpecificDataProfilePage() { | ||
const { dataProfileId } = useParams(); | ||
const [profile, setProfile] = useState(null); | ||
const [loading, setLoading] = useState(true); | ||
const [error, setError] = useState(null); | ||
|
||
useEffect(() => { | ||
axios.get(`${API_URL}/data-profiles/${dataProfileId}`) | ||
.then(response => { | ||
setProfile(response.data); | ||
setLoading(false); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching data profile:', error); | ||
setError(error); | ||
setLoading(false); | ||
}); | ||
}, [dataProfileId]); | ||
|
||
if (loading) { | ||
return <CircularProgress />; | ||
} | ||
|
||
if (error) { | ||
return <Typography variant="h6" color="error">Error loading profile</Typography>; | ||
} | ||
|
||
return ( | ||
<Box> | ||
<Typography variant="h4" gutterBottom>Data Profile Details</Typography> | ||
<TableContainer component={Paper}> | ||
<Table> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell>ID</TableCell> | ||
<TableCell>{profile.id}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Name</TableCell> | ||
<TableCell>{profile.name}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>File Type</TableCell> | ||
<TableCell>{profile.file_type}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Organization ID</TableCell> | ||
<TableCell>{profile.organization_id}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Description</TableCell> | ||
<TableCell>{profile.description}</TableCell> | ||
</TableRow> | ||
{/* Add more rows as needed */} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
</Box> | ||
); | ||
} | ||
|
||
export default SpecificDataProfilePage; |