Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontendstart #1143

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export default configs;
//https://backend.shoonya.ai4bharat.org/
// https://backend.dev2.shoonya.ai4bharat.org
//https://backend.prod2.shoonya.ai4bharat.org
// "http://127.0.0.1:8000"
2 changes: 1 addition & 1 deletion src/redux/actions/api/Dataset/GetDatasetList.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

}
}
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/?${queryString}`;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/optimized-list/?${queryString}`;
}
}
processResponse(res) {
Expand Down
237 changes: 208 additions & 29 deletions src/ui/pages/container/Admin/DashBoard.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,167 @@
import { Box, Tab, Tabs, Typography, Paper } from '@mui/material'
import React from 'react'
import { useState } from 'react'
// import { Box, Tab, Tabs, Typography, Paper } from '@mui/material'
// import React from 'react'
// import { useState } from 'react'
// import UserDetail from "./UserDetail";
// import TaskDetails from './TaskDetails';
// import AnnotationDetails from './AnnotationDetails';
// import QueuedTasksDetails from './QueuedTasksDetails';

// function TabPanel(props) {
// const { children, value, index, ...other } = props;

// return (
// <div
// role="tabpanel"
// hidden={value !== index}
// id={`simple-tabpanel-${index}`}
// aria-labelledby={`simple-tab-${index}`}
// {...other}
// >
// {value === index && (
// <Box p={2}>
// <Typography>{children}</Typography>
// </Box>
// )}
// </div>
// );
// }

// const DashBoard = () => {
// const [tabValue, setTabValue] = useState(0);

// const handleTabChange = (e, v) => {
// setTabValue(v)
// }

// return (

// < >
// <Box sx={{mb:2,}} >
// <Tabs value={tabValue} onChange={handleTabChange} aria-label="admin-tabs">
// <Tab label="Task Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// <Tab label="Annotation Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// <Tab label="User Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// <Tab label="Queued Tasks Status" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// </Tabs>
// </Box>
// <Box sx={{ p: 1}}>
// <TabPanel value={tabValue} index={0}>
// <Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px'}}>
// <TaskDetails />
// </Paper>
// </TabPanel>
// <TabPanel value={tabValue} index={1}>
// <Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px'}}>
// <AnnotationDetails />
// </Paper>
// </TabPanel>
// <TabPanel value={tabValue} index={2}>
// <UserDetail />
// </TabPanel>
// <TabPanel value={tabValue} index={3}>
// <QueuedTasksDetails />
// </TabPanel>
// </Box>
// </>

// )
// }

// export default DashBoard


// import { Box, Tab, Tabs, Typography, Paper, CircularProgress } from '@mui/material';
// import React, { useState, useEffect } from 'react';
// import UserDetail from "./UserDetail";
// import TaskDetails from './TaskDetails';
// import AnnotationDetails from './AnnotationDetails';
// import QueuedTasksDetails from './QueuedTasksDetails';

// function TabPanel(props) {
// const { children, value, index, ...other } = props;

// return (
// <div
// role="tabpanel"
// hidden={value !== index}
// id={`simple-tabpanel-${index}`}
// aria-labelledby={`simple-tab-${index}`}
// {...other}
// >
// {value === index && (
// <Box p={2}>
// <Typography>{children}</Typography>
// </Box>
// )}
// </div>
// );
// }

// const DashBoard = () => {
// const [tabValue, setTabValue] = useState(0);
// const [loading, setLoading] = useState(false);

// const handleTabChange = (e, v) => {
// setLoading(true); // Start loading
// setTabValue(v);

// // Simulate a loading delay (e.g., data fetching)
// setTimeout(() => {
// setLoading(false); // Stop loading
// }, 2000); // Adjust time as needed
// };

// return (
// <>
// <Box sx={{ mb: 2 }}>
// <Tabs value={tabValue} onChange={handleTabChange} aria-label="admin-tabs">
// <Tab label="Task Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// <Tab label="Annotation Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// <Tab label="User Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// <Tab label="Queued Tasks Status" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
// </Tabs>
// </Box>
// <Box sx={{ p: 1 }}>
// {loading ? (
// <Box
// sx={{
// display: 'flex',
// justifyContent: 'center',
// alignItems: 'center',
// height: '200px',
// }}
// >
// <CircularProgress />
// </Box>
// ) : (
// <>
// <TabPanel value={tabValue} index={0}>
// <Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px' }}>
// <TaskDetails />
// </Paper>
// </TabPanel>
// <TabPanel value={tabValue} index={1}>
// <Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px' }}>
// <AnnotationDetails />
// </Paper>
// </TabPanel>
// <TabPanel value={tabValue} index={2}>
// <UserDetail />
// </TabPanel>
// <TabPanel value={tabValue} index={3}>
// <QueuedTasksDetails />
// </TabPanel>
// </>
// )}
// </Box>
// </>
// );
// };

// export default DashBoard;

import { Box, Tab, Tabs, Typography, Paper, CircularProgress } from '@mui/material';
import React, { useState, useEffect } from 'react';
import UserDetail from "./UserDetail";
import TaskDetails from './TaskDetails';
import AnnotationDetails from './AnnotationDetails';
Expand Down Expand Up @@ -28,43 +189,61 @@ function TabPanel(props) {

const DashBoard = () => {
const [tabValue, setTabValue] = useState(0);
const [loading, setLoading] = useState(true); // New loading state

const handleTabChange = (e, v) => {
setTabValue(v)
}
setLoading(true); // Set loading to true when tab changes
setTabValue(v);
};

useEffect(() => {
// Simulate content loading
const timer = setTimeout(() => {
setLoading(false);
}, 1000); // Simulated delay (1 second)

return () => clearTimeout(timer); // Cleanup timer on unmount
}, [tabValue]);

return (

< >
<Box sx={{mb:2,}} >
<>
<Box sx={{ mb: 2 }}>
<Tabs value={tabValue} onChange={handleTabChange} aria-label="admin-tabs">
<Tab label="Task Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
<Tab label="Annotation Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
<Tab label="User Details" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
<Tab label="Queued Tasks Status" sx={{ fontSize: 17, fontWeight: '700', marginRight: '28px !important' }} />
</Tabs>
</Box>
<Box sx={{ p: 1}}>
<TabPanel value={tabValue} index={0}>
<Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px'}}>
<TaskDetails />
</Paper>
</TabPanel>
<TabPanel value={tabValue} index={1}>
<Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px'}}>
<AnnotationDetails />
</Paper>
</TabPanel>
<TabPanel value={tabValue} index={2}>
<UserDetail />
</TabPanel>
<TabPanel value={tabValue} index={3}>
<QueuedTasksDetails />
</TabPanel>
<Box sx={{ p: 1 }}>
{loading ? (
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '200px' }}>
<CircularProgress />
</Box>
) : (
<>
<TabPanel value={tabValue} index={0}>
<Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px' }}>
<TaskDetails />
</Paper>
</TabPanel>
<TabPanel value={tabValue} index={1}>
<Paper variant="outlined" sx={{ borderRadius: "5px", backgroundColor: 'ButtonHighlight', padding: '32px' }}>
<AnnotationDetails />
</Paper>
</TabPanel>
<TabPanel value={tabValue} index={2}>
<UserDetail />
</TabPanel>
<TabPanel value={tabValue} index={3}>
<QueuedTasksDetails />
</TabPanel>
</>
)}
</Box>
</>

)
}
);
};

export default DashBoard;

export default DashBoard
36 changes: 16 additions & 20 deletions src/ui/pages/container/Dataset/DatasetList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import DatasetCard from "./DatasetCard";
import APITransport from "../../../../redux/actions/apitransport/apitransport";
import { useDispatch, useSelector } from "react-redux";
import GetDatasetsAPI from "../../../../redux/actions/api/Dataset/GetDatasetList";
import { Link, useNavigate, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import CustomButton from "../../component/common/Button";
import Spinner from "../../component/common/Spinner";
import DatasetStyle from "../../../styles/Dataset";
Expand All @@ -29,47 +29,43 @@ export default function DatasetList() {
dataset_visibility: "",
dataset_type: "",
});
const getDashboardprojectData = () => {
const projectObj = new GetDatasetsAPI(selectedFilters);
dispatch(APITransport(projectObj));
};


const loggedInUserData = useSelector(
(state) => state.fetchLoggedInUserData.data
);

const getDashboardprojectData = () => {
const projectObj = new GetDatasetsAPI(selectedFilters);
dispatch(APITransport(projectObj));
};

useEffect(() => {
getDashboardprojectData();
}, [selectedFilters]);

useEffect(() => {
setLoading(apiLoading);
}, [apiLoading]);

const handleProjectlist = () => {
setRadiobutton(true);
};

const handleProjectcard = () => {
setRadiobutton(false);
};
const handleCreateProject = (e) => {

const handleCreateProject = () => {
navigate(`/create-Dataset-Instance-Button/`);
};
// useEffect(()=>{
// getDatasetList();
// },[]);

// const handleCreateProject =(e)=>{
// navigate(`/create-Dataset-Instance-Button/`)
// }

const handleAutomateButton = (e) => {
const handleAutomateButton = () => {
navigate("/datasets/automate");
};
useEffect(() => {
setLoading(apiLoading);
}, [apiLoading])

return (
<ThemeProvider theme={themeDefault}>
{loading && <Spinner />}
{(loading || !datasetList || datasetList.length === 0) && <Spinner />}

<Grid container className={classes.root}>
<Grid item style={{ flexGrow: "0" }}>
Expand Down Expand Up @@ -126,7 +122,7 @@ export default function DatasetList() {
ml: 2,
justifyContent: "flex-end",
}}
disabled = {userRole.Admin === loggedInUserData?.role? false : true}
disabled={userRole.Admin === loggedInUserData?.role ? false : true}
onClick={handleAutomateButton}
label="Automate Datasets"
/>
Expand Down
Loading