history.push('/datahub/participants' +
+ `?costeward=${props.coSteward == true}`)}>
{
+ const { inSettings, isaccesstoken, showBrandingScreen, isOnborading } = props;
+ const [allDatapoints, setAllDataPoints] = useState([
+ // { datapoint_category: "Farmer profile", datapoint_description: "Add Datapoint attributes" },
+ // { datapoint_category: "Farmer profile", datapoint_description: "Add Datapoint attributes" },
+ ]);
+ const [allAttributes, setAllAttributes] = useState({});
+ const [allAttributesDes, setAllAttributesDes] = useState({});
+ const [datapointName, setDatapointName] = useState("");
+ const [datapointDes, setDatapointDes] = useState("");
+ const [isLoading, setIsLoading] = useState(false);
+ const [error, setError] = useState(false);
+ const [errorMessages, setErrorMessage] = useState("");
+ const [saveButtonEnabled, setSaveButtonEnabled] = useState(false)
+ const [editCategoryTitle, setEditCategoryTitle] = useState([])
+ const [datapointNameError,setDatapointNameError] = useState("")
+ const [accordionDatapointNameError,setAccordionDatapointNameError] = useState([])
+
+ const history = useHistory();
+
+ const [messageApi, contextHolder] = message.useMessage();
+ const success = (text, type) => {
+ messageApi.open({
+ type: type,
+ content: text,
+ duration: 5,
+ });
+ };
+
+ console.log("all datapoints", allDatapoints);
+
+ const handleDatapointCategoryName = (e) =>{
+
+ setDatapointNameError("")
+ if(e.target.value.length<51 && e.target.value.match(RegexConstants.NEW_NAME_REGEX)) setDatapointName(e.target.value)
+ }
+
+ const handleDatapointCategoryDescription = (e) =>{
+
+ if(e.target.value.length<251) setDatapointDes(e.target.value)
+
+ }
+
+ const handleNameField = (e) => {
+
+ handleUnwantedSpace(datapointName, e)
+ }
+
+ const handledescriptionKeydowndes = (e) => {
+
+ handleUnwantedSpace(datapointDes, e);
+
+ };
+
+ const handleAddDatapoint = () => {
+ if(!datapointName || !datapointDes ){
+ return
+ }
+ setSaveButtonEnabled(true)
+ let tmpAllDatapoints = [...allDatapoints];
+ let newDatapoint = {
+ datapoint_category: datapointName,
+ datapoint_description: datapointDes,
+ };
+ // Check if category name already exist or not
+ let returnFromFuntion = false
+ tmpAllDatapoints.forEach((category,index)=>{
+ if(category.datapoint_category === datapointName) {
+ setDatapointNameError("Category already exists!")
+ returnFromFuntion = true;
+ return
+ }
+ })
+ if(returnFromFuntion) return
+
+
+ let tmpAllAttributes = { ...allAttributes };
+ let tmpAllAttributesDes = { ...allAttributesDes };
+
+ let keys = Object.keys(allAttributes);
+ console.log("keys", keys);
+
+ tmpAllAttributes[keys.length] = [];
+ tmpAllAttributesDes[keys.length] = [];
+
+ console.log("all attribute tmp in add", tmpAllAttributes);
+
+ setAllAttributes({ ...tmpAllAttributes });
+ setAllAttributesDes({ ...tmpAllAttributesDes });
+
+ console.log('tmpAllDatapoints in add',tmpAllDatapoints)
+
+ tmpAllDatapoints.push(newDatapoint);
+ setAllDataPoints(tmpAllDatapoints);
+ setDatapointName("");
+ setDatapointDes("");
+ };
+ const handleUpdateCategoryName = (index,newValue) =>{
+ setSaveButtonEnabled(true)
+
+ let tmpAllDatapoints = [...allDatapoints];
+ console.log('error array', accordionDatapointNameError)
+
+ //Check if category name already exist or not
+ // let returnFromFuntion = false
+ // tmpAllDatapoints.forEach((category)=>{
+ // if(category.datapoint_category === newValue) {
+ // let tmpDatapointNameError = [...accordionDatapointNameError]
+ //tmpDatapointNameError[index] = ` ${newValue} Category already exists!`
+ // setAccordionDatapointNameError(tmpDatapointNameError)
+ // returnFromFuntion = true;
+ // return
+ // }
+ // })
+ // if(returnFromFuntion) return
+ // let tmpDatapointNameError = [...accordionDatapointNameError]
+ // tmpDatapointNameError[index] = ""
+ // setAccordionDatapointNameError(tmpDatapointNameError)
+
+ tmpAllDatapoints[index].datapoint_category = newValue;
+ setAllDataPoints(tmpAllDatapoints);
+ }
+ const handleNameExistsUpdate = (index, newValue) => {
+ let tmpAllDatapoints = [...allDatapoints];
+ let newCategoryName = newValue.trim();
+
+ // Check if category name already exists or not
+ let categoryAlreadyExists = tmpAllDatapoints.some((category, i) => {
+ return i !== index && category.datapoint_category === newCategoryName;
+ });
+
+ if (categoryAlreadyExists) {
+ let errorofnewValue = [...accordionDatapointNameError];
+ errorofnewValue[index] = `"${newCategoryName}" is already taken. Please choose a different name.`;
+ setAccordionDatapointNameError(errorofnewValue);
+
+ }else if (newCategoryName === ""){
+ let errorofnewValue = [...accordionDatapointNameError]
+ errorofnewValue[index] = "This field may not be blank"
+ setAccordionDatapointNameError(errorofnewValue)
+
+ } else {
+ let tmpDatapointNameError = [...accordionDatapointNameError];
+ tmpDatapointNameError[index] = "";
+ setAccordionDatapointNameError(tmpDatapointNameError);
+ handleUpdateCategoryName(index, newCategoryName);
+ let tmp = [...editCategoryTitle]
+ tmp[index] = false
+ console.log('edit title', tmp, editCategoryTitle)
+ setEditCategoryTitle(tmp)
+
+ }
+ };
+
+
+ const hanldeAttributeInputChange = (
+ index,
+ allAttributesArrIndex,
+ newValue
+ ) => {
+
+ if(newValue.length>=251 || !newValue.match(RegexConstants.DATAPOINT_ATTRIBUTE_REGEX)){
+ return
+ }
+ setSaveButtonEnabled(true)
+ console.log("allAttribute in start of function", allAttributes);
+ let tmpAllAttributes = { ...allAttributes };
+
+ tmpAllAttributes[index][allAttributesArrIndex] = newValue;
+ setAllAttributes(tmpAllAttributes);
+ console.log("allAttribute", allAttributes);
+ };
+ const hanldeAttributeDesInputChange = (
+ index,
+ allAttributesArrIndex,
+ newValue
+ ) => {
+
+ if(newValue.length>=251){
+ return
+ }
+ if(newValue == " "){
+ newValue.replace("")
+ }
+ setSaveButtonEnabled(true)
+
+ console.log("allAttribute Des in start of function", allAttributesDes);
+ let tmpAllAttributesDes = { ...allAttributesDes };
+
+ tmpAllAttributesDes[index][allAttributesArrIndex] = newValue;
+ setAllAttributesDes(tmpAllAttributesDes);
+ console.log("allAttributeDes", allAttributesDes);
+ };
+
+ const handleAddDatapointAttribute = (index) => {
+
+ if(!allAttributes[index][0] || !allAttributesDes[index][0]){
+ return
+ }
+ setSaveButtonEnabled(true)
+
+ let tmpAllAttributes = { ...allAttributes };
+ tmpAllAttributes[index].push(tmpAllAttributes[index][0]);
+ tmpAllAttributes[index][0] = "";
+ setAllAttributes(tmpAllAttributes);
+
+ // For Des
+ let tmpAllAttributesDes = { ...allAttributesDes };
+ tmpAllAttributesDes[index].push(tmpAllAttributesDes[index][0]);
+ tmpAllAttributesDes[index][0] = "";
+ setAllAttributesDes(tmpAllAttributesDes);
+ console.log("all Des", tmpAllAttributesDes);
+ };
+
+ const handleDatapointAtticuteDelete = (index, arrIndex) => {
+ let tmpAllAttributes = { ...allAttributes };
+ tmpAllAttributes[index].splice(arrIndex, 1);
+ setAllAttributes(tmpAllAttributes);
+ console.log("tmpAllAttributes", tmpAllAttributes);
+ };
+
+ const handleDatapointCategoryDelete = (index) => {
+ if (allDatapoints[index]["id"]) {
+ console.log("id", allDatapoints[index]["id"]);
+ deleteDatapointCategory(allDatapoints[index]["id"], index);
+ } else {
+ let tmpAllDatapoints = [...allDatapoints];
+ tmpAllDatapoints.splice(index, 1);
+ setAllDataPoints(tmpAllDatapoints);
+
+ let tmpAllAttributes = {...allAttributes};
+ tmpAllAttributes[index] = []
+ setAllAttributes(tmpAllAttributes)
+ success("Category deleted successfully.", "success");
+ }
+ };
+
+ // API calls
+
+ const handleSubmit = () => {
+ let payload = [...allDatapoints];
+
+ console.log('payload before setting up', payload)
+
+ for (let index = 0; allDatapoints[index]; index++) {
+ let attributeObj = {};
+ for (let i = 1; i < allAttributes[index].length; i++) {
+ attributeObj[allAttributes[index][i]] = allAttributesDes[index][i];
+ }
+ payload[index]["datapoint_attributes"] = attributeObj;
+ }
+
+ console.log("final payload", payload);
+
+ let method = inSettings ? "PUT" : isOnborading ? "POST" : "POST";
+ let url = isOnborading
+ ? UrlConstant.base_url + UrlConstant.standardization_post_data
+ : inSettings
+ ? UrlConstant.base_url + UrlConstant.standardization_update_data
+ : UrlConstant.base_url + UrlConstant.standardization_post_data;
+
+ setIsLoading(true);
+ HTTPService(method, url, payload, false, true, isOnborading ? isaccesstoken : false)
+ .then((response) => {
+ setIsLoading(false);
+ console.log("response", response);
+ if (response.status == 201) {
+ if (inSettings) {
+ success("Standardization template updated!", "success");
+ } else {
+ success(
+ "Standardization template created successfully.",
+ "success"
+ );
+ }
+ console.log("success");
+ if (isOnborading) {
+ showBrandingScreen();
+ }
+ else if (inSettings) {
+ getStandardiziedTemplate()
+ }
+ }
+ })
+ .catch((e) => {
+ setIsLoading(false);
+ // success('Standardization template created successfully')
+ console.log(e);
+ if (
+ e.response != null &&
+ e.response != undefined &&
+ (e.response.status === 401 || e.response.status === 502)
+ ) {
+ setError(true);
+ // success(
+ // e.response.data && e.response.data.message
+ // ? e.response.data.message
+ // : "User not registered", "error"
+ // );
+ history.push(GetErrorHandlingRoute(e));
+ } else {
+ setError(false);
+ success(
+ e.response.data
+ ? e.response.data
+ : "Something went wrong.",
+ "error"
+ );
+ }
+ });
+ };
+
+ const getStandardiziedTemplate = () => {
+ let url = UrlConstant.base_url + UrlConstant.standardization_get_data;
+
+ setIsLoading(true);
+ HTTPService("GET", url, false, false, true)
+ .then((response) => {
+ setIsLoading(false);
+ console.log("response", response);
+ if (response.status == 200) {
+ setAllDataPoints(response?.data);
+ let tmp = { ...allAttributes };
+ let tmpDes = { ...allAttributesDes };
+ response.data.forEach((item, index) => {
+ tmp[index] = Object.keys(item.datapoint_attributes);
+ tmp[index].push(tmp[index]?.[0]);
+ tmp[index][0] = "";
+
+ tmpDes[index] = Object.values(item.datapoint_attributes);
+ tmpDes[index].push(tmpDes[index]?.[0]);
+ tmpDes[index][0] = "";
+ });
+ setAllAttributes(tmp);
+ setAllAttributesDes(tmpDes);
+ console.log("tmp in get call attributes", tmp,tmpDes, allAttributes);
+ }
+ })
+ .catch((e) => {
+ setIsLoading(false);
+ // success('Standardization template created successfully')
+ console.log(e);
+ if (
+ e.response != null &&
+ e.response != undefined &&
+ (e.response.status === 401 || e.response.status === 502)
+ ) {
+ setError(true);
+ // success(
+ // e.response.data && e.response.data.message
+ // ? e.response.data.message
+ // : "User not registered", "error"
+ // );
+ history.push(GetErrorHandlingRoute(e));
+ } else {
+ setError(false);
+ success(
+ e.response.data && e.response.data.message
+ ? e.response.data.message
+ : "Something went wrong.",
+ "error"
+ );
+ }
+ });
+ };
+
+ const deleteDatapointCategory = (id, index) => {
+ let url =
+ UrlConstant.base_url +
+ UrlConstant.standardization_delete_category +
+ id +
+ "/";
+
+ HTTPService("DELETE", url, false, false, true)
+ .then((response) => {
+ setIsLoading(false);
+ console.log("response", response);
+ let tmpAllAttributes = {...allAttributes};
+ tmpAllAttributes[index] = []
+ setAllAttributes(tmpAllAttributes)
+ success("Category deleted successfully.", "success");
+
+ let tmpAllDatapoints = [...allDatapoints];
+ tmpAllDatapoints.splice(index, 1);
+ setAllDataPoints(tmpAllDatapoints);
+ return true;
+ })
+ .catch((e) => {
+ setIsLoading(false);
+ console.log(e);
+ if (
+ e.response != null &&
+ e.response != undefined &&
+ (e.response.status === 401 || e.response.status === 502)
+ ) {
+ setError(true);
+ history.push(GetErrorHandlingRoute(e));
+ } else {
+ setError(false);
+ success(
+ e.response.data && e.response.data.message
+ ? e.response.data.message
+ : "Something went wrong.",
+ "error"
+ );
+ }
+ });
+ };
+
+ // useEffect(()=>{
+ // console.log('attribute in use effect to check', allAttributes)
+ // },[allAttributes])
+
+ // useEffect(() => {
+ // console.log('use effect run 1')
+ // let tmpAllAttributes = { ...allAttributes };
+ // let tmpAllAttributesDes = { ...allAttributesDes };
+ // allDatapoints.forEach((item, index) => {
+
+ // // if(!allAttributes[index]){
+ // // // console.log('in use effect loop', allAttributes, index, tmpAllAttributes)
+ // // tmpAllAttributes[index] = [];
+ // // tmpAllAttributesDes[index] = [];
+
+ // // }
+ // });
+ // console.log("all attribute in map", allAttributes,tmpAllAttributes);
+ // // setAllAttributes(tmpAllAttributes);
+ // // setAllAttributesDes(tmpAllAttributesDes)
+
+ // }, [allDatapoints]);
+
+ useEffect(() => {
+ if (inSettings) {
+ getStandardiziedTemplate();
+ }
+ }, []);
+
+ console.log("all attribute", allAttributes);
+
+ return (
+ <>
+ {isLoading ?
: ""}
+ {contextHolder}
+
+
+
Datapoint category details
+
+ Enter the datapoints and datapoints attributes, we will show to
+ others!
+
+
+
+ handleDatapointCategoryName(e)}
+ onKeyDown={handleNameField}
+ inputProps={{ maxLength: 250 }}
+ className="datapoint-name-input-box"
+ id="datapoint-name-input-box-id"
+ label="Datapoint category name"
+ variant="outlined"
+ error={datapointNameError ? datapointNameError : "" }
+ helperText={datapointNameError ? datapointNameError : "" }
+ />
+ handleDatapointCategoryDescription(e)}
+ onKeyDown={handledescriptionKeydowndes}
+ inputProps={{ maxLength: 250 }}
+ multiline
+ size="small"
+ className="datapoint-name-input-box-description"
+ id="datapoint-name-input-box-description-id"
+ label="Datapoint category description"
+ variant="outlined"
+ />
+
+
+
+
+
+
+
Datapoint attributes
+ {allDatapoints?.map((item, index) => {
+ // let tmpAllAttributes = {...allAttributes}
+ // tmpAllAttributes[index] = []
+ // setAllAttributes(tmpAllAttributes)
+ // console.log('all attribute in map', allAttributes)
+
+ return (
+ <>
+
+ }
+ aria-controls="panel1a-content"
+ id="panel1a-header"
+ className="attribute-accordion-titile"
+ >
+ {/*
+ {item.datapoint_category}
+ */}
+
+ {
+ editCategoryTitle[index] ?
+ handleUpdateCategoryName(index,e.target.value,e)}
+ inputProps={{ maxLength: 250 }}
+ className="datapoint-name-input-box"
+ id="datapoint-name-input-box-id"
+ label="Datapoint category name"
+ variant="outlined"
+ helperText={accordionDatapointNameError[index] ? accordionDatapointNameError[index] : accordionDatapointNameError[index]}
+ error={accordionDatapointNameError[index] ? accordionDatapointNameError[index] : accordionDatapointNameError[index]}
+ />
+ :
+
+
+
+ {item.datapoint_category}
+
+
+ }{
+ editCategoryTitle[index] ?
+
+
+
+ :
+ null
+ }
+ {/* */}
+ {
+ // this funtion will make a particular index of editCategoryTitle array true
+ e.stopPropagation();
+ let tmp = [...editCategoryTitle]
+ tmp[index] = true
+ console.log('edit title', tmp, editCategoryTitle)
+ setEditCategoryTitle(tmp)
+ }}>
+
+
+ {
+ handleDatapointCategoryDelete(index)
+ e.stopPropagation();
+ }}
+ >
+
+
+ {/*
*/}
+
+
+
+ {/*
Farmer profile
*/}
+
{item.datapoint_description}
+
+
+ hanldeAttributeInputChange(index, 0, e.target.value)
+ }
+ inputProps={{ maxLength: 250 }}
+ />
+
+ hanldeAttributeDesInputChange(
+ index,
+ 0,
+ e.target.value
+ )
+ }
+ inputProps={{ maxLength: 250 }}
+ />
+ handleAddDatapointAttribute(index)}
+ >
+
+
+
+
+ {allAttributes?.[index]?.map((inputValue, arrIndex) => {
+ console.log('in category map ',allAttributesDes?.[index]?.[arrIndex], allAttributesDes?.[index])
+ return (
+ <>
+ {arrIndex != 0 ? (
+
+
+
+
+
+ handleDatapointAtticuteDelete(
+ index,
+ arrIndex
+ )
+ }
+ >
+
+
+ >
+ //
+ ),
+ }}
+ className="datapoint-attribute-input-box"
+ id="datapoint-attribute-input-box-id"
+ label="Datapoint attributes"
+ variant="outlined"
+ value={inputValue}
+ // onChange={(e) =>
+ // // hanldeAttributeInputChange(index, 0, e.target.value)
+ // }
+ />
+ ) : (
+ ""
+ )}
+ >
+ );
+ })}
+
+
+
+
+ >
+ );
+ })}
+
+ {/*
Datapoint attributes
+
+
+
Farmer profile
+
Add Datapoint attributes
+
+
+
+
+
*/}
+
+
+
+ {inSettings ? (
+ <>
+
+ >
+ ) : (
+ <>
+
+
+ >
+ )}
+
+ >
+ );
+};
+
+export default StandardizationInOnbord;
diff --git a/src/Components/Standardization/standardizationInOnbording.css b/src/Components/Standardization/standardizationInOnbording.css
new file mode 100644
index 000000000..db9b10b68
--- /dev/null
+++ b/src/Components/Standardization/standardizationInOnbording.css
@@ -0,0 +1,136 @@
+.main-container {
+ text-align: left;
+ width: 1150px !important;
+ margin: auto;
+ background: #ffffff;
+ border-radius: 30px;
+}
+.datapoint-name-input-box {
+ width: 950px;
+ height: 50px;
+ margin: 20px auto !important;
+}
+.datapoint-name-input-box-description {
+ width: 950px;
+ /* height: 120px; */
+}
+.datapoint-name-input-box-description > div {
+ /* height: 100%; */
+}
+.datapoint-name-input-box-description > div > textarea {
+ /* height: 120px !important; */
+ min-height: 120px !important;
+ max-height: 120px !important;
+ overflow: scroll !important;
+}
+.data-point-input-box-container {
+ margin: auto !important;
+}
+.title-container,
+.data-point-input-box-container,
+.datapoint-add-button-classname {
+ margin: auto;
+ width: 950px !important;
+}
+.datapoint-add-button-classname {
+ margin: 50px auto;
+}
+.title-container > h1 {
+ font-weight: 700;
+ font-size: 32px;
+}
+.title-container > p {
+ font-weight: 300;
+ font-size: 18px;
+}
+.datapoint-add-button-classname {
+ text-align: right;
+}
+.datapoint-add-button {
+ width: 172px !important;
+ height: 48px !important;
+ text-transform: none !important;
+ color: #c09507 !important;
+ margin-top: 30px;
+ margin-bottom: 30px;
+ font-weight: 700;
+ background: #ffffff !important;
+ border: 2px solid #c09507 !important;
+ box-shadow: none !important;
+}
+.datapoint-add-button:hover {
+ background: #c09507 !important;
+ color: #ffffff !important;
+}
+.finish-later-button {
+ width: 172px !important;
+ height: 48px !important;
+ text-transform: none !important;
+ color: #c09507 !important;
+ margin-top: 30px;
+ margin-bottom: 30px;
+ font-weight: 700;
+ background: #ffffff !important;
+ /* border: 2px solid #c09507 !important; */
+ box-shadow: none !important;
+ border: none !important;
+ color: black;
+ background-color: #ffffff !important;
+
+}
+.finish-later-button:hover{
+ border: 2px solid #c09507 !important;
+}
+
+.attribute-container {
+ width: 950px;
+ margin: auto;
+}
+.attribute-accordion-titile :nth-child(1) {
+ width: 100% !important;
+}
+.datapoint-name-input-box input {
+ height: 15px !important;
+}
+.attribute-container > h1 {
+ font-weight: 700;
+ font-size: 32px;
+ margin: 20px auto;
+}
+.accordion-title {
+ font-weight: 700 !important;
+ font-size: 20px !important;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+.standardization-accordion-description {
+ word-wrap: break-word;
+}
+.datapoint-attribute-input-box {
+ width: 45%;
+ margin: 0 20px 20px 0 !important;
+}
+
+.accordion-main-classname {
+ box-shadow: 0px 20px 40px -4px rgba(145, 158, 171, 0.16) !important;
+}
+#add-attribute-icon-id {
+ color: black !important;
+ /* font-size: small; */
+}
+.add-datapoint-svg {
+ cursor: pointer !important;
+}
+.update-category-button{
+ width: 90px !important;
+ height: 30px !important;
+ text-transform: none !important;
+ color: #c09507 !important;
+ margin-top: 30px;
+ margin-bottom: 30px;
+ font-weight: 700;
+ background: #ffffff !important;
+ border: 2px solid #c09507 !important;
+ box-shadow: none !important;
+}
diff --git a/src/Components/signup/DataStandardization.js b/src/Components/signup/DataStandardization.js
new file mode 100644
index 000000000..be46efd5d
--- /dev/null
+++ b/src/Components/signup/DataStandardization.js
@@ -0,0 +1,337 @@
+import { TextField } from "@material-ui/core";
+import React, { useState } from "react";
+import "./dataStandardization.css";
+import AddIcon from "@mui/icons-material/Add";
+import ClearIcon from "@mui/icons-material/Clear";
+import { Button } from "@mui/material";
+import { Col, Row } from "react-bootstrap";
+import labels from "../../Constants/labels";
+
+const DataStandardization = () => {
+ const [tableRow, setTableRow] = useState([1]);
+ const [dataPointCategoryNames, setDataPointCategoryNames] = useState([]);
+ const [columnNames, setColumnNames] = useState({});
+
+ // Funcitons
+
+ const hanldeTableAdd = () => {
+ console.log("hanldeTableAdd click");
+ console.log("columnNames in add table", columnNames);
+ let newTableRow = [...tableRow];
+ newTableRow.push(1);
+ setTableRow(newTableRow);
+ console.log("tableRow", tableRow, newTableRow);
+ };
+
+ const handleTableDelete = (index) => {
+ let newTableRow = [...tableRow];
+ newTableRow.splice(index, 1);
+ setTableRow(newTableRow);
+ let tmpDataPointCategoryNames = [...dataPointCategoryNames];
+ tmpDataPointCategoryNames.splice(index, 1);
+ setDataPointCategoryNames(tmpDataPointCategoryNames);
+ let tmpColumnNames = { ...columnNames };
+ tmpColumnNames[index] = [{}];
+ setColumnNames(tmpColumnNames);
+ console.log("tableRow", tableRow, newTableRow);
+ };
+
+ const handleTableRowAdd = (index) => {
+ console.log("hanldeTable row Add click");
+ let newTableRow = [...tableRow];
+ newTableRow[index] = newTableRow[index] + 1;
+ setTableRow(newTableRow);
+ console.log("tableRow in handleTableRowAdd", tableRow, newTableRow);
+ };
+
+ const handleTableRowDelete = (index, keyIndex) => {
+ console.log("index to row", index, keyIndex);
+ let tmpColumnNames = columnNames;
+ if (tmpColumnNames[index]?.[keyIndex]) tmpColumnNames[index][keyIndex] = {};
+ setColumnNames(tmpColumnNames);
+ let newTableRow = [...tableRow];
+ newTableRow[index] = newTableRow[index] - 1;
+ setTableRow(newTableRow);
+ console.log("tableRow", tableRow, tmpColumnNames);
+ };
+
+ const handleDataPointCategoryNames = (value, index) => {
+ let tmpDataPointName = [...dataPointCategoryNames];
+ console.log(
+ "tmpDataPointName[index] in handleDataPointCategoryNames",
+ tmpDataPointName[index]
+ );
+ tmpDataPointName[index] = value;
+ console.log(
+ "tmpDataPointName[index] in handleDataPointCategoryNames",
+ tmpDataPointName[index]
+ );
+
+ // let tmpColumnNames = {}
+ // tmpDataPointName.forEach((item, index)=>{
+ // console.log(item)
+ // tmpColumnNames[item] = [{}]
+ // })
+ // setColumnNames(tmpColumnNames)
+ setDataPointCategoryNames(tmpDataPointName);
+ // setColumnNames({...columnNames})
+ console.log("columnNames", columnNames);
+ console.log("dataPointCategoryNames", dataPointCategoryNames);
+ };
+
+ const handleColumnName = (value, tableKeyName, index) => {
+ console.log("handleColumnName called");
+
+ let newTmpColumnNames = { ...columnNames };
+ dataPointCategoryNames.forEach((item, index) => {
+ console.log(item);
+ if (!newTmpColumnNames[index]) newTmpColumnNames[index] = [{}];
+ });
+ setColumnNames(newTmpColumnNames);
+
+ let tmpColumnNames = newTmpColumnNames;
+ console.log(
+ "tmpColumnNames[tableKeyName]",
+ tmpColumnNames[tableKeyName],
+ tmpColumnNames,
+ tableKeyName
+ );
+ if (!tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index])
+ tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)].push({});
+
+ // console.log('tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)]',tmpColumnNames,dataPointCategoryNames.indexOf(tableKeyName),tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)],tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index]['columnName'])
+
+ tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index][
+ "columnName"
+ ]
+ ? (tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index][
+ "columnName"
+ ] = value)
+ : (tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index] = {
+ ...tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][
+ index
+ ],
+ columnName: value,
+ });
+ setColumnNames(tmpColumnNames);
+ console.log(
+ "tmpColumnNames",
+ tmpColumnNames,
+ newTmpColumnNames,
+ columnNames
+ );
+ };
+
+ const handleColumnDescription = (value, tableKeyName, index) => {
+ console.log("handleColumnDescription called");
+
+ let tmpColumnNames = { ...columnNames };
+ console.log(
+ "tmpColumnNames[tableKeyName]",
+ tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)],
+ tmpColumnNames,
+ tableKeyName
+ );
+
+ if (!tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index])
+ tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)].push({});
+
+ tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index][
+ "columnDescription"
+ ]
+ ? (tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index][
+ "columnDescription"
+ ] = value)
+ : (tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][index] = {
+ ...tmpColumnNames[dataPointCategoryNames.indexOf(tableKeyName)][
+ index
+ ],
+ columnDescription: value,
+ });
+ setColumnNames(tmpColumnNames);
+ console.log("tmpColumnNames", tmpColumnNames, columnNames);
+ };
+
+ const handleSubmit = () => {
+ console.log("submit click");
+ };
+
+ const handleClear = () => {
+ setTableRow([1]);
+ setDataPointCategoryNames([]);
+ setColumnNames({});
+ };
+
+ console.log(
+ "component re rendring",
+ columnNames,
+ columnNames[0]?.[0]?.columnName
+ );
+
+ return (
+ <>
+
+
+
Data Standardization
+
+
+ {tableRow.map((row, index) => {
+ console.log("row no in map", row, index);
+
+ let tmpRowArray = new Array(row);
+ tmpRowArray.fill(1);
+
+ return (
+ <>
+
+
+ handleDataPointCategoryNames(e.target.value, index)
+ }
+ style={{ width: "850px" }}
+ // className="profilelastname"
+ // onChange={props.handleprofilelastname}
+ //inputRef={props.profilelastname}
+ // error={
+ // props.ispropfilelastnameerror || props.lastNameErrorMessage
+ // }
+ // helperText={
+ // props.ispropfilelastnameerror
+ // ? "Enter Valid last name"
+ // : props.lastNameErrorMessage
+ // }
+ // value={props.profilelastname}
+ />
+ {index === 0 ? (
+
+
+
+ ) : (
+ handleTableDelete(index)}>
+
+
+ )}
+ {tmpRowArray.map((childRow, keyIndex) => {
+ return (
+ <>
+
+
+ handleColumnName(
+ e.target.value,
+ dataPointCategoryNames[index],
+ keyIndex
+ )
+ }
+ id={`data_standardization_table_row${keyIndex}`}
+ className="data_standardization_table_row_class_name"
+ label="Column/Key Name"
+ variant="outlined"
+ style={{ width: "300px" }}
+ // className="profilelastname"
+ // onChange={props.handleprofilelastname}
+ //inputRef={props.profilelastname}
+ // error={
+ // props.ispropfilelastnameerror || props.lastNameErrorMessage
+ // }
+ // helperText={
+ // props.ispropfilelastnameerror
+ // ? "Enter Valid last name"
+ // : props.lastNameErrorMessage
+ // }
+ // value={props.profilelastname}
+ />
+
+ handleColumnDescription(
+ e.target.value,
+ dataPointCategoryNames[index],
+ keyIndex
+ )
+ }
+ id={`data_standardization_table_row_description${keyIndex}`}
+ className="data_standardization_table_row_description_class_name"
+ label="Column/Key Description"
+ variant="outlined"
+ style={{ width: "500px" }}
+ // className="profilelastname"
+ // onChange={props.handleprofilelastname}
+ //inputRef={props.profilelastname}
+ // error={
+ // props.ispropfilelastnameerror || props.lastNameErrorMessage
+ // }
+ // helperText={
+ // props.ispropfilelastnameerror
+ // ? "Enter Valid last name"
+ // : props.lastNameErrorMessage
+ // }
+ // value={props.profilelastname}
+ />
+ {keyIndex === 0 ? (
+ handleTableRowAdd(index)}>
+
+
+ ) : (
+
+ handleTableRowDelete(index, keyIndex)
+ }
+ >
+
+
+ )}
+
+ >
+ );
+ })}
+
+ >
+ );
+ })}
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+};
+
+export default DataStandardization;
diff --git a/src/Components/signup/OrgRightside.js b/src/Components/signup/OrgRightside.js
index 1897dedf5..9a83e6282 100644
--- a/src/Components/signup/OrgRightside.js
+++ b/src/Components/signup/OrgRightside.js
@@ -29,6 +29,7 @@ import {
handleAddressCharacters,
isLoggedInUserCoSteward,
isLoggedInUserParticipant,
+ mobileNumberMinimunLengthCheck,
validateInputField,
} from "../../Utils/Common";
import RegexConstants from "../../Constants/RegexConstants";
@@ -820,7 +821,7 @@ export default function OrgRightside(props) {
Next
*/}
{props.orgName &&
- props.validOrgNumber?.length == 15 &&
+ mobileNumberMinimunLengthCheck(props.validOrgNumber) &&
!props.isOrgnameerror &&
props.Orgemailbtn &&
!props.isOrgmailerror &&
diff --git a/src/Components/signup/ProfileRightside.js b/src/Components/signup/ProfileRightside.js
index 0dfa05da6..4d8085ed9 100644
--- a/src/Components/signup/ProfileRightside.js
+++ b/src/Components/signup/ProfileRightside.js
@@ -8,6 +8,7 @@ import Footerimg from "../../Components/signup/Footerimg";
import HTTPService from "../../Services/HTTPService";
import UrlConstant from "../../Constants/UrlConstants";
import Footer from "../Footer/Footer";
+import { mobileNumberMinimunLengthCheck } from "../../Utils/Common";
// import "react-phone-input-2/lib/material.css";
@@ -263,7 +264,8 @@ export default function ProfileRightside(props) {
/>
- {props.profilenextbutton ? (
+ {props.profilenextbutton &&
+ mobileNumberMinimunLengthCheck(props.profilephone)? (
diff --git a/src/Components/signup/ProfileRightsideParticipant.js b/src/Components/signup/ProfileRightsideParticipant.js
index 579ca82e2..18e72bfe2 100644
--- a/src/Components/signup/ProfileRightsideParticipant.js
+++ b/src/Components/signup/ProfileRightsideParticipant.js
@@ -14,7 +14,7 @@ import { LinearProgress } from "@mui/material";
import CancelIcon from '@mui/icons-material/Cancel'
import { useHistory } from "react-router-dom";
import Loader from "../Loader/Loader";
-import {GetErrorHandlingRoute, getUserLocal, isLoggedInUserCoSteward, isLoggedInUserParticipant } from "../../Utils/Common";
+import {GetErrorHandlingRoute, getUserLocal, isLoggedInUserCoSteward, isLoggedInUserParticipant, mobileNumberMinimunLengthCheck } from "../../Utils/Common";
import Footer from "../Footer/Footer";
const fileTypes = ['JPEG', 'PNG', 'jpg']
@@ -254,7 +254,8 @@ export default function ProfileRightsideParticipant(props) {
- {props.profilenextbutton ? (
+ {props.profilenextbutton &&
+ mobileNumberMinimunLengthCheck(props.profilephone) ? (
diff --git a/src/Components/signup/dataStandardization.css b/src/Components/signup/dataStandardization.css
new file mode 100644
index 000000000..1f2b0db4e
--- /dev/null
+++ b/src/Components/signup/dataStandardization.css
@@ -0,0 +1,14 @@
+
+.data_standardization_table{
+ text-align: left !important
+}
+
+.data_standardization_table_class_name{
+ margin: 30px 0px 20px 50px !important;
+}
+.data_standardization_table_row_class_name{
+ margin: 0 50px 10px 50px !important;
+}
+.data_standardization_add_icon{
+ margin-top: 20px;
+}
\ No newline at end of file
diff --git a/src/Constants/RegexConstants.js b/src/Constants/RegexConstants.js
index 9cdd93088..ed1b5dcb2 100644
--- a/src/Constants/RegexConstants.js
+++ b/src/Constants/RegexConstants.js
@@ -22,7 +22,8 @@ const RegexConstants = {
DES_SET_REGEX: /^$|^[a-zA-Z0-9.][a-zA-Z0-9. ]*$/,
city_name: /^$|^[a-zA-Z][a-zA-Z ]*$/,
address: /^$|^[a-zA-Z0-9#,][a-zA-Z0-9#, ]*$/,
- NEW_NAME_REGEX: /^([a-zA-Z0-9]+\s?)*$/ //allows only one space and no spl characters allowed
+ NEW_NAME_REGEX: /^([a-zA-Z0-9]+\s?)*$/, //allows only one space and no spl characters allowed
+ DATAPOINT_ATTRIBUTE_REGEX: /^([a-zA-Z0-9_]+)*$/ // accepts only 1 spl charecter "_" and no spl characters and no space
};
export default RegexConstants;
diff --git a/src/Constants/UrlConstants.js b/src/Constants/UrlConstants.js
index bee798d1a..28bda31d9 100644
--- a/src/Constants/UrlConstants.js
+++ b/src/Constants/UrlConstants.js
@@ -62,7 +62,7 @@ const UrlConstant = {
microsite_legal_documents: "/microsite/legal_documents/",
consumer_paring_request: "participant/connectors_map/",
provider_connectors: "participant/connectors/get_connectors/?dataset_id=",
- microsite_theme: "/microsite/theme/",
+ microsite_theme: "microsite/theme/",
datahub_dashboard: "datahub/dashboard/",
add_project: "/participant/project/",
register_participant: "accounts/self_register/",
@@ -82,10 +82,25 @@ const UrlConstant = {
co_steward_add: "datahub/participant/",
//integration
+ get_org_name_list: "datahub/dataset_ops/organization/",
get_dataset_name_list: "datahub/dataset_ops/datasets_names/",
get_files_for_selected_datasets: "datahub/dataset_ops/datasets_file_names/",
get_columns_for_selected_files: "datahub/dataset_ops/datasets_col_names/",
- joining_the_table: "datahub/dataset_ops/datasets_join_condition/"
+ joining_the_table: "datahub/dataset_ops/datasets_join_condition/",
+
+ // Standardization
+
+ standardization_post_data: "datahub/standardise/",
+ standardization_update_data: "datahub/standardise/update_standardisation_template/",
+ standardization_delete_category: "datahub/standardise/",
+ standardization_get_data: "datahub/standardise/",
+ standardization_get_all_file_name: "datahub/dataset/v2/temp_dataset_files/?dataset_name=",
+ standardization_get_file_columns: "datahub/dataset/v2/temp_dataset_file_columns/",
+ standardise_file: "datahub/dataset/v2/standardise/",
+
+ joining_the_table: "connectors/integration/",
+ integration_connectors: "connectors/",
+ list_of_connectors: "connectors/",
};
diff --git a/src/Constants/labels.js b/src/Constants/labels.js
index 4826a5ba7..daecf3f46 100755
--- a/src/Constants/labels.js
+++ b/src/Constants/labels.js
@@ -392,6 +392,10 @@ const labels = {
first_name: "First name",
last_name: "Last name",
contact_number: "Contact number",
+ },
+ data_satandardization: {
+ submit_button: "Submit",
+ clear_button: 'Clear',
}
},
};
diff --git a/src/Layout/Datahub.js b/src/Layout/Datahub.js
index 7fb7060f4..1893a0b9b 100644
--- a/src/Layout/Datahub.js
+++ b/src/Layout/Datahub.js
@@ -41,19 +41,20 @@ import ViewMetaDatasetDetails from "../Components/AdminDatasetConnection/ViewMet
import ViewCoSteward from "../Components/Participants/ViewCoSteword";
import EditCoSteward from "../Components/Participants/EditCoSteward";
import DatasetIntegration from "../Components/Datasets/IntegrationDatasets/DatasetIntegration";
+import ConnectorsList from "../Components/IntegrationConnectors/ConnectorsList";
function Datahub(props) {
// const [activePage, setactivePage] = useState("");
// useEffect(() => {
// }, []);
return (
<>
- {(getTokenLocal() && (isLoggedInUserAdmin() || isLoggedInUserCoSteward()))? (
+ {(getTokenLocal() && (isLoggedInUserAdmin() || isLoggedInUserCoSteward())) ? (
-
- {/* */}
-
+ /> */}
-
-
+
+
+
-
+
diff --git a/src/Layout/Participant.js b/src/Layout/Participant.js
index 2d311efea..fcae17eae 100644
--- a/src/Layout/Participant.js
+++ b/src/Layout/Participant.js
@@ -29,6 +29,7 @@ import DemoDashboardTable from "../Components/Connectors/DemoDashboardTable";
import AddDataset from "../Components/AdminDatasetConnection/AddDataset";
import ViewMetaDatasetDetails from "../Components/AdminDatasetConnection/ViewMetaDatasetDetails";
import DatasetIntegration from "../Components/Datasets/IntegrationDatasets/DatasetIntegration";
+import ConnectorsList from "../Components/IntegrationConnectors/ConnectorsList";
function Participant(props) {
return (
@@ -43,11 +44,11 @@ function Participant(props) {
path="/participant/datasets"
component={DatasetParticipant}
/>
-
+ /> */}
{/*
-
-
-
+
+ {/*
+
+ */}
+
diff --git a/src/Utils/Common.js b/src/Utils/Common.js
index 83edc8fc4..f476c78ce 100644
--- a/src/Utils/Common.js
+++ b/src/Utils/Common.js
@@ -150,7 +150,7 @@ export const getErrorLocal = () => {
export const isLoggedInUserAdmin = () => {
return getRoleLocal()
? getRoleLocal().toLowerCase() ==
- LocalStorageConstants.ROLES.DATAHUB_ADMIN.toLowerCase()
+ LocalStorageConstants.ROLES.DATAHUB_ADMIN.toLowerCase()
: false;
};
@@ -158,14 +158,14 @@ export const isLoggedInUserParticipant = () => {
//return true;
return getRoleLocal()
? getRoleLocal().toLowerCase() ==
- LocalStorageConstants.ROLES.DATAHUB_PARTICIPANT_ROOT.toLowerCase()
+ LocalStorageConstants.ROLES.DATAHUB_PARTICIPANT_ROOT.toLowerCase()
: false;
};
export const isLoggedInUserCoSteward = () => {
//return true;
return getRoleLocal()
? getRoleLocal().toLowerCase() ==
- LocalStorageConstants.ROLES.DATAHUB_CO_STEWARD.toLowerCase()
+ LocalStorageConstants.ROLES.DATAHUB_CO_STEWARD.toLowerCase()
: false;
};
@@ -203,6 +203,7 @@ export const flushLocalstorage = () => {
};
export const downloadAttachment = (uri, name) => {
+ console.log("click on download", uri, name)
FileSaver.saveAs(uri, name);
};
@@ -246,7 +247,7 @@ export const openLinkInNewTab = (url) => {
};
export const mobileNumberMinimunLengthCheck = (number) => {
- return number?.length >= 13;
+ return number?.length >= 9;
};
export const stringMinimumLengthCheck = (str, len) => {
@@ -306,3 +307,9 @@ export const adminNotFoundRoute = (e) => {
return "/error";
}
};
+
+//function to scroll on top
+export function goToTop(no) {
+ document.body.scrollTop = no ? no : 0; // For Safari
+ document.documentElement.scrollTop = no ? no : 0; // For Chrome, Firefox, IE and Opera
+}
\ No newline at end of file
diff --git a/src/Views/Dataset/DataSetFilter.js b/src/Views/Dataset/DataSetFilter.js
index ece49374b..1a9988435 100644
--- a/src/Views/Dataset/DataSetFilter.js
+++ b/src/Views/Dataset/DataSetFilter.js
@@ -196,7 +196,7 @@ export default function DataSetFilter(props) {
)}
- {getRoleLocal() !== "datahub_co_steward" && (
+ {/* {getRoleLocal() !== "datahub_co_steward" && (
<>
{props.showMemberFilters && (
@@ -245,7 +245,7 @@ export default function DataSetFilter(props) {
/>
))}
>
- )}
+ )} */}
{/*
diff --git a/src/Views/GuestUser/GuestUserContact.js b/src/Views/GuestUser/GuestUserContact.js
index 42c150477..48f21a031 100644
--- a/src/Views/GuestUser/GuestUserContact.js
+++ b/src/Views/GuestUser/GuestUserContact.js
@@ -203,7 +203,7 @@ export default function GuestUserContact(props) {
// console.log({admin_name: admin.first_name,org_name:organization.org_description,address:`${organization.address.address}, ${admin.address.city}`,phone_number:organization.phone_number,admin_email:admin.email,country:organization.address.country,city:organization.address.city,website:organization.website,admin_phone:admin.phone_number,admin_pin_code:organization.address.pincode,email_id:organization.org_email})
setDatahubUserDetails((admin == null) ? setAdminNotFound(adminErrorMessage)
: ({
- admin_name: admin.first_name, org_name: organization.name, address: `${organization.address.address}, ${organization.address.city}`, phone_number: organization.phone_number, admin_email: admin.email, country: organization.address.country, city: organization.address.city, website: organization.website, admin_phone: admin.phone_number, admin_pin_code: organization.address.pincode, email_id: organization.org_email
+ admin_name: admin?.first_name, org_name: organization?.name, address: `${organization?.address?.address}, ${organization?.address?.city}`, phone_number: organization?.phone_number, admin_email: admin?.email, country: organization?.address?.country, city: organization?.address?.city, website: organization?.website, admin_phone: admin?.phone_number, admin_pin_code: organization?.address?.pincode, email_id: organization?.org_email
})
// setIsSuccess(true);
)
diff --git a/src/Views/GuestUser/GuestUserHome.js b/src/Views/GuestUser/GuestUserHome.js
index 7cc823ebc..ddf32e49d 100644
--- a/src/Views/GuestUser/GuestUserHome.js
+++ b/src/Views/GuestUser/GuestUserHome.js
@@ -27,7 +27,7 @@ import "./GuestUserHome.css";
export default function GuestUserHome(props) {
// loader
const [isLoader, setIsLoader] = useState(false);
- const [farmstackLogo,setFarmstackLogo] = useState(true);
+ const [farmstackLogo,setFarmstackLogo] = useState(false);
const [noDatasetGuestUserPage, setNoDatasetGuestUserPage] = useState(true);
useEffect(() => {
setIsLoader(true);
diff --git a/src/Views/Login/Login.js b/src/Views/Login/Login.js
index 508d8056d..5071f36d3 100644
--- a/src/Views/Login/Login.js
+++ b/src/Views/Login/Login.js
@@ -46,6 +46,7 @@ import LeftintroParticipant from "../../Components/intros/LeftIntroParticipant";
import LocalStorageConstants from "../../Constants/LocalStorageConstants";
import AddingCategory from "../../Components/Catergories/AddingCategory";
import { ConsoleSqlOutlined } from "@ant-design/icons";
+import StandardizationInOnbord from "../../Components/Standardization/StandardizationInOnbording";
export default function Login(props) {
const [button, setButton] = useState(false);
const email = useRef();
@@ -72,6 +73,7 @@ export default function Login(props) {
const [isDataSet, setIsDataSet] = useState(false);
const [isCategorySetup, setIsCategorySetup] = useState(false);
const [isaccesstoken, setisaccesstoken] = useState(false);
+ const [isDataStandardization, setIsDataStandardization] = useState(false);
//const [userid, setUserId] = useState(false)
const [orgName, setOrgName] = useState("");
@@ -264,6 +266,8 @@ export default function Login(props) {
setOrgIdState(response?.data?.org_id);
setOtpError(false);
setisProfile(true);
+ // setIsDataStandardization(true)
+ // setIsDataStandardization(true)
setisOtp(false);
}
// console.log(response.json());
@@ -861,8 +865,9 @@ export default function Login(props) {
const handlepincode = (e) => {
console.log(e.target.value);
+ if (e.target.value > 10) e.target.value = e.target.value.substring(0, 10);
var pincode = e.target.value;
- if (pincode.length > 0) {
+ if (pincode.length >= 5) {
setispincodeerror(false);
setOrgpincodebtn(true);
// setOrgnextbutton(true);
@@ -936,8 +941,8 @@ export default function Login(props) {