Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated version and boundary fix #1141

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].61-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].62-campaign/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->
<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->

Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,5 @@
}
.timeline-user{
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`;
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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 (
<React.Fragment>
<div className="timeline-user">
{userCredential && (
<Button
label={t("CAMPAIGN_DOWNLOAD_USER_CRED")}
variation="primary"
icon={"DownloadIcon"}
type="button"
className="campaign-download-template-btn hover"
onClick={downloadUserCred}
/>
)}
{
(subElements.length > 0 || subElements2.length > 0) ? (
<TimelineMolecule >
Expand Down Expand Up @@ -172,6 +211,16 @@ const TimelineComponent = ({campaignId, resourceId}) => {
</TimelineMolecule>
)
}
{userCredential && (
<Button
label={t("CAMPAIGN_DOWNLOAD_USER_CRED")}
variation="primary"
icon={"DownloadIcon"}
type="button"
className="campaign-download-template-btn hover"
onClick={downloadUserCred}
/>
)}
</div>
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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"));

Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].61-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].62-campaign/dist/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#00bcd1" />
<title>DIGIT</title>
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/workbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading