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

Tenant config upload #1416

Merged
merged 12 commits into from
Sep 27, 2024
2 changes: 1 addition & 1 deletion micro-ui/web/core/inter-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"dependencies": {
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-react-components": "1.8.1-beta.11",
"@egovernments/digit-ui-react-components": "1.8.1-beta.14",
"@egovernments/digit-ui-components": "0.0.2-beta.31",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@egovernments/digit-ui-module-open-payment":"0.0.1",
"@egovernments/digit-ui-module-hrms": "1.8.1-beta.1",
"@egovernments/digit-ui-module-pgr": "1.8.1-beta.1",
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-react-components": "1.8.2-beta.14",
"babel-loader": "8.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
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 @@ -20,7 +20,7 @@
"@egovernments/digit-ui-module-open-payment":"0.0.1",
"@egovernments/digit-ui-module-engagement": "1.5.20",
"@egovernments/digit-ui-components": "0.0.2-beta.31",
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-react-components": "1.8.2-beta.14",
"@egovernments/digit-ui-module-sandbox": "0.0.1",
"http-proxy-middleware": "^1.0.5",
"react": "17.0.2",
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 @@ -73,7 +73,7 @@
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-components": "0.0.2-beta.31",
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-react-components": "1.8.2-beta.14",
"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
Expand Up @@ -109,10 +109,12 @@
margin-top: 3rem;
width: 100%;
}

.submit-bar {
margin-top: 3rem;
width: 100%;
}

.bannerHeader {
.bannerLogo {
margin-top: 1rem;
Expand Down Expand Up @@ -173,6 +175,7 @@
margin-right: auto;
width: fit-content;
}

.digit-card-text.sandbox-resend-otp {
margin: 0;
margin-top: -1rem;
Expand Down Expand Up @@ -214,6 +217,7 @@
}
}
}

.digit-card-component.signupCardClassName.sandbox-onboarding-wrapper {
.bannerHeader {
.bannerLogo {
Expand All @@ -222,6 +226,7 @@
}
}
}

.digit-card-component.card-sandbox {
.bannerHeader {
.bannerLogo {
Expand All @@ -238,32 +243,40 @@
height: 2rem;
}
}

.sandbox-success-signup {
margin-top: unset;
}

.digit-field {
margin-top: 0.5rem;
}

.sandbox-url-footer {
margin-top: 0.5rem;
}

.digit-button-primary {
width: 100%;
}
}

.submit-bar {
background-color: #c84c0e;
}

.digit-employee-card.card-sandbox {
.digit-card-header.cardHeader-sandbox {
color: #00703c !important;
}
}

.sandbox-url-wrapper {
display: flex;
width: 100%;
.digit-text-input-field.urlInputText {
}

.digit-text-input-field.urlInputText {}

.digit-button-secondary.large.copyButton {
width: 30%;
padding: 0;
Expand All @@ -281,23 +294,27 @@
display: flex;
flex-direction: row-reverse;
}

.digit-employee-card.sandboxSetupMasterInfo {
.h1.headerFlex {
display: flex;
gap: 1rem;
align-items: center;
}

.digit-card-header.subHeader {
font-size: 1.5rem;
font-weight: 700;
color: unset !important;
}
}

.digit-card-header.setupMaster-subheading {
font-size: 1.5rem;
color: unset !important;
margin-left: 1.5rem;
}

.digit-popup-wrapper.masterHandlerPopup {
.digit-popup-header {
.header-close-container {
Expand All @@ -307,67 +324,87 @@
}
}
}

.digit-topbar-ulb {
.state {
width: 80px;
height: 19px;
}
}

.digit-popup-footer.masterHandlerPopUpFooter {
.digit-popup-footer-buttons {
margin-left: unset;
width: 100%;
justify-content: center;
}
}

.main.center-container.citizen-home-container {
z-index: 100;
justify-content: flex-start;
}

.SideBarStatic {
z-index: 10;
height: 100vh;
}

.citizen-form-wrapper {
justify-content: flex-start;

.citizen-card-input.citizen-card-input--front {
margin-bottom: 0;
}
}

.action-bar-wrap {
.menu-wrap {
p {
margin: 0 !important;
}
}
}

.digit-popup-wrapper.setupMasterPopUp.alert {
.digit-popup-alert-content{
.digit-popup-alert-content {
.digit-popup-alert-heading {
color: #00703c;
}
}
}
.pgr-citizen-wrapper{
.applications-list-container{
.card{
.date-wrap{

.pgr-citizen-wrapper {
.applications-list-container {
.card {
.date-wrap {
align-items: center;
justify-content: flex-start;
}
}
}
}

.pgr-citizen-wrapper{
.applications-list-container{
.card{
.status-highlight{
.pgr-citizen-wrapper {
.applications-list-container {
.card {
.status-highlight {
display: flex;
align-items: center;
justify-content: center;
}
}
}
}

.digit-uploader-wrap {
.digit-uploader-content {
.digit-button-secondary {
.icon-label-container {
.digit-button-label {
width: fit-content;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ApiCacheService } from "../../atoms/ApiCacheService";
import { TenantConfigSearch } from "../../elements/TenantConfigService";

const getImgUrl = (url, fallbackUrl) => {

if (!url && fallbackUrl) {
return fallbackUrl;
}
Expand Down Expand Up @@ -65,35 +66,46 @@ export const StoreService = {
const fetchTenantConfig = async () => {
const tenantConfigs = await TenantConfigSearch.tenant(stateCode);
const tenantConfigSearch = tenantConfigs?.tenantConfigs ? tenantConfigs?.tenantConfigs : null;
const logoArray = tenantConfigSearch[0].documents
.filter(doc => doc.type === "logoUrl")
.map(doc => doc.fileStoreId);

const bannerArray = tenantConfigSearch[0].documents
.filter(doc => doc.type === "bannerUrl")
.map(doc => doc.fileStoreId);

const logoUrl = await Digit.UploadServices.Filefetch(logoArray, tenantConfigSearch?.[0]?.code);
const bannerUrl = await Digit.UploadServices.Filefetch(bannerArray, tenantConfigSearch?.[0]?.code);

return {
languages: stateInfo.hasLocalisation ? stateInfo.languages : [{ label: "ENGLISH", value: Digit.Utils.getDefaultLanguage() }],
stateInfo: {
code: tenantConfigFetch ? tenantConfigSearch?.[0]?.code : stateInfo.code,
name: tenantConfigFetch ? tenantConfigSearch?.[0]?.name : stateInfo.name,
logoUrl: tenantConfigFetch ? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "logoUrl")?.url : stateInfo.logoUrl,
logoUrl: tenantConfigFetch ? logoUrl ? logoUrl : tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "logoUrl")?.url : stateInfo.logoUrl,
statelogo: tenantConfigFetch ? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "statelogo")?.url : stateInfo.statelogo,
logoUrlWhite: tenantConfigFetch
? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "logoUrlWhite")?.url
: stateInfo.logoUrlWhite,
bannerUrl: tenantConfigFetch ? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "bannerUrl")?.url : stateInfo.bannerUrl,
bannerUrl: tenantConfigFetch ? bannerUrl ? bannerUrl : tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "bannerUrl")?.url : stateInfo.bannerUrl,
},
localizationModules: stateInfo.localizationModules,
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x,y)=>x?.order-y?.order)|| [],
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x, y) => x?.order - y?.order) || [],
uiHomePage: uiHomePage
};
};
const initData = tenantConfigFetch ? await fetchTenantConfig() : {
languages: stateInfo.hasLocalisation ? stateInfo.languages : [{ label: "ENGLISH", value: Digit.Utils.getDefaultLanguage() }],
stateInfo: {
code: stateInfo.code,
name: stateInfo.name,
name: stateInfo.name,
logoUrl: stateInfo.logoUrl,
statelogo: stateInfo.statelogo,
logoUrlWhite: stateInfo.logoUrlWhite,
bannerUrl: stateInfo.bannerUrl,
},
localizationModules: stateInfo.localizationModules,
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x,y)=>x?.order-y?.order)|| [],
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x, y) => x?.order - y?.order) || [],
uiHomePage: uiHomePage
};
initData.selectedLanguage = Digit.SessionStorage.get("locale") || initData.languages[0].value;
Expand All @@ -105,9 +117,9 @@ export const StoreService = {
.flat()
.reduce((unique, ele) => (unique.find((item) => item.code === ele.code) ? unique : [...unique, ele]), []);
initData.tenants = MdmsRes?.tenant?.tenants
.map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));
// .filter((item) => !!moduleTenants.find((mt) => mt.code === item.code))
// .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));
.map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));
// .filter((item) => !!moduleTenants.find((mt) => mt.code === item.code))
// .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));

await LocalizationService.getLocale({
modules: [
Expand All @@ -128,7 +140,7 @@ export const StoreService = {
},
defaultData: async (stateCode, moduleCode, language, modulePrefix) => {
let moduleCodes = [];
if(typeof moduleCode !== "string") moduleCode.forEach(code => { moduleCodes.push(modulePrefix ? `${modulePrefix}-${code.toLowerCase()}` : `${code.toLowerCase()}`) });
if (typeof moduleCode !== "string") moduleCode.forEach(code => { moduleCodes.push(modulePrefix ? `${modulePrefix}-${code.toLowerCase()}` : `${code.toLowerCase()}`) });
const LocalePromise = LocalizationService.getLocale({
modules: typeof moduleCode == "string" ? modulePrefix ? [`${modulePrefix}-${moduleCode.toLowerCase()}`] : [`${moduleCode.toLowerCase()}`] : moduleCodes,
locale: language,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.2-beta.31",
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-react-components": "1.8.2-beta.14",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.16.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-react-components": "1.8.2-beta.14",
"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
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-react-components": "1.8.2-beta.14",
"lodash.merge": "^4.6.2",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-react-components": "1.8.2-beta.14",
"@egovernments/digit-ui-components": "0.0.2-beta.31",
"react": "17.0.2",
"react-date-range": "^1.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { default as EmployeeApp } from "./pages/employee";
import SandboxCard from "./components/SandboxCard";
import { overrideHooks, updateCustomConfigs } from "./utils";
import ModuleCard from "./components/ModuleCard";
import ConfigUploaderComponent from "./pages/employee/tenantMgmt/ConfigUploaderComponent";
import LogoUploaderComponent from "./pages/employee/tenantMgmt/LogoUploaderComponent";

export const SandboxModule = ({ stateCode, userType, tenants }) => {
const { path, url } = useRouteMatch();
Expand Down Expand Up @@ -33,6 +35,8 @@ const componentsToRegister = {
SandboxCard,
WorkbenchCard: null,
SandboxModuleCard: ModuleCard,
ConfigUploaderComponent,
LogoUploaderComponent
};

export const initSandboxComponents = () => {
Expand Down
Loading