From 15d77eb02a7dfb471149893a8d53a7f301e5faa6 Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Mon, 20 Jan 2025 14:44:39 +0530 Subject: [PATCH 1/9] loader applied --- package.json | 5 + src/ui/pages/container/Admin/DashBoard.jsx | 149 ++++++++++++---- .../container/Workspace/WorkSpaceList.jsx | 162 ++++++++++++++---- 3 files changed, 255 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index 730ddbe73..549518b2b 100644 --- a/package.json +++ b/package.json @@ -94,5 +94,10 @@ }, "alias": { "LabelStudio": false + }, + "resolution":{ + "@ai4bharat/indic-transliterate": { + "react": "^18.0.0" + } } } diff --git a/src/ui/pages/container/Admin/DashBoard.jsx b/src/ui/pages/container/Admin/DashBoard.jsx index 117fc0d25..fc60cc03f 100644 --- a/src/ui/pages/container/Admin/DashBoard.jsx +++ b/src/ui/pages/container/Admin/DashBoard.jsx @@ -1,6 +1,77 @@ -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 ( +// +// ); +// } + +// const DashBoard = () => { +// const [tabValue, setTabValue] = useState(0); + +// const handleTabChange = (e, v) => { +// setTabValue(v) +// } + +// return ( + +// < > +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// + +// ) +// } + +// 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'; @@ -28,15 +99,21 @@ function TabPanel(props) { const DashBoard = () => { const [tabValue, setTabValue] = useState(0); + const [loading, setLoading] = useState(false); const handleTabChange = (e, v) => { - setTabValue(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 ( - - < > - + <> + @@ -44,27 +121,41 @@ const DashBoard = () => { - - - - - - - - - - - - - - - - - + + {loading ? ( + + + + ) : ( + <> + + + + + + + + + + + + + + + + + + )} - - ) -} + ); +}; -export default DashBoard +export default DashBoard; diff --git a/src/ui/pages/container/Workspace/WorkSpaceList.jsx b/src/ui/pages/container/Workspace/WorkSpaceList.jsx index 5c52604b5..e9f8f5aa8 100644 --- a/src/ui/pages/container/Workspace/WorkSpaceList.jsx +++ b/src/ui/pages/container/Workspace/WorkSpaceList.jsx @@ -1,41 +1,139 @@ -import { Box, Divider, Grid, Typography } from "@mui/material"; +// import { Box, Divider, Grid, Typography } from "@mui/material"; +// import React, { useEffect, useState } from "react"; +// import Header from "../../component/common/Header"; +// import ProjectCard from "../../component/common/ProjectCard"; +// import WorkspaceTable from "../../component/common/WorkspaceTable"; +// import DatasetStyle from "../../../styles/Dataset"; +// import GetProjectsAPI from "../../../../redux/actions/api/Dashboard/GetProjects"; +// import {useDispatch,useSelector} from 'react-redux'; +// import APITransport from '../../../../redux/actions/apitransport/apitransport'; +// import GetWorkspacesAPI from "../../../../redux/actions/api/Dashboard/GetWorkspaces"; + +// export default function WorkSpaces(props) { + +// // const classes = DatasetStyle(); +// // const dispatch = useDispatch(); +// // const workspaceData = useSelector(state=>state.getWorkspaces.data); + +// // const getDashboardWorkspaceData = ()=>{ +// // const workspaceObj = new GetWorkspacesAPI(1); +// // dispatch(APITransport(workspaceObj)); +// // } + +// // useEffect(()=>{ +// // getDashboardWorkspaceData(); +// // },[]); + + +// return ( +// +// {/*
*/} +// +// {/* Visit Workspaces */} +// +// +// +// ) +// } + + +// import { Box } from "@mui/material"; +// import React, { useEffect, useState } from "react"; +// import WorkspaceTable from "../../component/common/WorkspaceTable"; +// import GetWorkspacesAPI from "../../../../redux/actions/api/Dashboard/GetWorkspaces"; +// import { useDispatch, useSelector } from "react-redux"; +// import APITransport from "../../../../redux/actions/apitransport/apitransport"; +// import Spinner from "../../component/common/Spinner"; // Ensure Spinner component is imported + +// export default function WorkSpaces(props) { +// const [loading, setLoading] = useState(false); +// const dispatch = useDispatch(); +// const workspaceData = useSelector((state) => state.getWorkspaces.data); + +// const getDashboardWorkspaceData = async () => { +// setLoading(true); +// try { +// const workspaceObj = new GetWorkspacesAPI(1); +// await dispatch(APITransport(workspaceObj)); +// } finally { +// setLoading(false); +// } +// }; + +// useEffect(() => { +// getDashboardWorkspaceData(); +// }, []); + +// return ( +// +// +// {/* Spinner appears when loading */} +// +// +// +// ); +// } + + +import { Box } from "@mui/material"; import React, { useEffect, useState } from "react"; -import Header from "../../component/common/Header"; -import ProjectCard from "../../component/common/ProjectCard"; import WorkspaceTable from "../../component/common/WorkspaceTable"; -import DatasetStyle from "../../../styles/Dataset"; -import GetProjectsAPI from "../../../../redux/actions/api/Dashboard/GetProjects"; -import {useDispatch,useSelector} from 'react-redux'; -import APITransport from '../../../../redux/actions/apitransport/apitransport'; import GetWorkspacesAPI from "../../../../redux/actions/api/Dashboard/GetWorkspaces"; +import { useDispatch, useSelector } from "react-redux"; +import APITransport from "../../../../redux/actions/apitransport/apitransport"; +import Spinner from "../../component/common/Spinner"; export default function WorkSpaces(props) { - - // const classes = DatasetStyle(); - // const dispatch = useDispatch(); - // const workspaceData = useSelector(state=>state.getWorkspaces.data); - - // const getDashboardWorkspaceData = ()=>{ - // const workspaceObj = new GetWorkspacesAPI(1); - // dispatch(APITransport(workspaceObj)); - // } - - // useEffect(()=>{ - // getDashboardWorkspaceData(); - // },[]); - + const [loading, setLoading] = useState(false); + const dispatch = useDispatch(); + const workspaceData = useSelector((state) => state.getWorkspaces.data); + + const getDashboardWorkspaceData = async () => { + setLoading(true); + try { + const workspaceObj = new GetWorkspacesAPI(1); + await dispatch(APITransport(workspaceObj)); + await new Promise((resolve) => setTimeout(resolve, 2000)); // Simulate delay + } finally { + setLoading(false); + } + }; + + useEffect(() => { + getDashboardWorkspaceData(); + }, []); return ( - {/*
*/} - - {/* Visit Workspaces */} - - - - ) + + {loading && ( + + + + )} + {!loading && ( + + )} + + + ); } From 433267e2d2f2cef6f68f73f04e548c7a6a4ec02c Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Tue, 21 Jan 2025 12:58:20 +0530 Subject: [PATCH 2/9] loader appliedon dataset --- src/ui/pages/container/Admin/DashBoard.jsx | 75 +------ .../pages/container/Dataset/DatasetList.jsx | 186 +++++++++--------- 2 files changed, 97 insertions(+), 164 deletions(-) diff --git a/src/ui/pages/container/Admin/DashBoard.jsx b/src/ui/pages/container/Admin/DashBoard.jsx index fc60cc03f..9acad1743 100644 --- a/src/ui/pages/container/Admin/DashBoard.jsx +++ b/src/ui/pages/container/Admin/DashBoard.jsx @@ -1,81 +1,10 @@ -// 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 ( -// -// ); -// } - -// const DashBoard = () => { -// const [tabValue, setTabValue] = useState(0); - -// const handleTabChange = (e, v) => { -// setTabValue(v) -// } - -// return ( - -// < > -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -// ) -// } - -// 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'; +import Spinner from "../../component/common/Spinner"; function TabPanel(props) { const { children, value, index, ...other } = props; @@ -131,7 +60,7 @@ const DashBoard = () => { height: '200px', }} > - + ) : ( <> diff --git a/src/ui/pages/container/Dataset/DatasetList.jsx b/src/ui/pages/container/Dataset/DatasetList.jsx index 5d3eebbdb..7c66c6f77 100644 --- a/src/ui/pages/container/Dataset/DatasetList.jsx +++ b/src/ui/pages/container/Dataset/DatasetList.jsx @@ -1,3 +1,4 @@ + import React, { useState, useEffect } from "react"; import { Radio, Box, Grid, Typography, ThemeProvider } from "@mui/material"; import RadioGroup from "@mui/material/RadioGroup"; @@ -8,7 +9,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"; @@ -20,8 +21,9 @@ export default function DatasetList() { const dispatch = useDispatch(); const classes = DatasetStyle(); const navigate = useNavigate(); + const [radiobutton, setRadiobutton] = useState(true); - const [loading, setLoading] = useState(false); + const [loading, setLoading] = useState(true); // Ensure spinner shows initially const datasetList = useSelector((state) => state.getDatasetList.data); const apiLoading = useSelector((state) => state.apiStatus.loading); @@ -29,20 +31,28 @@ 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 = () => { + setLoading(true); // Ensure loading is true when fetching data + const projectObj = new GetDatasetsAPI(selectedFilters); + dispatch(APITransport(projectObj)); + }; useEffect(() => { getDashboardprojectData(); }, [selectedFilters]); + useEffect(() => { + if (!apiLoading && datasetList?.length >= 0) { + // Stop loading when the API finishes and data is fetched + setLoading(false); + } + }, [apiLoading, datasetList]); + const handleProjectlist = () => { setRadiobutton(true); }; @@ -52,100 +62,94 @@ export default function DatasetList() { const handleCreateProject = (e) => { navigate(`/create-Dataset-Instance-Button/`); }; - // useEffect(()=>{ - // getDatasetList(); - // },[]); - - // const handleCreateProject =(e)=>{ - // navigate(`/create-Dataset-Instance-Button/`) - // } const handleAutomateButton = (e) => { navigate("/datasets/automate"); }; - useEffect(() => { - setLoading(apiLoading); - }, [apiLoading]) return ( - {loading && } - - - - - View :{" "} - - - - - - } - label="List" - onClick={handleProjectlist} - /> - } - label="Card" - onClick={handleProjectcard} - /> - - - - - - - + {loading ? ( + // Spinner shown when loading is true + ) : ( + <> + + + + View :{" "} + + + + + + } + label="List" + onClick={handleProjectlist} + /> + } + label="Card" + onClick={handleProjectcard} + /> + + + + + + + - - - - - {radiobutton ? ( - + - ) : ( - - )} - - + + {radiobutton ? ( + + ) : ( + + )} + + + + )} ); } From 232c200fc7aa22829145208a6a311ec6908469fa Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Tue, 21 Jan 2025 15:01:30 +0530 Subject: [PATCH 3/9] updated code loader applied dataset --- .../pages/container/Dataset/DatasetList.jsx | 175 +++++++++--------- 1 file changed, 85 insertions(+), 90 deletions(-) diff --git a/src/ui/pages/container/Dataset/DatasetList.jsx b/src/ui/pages/container/Dataset/DatasetList.jsx index 7c66c6f77..6582cc1a8 100644 --- a/src/ui/pages/container/Dataset/DatasetList.jsx +++ b/src/ui/pages/container/Dataset/DatasetList.jsx @@ -1,4 +1,3 @@ - import React, { useState, useEffect } from "react"; import { Radio, Box, Grid, Typography, ThemeProvider } from "@mui/material"; import RadioGroup from "@mui/material/RadioGroup"; @@ -21,23 +20,22 @@ export default function DatasetList() { const dispatch = useDispatch(); const classes = DatasetStyle(); const navigate = useNavigate(); - const [radiobutton, setRadiobutton] = useState(true); - const [loading, setLoading] = useState(true); // Ensure spinner shows initially + const [loading, setLoading] = useState(true); + const datasetList = useSelector((state) => state.getDatasetList.data); const apiLoading = useSelector((state) => state.apiStatus.loading); + const loggedInUserData = useSelector( + (state) => state.fetchLoggedInUserData.data + ); const [selectedFilters, setsSelectedFilters] = useState({ dataset_visibility: "", dataset_type: "", }); - const loggedInUserData = useSelector( - (state) => state.fetchLoggedInUserData.data - ); - const getDashboardprojectData = () => { - setLoading(true); // Ensure loading is true when fetching data + setLoading(true); const projectObj = new GetDatasetsAPI(selectedFilters); dispatch(APITransport(projectObj)); }; @@ -47,8 +45,7 @@ export default function DatasetList() { }, [selectedFilters]); useEffect(() => { - if (!apiLoading && datasetList?.length >= 0) { - // Stop loading when the API finishes and data is fetched + if (!apiLoading && datasetList) { setLoading(false); } }, [apiLoading, datasetList]); @@ -56,100 +53,98 @@ export default function DatasetList() { const handleProjectlist = () => { setRadiobutton(true); }; + const handleProjectcard = () => { setRadiobutton(false); }; - const handleCreateProject = (e) => { + + const handleCreateProject = () => { navigate(`/create-Dataset-Instance-Button/`); }; - const handleAutomateButton = (e) => { + const handleAutomateButton = () => { navigate("/datasets/automate"); }; return ( - {loading ? ( - // Spinner shown when loading is true - ) : ( - <> - - - - View :{" "} - - - - - - } - label="List" - onClick={handleProjectlist} - /> - } - label="Card" - onClick={handleProjectcard} - /> - - - - - - - + {loading && } + + + + + View :{" "} + + + + + + } + label="List" + onClick={handleProjectlist} + /> + } + label="Card" + onClick={handleProjectcard} + /> + + + + + + + - - + + + + {radiobutton ? ( + - - - {radiobutton ? ( - - ) : ( - - )} - - - - )} + )} + + ); } From d2217964fd4b465a14dc23a6d2ddc8c9e8184435 Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Wed, 22 Jan 2025 09:04:37 +0530 Subject: [PATCH 4/9] remove version from package.json --- package.json | 5 -- src/ui/pages/container/Admin/DashBoard.jsx | 75 +++++++++++++++++++++- 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 549518b2b..730ddbe73 100644 --- a/package.json +++ b/package.json @@ -94,10 +94,5 @@ }, "alias": { "LabelStudio": false - }, - "resolution":{ - "@ai4bharat/indic-transliterate": { - "react": "^18.0.0" - } } } diff --git a/src/ui/pages/container/Admin/DashBoard.jsx b/src/ui/pages/container/Admin/DashBoard.jsx index 9acad1743..fc60cc03f 100644 --- a/src/ui/pages/container/Admin/DashBoard.jsx +++ b/src/ui/pages/container/Admin/DashBoard.jsx @@ -1,10 +1,81 @@ +// 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 ( +// +// ); +// } + +// const DashBoard = () => { +// const [tabValue, setTabValue] = useState(0); + +// const handleTabChange = (e, v) => { +// setTabValue(v) +// } + +// return ( + +// < > +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// + +// ) +// } + +// 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'; -import Spinner from "../../component/common/Spinner"; function TabPanel(props) { const { children, value, index, ...other } = props; @@ -60,7 +131,7 @@ const DashBoard = () => { height: '200px', }} > - + ) : ( <> From 37520a24b1afcf26040db0ab1a363a5d84a4929f Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Fri, 24 Jan 2025 10:55:17 +0530 Subject: [PATCH 5/9] loading bug clean --- package.json | 5 +++++ src/config/config.js | 3 ++- .../actions/api/Dataset/GetDatasetList.js | 2 +- .../pages/container/Dataset/DatasetList.jsx | 19 ++++++++----------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 730ddbe73..549518b2b 100644 --- a/package.json +++ b/package.json @@ -94,5 +94,10 @@ }, "alias": { "LabelStudio": false + }, + "resolution":{ + "@ai4bharat/indic-transliterate": { + "react": "^18.0.0" + } } } diff --git a/src/config/config.js b/src/config/config.js index 999212c0a..72e7c785a 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -2,7 +2,7 @@ const configs = { BASE_URL: "https://backend.prod2.shoonya.ai4bharat.org", BASE_URL_AUTO: process.env.REACT_APP_APIGW_BASE_URL ? process.env.REACT_APP_APIGW_BASE_URL - :"https://backend.shoonya.ai4bharat.org" + :"http://127.0.0.1:8000" }; export default configs; @@ -10,3 +10,4 @@ export default configs; //https://backend.shoonya.ai4bharat.org/ // https://backend.dev2.shoonya.ai4bharat.org //https://backend.prod2.shoonya.ai4bharat.org +// \ No newline at end of file diff --git a/src/redux/actions/api/Dataset/GetDatasetList.js b/src/redux/actions/api/Dataset/GetDatasetList.js index 80e6861f1..654ac7ca0 100644 --- a/src/redux/actions/api/Dataset/GetDatasetList.js +++ b/src/redux/actions/api/Dataset/GetDatasetList.js @@ -26,7 +26,7 @@ } } - this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/?${queryString}`; + this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/optimized-list/?${queryString}`; } } processResponse(res) { diff --git a/src/ui/pages/container/Dataset/DatasetList.jsx b/src/ui/pages/container/Dataset/DatasetList.jsx index 6582cc1a8..ee8277696 100644 --- a/src/ui/pages/container/Dataset/DatasetList.jsx +++ b/src/ui/pages/container/Dataset/DatasetList.jsx @@ -21,21 +21,20 @@ export default function DatasetList() { const classes = DatasetStyle(); const navigate = useNavigate(); const [radiobutton, setRadiobutton] = useState(true); - const [loading, setLoading] = useState(true); - + const [loading, setLoading] = useState(false); const datasetList = useSelector((state) => state.getDatasetList.data); const apiLoading = useSelector((state) => state.apiStatus.loading); - const loggedInUserData = useSelector( - (state) => state.fetchLoggedInUserData.data - ); const [selectedFilters, setsSelectedFilters] = useState({ dataset_visibility: "", dataset_type: "", }); + const loggedInUserData = useSelector( + (state) => state.fetchLoggedInUserData.data + ); + const getDashboardprojectData = () => { - setLoading(true); const projectObj = new GetDatasetsAPI(selectedFilters); dispatch(APITransport(projectObj)); }; @@ -45,10 +44,8 @@ export default function DatasetList() { }, [selectedFilters]); useEffect(() => { - if (!apiLoading && datasetList) { - setLoading(false); - } - }, [apiLoading, datasetList]); + setLoading(apiLoading); + }, [apiLoading]); const handleProjectlist = () => { setRadiobutton(true); @@ -68,7 +65,7 @@ export default function DatasetList() { return ( - {loading && } + {(loading || !datasetList || datasetList.length === 0) && } From b81ecf6aaac4baf981d5fdd94e8f984fca42c0d3 Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Fri, 24 Jan 2025 10:56:25 +0530 Subject: [PATCH 6/9] loading bug clean --- package.json | 5 ----- src/config/config.js | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/package.json b/package.json index 549518b2b..730ddbe73 100644 --- a/package.json +++ b/package.json @@ -94,10 +94,5 @@ }, "alias": { "LabelStudio": false - }, - "resolution":{ - "@ai4bharat/indic-transliterate": { - "react": "^18.0.0" - } } } diff --git a/src/config/config.js b/src/config/config.js index 72e7c785a..ad61add44 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -2,7 +2,7 @@ const configs = { BASE_URL: "https://backend.prod2.shoonya.ai4bharat.org", BASE_URL_AUTO: process.env.REACT_APP_APIGW_BASE_URL ? process.env.REACT_APP_APIGW_BASE_URL - :"http://127.0.0.1:8000" + :"https://backend.shoonya.ai4bharat.org" }; export default configs; From 273b3cb4e8cad3ee4998bb4e515338cb4dd9248f Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Tue, 28 Jan 2025 10:15:42 +0530 Subject: [PATCH 7/9] loading bug2 clean --- package.json | 5 + src/config/config.js | 4 +- .../actions/api/Dataset/GetDatasetList.js | 2 +- src/ui/pages/container/Admin/DashBoard.jsx | 118 +++++++++++++++--- 4 files changed, 111 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 730ddbe73..549518b2b 100644 --- a/package.json +++ b/package.json @@ -94,5 +94,10 @@ }, "alias": { "LabelStudio": false + }, + "resolution":{ + "@ai4bharat/indic-transliterate": { + "react": "^18.0.0" + } } } diff --git a/src/config/config.js b/src/config/config.js index ad61add44..0b8379845 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -2,7 +2,7 @@ const configs = { BASE_URL: "https://backend.prod2.shoonya.ai4bharat.org", BASE_URL_AUTO: process.env.REACT_APP_APIGW_BASE_URL ? process.env.REACT_APP_APIGW_BASE_URL - :"https://backend.shoonya.ai4bharat.org" + :"http://127.0.0.1:8000" }; export default configs; @@ -10,4 +10,4 @@ export default configs; //https://backend.shoonya.ai4bharat.org/ // https://backend.dev2.shoonya.ai4bharat.org //https://backend.prod2.shoonya.ai4bharat.org -// \ No newline at end of file +// http://127.0.0.1:8000 \ No newline at end of file diff --git a/src/redux/actions/api/Dataset/GetDatasetList.js b/src/redux/actions/api/Dataset/GetDatasetList.js index 654ac7ca0..80e6861f1 100644 --- a/src/redux/actions/api/Dataset/GetDatasetList.js +++ b/src/redux/actions/api/Dataset/GetDatasetList.js @@ -26,7 +26,7 @@ } } - this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/optimized-list/?${queryString}`; + this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/?${queryString}`; } } processResponse(res) { diff --git a/src/ui/pages/container/Admin/DashBoard.jsx b/src/ui/pages/container/Admin/DashBoard.jsx index fc60cc03f..8b05e6aea 100644 --- a/src/ui/pages/container/Admin/DashBoard.jsx +++ b/src/ui/pages/container/Admin/DashBoard.jsx @@ -70,6 +70,96 @@ // 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 ( +// +// ); +// } + +// 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 ( +// <> +// +// +// +// +// +// +// +// +// +// {loading ? ( +// +// +// +// ) : ( +// <> +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// )} +// +// +// ); +// }; + +// export default DashBoard; + import { Box, Tab, Tabs, Typography, Paper, CircularProgress } from '@mui/material'; import React, { useState, useEffect } from 'react'; import UserDetail from "./UserDetail"; @@ -99,18 +189,22 @@ function TabPanel(props) { const DashBoard = () => { const [tabValue, setTabValue] = useState(0); - const [loading, setLoading] = useState(false); + const [loading, setLoading] = useState(true); // New loading state const handleTabChange = (e, v) => { - setLoading(true); // Start loading + setLoading(true); // Set loading to true when tab changes setTabValue(v); - - // Simulate a loading delay (e.g., data fetching) - setTimeout(() => { - setLoading(false); // Stop loading - }, 2000); // Adjust time as needed }; + useEffect(() => { + // Simulate content loading + const timer = setTimeout(() => { + setLoading(false); + }, 1000); // Simulated delay (1 second) + + return () => clearTimeout(timer); // Cleanup timer on unmount + }, [tabValue]); + return ( <> @@ -123,14 +217,7 @@ const DashBoard = () => { {loading ? ( - + ) : ( @@ -159,3 +246,4 @@ const DashBoard = () => { }; export default DashBoard; + From 0d5afa605d79dbf0cdabf8189890340e48f06c10 Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Tue, 28 Jan 2025 10:26:43 +0530 Subject: [PATCH 8/9] Revert "loading bug2 clean" This reverts commit 273b3cb4e8cad3ee4998bb4e515338cb4dd9248f. --- package.json | 5 - src/config/config.js | 4 +- .../actions/api/Dataset/GetDatasetList.js | 2 +- src/ui/pages/container/Admin/DashBoard.jsx | 118 +++--------------- 4 files changed, 18 insertions(+), 111 deletions(-) diff --git a/package.json b/package.json index 549518b2b..730ddbe73 100644 --- a/package.json +++ b/package.json @@ -94,10 +94,5 @@ }, "alias": { "LabelStudio": false - }, - "resolution":{ - "@ai4bharat/indic-transliterate": { - "react": "^18.0.0" - } } } diff --git a/src/config/config.js b/src/config/config.js index 0b8379845..ad61add44 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -2,7 +2,7 @@ const configs = { BASE_URL: "https://backend.prod2.shoonya.ai4bharat.org", BASE_URL_AUTO: process.env.REACT_APP_APIGW_BASE_URL ? process.env.REACT_APP_APIGW_BASE_URL - :"http://127.0.0.1:8000" + :"https://backend.shoonya.ai4bharat.org" }; export default configs; @@ -10,4 +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 \ No newline at end of file +// \ No newline at end of file diff --git a/src/redux/actions/api/Dataset/GetDatasetList.js b/src/redux/actions/api/Dataset/GetDatasetList.js index 80e6861f1..654ac7ca0 100644 --- a/src/redux/actions/api/Dataset/GetDatasetList.js +++ b/src/redux/actions/api/Dataset/GetDatasetList.js @@ -26,7 +26,7 @@ } } - this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/?${queryString}`; + this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getDatasets}instances/optimized-list/?${queryString}`; } } processResponse(res) { diff --git a/src/ui/pages/container/Admin/DashBoard.jsx b/src/ui/pages/container/Admin/DashBoard.jsx index 8b05e6aea..fc60cc03f 100644 --- a/src/ui/pages/container/Admin/DashBoard.jsx +++ b/src/ui/pages/container/Admin/DashBoard.jsx @@ -70,96 +70,6 @@ // 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 ( -// -// ); -// } - -// 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 ( -// <> -// -// -// -// -// -// -// -// -// -// {loading ? ( -// -// -// -// ) : ( -// <> -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// )} -// -// -// ); -// }; - -// export default DashBoard; - import { Box, Tab, Tabs, Typography, Paper, CircularProgress } from '@mui/material'; import React, { useState, useEffect } from 'react'; import UserDetail from "./UserDetail"; @@ -189,21 +99,17 @@ function TabPanel(props) { const DashBoard = () => { const [tabValue, setTabValue] = useState(0); - const [loading, setLoading] = useState(true); // New loading state + const [loading, setLoading] = useState(false); const handleTabChange = (e, v) => { - setLoading(true); // Set loading to true when tab changes + setLoading(true); // Start loading setTabValue(v); - }; - useEffect(() => { - // Simulate content loading - const timer = setTimeout(() => { - setLoading(false); - }, 1000); // Simulated delay (1 second) - - return () => clearTimeout(timer); // Cleanup timer on unmount - }, [tabValue]); + // Simulate a loading delay (e.g., data fetching) + setTimeout(() => { + setLoading(false); // Stop loading + }, 2000); // Adjust time as needed + }; return ( <> @@ -217,7 +123,14 @@ const DashBoard = () => { {loading ? ( - + ) : ( @@ -246,4 +159,3 @@ const DashBoard = () => { }; export default DashBoard; - From 952cd7eb2bac8d09e6bbe02a7be2974a5ea77004 Mon Sep 17 00:00:00 2001 From: munishmangla98 Date: Tue, 28 Jan 2025 10:44:15 +0530 Subject: [PATCH 9/9] loading bug2 clean --- src/config/config.js | 2 +- src/ui/pages/container/Admin/DashBoard.jsx | 118 ++++++++++++++++++--- 2 files changed, 104 insertions(+), 16 deletions(-) diff --git a/src/config/config.js b/src/config/config.js index ad61add44..dc86c41fd 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -10,4 +10,4 @@ export default configs; //https://backend.shoonya.ai4bharat.org/ // https://backend.dev2.shoonya.ai4bharat.org //https://backend.prod2.shoonya.ai4bharat.org -// \ No newline at end of file +// "http://127.0.0.1:8000" \ No newline at end of file diff --git a/src/ui/pages/container/Admin/DashBoard.jsx b/src/ui/pages/container/Admin/DashBoard.jsx index fc60cc03f..8b05e6aea 100644 --- a/src/ui/pages/container/Admin/DashBoard.jsx +++ b/src/ui/pages/container/Admin/DashBoard.jsx @@ -70,6 +70,96 @@ // 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 ( +// +// ); +// } + +// 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 ( +// <> +// +// +// +// +// +// +// +// +// +// {loading ? ( +// +// +// +// ) : ( +// <> +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// )} +// +// +// ); +// }; + +// export default DashBoard; + import { Box, Tab, Tabs, Typography, Paper, CircularProgress } from '@mui/material'; import React, { useState, useEffect } from 'react'; import UserDetail from "./UserDetail"; @@ -99,18 +189,22 @@ function TabPanel(props) { const DashBoard = () => { const [tabValue, setTabValue] = useState(0); - const [loading, setLoading] = useState(false); + const [loading, setLoading] = useState(true); // New loading state const handleTabChange = (e, v) => { - setLoading(true); // Start loading + setLoading(true); // Set loading to true when tab changes setTabValue(v); - - // Simulate a loading delay (e.g., data fetching) - setTimeout(() => { - setLoading(false); // Stop loading - }, 2000); // Adjust time as needed }; + useEffect(() => { + // Simulate content loading + const timer = setTimeout(() => { + setLoading(false); + }, 1000); // Simulated delay (1 second) + + return () => clearTimeout(timer); // Cleanup timer on unmount + }, [tabValue]); + return ( <> @@ -123,14 +217,7 @@ const DashBoard = () => { {loading ? ( - + ) : ( @@ -159,3 +246,4 @@ const DashBoard = () => { }; export default DashBoard; +