Skip to content

Commit

Permalink
Merge pull request #1097 from AI4Bharat/mas-ef
Browse files Browse the repository at this point in the history
analytics api integration effciency and download button ui changes
  • Loading branch information
ishvindersethi22 authored Sep 11, 2024
2 parents 900902f + 33430a8 commit b33eb9d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/ui/pages/component/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import CustomizedSnackbars from "../common/Snackbar";
import userRole from "../../../../utils/UserMappedByRole/Roles";
import NotificationAPI from "../../../../redux/actions/api/Notification/Notification";
import UpdateUIPrefsAPI from "../../../../redux/actions/api/UserManagement/UpdateUIPrefs";
import TaskAnalyticsDataAPI from "../../../../redux/actions/api/Progress/TaskAnalytics";
import MetaAnalyticsDataAPI from "../../../../redux/actions/api/Progress/MetaAnalytics";

const Header = () => {
const [anchorElUser, setAnchorElUser] = useState(null);
Expand Down Expand Up @@ -169,7 +171,14 @@ const Header = () => {
getLoggedInUserData();

}, []);
useEffect(() => {
const userObj = new TaskAnalyticsDataAPI('ContextualTranslationEditing');
dispatch(APITransport(userObj));
const userObj1 = new MetaAnalyticsDataAPI(1,'ContextualTranslationEditing');
dispatch(APITransport(userObj1));


}, []);

/* useEffect(()=>{
if(loggedInUserData?.prefer_cl_ui !== undefined){
Expand Down
16 changes: 12 additions & 4 deletions src/ui/pages/container/Progress/MetaAnalytics/MetaAnalytics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ export default function MetaAnalytics(props) {
}, []);

useEffect(() => {
getMetaAnalyticsdata();
}, []);
const handler = setTimeout(() => {
if(!metaAnalyticsData.length){
getMetaAnalyticsdata();
}
}, 500);
return () => {
clearTimeout(handler);
};
}, []);

const handleSubmit = async () => {
getMetaAnalyticsdata();
}
Expand Down Expand Up @@ -231,8 +239,8 @@ export default function MetaAnalytics(props) {
</Select>
</FormControl>
{/* <Grid item xs={12} sm={12} md={12} lg={12} xl={12} container justifyContent="space-between" alignItems="center"> */}
<CustomButton label="Submit" sx={{ width: "120px" }} onClick={handleSubmit} disabled={loading} />
<Box display="flex" alignItems="center">
<CustomButton label="Submit" sx={{ width: { xs: "100px", md: "120px" }, height: "40px" }} onClick={handleSubmit} />
<Box display="flex" sx={{ width: { xs: "100px", md: "120px" }, height: "40px", marginRight: 1 }}alignItems="center">
<CustomButton
onClick={handleClick}
disabled={loading}
Expand Down
17 changes: 12 additions & 5 deletions src/ui/pages/container/Progress/TaskAnalytics/TaskAnalytics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,17 @@ const TaskAnalytics = (props) => {
setProjectTypes(types);
}, []);


useEffect(() => {
getTaskAnalyticsdata();
}, []);
const handler = setTimeout(() => {
if(!taskAnalyticsData.length){
getTaskAnalyticsdata();
}
}, 500);
return () => {
clearTimeout(handler);
};
}, []);


useEffect(() => {
if (taskAnalyticsData.length > 0) {
Expand Down Expand Up @@ -203,8 +210,8 @@ const TaskAnalytics = (props) => {
</Select>
</FormControl>
{/* <Grid item xs={12} sm={12} md={12} lg={12} xl={12} container justifyContent="space-between" alignItems="center"> */}
<CustomButton label="Submit" sx={{ width: "120px" }} onClick={handleSubmit} disabled={loading} />
<Box display="flex" alignItems="center">
<CustomButton label="Submit" sx={{ width: { xs: "100px", md: "120px" }, height: "40px" }} onClick={handleSubmit} />
<Box display="flex" sx={{ width: { xs: "100px", md: "120px" }, height: "40px", marginRight: 1 }}alignItems="center">
<CustomButton
onClick={handleClick}
disabled={loading}
Expand Down

0 comments on commit b33eb9d

Please sign in to comment.