Skip to content

Commit

Permalink
UI core mfe (#1081)
Browse files Browse the repository at this point in the history
* duplicatedthe core module

* removed the topbar and sidebar component

* added the ui module

* removed the css

* added css in index.html file to remove the topbar and sidebbar space

* added the core module

* changed the package name to ui

* Update lerna.json

* Update package.json

* Update index.js

* Create mfe-ui-docker.yml

---------

Co-authored-by: Jagankumar <[email protected]>
  • Loading branch information
hridya-egov and jagankumar-egov authored Jul 16, 2024
1 parent 2aac594 commit a9d8728
Show file tree
Hide file tree
Showing 84 changed files with 6,717 additions and 5 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/mfe-ui-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: ui service docker Image CI

on:
push:
branches: [ "develop-mfe","develop-mfe-microplan-common-pkgs","develop-mfe-campaign-microplan","build-fix-develop-mfe-campaign-microplan" ]
pull_request:
branches: [ "develop-mfe","develop-mfe-microplan-common-pkgs","develop-mfe-campaign-microplan","build-fix-develop-mfe-campaign-microplan" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for tags and branches

- name: Set up environment variables
id: env
run: |
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "ACTION_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
echo "COMMIT_ID=${GITHUB_SHA: -8}" >> $GITHUB_ENV # Extract last 8 characters of SHA
- name: Build the Docker image
id: docker_build
working-directory: ./micro-ui/web/packages/core
run: |
IMAGE_TAG=egovio/ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }}
docker build . \
--file docker/Dockerfile \
--tag $IMAGE_TAG
echo "::set-output name=image_name::$IMAGE_TAG"
- name: Login to Docker Hub and Push Docker Image
working-directory: ./micro-ui/web/packages/core
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_NAME: ${{ steps.docker_build.outputs.image_name }}
run: |
# Authenticate with Docker Hub
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# Push the image to Docker Hub
docker push $IMAGE_NAME
echo "Docker image pushed: $IMAGE_NAME"
4 changes: 3 additions & 1 deletion micro-ui/web/lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"packages/components",
"packages/svg-components",
"packages/microplan",
"packages/campaign"
"packages/campaign",
"packages/hrms",
"packages/ui"
],
"command": {
"run": {
Expand Down
6 changes: 4 additions & 2 deletions micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"packages/components",
"packages/svg-components",
"packages/microplan",
"packages/campaign"
"packages/campaign",
"packages/hrms",
"packages/ui"
],
"scripts": {
"build": "yarn lerna run build",
Expand All @@ -43,4 +45,4 @@
"dependencies": {
"dotenv": "^16.3.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const TopBarSideBar = ({
];
return (
<React.Fragment>
<TopBar
<TopBar
t={t}
stateInfo={stateInfo}
toggleSidebar={toggleSidebar}
Expand Down Expand Up @@ -75,4 +75,4 @@ const TopBarSideBar = ({
</React.Fragment>
);
};
export default TopBarSideBar;
export default TopBarSideBar;
6 changes: 6 additions & 0 deletions micro-ui/web/packages/ui/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env","@babel/preset-react"
],
"plugins": ["react-html-attrs"]
}
2 changes: 2 additions & 0 deletions micro-ui/web/packages/ui/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
63 changes: 63 additions & 0 deletions micro-ui/web/packages/ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

dist/

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# Serverless directories
.serverless/
21 changes: 21 additions & 0 deletions micro-ui/web/packages/ui/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 design-egov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions micro-ui/web/packages/ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# core
47 changes: 47 additions & 0 deletions micro-ui/web/packages/ui/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Use Node.js base image with version 16
FROM node:16 AS build

# Set working directory
WORKDIR /app

# Set build arguments
ARG BRANCH_NAME
ARG ACTION_NUMBER
ARG COMMIT_ID

# Set environment variables based on build arguments
ENV BRANCH_NAME=$BRANCH_NAME
ENV ACTION_NUMBER=$ACTION_NUMBER
ENV COMMIT_ID=$COMMIT_ID

# Copy package.json and yarn.lock (if exists)
COPY package.json ./

RUN rm -rf node_modules/

RUN rm -rf yarn.lock

# clear cache
RUN yarn cache clean

# Install dependencies
RUN yarn install

# Optionally, you can add a label with the commit ID
LABEL commit_id=$COMMIT_ID

# Copy the rest of the application
COPY . .

# Build the React app with Webpack
RUN yarn build

FROM nginx:mainline-alpine

ENV WORK_DIR=/var/web/ui-core-mfe

RUN mkdir -p ${WORK_DIR}


COPY --from=build /app/dist ${WORK_DIR}/
COPY --from=build /app/docker/nginx.conf /etc/nginx/conf.d/default.conf
12 changes: 12 additions & 0 deletions micro-ui/web/packages/ui/docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server
{
listen 80;
underscores_in_headers on;

location /ui-core-mfe
{
root /var/web;
index index.html index.htm;
try_files $uri $uri/ /ui-core-mfe/index.html;
}
}
64 changes: 64 additions & 0 deletions micro-ui/web/packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "ui",
"version": "1.0.2",
"description": "",
"main": "index.js",
"private": true,
"scripts": {
"start": "webpack serve --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"build:dev": "webpack --config webpack.dev.js",
"predeploy": "yarn build",
"deploy": "gh-pages -d dist"
},
"homepage": "http://design-egov.github.io/core",
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/preset-env": "7.23.9",
"@babel/preset-react": "7.12.10",
"autoprefixer": "^10.4.13",
"babel-loader": "8.2.2",
"babel-plugin-react-html-attrs": "^3.0.5",


"react-query-devtools": "^2.6.3",
"regex-escape": "^3.4.10",


"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "5.7.3"
},
"dependencies": {
"@digit-ui/digit-ui-components": "1.0.3",
"@digit-ui/digit-ui-libraries-mfe": "1.0.17",
"@digit-ui/digit-ui-react-components": "1.0.1",

"@rjsf/core": "5.10.0",
"@rjsf/utils": "5.10.0",
"@rjsf/validator-ajv8": "5.10.0",

"i18next": "19.9.2",
"i18next-browser-languagedetector": "^7.2.1",
"i18next-http-backend": "^2.5.1",
"i18next-react-postprocessor": "3.0.7",
"lodash.merge": "^4.6.2",
"pdfmake": "0.1.72",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.16.2",
"react-query": "3.6.1",
"react-redux": "7.2.8",
"react-router-dom": "5.3.0",
"react-tooltip": "^5.21.1",
"redux": "4.1.2",
"redux-thunk": "^2.4.2",
"rxjs": "6.6.3",
"single-spa": "^5.9.3",
"single-spa-react": "^4.6.1"
}
}
Loading

0 comments on commit a9d8728

Please sign in to comment.