From e97f97e9ec61ec2e86d02fdad5af1e71bfc84469 Mon Sep 17 00:00:00 2001 From: emmanuelnegash Date: Tue, 8 Nov 2022 08:40:02 +0300 Subject: [PATCH 1/6] view the public and private dataset --- src/Components/Datasets/viewDataSet.js | 182 +++++++++++++++++-------- src/Constants/labels.js | 8 +- 2 files changed, 131 insertions(+), 59 deletions(-) diff --git a/src/Components/Datasets/viewDataSet.js b/src/Components/Datasets/viewDataSet.js index 53df25186..b136a3164 100644 --- a/src/Components/Datasets/viewDataSet.js +++ b/src/Components/Datasets/viewDataSet.js @@ -89,7 +89,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + > {"Dataset name"} @@ -106,18 +107,21 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + }} + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.name} @@ -137,14 +141,17 @@ export default function ViewDataSet(props) { height: "37px", "line-height": "19px", "word-break": "break-word", - }}> + }} + > + title={props.rowdata.description} + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {" "} {props.rowdata.description} @@ -155,7 +162,8 @@ export default function ViewDataSet(props) { + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {categoryStr} @@ -166,7 +174,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "40px", "text-align": "left", - }}> + }} + > {"Geography"} @@ -182,10 +191,12 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + style={{ width: "30px", height: "37px", "line-height": "19px" }} + > + }} + > {props.rowdata.geography} @@ -210,15 +222,18 @@ export default function ViewDataSet(props) { "line-height": "19px", "word-break": "break-word", // border:"1px solid red" - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.crop_detail ? props.rowdata.crop_detail : "N/A"} @@ -235,7 +250,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "40px", "text-align": "left", - }}> + }} + > {"Age of actual data"} @@ -251,7 +267,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > {props.rowdata.age_of_date ? props.rowdata.age_of_date : "N/A"} @@ -290,17 +307,25 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "40px", "text-align": "left", - }}> + }} + > {"Connector availablity"} + + {"Data visibility"} + + + + + }} + > {props.rowdata.connector_availability @@ -308,6 +333,17 @@ export default function ViewDataSet(props) { : "N/A"} + + + {props.rowdata["is_public"] + ? "Public" + : "Private"} + + + + + + {!props.isAdminView ? ( @@ -320,7 +356,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + > {"Contact person's name"} @@ -338,7 +375,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.user.first_name} {props.rowdata.user.last_name} @@ -370,7 +410,8 @@ export default function ViewDataSet(props) { ) : ( + aria-label="recipe" + > {props.rowdata.organization.name.charAt(0)} )} @@ -379,10 +420,12 @@ export default function ViewDataSet(props) { + title={props.rowdata.organization.name} + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization.name} @@ -397,10 +440,12 @@ export default function ViewDataSet(props) { props.rowdata.organization.org_email ? props.rowdata.organization.org_email : "N/A" - }> + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization.org_email ? props.rowdata.organization.org_email : "N/A"} @@ -413,7 +458,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + > {"Contact number"} @@ -429,7 +475,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["name"] ? props.rowdata.organization["name"] : "N/A"} @@ -455,10 +504,12 @@ export default function ViewDataSet(props) { props.rowdata.organization["address"]["address"] ? props.rowdata.organization["address"]["address"] : "N/A" - }> + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["address"]["address"] ? props.rowdata.organization["address"]["address"] : "N/A"} @@ -475,7 +526,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + > {"Country"} @@ -491,7 +543,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["address"]["country"] ? props.rowdata.organization["address"]["country"] : "N/A"} @@ -517,10 +572,12 @@ export default function ViewDataSet(props) { props.rowdata.organization["address"]["pincode"] ? props.rowdata.organization["address"]["pincode"] : "N/A" - }> + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["address"]["pincode"] ? props.rowdata.organization["address"]["pincode"] : "N/A"} @@ -538,22 +595,26 @@ export default function ViewDataSet(props) { <> )} - {"Sample data table"} + + {!props.rowdata["is_public"] + ? "Sample Data Table" + : "Actual Data Table"} + - props.downloadAttachment(props.rowdata.sample_dataset) - }> + onClick={() => props.downloadAttachment(props.rowdata.sample_dataset)} + > new - props.downloadAttachment(props.rowdata.sample_dataset) - }> - {"Download sample data"} + onClick={() => props.downloadAttachment(props.rowdata.sample_dataset)} + > + {!props.rowdata["is_public"] + ? "Download sample data" + : "Download actual data"} + }} + > {/* Warning */} {/* This is a warning alert —{" "} */} - - This table's sample dataset is solely meant to be used as a source - of information. Despite the fact that accuracy is a goal, the - steward is not accountable for the information. Please let the - admin know if you come across any information that you think is - inaccurate. - + {!props.rowdata["is_public"] ? ( + + {screenlabels.dataset.private_data_warning} + + ) : ( + + {screenlabels.dataset.public_data_warning} + + )} @@ -583,11 +647,13 @@ export default function ViewDataSet(props) { "margin-top": "10px", "margin-right": "70px", overflow: "scroll", - }}> + }} + > + style={{ overflow: "scroll", width: "1300px" }} + > {props.tabelkeys.map((key) => ( diff --git a/src/Constants/labels.js b/src/Constants/labels.js index 0c4266dd0..92d9e202e 100755 --- a/src/Constants/labels.js +++ b/src/Constants/labels.js @@ -174,7 +174,7 @@ const labels = { Available: "Available", Not_Available: "Not available", Upload_dataset: " Upload sample datasets *", - + visiblity: "Data Visibility", filter: "Filter", geography: "Geography", age: "Age", @@ -196,6 +196,12 @@ const labels = { "Add details about your dataset and make it discoverable to other users of our network.", no_dataset_text1: "Currently, there are no datasets available.", no_dataset_text2: "Add your dataset.", + private_data_warning: "This table's sample dataset is solely meant to be used as a source of information."+ + "Despite the fact that accuracy is a goal,the steward is not accountable for the information. Please let" + + "the admin know if you come across any information that you think is inaccurate." , + public_data_warning: "This table's dataset is solely meant to be used as a source of information."+ + "Despite the fact that accuracy is a goal,the steward is not accountable for the information. Please let" + + "the admin know if you come across any information that you think is inaccurate." }, dashboard: { organisation_details: "Organisation details", From bfc85e271bc716db1ec5b9e6d1faed35f9c96c3f Mon Sep 17 00:00:00 2001 From: Jashwanth-Gowda-R Date: Tue, 8 Nov 2022 17:07:29 +0530 Subject: [PATCH 2/6] changed profile pic key --- src/Views/Participants/Participants.js | 268 +++++++++++++++---------- 1 file changed, 165 insertions(+), 103 deletions(-) diff --git a/src/Views/Participants/Participants.js b/src/Views/Participants/Participants.js index 68b9f2c9d..e413ee872 100644 --- a/src/Views/Participants/Participants.js +++ b/src/Views/Participants/Participants.js @@ -1,111 +1,173 @@ -import React, { useState, useEffect } from 'react'; -import ParticipantsCards from '../../Components/Participants/ParticipantsCards' -import AddCard from '../../Components/AddCard/AddCard' -import Row from 'react-bootstrap/Row' -import Col from 'react-bootstrap/Col' -import Container from 'react-bootstrap/Container'; -import labels from '../../Constants/labels'; +import React, { useState, useEffect } from "react"; +import ParticipantsCards from "../../Components/Participants/ParticipantsCards"; +import AddCard from "../../Components/AddCard/AddCard"; +import Row from "react-bootstrap/Row"; +import Col from "react-bootstrap/Col"; +import Container from "react-bootstrap/Container"; +import labels from "../../Constants/labels"; import Button from "@mui/material/Button"; -import THEME_COLORS from '../../Constants/ColorConstants' -import UrlConstants from '../../Constants/UrlConstants' +import THEME_COLORS from "../../Constants/ColorConstants"; +import UrlConstants from "../../Constants/UrlConstants"; import { useHistory } from "react-router-dom"; -import HTTPService from '../../Services/HTTPService' -import Loader from '../../Components/Loader/Loader'; -import {GetErrorHandlingRoute} from '../../Utils/Common'; +import HTTPService from "../../Services/HTTPService"; +import Loader from "../../Components/Loader/Loader"; +import { GetErrorHandlingRoute } from "../../Utils/Common"; const useStyles = { - btncolor: {color: "white","text-transform": "capitalize", "border-color": THEME_COLORS.THEME_COLOR, "background-color": THEME_COLORS.THEME_COLOR, float: "right", "border-radius": 0, "padding-right": "0px", "padding-left":"0px", width: "200px", height: "34px", "font-family": 'Open Sans',"font-style": "normal", "font-weight": 700, "font-size": "14px","line-height": "19px", "margin-bottom": "-20px"}, - btn: { width: "420px", height: "42px", "margin-top": "30px", background: "#ffffff", opacity: "0.5", border: "2px solid #c09507", color: "black"}, - marginrowtop: { "padding-top": "50px", "margin-left": "70px", "margin-right": "70px", background: "#FCFCFC", "padding-left": "110px", "padding-right": "110px" }, - marginrowtop10px: { "margin-top": "20px"}, - invbtn: {"padding-right": "50px", "padding-left":"50px"} + btncolor: { + color: "white", + "text-transform": "capitalize", + "border-color": THEME_COLORS.THEME_COLOR, + "background-color": THEME_COLORS.THEME_COLOR, + float: "right", + "border-radius": 0, + "padding-right": "0px", + "padding-left": "0px", + width: "200px", + height: "34px", + "font-family": "Open Sans", + "font-style": "normal", + "font-weight": 700, + "font-size": "14px", + "line-height": "19px", + "margin-bottom": "-20px", + }, + btn: { + width: "420px", + height: "42px", + "margin-top": "30px", + background: "#ffffff", + opacity: "0.5", + border: "2px solid #c09507", + color: "black", + }, + marginrowtop: { + "padding-top": "50px", + "margin-left": "70px", + "margin-right": "70px", + background: "#FCFCFC", + "padding-left": "110px", + "padding-right": "110px", + }, + marginrowtop10px: { "margin-top": "20px" }, + invbtn: { "padding-right": "50px", "padding-left": "50px" }, }; function Participants(props) { - const [screenlabels, setscreenlabels] = useState(labels['en']); - const [participantList, setparticipantList] = useState([]); - const [isShowLoadMoreButton, setisShowLoadMoreButton] = useState(false); - const [participantUrl, setparticipantUrl] = useState(""); - const[isLoader, setIsLoader] = useState(false) + const [screenlabels, setscreenlabels] = useState(labels["en"]); + const [participantList, setparticipantList] = useState([]); + const [isShowLoadMoreButton, setisShowLoadMoreButton] = useState(false); + const [participantUrl, setparticipantUrl] = useState(""); + const [isLoader, setIsLoader] = useState(false); - const history = useHistory(); - useEffect(() => { - setIsLoader(true); - HTTPService('GET',UrlConstants.base_url+UrlConstants.participant,'',false, true).then((response) => { - setIsLoader(false); - console.log("otp valid", response.data); - if (response.data.next == null) { - setisShowLoadMoreButton(false) - } else { - setisShowLoadMoreButton(true) - setparticipantUrl(response.data.next) - } - setparticipantList(response.data.results) - }).catch((e) => { - setIsLoader(false); - history.push(GetErrorHandlingRoute(e)); - }); - }, []); - const getParticipantList = () => { - setIsLoader(true); - HTTPService('GET',participantUrl,'', false, true).then((response) => { - setIsLoader(false); - console.log("otp valid", response.data); - if (response.data.next == null) { - setisShowLoadMoreButton(false) - } else { - setisShowLoadMoreButton(true) - setparticipantUrl(response.data.next) - } - let datalist=participantList - let finalDataList=[...datalist,...response.data.results] - console.log(datalist) - setparticipantList(finalDataList) - }).catch((e) => { - setIsLoader(false); - history.push(GetErrorHandlingRoute(e)); - }); - }; - return ( - <> - {isLoader ? : ''} -
- -
- - - - - - history.push('/datahub/participants/add')}> - - {participantList.map((rowData, index) => ( - - - - ))} - - - - - {isShowLoadMoreButton ? - - : <>} - - - - ); + const history = useHistory(); + useEffect(() => { + setIsLoader(true); + HTTPService( + "GET", + UrlConstants.base_url + UrlConstants.participant, + "", + false, + true + ) + .then((response) => { + setIsLoader(false); + console.log("otp valid", response.data); + if (response.data.next == null) { + setisShowLoadMoreButton(false); + } else { + setisShowLoadMoreButton(true); + setparticipantUrl(response.data.next); + } + setparticipantList(response.data.results); + }) + .catch((e) => { + setIsLoader(false); + history.push(GetErrorHandlingRoute(e)); + }); + }, []); + const getParticipantList = () => { + setIsLoader(true); + HTTPService("GET", participantUrl, "", false, true) + .then((response) => { + setIsLoader(false); + console.log("otp valid", response.data); + if (response.data.next == null) { + setisShowLoadMoreButton(false); + } else { + setisShowLoadMoreButton(true); + setparticipantUrl(response.data.next); + } + let datalist = participantList; + let finalDataList = [...datalist, ...response.data.results]; + console.log(datalist); + setparticipantList(finalDataList); + }) + .catch((e) => { + setIsLoader(false); + history.push(GetErrorHandlingRoute(e)); + }); + }; + return ( + <> + {isLoader ? : ""} +
+ +
+ + + + + + + history.push("/datahub/participants/add") + }> + + {participantList.map((rowData, index) => ( + + + + ))} + + + + {isShowLoadMoreButton ? ( + + + + ) : ( + <> + )} + + + + ); } export default Participants; From f26512fbd3355fae5cf32c4268d8e6f8462615a4 Mon Sep 17 00:00:00 2001 From: emmanuelnegash Date: Tue, 8 Nov 2022 15:01:57 +0300 Subject: [PATCH 3/6] dataset can be created based on the access --- src/Components/Datasets/DataSetForm.css | 4 ++ src/Components/Datasets/DataSetForm.js | 39 +++++++++++++++++--- src/Constants/labels.js | 4 +- src/Views/Dataset/DatasetAdmin/AddDataset.js | 22 ++++++++--- 4 files changed, 58 insertions(+), 11 deletions(-) diff --git a/src/Components/Datasets/DataSetForm.css b/src/Components/Datasets/DataSetForm.css index 025b6f8ca..7ecd8b3db 100644 --- a/src/Components/Datasets/DataSetForm.css +++ b/src/Components/Datasets/DataSetForm.css @@ -11,6 +11,7 @@ float: left; /*margin-left: 20%;*/ margin-top: 3%; + margin-bottom: 3%; } .datasetform .name { width: 100%; @@ -144,6 +145,9 @@ .datasetform .notavaiable { margin-left: 13%; } +.datasetform .private { + margin-left: 15% +} .datasetupload { background: #ffffff; border: 1px dashed #d8af28; diff --git a/src/Components/Datasets/DataSetForm.js b/src/Components/Datasets/DataSetForm.js index 5c1bb01c6..8511b668a 100644 --- a/src/Components/Datasets/DataSetForm.js +++ b/src/Components/Datasets/DataSetForm.js @@ -31,6 +31,30 @@ export default function DataSetForm(props) { {props.title} + + {/* {console.log("This is the sample data",props)} */} + + + } + label={screenlabels.dataset.public} + /> + } + label={screenlabels.dataset.private} + className="private" + /> + + + + onChange={props.handleChange} + > } @@ -424,7 +449,8 @@ export default function DataSetForm(props) { sm={12} md={6} lg={6} - className="FromDate addDatasetFromdate"> + className="FromDate addDatasetFromdate" + > + className="toDate addDatasetTodate" + > + onChange={props.handleChangeRecords} + > } label="<100k" /> + onChange={props.handleChangeAvailable} + > } diff --git a/src/Constants/labels.js b/src/Constants/labels.js index 92d9e202e..11ba7db26 100755 --- a/src/Constants/labels.js +++ b/src/Constants/labels.js @@ -154,7 +154,9 @@ const labels = { Diary: "Diary", Poultry: "Poultry", Other: "Other", - + data_access:"Data access type", + private:"Private", + public:"Public", Soil_data: "Soil data", Weather_data: "Weather data", Research_data: "Research data", diff --git a/src/Views/Dataset/DatasetAdmin/AddDataset.js b/src/Views/Dataset/DatasetAdmin/AddDataset.js index 228d89656..87c4b7345 100644 --- a/src/Views/Dataset/DatasetAdmin/AddDataset.js +++ b/src/Views/Dataset/DatasetAdmin/AddDataset.js @@ -59,6 +59,7 @@ export default function AddDataset(props) { const [value, setValue] = React.useState(""); const [recordsvalue, setrecordsvalue] = React.useState(""); const [availablevalue, setavailablevalue] = React.useState(""); + const [dataAccessValue, setDataAccessValue] = React.useState(""); // const [value, setValue] = React.useState("3 months"); // const [recordsvalue, setrecordsvalue] = React.useState("100k"); @@ -150,7 +151,7 @@ export default function AddDataset(props) { bodyFormData.append("dataset_size", recordsvalue); bodyFormData.append("user_map", id); bodyFormData.append("approval_status", "approved"); - + bodyFormData.append("is_public", dataAccessValue); console.log("add dataset", bodyFormData); setIsLoader(true); HTTPService( @@ -224,6 +225,10 @@ export default function AddDataset(props) { console.log(event.target.value); setrecordsvalue(event.target.value); }; + const handleDataAccessAvailable = (event) => { + console.log(event.target.value); + setDataAccessValue(event.target.value); + }; const handleChangeAvailable = (event) => { console.log(event.target.value); setavailablevalue(event.target.value); @@ -373,7 +378,8 @@ export default function AddDataset(props) { btntext={"ok"} heading={"You added a new dataset"} imageText={"Added Successfully!"} - msg={"Your dataset added in database."}> + msg={"Your dataset added in database."} + > ) : (
{datasetname && + dataAccessValue && reply && Geography && !CheckEndDate && @@ -464,14 +473,16 @@ export default function AddDataset(props) { onClick={handleAddDatasetSubmit} variant="contained" className="submitbtn" - type="submit"> + type="submit" + > {screenlabels.common.submit} ) : ( )} @@ -483,7 +494,8 @@ export default function AddDataset(props) { From c4e9ecccac23b432dd61e51d375f5f0ee758d3fc Mon Sep 17 00:00:00 2001 From: Samuel Date: Tue, 8 Nov 2022 15:55:33 +0300 Subject: [PATCH 4/6] Upload/Download pdf, jpg, jpeg, png for public datasets --- src/Components/Datasets/DataSetForm.js | 36 ++- src/Components/Datasets/viewDataSet.js | 281 ++++++++++++------- src/Views/Dataset/DatasetAdmin/AddDataset.js | 13 +- 3 files changed, 208 insertions(+), 122 deletions(-) diff --git a/src/Components/Datasets/DataSetForm.js b/src/Components/Datasets/DataSetForm.js index 5c1bb01c6..1adaa2571 100644 --- a/src/Components/Datasets/DataSetForm.js +++ b/src/Components/Datasets/DataSetForm.js @@ -22,7 +22,13 @@ import { width } from "@mui/system"; export default function DataSetForm(props) { const [screenlabels, setscreenlabels] = useState(labels["en"]); - const fileTypes = ["csv", "xls", "xlsx"]; + const privateFileTypes = ["csv", "xls", "xlsx"]; + const publicFileTypes = privateFileTypes.concat([ + "jpg", + "jpeg", + "pdf", + "png", + ]); return ( @@ -341,7 +347,8 @@ export default function DataSetForm(props) { aria-labelledby="demo-row-radio-buttons-group-label" name="row-radio-buttons-group" value={props.value} - onChange={props.handleChange}> + onChange={props.handleChange} + > } @@ -424,7 +431,8 @@ export default function DataSetForm(props) { sm={12} md={6} lg={6} - className="FromDate addDatasetFromdate"> + className="FromDate addDatasetFromdate" + > + className="toDate addDatasetTodate" + > + onChange={props.handleChangeRecords} + > } label="<100k" /> + onChange={props.handleChangeAvailable} + > } @@ -550,10 +561,14 @@ export default function DataSetForm(props) { } @@ -571,8 +586,9 @@ export default function DataSetForm(props) { : ""}

- {props.file != null && props.file.size > 2097152 - ? "File uploaded is more than 2MB!" + {props.file != null && + props.file.size > (props.isPublic ? 52428800 : 2097152) + ? `File uploaded is more than ${props.isPublic ? 50 : 2} MB!` : ""} {props.fileValid}

diff --git a/src/Components/Datasets/viewDataSet.js b/src/Components/Datasets/viewDataSet.js index 53df25186..bc06c6d6a 100644 --- a/src/Components/Datasets/viewDataSet.js +++ b/src/Components/Datasets/viewDataSet.js @@ -15,6 +15,7 @@ import { Tooltip, Zoom } from "@mui/material"; import Alert from "@mui/material/Alert"; import AlertTitle from "@mui/material/AlertTitle"; import Stack from "@mui/material/Stack"; +import Button from "@mui/material/Button"; const useStyles = { datasetdescription: { @@ -89,7 +90,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + >
{"Dataset name"} @@ -106,18 +108,21 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + }} + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.name} @@ -137,14 +142,17 @@ export default function ViewDataSet(props) { height: "37px", "line-height": "19px", "word-break": "break-word", - }}> + }} + > + title={props.rowdata.description} + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {" "} {props.rowdata.description} @@ -155,7 +163,8 @@ export default function ViewDataSet(props) { + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {categoryStr} @@ -166,7 +175,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "40px", "text-align": "left", - }}> + }} + > {"Geography"} @@ -182,10 +192,12 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + style={{ width: "30px", height: "37px", "line-height": "19px" }} + > + }} + > {props.rowdata.geography} @@ -210,15 +223,18 @@ export default function ViewDataSet(props) { "line-height": "19px", "word-break": "break-word", // border:"1px solid red" - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.crop_detail ? props.rowdata.crop_detail : "N/A"} @@ -235,7 +251,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "40px", "text-align": "left", - }}> + }} + > {"Age of actual data"} @@ -251,7 +268,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > {props.rowdata.age_of_date ? props.rowdata.age_of_date : "N/A"} @@ -290,7 +308,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "40px", "text-align": "left", - }}> + }} + > {"Connector availablity"} @@ -300,7 +319,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > {props.rowdata.connector_availability @@ -320,7 +340,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + > {"Contact person's name"} @@ -338,7 +359,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.user.first_name} {props.rowdata.user.last_name} @@ -370,7 +394,8 @@ export default function ViewDataSet(props) { ) : ( + aria-label="recipe" + > {props.rowdata.organization.name.charAt(0)} )} @@ -379,10 +404,12 @@ export default function ViewDataSet(props) { + title={props.rowdata.organization.name} + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization.name} @@ -397,10 +424,12 @@ export default function ViewDataSet(props) { props.rowdata.organization.org_email ? props.rowdata.organization.org_email : "N/A" - }> + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization.org_email ? props.rowdata.organization.org_email : "N/A"} @@ -413,7 +442,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + > {"Contact number"} @@ -429,7 +459,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["name"] ? props.rowdata.organization["name"] : "N/A"} @@ -455,10 +488,12 @@ export default function ViewDataSet(props) { props.rowdata.organization["address"]["address"] ? props.rowdata.organization["address"]["address"] : "N/A" - }> + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["address"]["address"] ? props.rowdata.organization["address"]["address"] : "N/A"} @@ -475,7 +510,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "30px", "text-align": "left", - }}> + }} + > {"Country"} @@ -491,7 +527,8 @@ export default function ViewDataSet(props) { "margin-left": "79px", "margin-top": "5px", "text-align": "left", - }}> + }} + > + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["address"]["country"] ? props.rowdata.organization["address"]["country"] : "N/A"} @@ -517,10 +556,12 @@ export default function ViewDataSet(props) { props.rowdata.organization["address"]["pincode"] ? props.rowdata.organization["address"]["pincode"] : "N/A" - }> + } + > + className="thirdmainheading memberDataSetCardTooltipAndWidthAndOverflow d-inline-block text-truncate" + > {props.rowdata.organization["address"]["pincode"] ? props.rowdata.organization["address"]["pincode"] : "N/A"} @@ -537,76 +578,100 @@ export default function ViewDataSet(props) { ) : ( <> )} - - {"Sample data table"} + {props.rowdata.is_public ? ( + + + + + + + ) : ( + <> + + {"Sample data table"} - - props.downloadAttachment(props.rowdata.sample_dataset) - }> - new - - - props.downloadAttachment(props.rowdata.sample_dataset) - }> - {"Download sample data"} - - - - - - {/* Warning */} - {/* This is a warning alert —{" "} */} - - This table's sample dataset is solely meant to be used as a source - of information. Despite the fact that accuracy is a goal, the - steward is not accountable for the information. Please let the - admin know if you come across any information that you think is - inaccurate. - - - - - - -
- - - {props.tabelkeys.map((key) => ( - {key} - ))} - - - - {props.rowdata.content.map((row) => ( - - {props.tabelkeys.map((key) => ( - {row[key]} + + props.downloadAttachment(props.rowdata.sample_dataset) + } + > + new + + + props.downloadAttachment(props.rowdata.sample_dataset) + } + > + {"Download sample data"} + + + + + + {/* Warning */} + {/* This is a warning alert —{" "} */} + + This table's sample dataset is solely meant to be used as a + source of information. Despite the fact that accuracy is a + goal, the steward is not accountable for the information. + Please let the admin know if you come across any information + that you think is inaccurate. + + + + + + +
+ + + {props.tabelkeys.map((key) => ( + {key} + ))} + + + + {props.rowdata.content.map((row) => ( + + {props.tabelkeys.map((key) => ( + {row[key]} + ))} + ))} - - ))} - -
- - + + + + + + )} ); } diff --git a/src/Views/Dataset/DatasetAdmin/AddDataset.js b/src/Views/Dataset/DatasetAdmin/AddDataset.js index 228d89656..87c492e55 100644 --- a/src/Views/Dataset/DatasetAdmin/AddDataset.js +++ b/src/Views/Dataset/DatasetAdmin/AddDataset.js @@ -373,7 +373,8 @@ export default function AddDataset(props) { btntext={"ok"} heading={"You added a new dataset"} imageText={"Added Successfully!"} - msg={"Your dataset added in database."}> + msg={"Your dataset added in database."} + > ) : (
@@ -464,14 +466,16 @@ export default function AddDataset(props) { onClick={handleAddDatasetSubmit} variant="contained" className="submitbtn" - type="submit"> + type="submit" + > {screenlabels.common.submit} ) : ( )} @@ -483,7 +487,8 @@ export default function AddDataset(props) { From c7d2b5085ddba2381d733ae1e61a77ddfc9d8416 Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 9 Nov 2022 16:14:11 +0300 Subject: [PATCH 5/6] File upload issue fix for new dataset --- src/Views/Dataset/DatasetAdmin/AddDataset.js | 8 +++----- src/Views/Dataset/DatasetAdmin/EditDataset.js | 10 +++++----- .../DatasetParticipant/AddDatasetParticipant.js | 8 +++----- .../Participant/Dataset/EditDatasetParticipant.js | 12 ++++++------ 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/Views/Dataset/DatasetAdmin/AddDataset.js b/src/Views/Dataset/DatasetAdmin/AddDataset.js index 3f3db7395..ec5da4f08 100644 --- a/src/Views/Dataset/DatasetAdmin/AddDataset.js +++ b/src/Views/Dataset/DatasetAdmin/AddDataset.js @@ -10,6 +10,7 @@ import { validateInputField, handleUnwantedSpace, HandleSessionTimeout, + fileUpload, getUserMapId, GetErrorKey, } from "../../../Utils/Common"; @@ -144,15 +145,12 @@ export default function AddDataset(props) { if (todate != null && Switchchecked == false) { bodyFormData.append("data_capture_end", todate.toISOString()); } - if (file != null) { - bodyFormData.append("sample_dataset", file); - } + fileUpload(bodyFormData, file, "sample_dataset"); bodyFormData.append("connector_availability", availablevalue); bodyFormData.append("is_public", isPublic); bodyFormData.append("dataset_size", recordsvalue); bodyFormData.append("user_map", id); bodyFormData.append("approval_status", "approved"); - console.log("add dataset", bodyFormData); setIsLoader(true); HTTPService( "POST", @@ -458,7 +456,7 @@ export default function AddDataset(props) { Geography && !CheckEndDate && file && - file.size < 2097152 && + // file.size < 2097152 && (Crop_data == true || Practice_data == true || Farmer_profile == true || diff --git a/src/Views/Dataset/DatasetAdmin/EditDataset.js b/src/Views/Dataset/DatasetAdmin/EditDataset.js index 26eaf63d0..b19e7f7fa 100644 --- a/src/Views/Dataset/DatasetAdmin/EditDataset.js +++ b/src/Views/Dataset/DatasetAdmin/EditDataset.js @@ -320,11 +320,11 @@ export default function EditDataset() { // setprofile_pic(file); console.log(file); console.log(typeof file); - if (file != null && file.size > 2097152) { - setfilesize(true); - } else { - setfilesize(false); - } + // if (file != null && file.size > 2097152) { + // setfilesize(true); + // } else { + // setfilesize(false); + // } }; const handleChangedatasetname = (e) => { validateInputField(e.target.value, RegexConstants.connector_name) diff --git a/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js b/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js index 19d3e75ac..7895e1ee5 100644 --- a/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js +++ b/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js @@ -4,12 +4,13 @@ import Row from "react-bootstrap/Row"; import Col from "react-bootstrap/Col"; import DataSetForm from "../../../Components/Datasets/DataSetForm"; -import $ from "jquery"; +import $, { type } from "jquery"; import { validateInputField, handleUnwantedSpace, HandleSessionTimeout, getUserMapId, + fileUpload, GetErrorHandlingRoute, GetErrorKey, } from "../../../Utils/Common"; @@ -145,15 +146,12 @@ export default function AddDataset(props) { if (todate != null && Switchchecked == false) { bodyFormData.append("data_capture_end", todate.toISOString()); } - if (file != null) { - bodyFormData.append("sample_dataset", file); - } + fileUpload(bodyFormData, file, "sample_dataset"); bodyFormData.append("connector_availability", availablevalue); bodyFormData.append("is_public", isPublic); bodyFormData.append("dataset_size", recordsvalue); bodyFormData.append("user_map", id); - console.log("add dataset", bodyFormData); setIsLoader(true); HTTPService( "POST", diff --git a/src/Views/Role/Participant/Dataset/EditDatasetParticipant.js b/src/Views/Role/Participant/Dataset/EditDatasetParticipant.js index 83774efee..78e8bd84e 100644 --- a/src/Views/Role/Participant/Dataset/EditDatasetParticipant.js +++ b/src/Views/Role/Participant/Dataset/EditDatasetParticipant.js @@ -329,11 +329,11 @@ export default function EditDatasetParticipant() { // setprofile_pic(file); console.log(file); console.log(typeof file); - if (file != null && file.size > 2097152) { - setfilesize(true); - } else { - setfilesize(false); - } + // if (file != null && file.size > 2097152) { + // setfilesize(true); + // } else { + // setfilesize(false); + // } }; const handleChangedatasetname = (e) => { validateInputField(e.target.value, RegexConstants.DATA_SET_REGEX) @@ -591,7 +591,7 @@ export default function EditDatasetParticipant() { Geography && !CheckEndDate && file && - !filesize && + // !filesize && // (file ? file.size < 2097152 : false) && // typeof file == "string" && (Crop_data == true || From 4d1314f712ddbf9a5b6809362fd178a4f7e85155 Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 9 Nov 2022 17:18:29 +0300 Subject: [PATCH 6/6] Removed sample data size cap for the submit btn to be active --- src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js b/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js index 7895e1ee5..a70e0012f 100644 --- a/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js +++ b/src/Views/Dataset/DatasetParticipant/AddDatasetParticipant.js @@ -491,7 +491,7 @@ export default function AddDataset(props) { Geography && !CheckEndDate && file && - file.size < 2097152 && + // file.size < 2097152 && (Crop_data == true || Practice_data == true || Farmer_profile == true ||