Skip to content

Commit

Permalink
Merge branch 'console' into feature/new-demo-cl
Browse files Browse the repository at this point in the history
  • Loading branch information
suryansh-egov authored Oct 16, 2024
2 parents ed16dc8 + f887c42 commit 1987af5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const BoundaryDetailsSummary = (props) => {
<PopUp
// className={"boundaries-pop-module"}
type={"default"}
// heading={t("ES_CAMPAIGN_UPDATE_TYPE_MODAL_HEADER")}
heading= {t(( props?.hierarchyType + "_" + props?.boundaries?.type).toUpperCase())}
children={[]}
onOverlayClick={() => {
setShowPopUp(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const BoundarySummary = (props) => {
// ),
props: {
boundaries: item,
hierarchyType: hierarchyType
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ const CampaignSummary = (props) => {
),
props: {
boundaries: item,
hierarchyType: hierarchyType
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const CampaignUpdateSummary = (props) => {
{
name: `HIERARCHY_${index + 1}`,
type: "COMPONENT",
cardHeader: { value: `${t(item?.type)}`, inlineStyles: { color: "#0B4B66" } },
cardHeader: { value: `${t(( hierarchyType + "_" + item?.type).toUpperCase())}`, inlineStyles: { color: "#0B4B66" } },
// cardHeader: { value: t("item?.boundaries?.type") },
component: "BoundaryDetailsSummary",
cardSecondaryAction: noAction !== "false" && (
Expand All @@ -197,6 +197,7 @@ const CampaignUpdateSummary = (props) => {
),
props: {
boundaries: item,
hierarchyType: hierarchyType
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
const [resourceId, setResourceId] = useState(null);
const [showPreview, setShowPreview] = useState(false);
// TODO : Remove hard coded id
const id = searchParams.get("campaignId") || "274f60e0-f6d8-4bf9-b4da-a714a9046e93";
const id = searchParams.get("campaignId") || null;
const { data: Schemas, isLoading: isThisLoading } = Digit.Hooks.useCustomMDMS(
tenantId,
"HCM-ADMIN-CONSOLE",
Expand Down Expand Up @@ -125,9 +125,8 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
}
}, [type, props?.props?.sessionData]);


useEffect(() => {
const fetchData = async () => {
const generateData = async () => {
if(boundaryHierarchy && type && id) {
const ts = new Date().getTime();
const reqCriteria = {
url: `/project-factory/v1/data/_generate`,
Expand All @@ -154,11 +153,13 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
} catch (error) {
console.error("Error fetching data:", error);
}
};
if(boundaryHierarchy && downloadError){
fetchData();
}
}, [type, boundaryHierarchy, downloadError]);
};


useEffect(() => {
generateData();
}, [type, boundaryHierarchy, id]);


useEffect(() => {
Expand Down Expand Up @@ -584,6 +585,7 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
onSuccess: async (result) => {
if (result?.GeneratedResource?.[0]?.status === "failed") {
setDownloadError(true);
generateData();
setShowToast({ key: "error", label: t("ERROR_WHILE_DOWNLOADING") });
return;
}
Expand All @@ -594,7 +596,8 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
}
if (!result?.GeneratedResource?.[0]?.fileStoreid || result?.GeneratedResource?.length == 0) {
setDownloadError(true);
setShowToast({ key: "info", label: t("HCM_PLEASE_WAIT_TRY_IN_SOME_TIME") });
generateData();
setShowToast({ key: "info", label: t("ERROR_WHILE_DOWNLOADING") });
return;
}
const filesArray = [result?.GeneratedResource?.[0]?.fileStoreid];
Expand All @@ -616,11 +619,12 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
}
} else {
setDownloadError(true);
setShowToast({ key: "info", label: t("HCM_PLEASE_WAIT") });
setShowToast({ key: "info", label: t("ERROR_WHILE_DOWNLOADING_FROM_FILESTORE") });
}
},
onError: (result) => {
setDownloadError(true);
generateData();
setShowToast({ key: "error", label: t("ERROR_WHILE_DOWNLOADING") });
},
}
Expand Down

0 comments on commit 1987af5

Please sign in to comment.