From a32e5395e12af619ab05ce878e09d3977c9f8099 Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Mon, 30 Sep 2024 16:34:58 +0530 Subject: [PATCH 1/8] upload error message bug --- .../pages/employee/tenantMgmt/ConfigUploaderComponent.js | 4 ++++ .../pages/employee/tenantMgmt/LogoUploaderComponent.js | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js index 65a866de088..dd3c91361c2 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js @@ -11,6 +11,7 @@ const ConfigUploaderComponent = ({ onSelect, ...props }) => { const [file, setFile] = useState(null); const [fileStoreId, setFileStoreId] = useState(null); const tenantId = Digit.ULBService.getCurrentTenantId(); + const [uploadErrorMEssage, setUploadErrorMessage] = useState(""); const { t } = useTranslation(); @@ -20,9 +21,11 @@ const ConfigUploaderComponent = ({ onSelect, ...props }) => { const response = await Digit.UploadServices.Filestorage("Sandbox", file, tenantId); const fileStoreId = response?.data?.files?.[0]?.fileStoreId; setFileStoreId(fileStoreId) + setUploadErrorMessage(""); } catch (error) { setToastMessage(t("BANNER_UPLOAD_FAILED")); setIsError(true); + setUploadErrorMessage(t("LOGO_UPLOAD_FAILED")); setShowToast(true); setTimeout(() => { setShowToast(false); @@ -56,6 +59,7 @@ const ConfigUploaderComponent = ({ onSelect, ...props }) => { uploadedFiles={[]} variant="uploadFile" onUpload={(files) => selectFile(files)} + iserror={uploadErrorMEssage} // if (files && files.length > 0) { // handleUploadFile(files); // } diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js index 1a53cf2c57b..8f52d78f9da 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js @@ -10,6 +10,8 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { const [showToast, setShowToast] = useState(null); const [toastMessage, setToastMessage] = useState(""); const [isError, setIsError] = useState(false); + const [uploadErrorMEssage, setUploadErrorMessage] = useState(""); + const tenantId = Digit.ULBService.getCurrentTenantId(); const { t } = useTranslation(); const handleUploadFile = async () => { @@ -18,12 +20,14 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { const response = await Digit.UploadServices.Filestorage("Sandbox", file, tenantId); const fileStoreId = response?.data?.files?.[0]?.fileStoreId; setFileStoreId(fileStoreId) + setUploadErrorMessage(""); } catch (error) { setToastMessage(t("LOGO_UPLOAD_FAILED")); + setUploadErrorMessage(t("LOGO_UPLOAD_FAILED")); setIsError(true); setShowToast(true); setTimeout(() => { - closeToast(); + setShowToast(false); }, 2000); } }; @@ -36,6 +40,7 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { const selectFile = (file) => { + console.log("file uploaded is ", file); setFile(file?.[0]) } @@ -52,6 +57,7 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { uploadedFiles={[]} variant="uploadFile" onUpload={(files) => selectFile(files)} + iserror={uploadErrorMEssage} // if (files && files.length > 0) { // handleUploadFile(files); // } From b83d8e571116cde1c080602d7470c71f42e7dee5 Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Tue, 1 Oct 2024 14:33:30 +0530 Subject: [PATCH 2/8] logo mobile css and upload success message --- .../packages/css/src/pages/employee/sandbox.scss | 6 ++++++ .../src/pages/employee/tenantMgmt/TenantConfigUpload.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss index fd57fc82adf..196848b6fdb 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss +++ b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss @@ -384,6 +384,12 @@ } } +.digit-topbar .digit-header-img-ulb-wrapper-mobileview .digit-topbar-ulb-mobileview { + .state { + width: 80px; + height: 19px; + } +} .digit-popup-footer.masterHandlerPopUpFooter { .digit-popup-footer-buttons { margin-left: unset; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js index 576fec24bc3..013d7f26031 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js @@ -127,12 +127,12 @@ const TenantConfigUpload = () => { }, { onError: (error) => { - setToastMessage(error.message || t("ERROR_MESSAGE")); + setToastMessage(error.message || t("CONFIG_UPLOAD_ERROR_MESSAGE")); setIsError(true); setShowToast(true); }, onSuccess: () => { - setToastMessage(t("SANDBOX_TENANT_CREATE_SUCCESS_TOAST")); + setToastMessage(t("CONFIG_UPLOAD_SUCCESSFUL_TOAST_MESSAGE")); setIsError(false); setShowToast(true); setTimeout(() => { From 4d26203d5fb10015e3dad4ec75d46f2ab9e5b6f0 Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Tue, 1 Oct 2024 15:49:55 +0530 Subject: [PATCH 3/8] upload labels changed --- .../employee/tenantMgmt/ConfigUploaderComponent.js | 2 +- .../employee/tenantMgmt/LogoUploaderComponent.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js index b3a0e97bf5e..12d342e4789 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js @@ -25,7 +25,7 @@ const ConfigUploaderComponent = ({ onSelect, ...props }) => { } catch (error) { setToastMessage(t("BANNER_UPLOAD_FAILED")); setIsError(true); - setUploadErrorMessage(t("LOGO_UPLOAD_FAILED")); + setUploadErrorMessage(t("BANNER_UPLOAD_FAILED")); setShowToast(true); setTimeout(() => { setShowToast(false); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js index f4753d4a2db..f2700e2ac5f 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js @@ -5,15 +5,15 @@ import { useTranslation } from "react-i18next"; import { Fragment } from "react"; const LogoUploaderComponent = ({ onSelect, ...props }) => { - const [file, setFile] = useState(null); - const [fileStoreId, setFileStoreId] = useState(null); const [showToast, setShowToast] = useState(null); const [toastMessage, setToastMessage] = useState(""); const [isError, setIsError] = useState(false); - const [uploadErrorMEssage, setUploadErrorMessage] = useState(""); - + const [file, setFile] = useState(null); + const [fileStoreId, setFileStoreId] = useState(null); const tenantId = Digit.ULBService.getCurrentTenantId(); + const [uploadErrorMEssage, setUploadErrorMessage] = useState(""); const { t } = useTranslation(); + const handleUploadFile = async () => { // Upload the file first try { @@ -23,8 +23,8 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { setUploadErrorMessage(""); } catch (error) { setToastMessage(t("LOGO_UPLOAD_FAILED")); - setUploadErrorMessage(t("LOGO_UPLOAD_FAILED")); setIsError(true); + setUploadErrorMessage(t("LOGO_UPLOAD_FAILED")); setShowToast(true); setTimeout(() => { setShowToast(false); @@ -40,7 +40,6 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { const selectFile = (file) => { - console.log("file uploaded is ", file); setFile(file?.[0]) } From 644fd0289317b3301df1f510ac7fbd4abd0b0b3f Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Tue, 1 Oct 2024 16:32:07 +0530 Subject: [PATCH 4/8] error message when no file is added --- .../pages/employee/tenantMgmt/TenantConfigUpload.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js index 013d7f26031..06973c5b4db 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js @@ -17,6 +17,8 @@ const TenantConfigUpload = () => { const [isError, setIsError] = useState(false); const [uploadData, setUploadData] = useState([]); // State to store the uploaded data const [tenantDocument, setDocuments] = useState([]); + const [canSubmit, setCanSubmit] = useState(false); + const mutation = Digit.Hooks.useCustomAPIMutationHook({ @@ -74,6 +76,17 @@ const TenantConfigUpload = () => { type: data[key]?.type, }; }); + + const isBannerUndefined = documents.find(doc => doc.type === "bannerUrl")?.fileStoreId === undefined; + const isLogoUndefined = documents.find(doc => doc.type === "logoUrl")?.fileStoreId === undefined; + + if (isBannerUndefined && isLogoUndefined) { + setToastMessage(t("BOTH_FILESTOREIDS_ARE_UNDEFINED")); + setIsError(true); + setShowToast(true); + return; + } + setUploadData(documents); }; From 951db0ff2cad865bfc21c40ae33cc301df8e6f34 Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Tue, 1 Oct 2024 16:41:26 +0530 Subject: [PATCH 5/8] toast message time out and error checks --- .../src/pages/employee/tenantMgmt/TenantConfigUpload.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js index 06973c5b4db..8a9d5df69c2 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js @@ -84,6 +84,9 @@ const TenantConfigUpload = () => { setToastMessage(t("BOTH_FILESTOREIDS_ARE_UNDEFINED")); setIsError(true); setShowToast(true); + setTimeout(() => { + setShowToast(false); + }, 2000); return; } @@ -159,6 +162,9 @@ const TenantConfigUpload = () => { setToastMessage(error.message); setIsError(true); setShowToast(true); + setTimeout(() => { + setShowToast(false); + }, 2000); } }; From b8c62642a0e22c808d29e167cfb68ca65ffdea37 Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Tue, 1 Oct 2024 17:53:26 +0530 Subject: [PATCH 6/8] css version upgrade --- micro-ui/web/micro-ui-internals/packages/css/package.json | 2 +- micro-ui/web/public/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 75e3465310a..1f8a84d6783 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.8.2-beta.33", + "version": "1.8.2-beta.34", "license": "MIT", "main": "dist/index.css", "author": "Jagankumar ", diff --git a/micro-ui/web/public/index.html b/micro-ui/web/public/index.html index 5a71694e767..9a752021fbe 100644 --- a/micro-ui/web/public/index.html +++ b/micro-ui/web/public/index.html @@ -7,7 +7,7 @@ - + From 21d59c6d2da7d6174ad245b46399d24504641db3 Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Thu, 3 Oct 2024 11:28:17 +0530 Subject: [PATCH 7/8] review changes --- .../packages/css/src/pages/employee/sandbox.scss | 4 ++-- .../src/pages/employee/tenantMgmt/ConfigUploaderComponent.js | 4 ++-- .../src/pages/employee/tenantMgmt/LogoUploaderComponent.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss index 196848b6fdb..2c6596859eb 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss +++ b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss @@ -379,14 +379,14 @@ .digit-topbar-ulb { .state { - width: 80px; + width: 5rem; height: 19px; } } .digit-topbar .digit-header-img-ulb-wrapper-mobileview .digit-topbar-ulb-mobileview { .state { - width: 80px; + width: 5rem; height: 19px; } } diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js index 12d342e4789..c1d2d613d1b 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/ConfigUploaderComponent.js @@ -11,7 +11,7 @@ const ConfigUploaderComponent = ({ onSelect, ...props }) => { const [file, setFile] = useState(null); const [fileStoreId, setFileStoreId] = useState(null); const tenantId = Digit.ULBService.getCurrentTenantId(); - const [uploadErrorMEssage, setUploadErrorMessage] = useState(""); + const [uploadErrorMessage, setUploadErrorMessage] = useState(""); const { t } = useTranslation(); @@ -59,7 +59,7 @@ const ConfigUploaderComponent = ({ onSelect, ...props }) => { uploadedFiles={[]} variant="uploadFile" onUpload={(files) => selectFile(files)} - iserror={uploadErrorMEssage} + iserror={uploadErrorMessage} accept="image/*, .jpg, .png, .jpeg" // if (files && files.length > 0) { // handleUploadFile(files); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js index f2700e2ac5f..d7751f0b82d 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/LogoUploaderComponent.js @@ -11,7 +11,7 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { const [file, setFile] = useState(null); const [fileStoreId, setFileStoreId] = useState(null); const tenantId = Digit.ULBService.getCurrentTenantId(); - const [uploadErrorMEssage, setUploadErrorMessage] = useState(""); + const [uploadErrorMessage, setUploadErrorMessage] = useState(""); const { t } = useTranslation(); const handleUploadFile = async () => { @@ -56,7 +56,7 @@ const LogoUploaderComponent = ({ onSelect, ...props }) => { uploadedFiles={[]} variant="uploadFile" onUpload={(files) => selectFile(files)} - iserror={uploadErrorMEssage} + iserror={uploadErrorMessage} accept="image/*, .jpg, .png, .jpeg" // if (files && files.length > 0) { // handleUploadFile(files); From 8a0f74516abf889ae9b9d8dd3d521663a61ca4ed Mon Sep 17 00:00:00 2001 From: mithun-hegde-egov Date: Thu, 3 Oct 2024 11:32:41 +0530 Subject: [PATCH 8/8] remov unused state variables --- .../sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js | 1 - 1 file changed, 1 deletion(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js index 8a9d5df69c2..ec3d49705db 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/tenantMgmt/TenantConfigUpload.js @@ -17,7 +17,6 @@ const TenantConfigUpload = () => { const [isError, setIsError] = useState(false); const [uploadData, setUploadData] = useState([]); // State to store the uploaded data const [tenantDocument, setDocuments] = useState([]); - const [canSubmit, setCanSubmit] = useState(false);