Skip to content

Commit

Permalink
Merge pull request #541 from digitalgreenorg/fs_eth_dev
Browse files Browse the repository at this point in the history
Fs eth dev
  • Loading branch information
kanhaiyasuthar0 authored Mar 28, 2023
2 parents 03bffb5 + 85af604 commit 49dd34f
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 31 deletions.
40 changes: 20 additions & 20 deletions src/Components/AdminDatasetConnection/AddDataset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ const AddDataset = (props) => {
return main_list
}

console.log("allStandardisedFile",allStandardisedFile, standardisedFileLink)
console.log("allStandardisedFile", allStandardisedFile, standardisedFileLink)


const handleAddDatasetSubmit = (e) => {
Expand Down Expand Up @@ -734,7 +734,7 @@ const AddDataset = (props) => {
bodyFormData.append("constantly_update", Switchchecked);
bodyFormData.append("data_capture_start", fromdate ? fromdate.toISOString() : "");
bodyFormData.append("data_capture_end", todate ? todate.toISOString() : "");
console.log("allStandardisedFile",allStandardisedFile, standardisedFileLink)
console.log("allStandardisedFile", allStandardisedFile, standardisedFileLink)
bodyFormData.append("standardisation_template", JSON.stringify(standardisedFileLink));
bodyFormData.append("standardisation_config", JSON.stringify(allStandardisedFile));

Expand Down Expand Up @@ -1029,7 +1029,7 @@ const AddDataset = (props) => {
) : (
<React.Fragment>
{/* <Typography sx={{ mt: 2, mb: 1 }}> {activeStep == 0 ? "Please provide the dataset name to enable the further steps" : ""}</Typography> */}
{activeStep == 0 ? <Col style={{ margin: "50px auto 150px auto", padding: "0px" }} lg={12} sm={12}>
{activeStep == 0 ? <Col style={{ margin: "50px auto 50px auto", padding: "0px" }} lg={12} sm={12}>
<TextField
disabled={isDatasetEditModeOn ? true : false}
style={{ marginBottom: "20px" }}
Expand Down Expand Up @@ -1094,20 +1094,20 @@ const AddDataset = (props) => {
</TabContext>
: ""}

{
activeStep == 2 ?
<DataStandardizationInAddDataset
allStandardisedFile={allStandardisedFile}
setAllStandardisedFile={setAllStandardisedFile}
standardisedFileLink={standardisedFileLink}
setStandardisedFileLink={setStandardisedFileLink}
datasetname={datasetname}
listOfFilesExistInDbForEdit={listOfFilesExistInDbForEdit}
isDatasetEditModeOn={isDatasetEditModeOn}
/>
:
{
activeStep == 2 ?
<DataStandardizationInAddDataset
allStandardisedFile={allStandardisedFile}
setAllStandardisedFile={setAllStandardisedFile}
standardisedFileLink={standardisedFileLink}
setStandardisedFileLink={setStandardisedFileLink}
datasetname={datasetname}
listOfFilesExistInDbForEdit={listOfFilesExistInDbForEdit}
isDatasetEditModeOn={isDatasetEditModeOn}
/>
:
""
}
}

{activeStep == 3 ?
<AddMetadata
Expand Down Expand Up @@ -1165,10 +1165,10 @@ const AddDataset = (props) => {
categoryNameList={categoryNameList} handleChangeCategory={handleChangeCategory} category={category} subCategoryNameList={subCategoryNameList} handleSubCategory={handleSubCategory} subCategory={subCategory} />
: ""} */}
<Box sx={{ display: 'flex', flexDirection: 'row', pt: 2 }}>
<Box className='button_main_box' sx={{ display: 'flex', flexDirection: 'row', padding: "10px 80px" }}>
<Button
id='back_button'
color="inherit"
className='back_btn'
// disabled={activeStep === 0}
onClick={activeStep == 0 && onBoardingPage && getRoleLocal() == "datahub_participant_root" ? () => history.push("/login") : activeStep == 0 ? () => history.push("/datahub/datasets") : handleBack}
sx={{ mr: 1 }}
Expand All @@ -1186,15 +1186,15 @@ const AddDataset = (props) => {
Finish Later
</Button> : " "}
<Box sx={{ flex: '1 1 auto' }} />
{activeStep != 0 && !isSubmitted ? <Button id='cancel_button' style={{ color: "white", background: "#c09507" }} onClick={handleResetForm}>Cancel</Button> : ""}
{activeStep != 0 && !isSubmitted ? <Button id='cancel_button' className='cancel_btn' onClick={handleResetForm}>Cancel</Button> : ""}
<Box sx={{ flex: '1 1 auto' }} />
{/* {(isStepOptional(activeStep) && (localUploaded.length > 0 || mysqlFileList.length > 0 || postgresFileList.length > 0)) && (
<Button color="inherit" onClick={handleSkip} sx={{ mr: 1 }}>
Add metadata
</Button>
)} */}

{activeStep == 3 ? <Button disabled ></Button> : <Button id='next_button' disabled={(activeStep == 0 && datasetname != "" && editorGovLawValue.getEditorState().getCurrentContent().hasText()) ? false : (activeStep == 1 && (localUploaded.length > 0 || mysqlFileList.length > 0 || postgresFileList.length > 0 || LiveApiFileList.length > 0 || listOfFilesExistInDbForEdit.length > 0) ? false : isSubmitted ? false : (activeStep==2)? false : true)} onClick={activeStep == 3 ? () => history.push("/datahub/datasets") : handleNext}>
{activeStep == 3 ? <Button disabled ></Button> : <Button className='next_btn' id='next_button' disabled={(activeStep == 0 && datasetname != "" && editorGovLawValue.getEditorState().getCurrentContent().hasText()) ? false : (activeStep == 1 && (localUploaded.length > 0 || mysqlFileList.length > 0 || postgresFileList.length > 0 || LiveApiFileList.length > 0 || listOfFilesExistInDbForEdit.length > 0) ? false : isSubmitted ? false : (activeStep == 2) ? false : true)} onClick={activeStep == 3 ? () => history.push("/datahub/datasets") : handleNext}>
{activeStep === steps.length - 1 ? 'Finish' : 'Next'}
</Button>}
</Box>
Expand Down
8 changes: 4 additions & 4 deletions src/Components/AdminDatasetConnection/AddMetadata.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Select } from 'antd';
import { DatePicker, Space } from 'antd';
import { DatePickerProps } from 'antd';
import dayjs from 'dayjs';

import "./admin-add-dataset.css"
const { RangePicker } = DatePicker;

const ITEM_HEIGHT = 48;
Expand Down Expand Up @@ -72,7 +72,7 @@ const AddMetadata = (props) => {
}
}



const onChange = (date, dateString) => {
props.handleChangeFromDate(new Date(dateString[0]))
Expand Down Expand Up @@ -231,7 +231,7 @@ const AddMetadata = (props) => {
/>
</Row>
<Row style={{ textAlign: "center", display: "inline-block" }}>
<RangePicker disabledDate={disabledDate} allowClear={false} inputReadOnly value={(props.fromdate && props.todate) ? [dayjs(props.fromdate), dayjs(props.todate)] : ""}
<RangePicker disabledDate={disabledDate} allowClear={false} inputReadOnly value={(props.fromdate && props.todate) ? [dayjs(props.fromdate), dayjs(props.todate)] : ""}
disabled={props.Switchchecked ? true : false} onChange={onChange} />
</Row>
</Col>
Expand Down Expand Up @@ -365,7 +365,7 @@ const AddMetadata = (props) => {
<Button
onClick={handleAddDatasetSubmit}
variant="contained"
className="submitbtn"
className="submit_btn"
type="submit"
disabled={(conscent && geography != "" && (!props.Switchchecked ? props.fromdate && props.todate : props.Switchchecked)) && !isSubmitted ? false : true}
>
Expand Down
66 changes: 65 additions & 1 deletion src/Components/AdminDatasetConnection/admin-add-dataset.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,68 @@
/* .Mui-completed {
font-weight: 600 !important;
font-size: 20px !important;
} */
} */
.button_main_box button {
width: 20%;
text-transform: capitalize !important;
}

.button_main_box .next_btn {
color: #c09507 !important;
border: 1px solid #c09507 !important;

}

.button_main_box .next_btn:hover {
color: white !important;
background-color: #c09507 !important;

}

.button_main_box .next_btn:disabled {
color: rgba(128, 128, 128, 0.78) !important;
background-color: rgba(128, 128, 128, 0.58) !important;
border-color: grey !important;
}

.button_main_box .cancel_btn {
color: red !important;
border: 1px solid red !important;
}

.button_main_box .cancel_btn:hover {
color: white !important;
background-color: red !important;
}

.button_main_box .back_btn {
color: #c09507 !important;
}

.button_main_box .back_btn:hover {
color: #c09507 !important;
background-color: unset !important;
}

#admin_add_dataset_main_container .submit_btn {
width: 400px !important;
color: #c09507 !important;
border: 1px solid #c09507 !important;
text-transform: capitalize !important;
margin-top: 20px;

}

#admin_add_dataset_main_container .submit_btn:hover {
color: white !important;
background-color: #c09507 !important;

}

#admin_add_dataset_main_container .submit_btn:disabled {
color: rgba(255, 255, 255, 0.45) !important;
background-color: grey !important;
border-color: grey !important;
width: 400px !important;
text-transform: capitalize !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ const CardDetail = (props) => {
} else {
setIsAllConditionForSaveMet(false)
}
let deleteArr = []
if (index != arr.length - 1) {
deleteArr.push(completeData[index]["map_id"])
}
setTemporaryDeletedCards([...temporaryDeletedCards, ...deleteArr])
console.log(temporaryDeletedCards)
// .then(()=>{
let obj
Expand All @@ -62,6 +57,18 @@ const CardDetail = (props) => {
arr[index - 1] = obj
}
arr.splice(index, 1)

let deleteArr = []
let start = index == 0 ? index : index - 1
for (let i = start; i < completeData.length; i++) {
console.log(index, i, temporaryDeletedCards)
if (!temporaryDeletedCards?.includes(completeData[i]["map_id"]) && completeData[i]["map_id"]) {
deleteArr.push(completeData[i]["map_id"])
}
}
setTemporaryDeletedCards([...temporaryDeletedCards, ...deleteArr])


setCompleteData([...arr])
setTotalCounter((prev) => prev - 1)
// })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const Preview = (props) => {
</Col>
<Col lg={3} sm={12} className={styles.data_before_download}>
<div>Datasets</div>
<ol style={{ width: "250px", height: "150px", overflowY: "auto", fontWeight: "600" }}>{completeData?.map((each) => <li> {each.dataset_name}</li>)}</ol>
<ol style={{ width: "250px", height: "150px", overflowY: "auto", fontWeight: "600", wordWrap: "break-word" }}>{completeData?.map((each) => <li> {each.dataset_name + " - " + decodeURI(each.file_name.split("/").at(-1))} <hr /></li>)}</ol>
</Col>
<Col lg={3} sm={12} className={styles.data_before_download}>
<div>No. of records</div>
Expand Down

0 comments on commit 49dd34f

Please sign in to comment.