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:
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 - .
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
- 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 -
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 -
A new component called KibanaCard.js
has been introduced to render Kibana DSS based on the configuration provided in dashboardConfig
. This document outlines the steps to integrate the Kibana Dashboard with the DSS module.
In the dashboardConfig
, a new configuration has been added to render Kibana DSS. The configuration includes details that specify which Kibana dashboards to render.
So here moduleName refers to the module name in uiConstants master and pageName refers to the iframe routes route information.
Based on the configuration, we render the KibanaCard
component, passing moduleName
and pageName
as props.
Within KibanaCard
, we utilize the IFrameInterface
component. This component receives the following props passed from KibanaCard.
We can define kibana dashboard URL in common-masters in uiCommonConstants.json config. Below are the examples of the structure
This component calls MDMS-V2
common-masters to fetch the URL of the Kibana dashboard and render it using an iframe.
Additionally, if a date range filter is set by the user, we update the Kibana URL to reflect this. The following logic is applied to construct the contextPath
:
API to fetch common constants
Payload:
Response:
URL:
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.
Configuration of privacy policy component on the login screen
A new feature, the Privacy Component, has been added to the login screen to enhance user transparency. This component displays privacy policy information based on the login configuration. Follow the steps below to configure this component on the login screen.
To render the Privacy Component, you must include specific configurations in the MDMS :
Master Name: commonUiConfig
Module Name: LoginConfig
If these configurations are not present, the default login configuration will be rendered instead.
The content displayed within the Privacy Component's pop-up will be filtered according to the module code
specified in the schema.
The fields on the login screen are fully configurable. Users can add or remove fields according to their specific requirements.
To ensure all mandatory fields are completed, the login button will be disabled until all required fields are filled. This ensures that users provide all necessary information before proceeding.
Here are some examples of different configurations for the login screen and their corresponding displays:
These configs will help to enable/disable the privacy declaration, at an instance level.
Screen:
Config:
Screen:
Config:
Data Customisation: The data can be modified through MDMS and localization updates. MDMS Path: Login Configuration Privacy policy schema Click here to access the privacy component file.
Localisation modules used:
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