Skip to content

Commit

Permalink
BUGFIX/HCMPRE-1730 & HCMPRE-1731 (#2070)
Browse files Browse the repository at this point in the history
* BUGFIX/HCMPRE-1730 & HCMPRE-1731

* fixes

---------

Co-authored-by: NabeelAyubee <[email protected]>
  • Loading branch information
nabeelmd-eGov and NabeelAyubee authored Dec 23, 2024
1 parent 0ed7ed8 commit 1071972
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ function UploadDataMapping({ formData, onSelect, currentCategories }) {
className={"data-mapping-filter-switch"}
isLabelFirst
label={t("FILTER_BY_ACTIVE_STATUS")}
style={{
position: "relative",
zIndex: "1",
}}
onToggle={(value) => {
dispatch({
type: "FILTER_BY_ACTIVE",
Expand All @@ -552,26 +556,32 @@ function UploadDataMapping({ formData, onSelect, currentCategories }) {
},
});
}}
shapeOnOff
/>
<DataTable
category={"category"}
columns={columns}
data={state?.currentData}
progressPending={isLoading || state?.currentData?.length === 0}
progressComponent={<Loader />}
pagination
paginationServer
customStyles={tableCustomStyle}
// paginationTotalRows={totalRows}
// onChangePage={handlePaginationChange}
// onChangeRowsPerPage={handleRowsPerPageChange}
// paginationPerPage={rowsPerPage}
paginationTotalRows={state.totalRows}
onChangePage={handlePageChange}
onChangeRowsPerPage={handleRowsPerPageChange}
paginationRowsPerPageOptions={[5, 10, 15, 20]}
shapeOnOff={true}
/>
{state?.currentData?.length === 0 ? (
<Fragment>
<NoResultsFound text={Digit.Utils.locale.getTransformedLocale(state?.filter ? `NO_RESULTS_FOR_ACTIVE_FILTER_${currentCategories}` : `NO_RESULTS_FOR_MAPPING_${currentCategories}`)} />
</Fragment>
) : (
<DataTable
category={"category"}
columns={columns}
data={state?.currentData}
progressPending={isLoading || state?.currentData?.length === 0}
progressComponent={<Loader />}
pagination
paginationServer
customStyles={tableCustomStyle}
// paginationTotalRows={totalRows}
// onChangePage={handlePaginationChange}
// onChangeRowsPerPage={handleRowsPerPageChange}
// paginationPerPage={rowsPerPage}
paginationTotalRows={state.totalRows}
onChangePage={handlePageChange}
onChangeRowsPerPage={handleRowsPerPageChange}
paginationRowsPerPageOptions={[5, 10, 15, 20]}
/>
)}
{showPopUp && (
<PopUp
className={"dataMapping"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,8 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
const callSecondApiUntilComplete = async () => {
let secondApiResponse;
let isCompleted = false;

while (!isCompleted) {
let isError = false;
while (!isCompleted && !isError) {
secondApiResponse = await Digit.CustomService.getResponse({
url: `/project-factory/v1/data/_search`,
body: {
Expand All @@ -651,6 +651,9 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
if (secondApiResponse && secondApiResponse?.ResourceDetails?.[0]?.status === "completed") {
// Replace `someCondition` with your own condition to determine if it's complete
isCompleted = true;
} else if (secondApiResponse && secondApiResponse?.ResourceDetails?.[0]?.status === "failed") {
// Replace `someCondition` with your own condition to determine if it's complete
isError = true;
} else {
// Optionally, add a delay before retrying
await new Promise((resolve) => setTimeout(resolve, 1000)); // Delay for 1 second before retrying
Expand All @@ -660,6 +663,11 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
return secondApiResponse;
};
const reqCriteriaResource = await callSecondApiUntilComplete();
if (reqCriteriaResource?.ResourceDetails?.[0]?.status === "failed") {
setLoader(false);
setShowToast({ key: "error", label: JSON.parse(reqCriteriaResource?.ResourceDetails?.[0]?.additionalDetails?.error)?.description });
return;
}
const temp = totalFormData?.["HCM_CAMPAIGN_UPLOAD_FACILITY_DATA"]?.uploadFacility?.uploadedFile?.[0];
const restructureTemp = {
...temp,
Expand Down Expand Up @@ -728,6 +736,8 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
updatedData: formData?.uploadUserMapping?.data,
tenantId: tenantId,
sheetNameToUpdate: "HCM_ADMIN_CONSOLE_USER_LIST",
schemas,
t: t,
},
{
onError: (error, variables) => {
Expand All @@ -754,8 +764,8 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
const callSecondApiUntilComplete = async () => {
let secondApiResponse;
let isCompleted = false;

while (!isCompleted) {
let isError = false;
while (!isCompleted && !isError) {
secondApiResponse = await Digit.CustomService.getResponse({
url: `/project-factory/v1/data/_search`,
body: {
Expand All @@ -770,6 +780,9 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
if (secondApiResponse && secondApiResponse?.ResourceDetails?.[0]?.status === "completed") {
// Replace `someCondition` with your own condition to determine if it's complete
isCompleted = true;
} else if (secondApiResponse && secondApiResponse?.ResourceDetails?.[0]?.status === "failed") {
// Replace `someCondition` with your own condition to determine if it's complete
isError = true;
} else {
// Optionally, add a delay before retrying
await new Promise((resolve) => setTimeout(resolve, 1000)); // Delay for 1 second before retrying
Expand All @@ -779,6 +792,11 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
return secondApiResponse;
};
const reqCriteriaResource = await callSecondApiUntilComplete();
if (reqCriteriaResource?.ResourceDetails?.[0]?.status === "failed") {
setLoader(false);
setShowToast({ key: "error", label: JSON.parse(reqCriteriaResource?.ResourceDetails?.[0]?.additionalDetails?.error)?.description });
return;
}
const temp = totalFormData?.["HCM_CAMPAIGN_UPLOAD_USER_DATA"]?.uploadUser?.uploadedFile?.[0];
const restructureTemp = {
...temp,
Expand Down

0 comments on commit 1071972

Please sign in to comment.