Skip to content

Commit

Permalink
Merge pull request #189 from egovernments/mf-dss
Browse files Browse the repository at this point in the history
DPG-2272: Implement DSS module with single spa react and test on unified-dev
  • Loading branch information
nipunarora-eGov authored Mar 4, 2024
2 parents 0dabd38 + c29bae3 commit 899ce30
Show file tree
Hide file tree
Showing 23 changed files with 352 additions and 117 deletions.
3 changes: 2 additions & 1 deletion micro-ui/web/lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"packages/workbench",
"packages/pgr",
"packages/ui-core",
"packages/app1"
"packages/app1",
"packages/dss"
],
"command": {
"run": {
Expand Down
5 changes: 5 additions & 0 deletions micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
"packages/pgr",
"packages/ui-core",
"packages/app1",

"packages/dss"

"packages/common"

],
"scripts": {
"build": "yarn lerna run build",
Expand All @@ -30,6 +34,7 @@
"build:common": "cd packages/common && yarn build",
"build:hrms": "cd packages/hrms && yarn build",
"build:workbench": "cd packages/workbench && yarn build",
"start:dss": "cd packages/dss && yarn start",
"build:dss": "cd packages/dss && yarn build",
"build:pgr": "cd packages/pgr && yarn build",
"start:core": "cd packages/core && yarn start",
Expand Down
9 changes: 6 additions & 3 deletions micro-ui/web/packages/core/src/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import { useState } from "react";
import ErrorBoundary from "./components/ErrorBoundaries";
import getStore from "./redux/store";

import { ReactQueryDevtools } from 'react-query/devtools';
//here add react-query dev tools


const DigitUIWrapper = ({ stateCode="pg", enabledModules, moduleReducers,defaultLanding }) => {
console.log("came till here 1");

const { isLoading, data: initData } = Digit.Hooks.useInitStore(stateCode, enabledModules);

if (isLoading) {
return <Loader page={true} />;
}
Expand Down Expand Up @@ -84,8 +85,10 @@ export const DigitUI = ({stateCode="pg", registry, enabledModules, moduleReducer
},
}}
>

<DigitUIWrapper stateCode={"pg"} enabledModules={enabledModules} moduleReducers={moduleReducers} defaultLanding={defaultLanding} />
{/* <div>Core Module Dummy</div> */}

{/* <ReactQueryDevtools initialIsOpen={false} /> */}
</PrivacyProvider.Provider>
</ComponentProvider.Provider>
Expand All @@ -104,4 +107,4 @@ export const initCoreComponents = () => {
Object.entries(componentsToRegister).forEach(([key, value]) => {
Digit.ComponentRegistryService.setComponent(key, value);
});
};
};
2 changes: 1 addition & 1 deletion micro-ui/web/packages/core/src/modules/Dss.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef } from "react";
import { mount } from "dss/DssModule";
import { mount } from "dss/DSSModule";
import { History } from "history";

// interface AuthProps {
Expand Down
10 changes: 10 additions & 0 deletions micro-ui/web/packages/core/src/modules/registerRemotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ export default (queryClient) => {
// },
// });

registerApplication({
name: "Dss",
app: () => import("dss/DSSModule"),
activeWhen: "/workbench-ui/employee/dss",
customProps: {
title: "DSS is running on host",
queryClient,
},
});

// registerApplication({
// name: "app1",
// app: () => import("app1/App"),
Expand Down
10 changes: 6 additions & 4 deletions micro-ui/web/packages/core/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = () => {
proxy: [
{
context: () => true,
// target: 'https://staging.digit.org',
// target: 'https://mukta-uat.digit.org',
target: 'https://unified-dev.digit.org',
secure: false,
changeOrigin:true,
changeOrigin: true,
bypass: function (req, res, proxyOptions) {
if (req.headers.accept.indexOf('html') !== -1) {
console.log('Skipping proxy for browser request.');
Expand All @@ -35,7 +35,7 @@ module.exports = () => {
historyApiFallback: {
index: "/",
},
server:"https", //Enable HTTPS
server: "https", //Enable HTTPS
},
plugins: [
new ModuleFederationPlugin({
Expand All @@ -47,10 +47,12 @@ module.exports = () => {
// dashboard: "dashboard@http://localhost:8084/remoteEntry.js",
// pgr: "pgr@https://localhost:8087/remoteEntry.js",
// hrms: "hrms@https://localhost:8085/remoteEntry.js",

// workbench: "workbench@https://localhost:8086/remoteEntry.js",
// common:"common@https://localhost:8090/remoteEntry.js"

// app1: "app1@https://localhost:8001/remoteEntry.js",
// dss: "dss@https://localhost:8087/remoteEntry.js",
//dss: "dss_ui@https://localhost:8087/remoteEntry.js",
// measurement : "measurement@https://localhost:8088/remoteEntry.js"
},
shared: packageJson.dependencies,
Expand Down
3 changes: 3 additions & 0 deletions micro-ui/web/packages/core/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ module.exports = () => {
// dashboard: `dashboard@${domain}/dashboard/remoteEntry.js`,
// pgr : `pgr-ui@${domain}/pgr/remoteEntry.js`,
// hrms: `hrms@${domain}/hrms/remoteEntry.js`,
//dss : `dss_ui@${domain}/dss/remoteEntry.js`,

// common: `common-ui@${domain}/common-ui/remoteEntry.js`,
// workbench : `workbench_web@${domain}/workbench/remoteEntry.js`,
// dss : `dss@${domain}/dss/remoteEntry.js`,

// measurement : `measurement@${domain}/measurement/remoteEntry.js`
},
// shared: packageJson.dependencies,
Expand Down
5 changes: 0 additions & 5 deletions micro-ui/web/packages/dss/.babelrc

This file was deleted.

204 changes: 204 additions & 0 deletions micro-ui/web/packages/dss/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<!-- TODO: update this -->

# digit-ui-module-dss

## Install

```bash
npm install --save @egovernments/digit-ui-module-dss
```

## Limitation

```bash
This Package is more specific to DIGIT-UI's can be used across mission's
```

## Usage

After adding the dependency make sure you have this dependency in

```bash
frontend/micro-ui/web/package.json
```

```json
"@egovernments/digit-ui-module-dss":"^1.5.0",
```

then navigate to App.js

```bash
frontend/micro-ui/web/src/App.js
```


```jsx
/** add this import **/

import { initDSSComponents } from "@egovernments/digit-ui-module-dss";

/** inside enabledModules add this new module key **/

const enabledModules = ["DSS"];

/** inside init Function call this function **/

const initDigitUI = () => {
initDSSComponents();
};
```

## Dynamic filter Usage
DSS UI

Digit-UI has a DSS module that displays multiple types of charts, and tables based on the configuration. In DSS there are some filters that are fixed for all the pages, they should be based on the configuration.

Example config

MasterDashboardConfig.json

```json

{
"name": "DSS_REPORT",
"filter": "FilterComponent",
"filterConfig": [
{
"id": "DATE_RANGE",
"name": "ES_DSS_DATE_RANGE",
"type": "DateRange",
"props": {
"maxNumberOfDays": 90
}
},
{
"id": "LOCALITY",
"name": "ES_DSS_LOCALITY",
"type": "Dropdown",
"source": {
"type": "request",
"hostUrl": "https://works-dev.digit.org",
"requestMethod": "POST",
"requestUrl": "/egov-location/location/v11/boundarys/_search?hierarchyTypeCode=ADMIN&boundaryType=Locality&tenantId={$.tenantId}",
"requestBody": "{\"criteria\":{\"tenantId\" : \"{$.tenantId}\" }}",
"keyPath": "$.TenantBoundary[0].boundary.*.name",
"valuesPath": "$.TenantBoundary[0].boundary.*.code"
},
"appliedFilterPath": "filters.locality",
"placeholder": "ES_DSS_ALL_LOCALITY_SELECTED"
},
{
"id": "DISTRICT",
"name": "ES_DSS_DDR",
"type": "MultiSelectDropdown",
"source": {
"type": "request",
"hostUrl": "https://works-dev.digit.org",
"requestMethod": "POST",
"requestUrl": "/egov-location/location/v11/boundarys/_search?hierarchyTypeCode=ADMIN&boundaryType=Locality&tenantId={$.tenantId}",
"requestBody": "{\"criteria\":{\"tenantId\" : \"{$.tenantId}\" }}",
"keyPath": "$.TenantBoundary[0].boundary.*.name",
"valuesPath": "$.TenantBoundary[0].boundary.*.code"
},
"appliedFilterPath": "filters.locality",
"placeholder": "ES_DSS_ALL_LOCALITY_SELECTED"
},

{
"id": "PAYMENT_MODE",
"name": "ES_DSS_PAYMENT_MODE",
"type": "MultiSelectDropdown",
"source": {
"type": "list",
"list": [
{
"key": "CASH",
"value": "CASH"
},
{
"key": "CARD",
"value": "CARD"
}
{
"key": "CHEQUE",
"value": "CHEQUE"
}
],
"keyPath": "$.*.key",
"valuesPath": "$.*.value",
"sortBy": "name"
},
"appliedFilterPath": "filters.paymentMode",
"placeholder": "ES_DSS_ALL_PAYMENT_SELECTED"
}
],
"visualizations": []
}
```

```jsx
// add the following hooks to have a dynamic filter under dss ``Digit.Hooks.dss.useGetCustomFilterValues``
const useGetCustomFilterValues = (filterConfigs, config={}) => {
return useQuery(`DSS_CUSTOM_FILTER_CONFIG_${JSON.stringify(filterConfigs)}`, () => DSSService.getFiltersConfigData(filterConfigs), config);
};


const useGetCustomFilterRequestValues = (filterConfigs, config={}) => {
return useQuery(`DSS_CUSTOM_FILTER_REQUEST_VAL_${JSON.stringify(filterConfigs)}`, () => DSSService.getCustomFiltersDynamicValues(filterConfigs), config);
};
```


### Changelog

```bash
1.8.0 workbench v1.0 release
1.8.0-beta.2 republished due to some version issues
1.8.0-beta.1 fixes
1.8.0-beta workbench base version beta release
1.7.0 urban 2.9
1.6.0 urban 2.8
1.5.48 DSS fix for MUKTA fontsize of the line chart and making multilink dropdown clone on outside click
1.5.44 UI/UX Audit Fixes :: Refer PFM-4442(https://digit-discuss.atlassian.net/browse/PFM-4442)
1.5.43 Alignment fixes
1.5.39 Bug fixes = tooltip text not showing fully + Share whatsapp and email was not working
1.5.38 updated the readme content
1.5.37 Pie chart denomination and Horizontal bar white spaces fixes
1.5.36 Bug Fix::Multiple tooltips showing in Tables
1.5.35 Added the dynamic filter component
1.5.34 Count config added for Metric chart
1.5.33 Horizontal Bar and Pie chart alignment fixes
1.5.32 Percentage symbol showing in Yaxis ticker and left alignment of label for FSM Capacity Utilization
1.5.31 Horizontal Bar chart alignment fixes
1.5.30 Added enhancement for pie chart using variant flag according to new requirements. Refer CustomPieChart component.
1.5.29 DSS UI alignment fixes for Horizontal Metric and bar chart
1.5.28 added the support for the dynamic icon in the metric chart by adding flag iconName
1.5.27 Alignment fixes for Horizontal Metric Charts
1.5.26 Added a new version of horizontalBar chart, In chartConfig it makes use of this boolean key = horizontalBarv2
1.5.25 added the support for horizontal metric chart, In chartConfig it makes use of this boolean key = isHorizontalChart
1.5.24 added commonmaster module to support its localisation
1.5.23 updated the routes in the dss module to have dynamic base context path
1.5.22 updated the readme file
1.5.21 added the readme file
1.5.20 base version
```
### Contributors
[jagankumar-egov] [nipunarora-eGov] [Tulika-eGov] [Ramkrishna-egov] [nabeelmd-eGov]
## Documentation
Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui)
## Maintainer
- [jagankumar-egov](https://www.github.com/jagankumar-egov)
### Published from DIGIT Frontend
DIGIT Frontend Repo (https://github.com/egovernments/Digit-Frontend/tree/master)
![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png)
30 changes: 0 additions & 30 deletions micro-ui/web/packages/dss/docker/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions micro-ui/web/packages/dss/docker/nginx.conf

This file was deleted.

Loading

0 comments on commit 899ce30

Please sign in to comment.