-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE/HCMPRE-1852 :: Consolidated Common UI (#2120)
* added change for common * Updated the readme content * revert * added build configs * Update buildCommonConsole.yml * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ea55874
commit 50641c7
Showing
10 changed files
with
465 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Blank Common Console Workflow | ||
on: | ||
push: | ||
branches: ['*'] # Trigger on any branch | ||
paths: | ||
- 'health/micro-ui/web/console/**' | ||
workflow_dispatch: # Enable manual triggering with inputs | ||
inputs: | ||
folder_name: | ||
description: 'Specify the folder for Docker build (default: console)' | ||
required: false | ||
default: 'console' | ||
|
||
jobs: | ||
docker_image-build: | ||
outputs: | ||
run_job_digit_ui: ${{ steps.check_files.outputs.run_job_digit_ui }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Setup Docker | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Check modified files | ||
id: check_files | ||
run: | | ||
echo "=============== List modified files ===============" | ||
git diff --name-only HEAD^ HEAD | ||
echo "========== Check paths of modified files ==========" | ||
git diff --name-only HEAD^ HEAD > files.txt | ||
run_job_digit_ui=false | ||
while IFS= read -r file | ||
do | ||
if [[ $file == health/micro-ui/* ]]; then | ||
echo "This modified file is under the 'digit_ui' folder." | ||
run_job_digit_ui=true | ||
fi | ||
done < files.txt | ||
# Set the output based on whether the job should run | ||
echo "::set-output name=run_job_digit_ui::$run_job_digit_ui" | ||
echo "ACTION_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | ||
echo "COMMIT_ID=${GITHUB_SHA: -8}" >> $GITHUB_ENV # Extract last 8 characters of SHA | ||
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | ||
- name: Login to egovio Docker Container Registry | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
run: | | ||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
- name: Build and Push Docker images for digit-ui | ||
if: ${{ steps.check_files.outputs.run_job_digit_ui == 'true' }} | ||
run: | | ||
# Use input folder name or default | ||
DOCKER_IMAGE_VARIANT=${{ github.event.inputs.folder_name || 'console' }} | ||
echo "Original folder for Docker build: $DOCKER_IMAGE_VARIANT" | ||
# Remove '-ui' if it exists in the folder name | ||
SANITIZED_FOLDER=${ORIGINAL_FOLDER//-ui/} | ||
echo "Sanitized folder for Docker build: $SANITIZED_FOLDER" | ||
IMAGE_NAME_1=$DOCKER_IMAGE_VARIANT:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} | ||
docker build -t $IMAGE_NAME_1 -f $SANITIZED_FOLDER/dockerfile . & | ||
# Wait for the build to complete | ||
wait | ||
# Tag and push Docker image | ||
docker tag $IMAGE_NAME_1 egovio/$IMAGE_NAME_1 | ||
docker push egovio/$IMAGE_NAME_1 | ||
# Set outputs for the summary | ||
echo "IMAGE_NAME_1=egovio/$IMAGE_NAME_1" >> $GITHUB_ENV | ||
working-directory: health/micro-ui | ||
|
||
- name: Display Docker images in Actions tab | ||
if: ${{ steps.check_files.outputs.run_job_digit_ui == 'true' }} | ||
run: | | ||
echo "First Docker image: ${{ env.IMAGE_NAME_1 }}" | ||
echo "::set-output name=first_image::$IMAGE_NAME_1" | ||
- name: Show Docker images in job summary | ||
if: ${{ steps.check_files.outputs.run_job_digit_ui == 'true' }} | ||
run: | | ||
echo "## Docker images built and pushed:" >> $GITHUB_STEP_SUMMARY | ||
echo "- ${{ env.IMAGE_NAME_1 }}" >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* The above code initializes various Digit UI modules and components, sets up customizations, and | ||
* renders the DigitUI component based on the enabled modules and state code. | ||
* @returns The `App` component is being returned, which renders the `DigitUI` component with the | ||
* specified props such as `stateCode`, `enabledModules`, `moduleReducers`, and `defaultLanding`. The | ||
* `DigitUI` component is responsible for rendering the UI based on the provided configuration and | ||
* modules. | ||
*/ | ||
import React from "react"; | ||
import { initLibraries } from "@egovernments/digit-ui-libraries"; | ||
import { DigitUI } from "@egovernments/digit-ui-module-core"; | ||
// import { initHRMSComponents } from "@egovernments/digit-ui-module-hrms"; | ||
import { UICustomizations } from "./Customisations/UICustomizations"; | ||
import { initWorkbenchComponents } from "@egovernments/digit-ui-module-workbench"; | ||
import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; | ||
import { initWorkbenchHCMComponents } from "@egovernments/digit-ui-module-hcmworkbench"; | ||
import { initCampaignComponents } from "@egovernments/digit-ui-module-campaign-manager" | ||
|
||
window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); | ||
|
||
const enabledModules = [ | ||
"DSS", | ||
"NDSS", | ||
"Utilities", | ||
// "HRMS", | ||
"Engagement", | ||
"Workbench", | ||
"HCMWORKBENCH", | ||
"Campaign" | ||
]; | ||
|
||
const moduleReducers = (initData) => ({ | ||
initData, | ||
}); | ||
|
||
const initDigitUI = () => { | ||
window.Digit.ComponentRegistryService.setupRegistry({}); | ||
window.Digit.Customizations = { | ||
PGR: {}, | ||
commonUiConfig: UICustomizations, | ||
}; | ||
// initHRMSComponents(); | ||
initUtilitiesComponents(); | ||
initWorkbenchComponents(); | ||
initWorkbenchHCMComponents(); | ||
initCampaignComponents(); | ||
|
||
}; | ||
|
||
initLibraries().then(() => { | ||
initDigitUI(); | ||
}); | ||
|
||
function App() { | ||
window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); | ||
const stateCode = | ||
window.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID") || | ||
process.env.REACT_APP_STATE_LEVEL_TENANT_ID; | ||
if (!stateCode) { | ||
return <h1>stateCode is not defined</h1>; | ||
} | ||
return ( | ||
<DigitUI | ||
stateCode={stateCode} | ||
enabledModules={enabledModules} | ||
moduleReducers={moduleReducers} | ||
defaultLanding="employee" | ||
/> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM egovio/alpine-node-builder-14:yarn AS build | ||
#FROM ghcr.io/egovernments/alpine-node-builder-14:yarn AS build | ||
RUN apk update && apk upgrade | ||
RUN apk add --no-cache git>2.30.0 | ||
ARG WORK_DIR | ||
WORKDIR /app | ||
ENV NODE_OPTIONS "--max-old-space-size=4792" | ||
|
||
COPY ${WORK_DIR} . | ||
RUN ls -lah | ||
|
||
#RUN node web/envs.js | ||
RUN cd web/ \ | ||
&& node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))' \ | ||
&& node -e 'console.log("health-console only")' \ | ||
&& cd console/ \ | ||
&& chmod +x ./install-deps.sh \ | ||
&& ./install-deps.sh \ | ||
&& cd ../ \ | ||
&& yarn install \ | ||
&& yarn build:webpack | ||
|
||
FROM nginx:mainline-alpine | ||
#FROM ghcr.io/egovernments/nginx:mainline-alpine | ||
ENV WORK_DIR=/var/web/console | ||
|
||
RUN mkdir -p ${WORK_DIR} | ||
|
||
COPY --from=build /app/web/build ${WORK_DIR}/ | ||
COPY --from=build /app/web/console/nginx.conf /etc/nginx/conf.d/default.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
BRANCH="$(git branch --show-current)" | ||
|
||
echo "Main Branch: $BRANCH" | ||
|
||
INTERNALS="micro-ui-internals" | ||
cd .. | ||
|
||
cp console/App.js src | ||
cp console/package.json package.json | ||
cp console/webpack.config.js webpack.config.js | ||
cp console/inter-package.json $INTERNALS/package.json | ||
|
||
cp $INTERNALS/example/src/UICustomizations.js src/Customisations | ||
|
||
echo "UI :: console " && echo "Branch: $(git branch --show-current)" && echo "$(git log -1 --pretty=%B)" && echo "installing packages" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "egovernments", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"workspaces": [ | ||
"packages/modules/campaign-manager" | ||
], | ||
"author": "JaganKumar <[email protected]>", | ||
"license": "MIT", | ||
"private": true, | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"scripts": { | ||
"start": "SKIP_PREFLIGHT_CHECK=true run-s build start:dev", | ||
"sprint": "SKIP_PREFLIGHT_CHECK=true run-s start:script", | ||
"start:dev": "run-p dev:**", | ||
"start:script": "./scripts/create.sh", | ||
"dev:css": "cd packages/css && yarn start", | ||
"publish:css": "cd packages/css && yarn publish --access public", | ||
"dev:example": "cd example && yarn start", | ||
"dev:campaign": "cd packages/modules/campaign-manager && yarn start", | ||
"build": "run-p build:**", | ||
"build:campaign": "cd packages/modules/campaign-manager && yarn build", | ||
"deploy:jenkins": "./scripts/jenkins.sh", | ||
"clean": "rm -rf node_modules" | ||
}, | ||
"resolutions": { | ||
"**/@babel/runtime": "7.20.1", | ||
"**/@babel/traverse":"7.25.9", | ||
"**/babel-preset-react-app": "10.0.0", | ||
"**/@jridgewell/gen-mapping": "0.3.5", | ||
"**/ajv": "8.11.2", | ||
"fast-uri":"2.1.0" | ||
}, | ||
"devDependencies": { | ||
"husky": "7.0.4", | ||
"lint-staged": "12.3.7", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.1.2" | ||
}, | ||
"husky": {}, | ||
"lint-staged": { | ||
"*.{js,css,md}": "prettier --write" | ||
}, | ||
"dependencies": { | ||
"lodash": "4.17.21", | ||
"microbundle-crl": "0.13.11", | ||
"@egovernments/digit-ui-react-components": "1.8.2-beta.18", | ||
"@egovernments/digit-ui-components": "0.0.2-beta.1", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"react-hook-form": "6.15.8", | ||
"react-i18next": "11.16.2", | ||
"react-query": "3.6.1", | ||
"react-router-dom": "5.3.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
server | ||
{ | ||
listen 80; | ||
underscores_in_headers on; | ||
|
||
location /console | ||
{ | ||
root /var/web; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /console/index.html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"name": "micro-ui", | ||
"version": "1.0.0", | ||
"author": "Jagankumar <[email protected]>", | ||
"license": "MIT", | ||
"private": true, | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"workspaces": [ | ||
"micro-ui-internals/packages/modules/campaign-manager" | ||
], | ||
"homepage": "/console", | ||
"dependencies": { | ||
"@egovernments/digit-ui-libraries": "1.8.6", | ||
"@egovernments/digit-ui-module-workbench": "1.0.11", | ||
"@egovernments/digit-ui-module-core": "1.8.14", | ||
"@egovernments/digit-ui-module-utilities": "1.0.10", | ||
"@egovernments/digit-ui-components": "0.0.2-beta.58", | ||
"@egovernments/digit-ui-react-components": "1.8.12", | ||
"@egovernments/digit-ui-module-hcmworkbench":"0.1.0", | ||
"@egovernments/digit-ui-module-campaign-manager": "0.3.0", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"jsonpath": "^1.1.1", | ||
"react-router-dom": "5.3.0", | ||
"react-scripts": "4.0.1", | ||
"web-vitals": "1.1.2", | ||
"terser-brunch": "^4.1.0", | ||
"react-hook-form": "6.15.8", | ||
"react-i18next": "11.16.2", | ||
"react-query": "3.6.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-proposal-private-property-in-object": "7.21.0", | ||
"http-proxy-middleware": "1.3.1", | ||
"lodash": "4.17.21", | ||
"microbundle-crl": "0.13.11", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"react-hook-form": "6.15.8", | ||
"react-i18next": "11.16.2", | ||
"react-query": "3.6.1", | ||
"react-router-dom": "5.3.0", | ||
"husky": "7.0.4", | ||
"lint-staged": "12.3.7", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.1.2", | ||
"file-loader": "6.2.0", | ||
"css-loader": "5.2.6", | ||
"style-loader": "2.0.0", | ||
"babel-loader": "8.1.0", | ||
"webpack-cli": "4.10.0", | ||
"clean-webpack-plugin": "4.0.0" | ||
}, | ||
"resolutions": { | ||
"**/babel-loader": "8.2.2", | ||
"**/@babel/core": "7.14.0", | ||
"**/@babel/traverse": "7.25.9", | ||
"**/@babel/preset-env": "7.14.0", | ||
"**/styled-components": "5.0.0", | ||
"**/@babel/plugin-transform-modules-commonjs": "7.14.0", | ||
"**/@jridgewell/gen-mapping": "0.3.5", | ||
"**/polished": "4.2.2", | ||
"fast-uri": "2.1.0" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "GENERATE_SOURCEMAP=false SKIP_PREFLIGHT_CHECK=true react-scripts build", | ||
"build:prepare": "./build.sh", | ||
"build:libraries": "cd micro-ui-internals && yarn build", | ||
"build:prod": "webpack --mode production", | ||
"build:webpack": "yarn build:libraries &&cd .. && ls && cd ./web && ls && yarn build:prod", | ||
"clean": "rm -rf node_modules" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
} |
Oops, something went wrong.