From ca82d99f538aef5556afd1da7813d032f471d6c4 Mon Sep 17 00:00:00 2001 From: Bhavya-egov Date: Wed, 24 Jul 2024 16:30:16 +0530 Subject: [PATCH] updated version and boundary fix --- .../micro-ui-internals/example/package.json | 2 +- .../example/public/index.html | 2 +- micro-ui/web/micro-ui-internals/package.json | 2 +- .../packages/css/package.json | 2 +- .../css/src/pages/employee/campaign.scss | 1 - .../modules/campaign-manager/package.json | 2 +- .../src/components/TimelineComponent.js | 83 +++++++++++++++---- .../src/components/UploadData.js | 47 ++++++----- micro-ui/web/package.json | 2 +- micro-ui/web/public/index.html | 2 +- micro-ui/web/workbench/package.json | 2 +- 11 files changed, 99 insertions(+), 48 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/example/package.json b/micro-ui/web/micro-ui-internals/example/package.json index b465d0e7127..d7477b96f74 100644 --- a/micro-ui/web/micro-ui-internals/example/package.json +++ b/micro-ui/web/micro-ui-internals/example/package.json @@ -11,7 +11,7 @@ "devDependencies": { "@egovernments/digit-ui-libraries": "1.8.2-beta.5", "@egovernments/digit-ui-module-workbench": "1.0.2-beta.3", - "@egovernments/digit-ui-components": "0.0.2-beta.14", + "@egovernments/digit-ui-components": "0.0.2-beta.15", "@egovernments/digit-ui-module-core": "1.8.2-beta.6", "@egovernments/digit-ui-module-utilities": "1.0.1-beta.30", "@egovernments/digit-ui-react-components": "1.8.2-beta.11", diff --git a/micro-ui/web/micro-ui-internals/example/public/index.html b/micro-ui/web/micro-ui-internals/example/public/index.html index 44c5d8df3a7..cb302969a6c 100644 --- a/micro-ui/web/micro-ui-internals/example/public/index.html +++ b/micro-ui/web/micro-ui-internals/example/public/index.html @@ -17,7 +17,7 @@ - + diff --git a/micro-ui/web/micro-ui-internals/package.json b/micro-ui/web/micro-ui-internals/package.json index 3fb54fe4899..62cf5393350 100644 --- a/micro-ui/web/micro-ui-internals/package.json +++ b/micro-ui/web/micro-ui-internals/package.json @@ -46,7 +46,7 @@ "lodash": "4.17.21", "microbundle-crl": "0.13.11", "@egovernments/digit-ui-react-components": "1.8.2-beta.11", - "@egovernments/digit-ui-components": "0.0.2-beta.14", + "@egovernments/digit-ui-components": "0.0.2-beta.15", "react": "17.0.2", "react-dom": "17.0.2", "react-hook-form": "6.15.8", diff --git a/micro-ui/web/micro-ui-internals/packages/css/package.json b/micro-ui/web/micro-ui-internals/packages/css/package.json index dfadba4e94f..387687e08d7 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/package.json +++ b/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-css", - "version": "1.0.61-campaign", + "version": "1.0.62-campaign", "license": "MIT", "main": "dist/index.css", "author": "Jagankumar ", diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss index a849c77372e..4cc371900f3 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss +++ b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss @@ -119,6 +119,5 @@ } .timeline-user{ display: flex; - flex-direction: row-reverse; justify-content: space-between; } diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json index cee5e99dcf2..d04e6665ff9 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@egovernments/digit-ui-react-components": "1.8.2-beta.11", - "@egovernments/digit-ui-components": "0.0.2-beta.14", + "@egovernments/digit-ui-components": "0.0.2-beta.15", "@rjsf/core": "5.10.0", "@rjsf/utils": "5.10.0", "@rjsf/validator-ajv8": "5.10.0", diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js index 6bdefbfcb22..f6ca3957669 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js @@ -37,6 +37,7 @@ const TimelineComponent = ({campaignId, resourceId}) => { const tenantId = Digit.ULBService.getCurrentTenantId(); const searchParams = new URLSearchParams(location.search); const [userCredential , setUserCredential] = useState(null); + const { data: baseTimeOut } = Digit.Hooks.useCustomMDMS(tenantId, "HCM-ADMIN-CONSOLE", [{ name: "baseTimeOut" }]); const formatLabel = (label) => { return `HCM_${label.replace(/-/g, "_").toUpperCase()}`; @@ -80,13 +81,6 @@ const TimelineComponent = ({campaignId, resourceId}) => { }; // use refetch interval in this const { data: progessTrack , refetch} = Digit.Hooks.useCustomAPIHook(reqCriteria); - useEffect(() => { - const intervalId = setInterval(() => { - refetch(); - }, 60000); // 60000ms = 1 minute - - return () => clearInterval(intervalId); - }, [refetch]); const lastCompletedProcess = progessTrack?.processTrack .filter((process) => process.status === "completed") @@ -97,6 +91,23 @@ const TimelineComponent = ({campaignId, resourceId}) => { return latestProcess; }, null); + useEffect(() => { + let intervalId; + + if (lastCompletedProcess?.type !== 'campaign-creation') { + intervalId = setInterval(() => { + refetch(); + }, baseTimeOut?.["HCM-ADMIN-CONSOLE"]?.baseTimeOut?.[0]?.timelineRefetch); + } + + return () => { + if (intervalId) { + clearInterval(intervalId); + } + }; + }, [lastCompletedProcess]); + + const completedProcesses = progessTrack?.processTrack .filter(process => process.status === 'completed') .sort((a, b) => b.lastModifiedTime - a.lastModifiedTime) @@ -123,21 +134,49 @@ const TimelineComponent = ({campaignId, resourceId}) => { ? upcomingProcesses.map(process => `${t(formatLabel(process.type))} , ${epochToDateTime(process.lastModifiedTime)}`) : []; + // useEffect(()=>{ + // const lastCompletedProcess = progessTrack?.processTrack + // .filter((process) => process.status === "completed") + // .reduce((latestProcess, currentProcess) => { + // if (!latestProcess || currentProcess.lastModifiedTime > latestProcess.lastModifiedTime) { + // return currentProcess; + // } + // return latestProcess; + // }, null); + // setLastCompletedProgress(lastCompletedProcess); + + // const completedProcesses = progessTrack?.processTrack + // .filter(process => process.status === 'completed') + // .sort((a, b) => b.lastModifiedTime - a.lastModifiedTime) + // .map(process => ({ type: process.type, lastModifiedTime: process.lastModifiedTime })); + // setCompletedProgress(completedProcesses); + + + // const completedTimelines = completedProcesses?.map(process => ({ + // label: t(formatLabel(process.type)), + // subElements: [epochToDateTime(process.lastModifiedTime)], + // })); + // setCompletedTimeline(completedTimelines); + + // const inprogressProcesses = progessTrack?.processTrack + // .filter(process => process.status === 'inprogress') + // .map(process => ({ type: process.type, lastModifiedTime: process.lastModifiedTime })); + + // setinprogressProcesses(inprogressProcesses); + + // const upcomingProcesses = progessTrack?.processTrack + // .filter(process => process.status === "toBeCompleted") + // .map(process => ({ type: process.type, lastModifiedTime: process.lastModifiedTime })); + + // setupcomingProcesses(upcomingProcesses); + + // }, [progessTrack]) + return (
- {userCredential && ( -
); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js index 71401bf6c4b..9d989d0a9a6 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js @@ -475,18 +475,19 @@ const UploadData = ({ formData, onSelect, ...props }) => { expectedHeaders = XLSX.utils.sheet_to_json(sheet, { header: 1 })[0]; } - for (const header of mdmsHeaders) { - if (!expectedHeaders.includes(t(header))) { - const errorMessage = t("HCM_BOUNDARY_INVALID_SHEET"); - setErrorsType((prevErrors) => ({ - ...prevErrors, - [type]: errorMessage, - })); - setIsError(true); - isValid = false; - break; - } - } + + // for (const header of mdmsHeaders) { + // if (!expectedHeaders.includes(t(header))) { + // const errorMessage = t("HCM_BOUNDARY_INVALID_SHEET"); + // setErrorsType((prevErrors) => ({ + // ...prevErrors, + // [type]: errorMessage, + // })); + // setIsError(true); + // isValid = false; + // break; + // } + // } if (!isValid) return isValid; @@ -505,16 +506,16 @@ const UploadData = ({ formData, onSelect, ...props }) => { })[0]; // Check if headers match the expected headers - if (!arraysEqual(headersToValidate, expectedHeaders)) { - const errorMessage = t("HCM_MISSING_HEADERS"); - setErrorsType((prevErrors) => ({ - ...prevErrors, - [type]: errorMessage, - })); - setIsError(true); - isValid = false; - break; - } + // if (!arraysEqual(headersToValidate, expectedHeaders)) { + // const errorMessage = t("HCM_MISSING_HEADERS"); + // setErrorsType((prevErrors) => ({ + // ...prevErrors, + // [type]: errorMessage, + // })); + // setIsError(true); + // isValid = false; + // break; + // } } if (!isValid) return isValid; @@ -536,6 +537,8 @@ const UploadData = ({ formData, onSelect, ...props }) => { })[0]; const jsonData = XLSX.utils.sheet_to_json(sheet, { blankrows: true }); + + if(jsonData.length == 0) continue; const boundaryCodeIndex = headersToValidate.indexOf(t("HCM_ADMIN_CONSOLE_BOUNDARY_CODE")); diff --git a/micro-ui/web/package.json b/micro-ui/web/package.json index e6ab4936637..5dcba66d352 100644 --- a/micro-ui/web/package.json +++ b/micro-ui/web/package.json @@ -19,7 +19,7 @@ "@egovernments/digit-ui-module-core": "1.8.2-beta.6", "@egovernments/digit-ui-module-hrms": "1.8.0-beta.2", "@egovernments/digit-ui-react-components": "1.8.2-beta.11", - "@egovernments/digit-ui-components": "0.0.2-beta.14", + "@egovernments/digit-ui-components": "0.0.2-beta.15", "@egovernments/digit-ui-module-dss": "1.8.0-beta", "@egovernments/digit-ui-module-common": "1.8.0-beta", "@egovernments/digit-ui-module-utilities": "1.0.0-beta", diff --git a/micro-ui/web/public/index.html b/micro-ui/web/public/index.html index 1e83fb5524f..f4499a408a4 100644 --- a/micro-ui/web/public/index.html +++ b/micro-ui/web/public/index.html @@ -11,7 +11,7 @@ - + DIGIT diff --git a/micro-ui/web/workbench/package.json b/micro-ui/web/workbench/package.json index 75ff74cd786..a7e81bbf16c 100644 --- a/micro-ui/web/workbench/package.json +++ b/micro-ui/web/workbench/package.json @@ -14,7 +14,7 @@ "dependencies": { "@egovernments/digit-ui-libraries": "1.8.2-beta.5", "@egovernments/digit-ui-module-workbench": "1.0.2-beta.3", - "@egovernments/digit-ui-components": "0.0.2-beta.14", + "@egovernments/digit-ui-components": "0.0.2-beta.15", "@egovernments/digit-ui-module-core": "1.8.2-beta.6", "@egovernments/digit-ui-module-utilities": "1.0.1-beta.30", "@egovernments/digit-ui-react-components": "1.8.2-beta.11",