Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This document will help us generate the APK for Citizen and Employee applications.
Android offers a variety of ways to present content to a user. To provide a user experience that’s consistent with the rest of the platform, it’s usually best to build a native app that incorporates framework-provided experiences, such as Android App Links or Search. Additionally, you can use Google Play-based experiences, such as App Actions and Slices, where Google Play services are available. Some apps, however, may need increased control over the UI. In this case, a WebView
is a good option for displaying trusted first-party content.
In Egov we create only responsive web apps instead of native apps (Android, IOS). The Android web view is used to render the out web application.
Open the below location in the Android studio.
Generate APK for citizen application
Go to build. Gradle file there we have created multiple environments(UAT and PROD), please select the environment where you want to generate APK and put your web application URL.
Update the web application URL as required Application URL.
buildConfigField 'String', 'url', '"https://uat.digit.org/citizen/user/register"'
also, specify the citizen gateway hostname if not using Mastercard,
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
3. Save the file on the left side of the Android studio. Click Build Variants and select the applicable build variant.
4. Click on Build menu, select Build APK(s) submenu.
It will take some time to generate and it will show generated location.
Generating APK for employee application
1. Go to build. Gradle file there we have created multiple environments (UAT and PROD), please select the environment where you want to generate APK and put your web application URL.
2. Save the file, left side of the android studio click Build variants, and select build variant.
3. Click on the build menu, and select Build APK(s) submenu.
It will take some time to generate and it will show generated location.
Follow the 3rd and 4th steps mentioned above.
Click on the Build menu and select Generate Signed Bundle / APK.
Select 1st radio button - Android App Bundle.
Enter the information presented in the form and click on Next.
Upload the APK generated by the 4th step and upload it to the play store.
DIGIT UI development guide
Post the backend development and deployment of DIGIT as per steps detailed in the Backend Developer Guide, it is time to start building the UI screens. For illustration purposes, we are going to build the citizen and employee screens for the Birth Registration module.
This guide offers a systematic view of how to create the application screens on DIGIT.
Developer code: Download the UI code from the link here Birth-Registration.
List of Pre-requisites - Before starting with the UI development, know the list of technical requirements for frontend development on DIGIT UI.
Steps to follow: The docs and resources below offer a step-by-step guide to UI development.
Run Sample Module - Once you are done with the setup, run the sample module provided in this guide. Test run the module and deploy it using CI/CD to your development environment.
Before setting up: The following tools have to be installed prior to development. Make sure to install the specific versions provided below. If no version is provided, it is assumed that the latest version can be installed.
Install Visual Studio Code. VS Code Extensions to be installed from the marketplace:
Install NodeJS 14.20.0
version 1.22.19
Install Python version 2.7
Clone the repository locally from your organization's umbrella. This contains the frontend code under the frontend folder.
To learn how to install yarn on Linux, follow .
Prior knowledge of React JS
Prior knowledge of HTML / CSS
Prior knowledge of Redux/Hooks
Prior knowledge of SCSS/React StoryBook
Prior knowledge of Git
Prior knowledge of Queries and Mutations
Knowledge of the DIGIT UI framework
Check the page to access help documents on the tools required for UI development.
Once the local setup is completed, the next step is to run the application locally. This document provides the steps on how to run the digit-ui on a local machine.
Step 1: To run the application in the local environment, add the .env
file in the example
folder -
Step 2: Copy the below content and add to the .env file. If the user is a citizen then configure the .env file as follows:-
Step 3: To run the application as citizen, then update the value of REACT_APP_USER_TYPE=CITIZEN.
Step 4: To point the frontend to different environment change the REACT_APP_GLOBAL,
and add the GlobalConfig environment file for that environment.
Update both REACT_APP_PROXY_API
and REACT_APP_PROXY_ASSETS
to the environment URL.
Step 1: To initialise the Yarn execute the below command -
Step 2: Once the yarn initialization is successful execute the below command -
Step 3: Running this command will start the application.
There are two types of login -
Employee: If you log in as an employee, the below screen is displayed.
HomePage Employee: Once the employee is logged in, users are redirected to the employee home page.
HomePage Citizen: Once the citizens are logged in successfully, users are redirected to the citizen homepage.
To learn more about global config visit .
On the home page, users can see the cards mCollect, HRMS, NOC, Property Tax, etc These cards need to be added. Refer to the instructions on the to create an employee card.
Click on the to create a card for your module on the home page under "Citizen Services".
Step 6 - Setup Monitoring Tools
Enable telemetry to trace & monitor user activity on the portal
Step 1 - Local Development Setup
The first step is to set up the development environment
Step 2 - Citizen Module Setup
Follow the steps to build and deploy the citizen module on top of DIGIT UI
Step 3 - Employee Module Setup
Follow the steps to build and deploy the employee module on top of DIGIT UI
Step 4 - Build & Deploy
Steps to build and deploy the DIGIT UI module
Step 5 - Run Application
Integrate the module with the backend service and run it in the local environment
Steps to add new screens in DIGIT-ui
This document provides the steps for creating new screens in the DIGIT-UI.
Creating a screen in DIGIT UI involve simple steps and is classified into 4 different screen -
To create any new screen of the Create type, use the FormcomposerV2 and transmit the configuration as specified in the sample.js file.
To check the different types of configurations, refer to the fieldSelector
function.
To use any view screen, create the hook for initiating API calls and structure the configurations for the View section.
Refer to the integrated screen with ApplicationDetailsTemplate - ViewProperty.js.
The hook details for the same is mentioned in useGenericViewProperty.js
The service configuration details are available in Search.js
To create any inbox screen, use the InboxComposer and add the following configurations:
Main file: EdcrInbox
Check the folder which contains other configs like filter, table, search, and mobile responsiveness.
The hook for the same is defined in useEDCRInbox.js
Use the latest InboxSearchComposer (InboxV2)
Both Inbox and Search screens can be shown based on the input configurations passed to that component - BillInbox.js
Configuration are mentioned in InboxConfig for local reference and it is fetched from the MDMS BillInboxConfig.
An example for Search screen is available in SearchConfig.
This page provides the steps to configure the FormComposer.
For complex configuration or screen details refer to documentation on Utility - preprocess
There are 3 new use cases added to the FormComposer in addition to the default one where the whole form was rendered in a single card. Those 2 are the following:
Multiple cards
Cards with navigation menu
Multiple cards with navigation menu on a single card
The following use cases are covered in the DIGIT-WORKS repo.
URL to access:/works-ui/employee/works/sampleForm
This can be done by setting the showMultipleCards
prop to the FormComposer as true. In this case, every object in the formConfig will be treated as a separate Card and will be rendered accordingly.
Access Config Link.
FormComposer provides the option to activate a navigation menu that appears on top of the card. Each link in the menu corresponds to a specific card. To enable this feature, provide an array configuration for the navigation menu as a prop to the FormComposer component. Then, map each card with a link from the navigation menu configuration array using a designated key named "navLink", associating it with a value in the Navigation Menu Config.
Access Configuration link.
This use case is the same as above. The only difference is the navLink
property in the config. If this property is present and valid for a card config, the corresponding card will be mapped to a navigation menu link. On the other hand, if navLink
is not present or invalid, the corresponding card will be rendered as a separate Card.
Multiple options can be selected.
There are two common components for workflow related actions and timeline management.
WorkflowActions -
WorkflowTimeline -
Both of these components are available on each View Screen. The WorkflowTimeline component is responsible for presenting the workflow history at the bottom of the View Screen. Similarly, the WorkflowActions component renders an action bar at the bottom of the view screens, showcasing pertinent actions based on the logged-in user's role and workflow configuration.
This component is directly integrated with the component that renders all the relevant data in view screens. WorkflowTimeline component is called in this component like this:
It expects a few props:
BusinessService -> Name of the businessService from workflow configuration
applicationNo -> Idgen generated application number
tenantId
timelineStatusPrefix -> prefix used in localisation of every checkpoint in timeline
statusAttribute -> here we can pass the attribute(either status/state) that is the key in the workflow process instance response, whichever we want to show in the checkpoint.
This component internally calls the workflow APIs to fetch the process instance of the application and renders the history accordingly. It also makes a check for the current state of the application. If the current state is not terminated state then it will show an extra checkpoint at the top with statusAttribute as status to show pending states checkpoint. If the current state is terminated state then it will not show pending states.
Refer to the below snapshots, notice they both have 4 checkpoints. Approved refers to terminate state.
This component is rendered on every View component separately to render the action bar with relevant actions.
Sample code Snapshot:
It expects a few props:
BusinessService -> Name of the businessService from workflow configuration
forcedActionPrefix -> for localization
applicationNo -> Idgen generated application number
tenantId
applicationDetails -> same data returned from hook used on view screen
Url -> update API url to hit
setStateChanged -> when update is successful this is called. Hence search apis will be called again and workflow history and workflow actions will be updated without screen refresh
moduleCode
editApplicationNumber -> Used in case of edit/modify action
This component internally calls the update apis and shows a relevant toast on success/failure or a response screen in case of edit action.
Approach to render Inbox and Search screen content based on config passed via MDMS data.
This page provides the approach details for -
rendering the Inbox screen or Search screen based on the config
calling the API dynamically based on API details passed via config
This is a container component for inbox and search screens. It consists of 4 children components which can be rendered conditionally.
Prop Name | Description |
---|
This component is used to render titles and links in the inbox.
Prop Name | Description |
---|
This component is used to render search or filter forms with ‘clear’ and ‘search’ buttons.
This component is used to render a table with searched results.
This component is used to render form fields passed in the 'fields' parameter in the config
To fetch inbox details, ‘useCustomAPIHook’ is used which takes all the API details like URL, query params, body, config etc. from config (defined in MDMS).
Create config based on the sections that need to be displayed on the screen. The basic structure for Inbox and Search screens is given below.
Based on the flag given for each section its visibility is controlled. If the ‘show’ flag is true, then the section is visible, else it is hidden.
Add API details in the top section, this API will be called via useCustomAPIHook and return the data. This consists of the below details.
Add search form config which can be used in both inbox/search screen. It consists of UIconfig containing label info, styling info, default form values, and fields which need to be rendered in the form. Refer below
Add Links config consists of link info, logo to be shown and title. Refer below
Add Filter form config which is similar to the search form. Refer below
Add Table (Search result) config consists of labels, column data and related jsonpaths to access the data passed. Refer below
To add any customisations on query params, request body, table columns or to add any custom validations in forms, related code can be added in the UICustomisations file as below
Once the above config is defined, created an index file/ Component in the pages folder. Fetch the config from MDMS and pass it to the inboxSearchComposer component as below
This approach is followed only in Inbox and Search screens currently.
Only one API can be called dynamically based on given configurations.
To use the latest Inbox search composer it has to be imported from the React components or Utilities
React components
package
Utilities:
package
This utility is designed to transform the MDMS configuration into FormComposer and InboxFormComposer configurations. Typically, every UI configuration relies on certain parameters. These parameters might include dropdown dependencies or custom classes determined at runtime based on specific logic. However, since the configuration is in JSON format stored within MDMS, direct usage of variables is not feasible. To address this requirement, we've developed a utility capable of converting this JSON into a parameter-based JSON structure.
This utility serves as an engine that accepts MDMS configurations along with dependent parameters. It then processes this data to generate a parameter-enabled configuration. This resultant configuration can be utilized by FormComposer and InboxFormComposer to render the UI elements accordingly.
Below is the method used to configure the MDMS -
Pass the JSON path of the dependent key that requires runtime updates. In the example above, the target is on “populators.options”.
Update the options at runtime based on certain logic.
Note :
Make sure to pass the JSON path in an array.
The order in which these JSON path are passed is important. Later on, this order will be used to target the respective dependent object.
Once the configuration is complete, this will be added to MDMS. So, the next thing is to pass this config and its dependencies to the Pre-Process utility. The Namespace to access this utility :
The dependency Object contains multiple actions which the pre-process function runs for us.
Translate - This targets the JSON path and does translation for the passed data.
updateDependent - This targets the JSON path and update the dependencies.
convertStringToRegex - This targets the JSON path and converts the String RegEx to RegExp based Regex.
Refer to the sample example below -
In the example above, we are using the action “updatedependent” from pre-process utility.
“Key” targets the input key name. This will help preprocess to target the right input field.
“Value” - Each input within the configuration is associated with a JSON path, with each path targeting a dependent object. As previously demonstrated, we passed the JSON in a specific order within an array. Similarly, we must pass the corresponding dependent values in the same order to ensure alignment with the correct targets.
Note: Ensure that the preprocessing call is optimized for performance. It should only be invoked when there is a change in the dependent values. As our dependent values are component states, the preprocessing should occur whenever the state changes, triggering a re-render of the component. To mitigate potential over-iterations, we employ useMemo to cache the result, ensuring efficient processing and minimizing unnecessary recalculations.
A similar utility is also developed for InboxSearchComposer. Refer to this same document for both utilities.
UI configuration for the application
This page provides details about the Digit UI configuration required to enable it in any environment
eGov recommends before developing on top of DIGIT. This ensures that new modules can be developed and deployed in a streamlined way. DIGIT ships with CI as code as part of the DevOps repository. Please run the prior to developing on DIGIT.
Step 1: Add entry in build-config.yaml file in the master branch of the forked repository. This will set up the job pipeline in Jenkins. Make sure to also add the same config to the feature branch you are working on. Refer
Add the below content for digit-ui.
Step 2: Go to the Jenkins build the page, select "Job Builder" and click on "Build now". This will pull the config from build_config.yaml and identify all modules that need to be built.
Step 3: Once the build is done, go to your Jenkins build page. The service will appear under the repository path in which it has been added, i.e. if the service is added under frontend, it will show up in the frontend section as below,
Step 2: Deploy-as-code/helm/charts/frontend/digit-ui
Step 1: Locate the following "deploy-as-code/helm/environments/works-dev.yaml" i
n the DevOps repository of your organization.
Step 2: Add the below code block within the environment YAML file used to deploy the Works platform -
This section contains the configuration that is applicable globally to all UI modules. These need to be configured prior to the configuration of service-specific UI.
Create a config file (globalconfigs.js) with the below-mentioned config (refer code below).
Configure all the images/logo required in the S3 and add links as footerBWLogoURL , footerLogoURL.
Mention the state tenant ID as stateTenantId.
If any User roles have to be made invalid add as invalidEmployeeRoles.
Then push this global config file into your S3 bucket as globalconfigs.js
The S3 bucket has to be configured by the DevOps team, to store all the assets being used in the Application like Logos, globalConfigs, etc.
Steps to create a new AWS Bucket -
Create a new AWS S3 Bucket
Update the Bucket Policy with the following content, to make the bucket public
Update the Cross-Origin Resource Sharing (CORS) configuration with the following content
To proxy the same bucket in any environment and make the necessary changes in the environment.yaml
file located in the DevOps repository's configmaps
under egov-config
, follow the steps below:
Add the s3-assets-bucket: "pg-egov-assets"
After adding the proxy in the enironment file, restart the s3-proxy
build in the environment with config enabled.
Key components of DIGIT-UI
This page provides the architecture and key features of the DIGIT UI. Click on the broader headings below to find the details.
Broadly, the DIGIT UI frontend components are categorized as below:
The first line contains the Architecture Component name or info
The second line has npm-package and in the bracket there is a template based on which the component will be created.
Easy-to-use CLI
Handles all modern JS features
Bundles commonjs
and es
module formats
Supports complicated peer-dependencies
Supports CSS modules
The templates have the following folder structure: The components related to the template are inside the src
folder of the template and an example is created to use and showcase the app created by the template.
We have two main React Apps:
micro-ui-internals
Meant for the eGov development team to build components and default modules.
Contains the following modules:
CSS Library
UI Components (presently react-components
)
Utils Library: Contains Services, Localization handling and React Hooks.
UI Modules
Core - containing login, routing and global state.
PGR
FSM
PT
Payment
etc ...
micro-ui
Meant for the state team to manage, make changes, and deploy
Import digit-ui-internals
modules
Customizations
View
Services
Build and deploy scripts
Dockerfile & nginx.conf
build-config.yaml
The CSS Library contains all the classes both in the module and compiled form.
This can be imported using import "@egovernments/digit-ui.css/Button"
or full CSS import using import "@egovernments/digit-ui.css"
Component Library contains a set of all the required components defined in them.
These contain the following:
Localization workflows
API handling - API caching and handling strategies will be here, imported, and shared by all modules. Published as a function, can be used by anyone.
Localisation
The module will function as a closed system for the states, limiting their access to node_modules or CDNs only. Any components specific to a state can be provided during the module's initialization within the employee or citizen application's state.
Below is an illustration of how the modules structure looks like:
Modules contain the following inbuilt
Theme - this may change if we later decide to use any css-in-js
library, like styled-components
.
Components
Routes
State management
Business logic
API integrations
The app imports the developed module.
In the next phase, the Employee and Citizen app can be rewritten as a single app with the role and permissions-based rendering.
Steps to build a citizen portal for a module
This section of the guide enables developers to create their own front-end citizen module from scratch which they can deploy on top of DIGIT UI. The new module will be visible as a "card" in the DIGIT citizen portal.
Steps to build the citizen portal for a module
This guide provides examples and illustrations on how to set up and integrate the most commonly used DIGIT UI libraries.
Refer to the sample screens .
Screenshots of employee and citizen modules
A significant part of this component is another component called the . This is the popup that renders whenever the user clicks on a specific action. This popup is fully configurable through this configuration file . Popup configs are defined in this configuration file which are organised as per the businessService of the workflow configuration. Refer to the configMap object in this file for more details.
Prop Name | Description |
---|
Prop Name | Description |
---|
Prop Name | Description |
---|
To know more about and process visit
Step 1: Add an entry in the helm chart of the frontend directory in the master branch of the forked repository.
Step 3: Modify the development environment as per requirements.
Mention the globalconfig file URL into your .
for example usage and local dev for React-based libraries
for bundling
for transpiling
configs | Config fetched from MDMS data |
headerText | Config fetched from MDMS data |
links | Links to navigate to other screens |
customClass | Class to update styling |
logoIcon | Icon name and class to render in component |
uiConfig | Config to render search/filter form |
header | Title of form |
screenType | Type of parent screen, can be either ‘inbox’ or ‘search’ |
fullConfig | Entire config of screen which also includes API details |
config | Config to render table |
data | Search results need to be populated in table |
isLoading | Flag to pass to handle loading state |
isFetching | Flag to pass to handle loading state |
fullConfig | Entire config of screen which also includes API details |
fields | Config to render all form fields |
control, formData, errors, register, setValue, getValues, setError, clearErrors | Props to handle all form actions like collectibe data, setting errors, clearing errors etc. |
apiDetails | Includes all API details required to fetch data |
Customisation options for DIGIT UI
This document provides the customisation details for DIGIT UI. Customisation can be classified broadly into two types -
Overriding the Component/Hooks/CSS
Overwriting the required changes directly into the Micro-ui-internals
Overriding involves making all customization changes exclusively within the micro-ui/web directory.
Within the custom CSS module, define customized CSS using the same class name or ID. Afterward, publish the changes. Ensure to reference this custom CSS file in the index.html to reflect the modifications on the website.
For overriding any components, re-register the same component in the same name in the customization folder. The latest changes are reflected.
Overwriting involves directly modifying the micro-ui-internals directory. This is slightly more challenging method to incorporate changes. Make sure the docker file is updated as per the code below and includes the install-deps.sh script.
The workspace in the web/package.json should be updated as below:
Once the project structure is ready, it is time to install and configure the module dependencies in the Master Data Management Service (MDMS). Follow the steps below to finalise these.
Enable the module in citymodule.json
before creating a new module. A sample module is available for reference here: citymodule.json.
For the purpose of illustration here, add the following module (birth registration) as given below:
Register the birth registration UI module in three places so that it will be available to the developer at runtime as well as at the time of deployment. Below are the three places where the module needs to be registered:
micro-ui/web/micro-ui-internals/package.json
micro-ui/web/micro-ui-internals/example/package.json
micro-ui/web/micro-ui-internalsWeb/package.json
Micro-ui-internals:- Open the micro-ui-internals package.json file and add this module as a dependency.
In the example/package.json, add the following line:
In the web/package.json, add the following line:
DIGIT comes with common re-usable libraries that can be imported for use in a new module. This page provides the steps on importing the required components.
CSS , libraries , common , react components can be imported by adding into package.json.
Common components live in micro-ui/web/micro-ui-internals/packages/react-components
micro-ui/web/micro-ui-internals/packages/css
DIGIT components that we are reusing -
FormComposer
ActionBar
Banner
Card
CardText
Loader
SubmitBar
AppContainer
BackButton
PrivateRoute
Icons
CitizenHomecard
Front-end module project structure
This is the first step towards the setup of the citizen module. Follow the steps given below to create the project structure.
Download the UI code from the link here Birth-Registration. Follow the steps detailed below.
Steps to integrate external UI with DIGIT UI
This document provides the steps on how to integrate another UI into the DIGIT UI using iframe.
Enable the Utilities module.
Once the Utilities module is enabled, add the following changes to the master (file path given below).
Reference Master details: data/pg/commonmasters/uiCommonConstants.json
Here -
shg is the path name to access inside digit-ui;
home is the route to access it;
whatever is mentioned inside routePath should be the Application/Pod name that is expected to be shown inside the digit-ui;
Once the MDMS changes are applied, access the new application using the following route - <SERVER_URL>/digit-ui/employee/utilities/iframe/<PATH_NAME>/<ROUTE_NAME>
Examples: New Web Application (UI - any framework)
DIGIT UI
This page explores the steps to publish CSS if there are any CSS Customization/changes. While customising, if any changes are made In the CSS folder it has to be compiled and published to npm.
Currently, the CSS is published in npm as @egovernments/digit-ui-css
Refer to the NPM link here - digit-ui-css.
So any changes to the CSS folder locally must be published in different organisations and in the same or different package name. For example - @xyz/digit-ui-css and version 1.0.0 then the following changes have to be made in the code to reflect in the digit-ui
index.html - file location
frontend/micro-ui/web/public/index.html
The style sheet link must be updated as follows,
<link rel="stylesheet" href="https://unpkg.com/@xyz/digit-ui-css@1.0.0/dist/index.css"/>
Use either of the following commands to publish the CSS
In the frontend/micro-ui/web/micro-ui-internals
folder run yarn run publish:css
or
In the frontend/micro-ui/web/micro-ui-internals/packages/css
folder run yarn run publish --access public
There are two ways to customize the CSS -
Override the required CSS only without changing in the CSS folder and making changes only in the custom CSS folder. Both CSS will be present in the index.html the order of the package mentioned in the HTML determines which CSS needs to be taken ie the box mentioned in the last will have more precedence. example of overriding CSS as follow - index.html
Overwrite the complete existing CSS.
Note: If there is overwriting of the complete CSS, future upgrades will need manual work to take the upgrade/difference changes.
Reference doc for publishing any package to npm -
Employee view of the module
Now that we are done with setting up the citizen module, the next step is to build the employee portal on top of the DIGIT UI for the Birth Registration module. The employee portal is designed to support multiple workflows like verifying the information and approving or rejecting the registered details of citizens.
How to build the employee portal for a module?
This guide provides examples and illustrations on how to set up and integrate the most commonly used DIGIT UI libraries.
Refer to the sample screens .
All content on this website by is licensed under a .
Building and deploying the digit-ui module
Follow the instructions to set up the job pipeline. Ignore the steps not applicable to the frontend.
Instructions here are provided assuming CD/CI has been set up using the DIGIT ci-as-code module.
All content on this website by is licensed under a .
This page provides details about how the Banner image and Citizen Services Card are rendered.
The link to banner images and the labels and links of citizen services on the citizen services card are defined in the below MDMS file.
egov-mdms-data/data/pb/common-masters/uiHomePage.json at DEV · egovernments/egov-mdms-data
For mobile and desktop we have different banner images link. We can change the images link on the below object
Here we have two objects citizenServicesCard
and informationAndUpdatesCard
. Both of them have sideOption
object which is a link to View All page.
props
object contains the objects that we want to show on these two cards.
Change the label of the cards and add the navigation URL for each prop. Click on the card redirects users to the respective screen.
Similar to Banner image, for WhatsApp Banner Image, we have two objects for mobile and desktop view. On click of the image it will redirect to WhatsApp bot. The redirection URL is defined in the navigation URL param.
Multiple options can be selected.
Details about how the module cards are rendered in the Citizen Home screen and how to add a new Card.
All the modules that are enabled are defined in this file
DIGIT-Dev/frontend/micro-ui/web/micro-ui-internals/example/src/index.js
This array contains a list of modules that are enabled in DIGIT-UI. This array is passed down to DigitUIWrapper Component defined here: frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/Module.js. Here this array is passed down to this hook:
Now initData.modules will be containing an array of modules containing the following details about each module. Example object is shown here as PT module:
This array is further passed down to the CitizenHome component present in the file
frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Home.js
This component will render a CitizenHomeCard component for every module that is present in the passed-down array of modules according to some conditions that are explained below.
As you can see in the home screen of Citizen, every module card has some links for it. Details of those links is stored in MDMS so that it becomes configurable. In the UI those details are fetched and accordingly module cards are rendered with the information fetched from the MDMS.
This module card data is stored in this file data/pb/ACCESSCONTROL-ACTIONS-TEST/actions-test.json. The format of the link data is described in such a way that every link object will have these key properties among others:
url → every link in the citizen side has this property set to “digit-ui-card”. It is used to filter all the links that belong to Citizen side
parentModule → describes to which module this link belongs
navigationURL → describes the destination url
In the UI this above mentioned data is fetched using this hook which calls this API egov-mdms-service/v1/_search
.
This hook call is made in this file frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/index.js
After some processing in the UI this linkData will be an array in which every key will be module name and its value would be an object containing the links array and iconName and module Header, it will look like this:
Using this data every card along with it’s icon, header and links will be rendered in Citizen Home.
This rendering is done in this component frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Home.js using CitizenHomeCard component.
Icon Configuration / Naming Convention
Every module icon is stored as an svg component in this file svgindex.js. Name of every svg component follows a common format which is the name of the module followed by Icon string. For instance, PTIcon is the icon name for PT module. This icon name details are also stored in the MDMS file, which is used to display appropriate icons on the module cards.
Now that we are aware of how the module cards are rendered with their respective data , let’s discuss how to add a new module Card.
To add a new module card , we need to add the name of the module in the list of enabled modules. The details of this module will be fetched using this same hook as explained above:
const { isLoading, data: initData } = Digit.Hooks.useInitStore(stateCode, enabledModules);
By doing this a new module card will be rendered but it’s header, links, and icon will not be rendered because we need to add this data in the MDMS. We need to add this data in this file as explained above actions-test.json and accordingly add matching ids in this file roleactions.json with rolecode property set to ‘CITIZEN’
Sample actions-test and roleactions object
Sample actions-test object
Sample roleactions Object
Multiple options can be selected.
Required setup things? i) Install Vs Code -
VS Code Extension -
ii) Install Node JS -
iii) Install Postman - Postman is the tool we use to hit and test the APIs exposed by various services that we have. To install postman, follow the following links -
2) How to install Yarn?
Install Yarn -
3) How To add Globalconfig in Digit UI Environment?
Local Environment: To enable it into local development we need to add the javascript code block of globalconfig.js into the index.html
Path:- micro-ui/web/public/index.html
Link:- https://github.com/egovernments/DIGIT-Dev/blob/master/frontend/micro-ui/web/public/index.html
Script:-
Dev Environment: To enable it in the dev environment we need to add the javascript code block of telemetry into the Path:- DIGIT-DevOps/deploy-as-code/helm/environments/dev.yam
Link:- https://github.com/egovernments/DIGIT-Dev/blob/master/frontend/micro-ui/web/public/index.html
4) How to Register New Module in Digit UI? Creating config into mdms:-
If you are creating a new module then, first we need to enable that module as true in citymodule.json and update the Module in citymodule.json.
Suppose your module name is BR(Birth-Registration) then change the module and code as BR. and update the citymodule.json file. or
Install Dependency 5) In Digit UI Where do we need to add the .env file? Add the .env file in the example folder -
If the User is a citizen then we will configure the .env file as follow:-
If the User is an Employee then we configure the .env as follows:-
6) In Digit UI Where do we need to add the .env file when we run the react app from micro-ui/web?
Add the .env file in the micro-ui/web/src/
Steps to debug
This page provides the steps to debug the android application using a chrome browser.
Connect your android device to the system.
Go to developer mode in the mobile device and enable USB debugging.
Open the Chrome browser and navigate to the URL chrome://inspect
The browser shows the list of devices connected to the system.
Select the mSeva application and click on inspect.
This opens a new window. Here we can see the mobile preview and the developer tool.
Start debugging the application as we have done in normal web applications.
This page provides the steps to resolve issues using the network tab on the browser.
While using the application or while performing some action if something fails we get generic error messages on the UI.
Such as - Something went wrong / Please try again or contact support.
Despite trying again, the same error message pops back up. What else could go wrong? The Network tab enables us to see more information about the Error.
To fetch more information in context to the error message -
Inspect the Page - On the page with the error message, right-click the page and choose Inspect in the dropdown menu.
Select the Network Tab - The browser’s network tab is a way to look directly at what’s happening behind the scenes of a page. It shows us not only the type of data being requested and passed as we interact with the page, but it also let's know if there are any actions that are failing. After selecting Inspect, a new window will appear. In this new window, click the Network tab. Then, select the XHR filter option. This will hide everything except API requests.
Refresh the Page - Click the Refresh button in your browser. Since the Network tab will only show us the requests that occur after the tab has been opened, we’ll need to refresh the page so that we can view the error as it occurs. As the page reloads, you’ll see various API requests populate the panel.
Re-create the Error - In order to understand what’s causing our error, we’ll first need to go through the same steps we took to get the error so that we can watch the request happen in real-time. In this case, to recreate the error we’ll click Update again. By re-creating the error, we’ll see exactly which request is causing the issue.
Find the Red-Line Item in the Network Panel - This is the error that occurs when clicking Update. The status is 400, which is the error code for “bad request.” Everything else has the status 200, which is the code for “OK,” meaning nothing went wrong for those other requests.
Preview the Error Details - Click the red-line item to see the error details. Clicking that line item will open a new frame on the right-hand side, and in this frame, you’ll see a few tabs: Headers, Preview, Response, Cookies, and Timing. In this case, stick with Preview since this contains the basic information.
View the Error Message - While in some cases you won’t see a specific message here, in this case, you’ll see the following:
Thanks to the network panel, you were able to take a look under the hood, diagnose the issue, and put a fix in place.
Writing citizen module logic
Monitor and trace user activity
To monitor and trace user activity on the client side, we need to enable telemetry in the local or development environment.
Whichever environment file has been used to deploy DIGIT, please make sure the above code blocks are added to the file. Dev has been used here as an example. This can differ based on the environment.
Redeploy the citizen, employee, and digit-ui modules using Helm. For example, to redeploy the citizen module, identify the docker image ID from the product release charts.
/DIGIT-DevOps/config-as-code/product-release-charts/DIGIT/dependancy_chart-digit-<version>.yaml
If you have deployed DIGIT v2.6, use the 2.6 release chart. If 2.7, use the 2.7 release chart. Search for the docker image ID of the citizen, employee and digit-UI modules and copy those.
Then, run the following commands to redeploy the citizen module with the updated variables in the environment file. This will replace the new values during deployment and configure it appropriately:
Repeat this exercise for the employee module. Redeploy the digit-ui module based on the instructions here. Once the deployment is successful, we can track it into the Network tab by filter telemetry.
__All content on this website by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
Before starting with Employee Module Code, make sure you have set up the Project Structure, installed dependencies and imported the required components.
This section will walk you through the code that needs to be developed for the application. Detailed user screen wireframes should be available at this point for development.
__All content on this website by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
__All content on this website by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
__All content on this website by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.