Skip to content

Commit

Permalink
Added Engagement Module
Browse files Browse the repository at this point in the history
  • Loading branch information
nipunarora-eGov committed Mar 22, 2024
1 parent 6bbc50a commit b5b6e32
Show file tree
Hide file tree
Showing 135 changed files with 10,099 additions and 8 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/mfe-engagement-ui-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: engagement ui service docker Image CI

on:
push:
branches: [ "mf-build-docker", "mf","mf-stable-common-module" ]
pull_request:
branches: [ "mf-build" ]

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/engagement
run: |
IMAGE_TAG=egovio/engagement-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/engagement
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"
3 changes: 2 additions & 1 deletion micro-ui/web/lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"packages/pgr",
"packages/dss",
"packages/hrms",
"packages/ui-libraries"
"packages/ui-libraries",
"packages/engagement"
],
"command": {
"run": {
Expand Down
3 changes: 2 additions & 1 deletion micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"packages/pgr",
"packages/dss",
"packages/hrms",
"packages/ui-libraries"
"packages/ui-libraries",
"packages/engagement"
],
"scripts": {
"build": "yarn lerna run build",
Expand Down
11 changes: 11 additions & 0 deletions micro-ui/web/packages/core/src/modules/registerRemotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ export default (queryClient) => {
},
});

registerApplication({
name: "Engagement",
app: () => import("engagement/EngagementModule"),
activeWhen: `/${window.contextPath ? window.contextPath : "core-digit-ui"}/employee/engagement`,
customProps: {
title: "Engagement is running on host",
queryClient,
userType
},
});

start();
}

7 changes: 1 addition & 6 deletions micro-ui/web/packages/core/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,12 @@ module.exports = () => {
new ModuleFederationPlugin({
name: "core",
remotes: {
// landing: "landing@http://localhost:8081/remoteEntry.js",
// auth: "auth@http://localhost:8082/remoteEntry.js",
// header: "header@http://localhost:8083/remoteEntry.js",
// dashboard: "dashboard@http://localhost:8084/remoteEntry.js",
hrms: "hrms@https://localhost:8085/remoteEntry.js",
workbench: "workbench@https://localhost:8086/remoteEntry.js",
common:"common@https://localhost:8090/remoteEntry.js",
pgr:"pgr@https://localhost:8087/remoteEntry.js",
// app1: "app1@https://localhost:8001/remoteEntry.js",
dss: "dss@https://localhost:8088/remoteEntry.js",
// measurement : "measurement@https://localhost:8088/remoteEntry.js"
engagement: "engagement@https://localhost:8091/remoteEntry.js",
},
shared: packageJson.dependencies,
}),
Expand Down
1 change: 1 addition & 0 deletions micro-ui/web/packages/core/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = () => {
pgr: `pgr@${domain}/pgr-ui/remoteEntry.js`,
workbench : `workbench@${domain}/workbench-mfe/remoteEntry.js`,
dss : `dss@${domain}/dss-ui/remoteEntry.js`,
engagement : `engagement@${domain}/engagement-ui/remoteEntry.js`,
// measurement : `measurement@${domain}/measurement/remoteEntry.js`
},
shared: packageJson.dependencies,
Expand Down
6 changes: 6 additions & 0 deletions micro-ui/web/packages/engagement/.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"]
}
81 changes: 81 additions & 0 deletions micro-ui/web/packages/engagement/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@


# digit-ui-module-engagement

## Install

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

## 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-engagement":"^1.5.0",
```

then navigate to App.js

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


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

import { initEngagementComponents } from "@egovernments/digit-ui-module-engagement";

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

const enabledModules = ["Engagement"];

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

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

### Changelog

```bash
1.8.0 workbench v1.0 release
1.8.0-beta workbench base version beta release
1.7.0 urban 2.9
1.6.0 urban 2.8
1.5.25 updated the readme content
1.5.24 added the readme file
1.5.23 base version
```

### Contributors

[jagankumar-egov] [nipunarora-eGov] [Tulika-eGov] [Ramkrishna-egov] [vamshikrishnakole-wtt-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)
36 changes: 36 additions & 0 deletions micro-ui/web/packages/engagement/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Use Node.js base image with version 16
FROM node:16 AS build

# Set working directory
WORKDIR /app

# 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

# RUN yarn add @digit-ui/[email protected]

# 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/engagement-ui

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/engagement/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 /engagement-ui
{
root /var/web;
index index.html index.htm;
try_files $uri $uri/ /engagement-ui/index.html;
}
}
34 changes: 34 additions & 0 deletions micro-ui/web/packages/engagement/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@egovernments/digit-ui-module-engagement-mfe",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"predeploy":"yarn build",
"deploy":"gh-pages -d dist",
"start": "webpack serve --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"build:dev": "webpack --config webpack.dev.js"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.5.5",
"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",
"react-time-picker": "4.2.1",
"recharts": "^2.0.9"
},
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/preset-react": "7.12.10",
"babel-loader": "8.2.2",
"gh-pages": "^5.0.0",
"html-webpack-plugin": "^5.5.0",
"babel-plugin-react-html-attrs": "^3.0.5",
"@babel/preset-env":"7.23.9"
},
"author": "JaganKumar <[email protected]>"
}
25 changes: 25 additions & 0 deletions micro-ui/web/packages/engagement/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Engagement Page</title>
<link rel="preconnect" href="https://fonts.gstatic.com" />
<script src="https://s3.ap-south-1.amazonaws.com/egov-dev-assets/globalConfigsWorkbench.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />

<link
href="https://fonts.googleapis.com/css2?family=Oxygen:wght@400;700&display=swap"
rel="stylesheet"
/>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Oxygen", sans-serif;
}
</style>
</head>
<body>
<div id="engagement-module-root"></div>
</body>
</html>
18 changes: 18 additions & 0 deletions micro-ui/web/packages/engagement/src/EngagementWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { QueryClientProvider } from 'react-query';
import { Switch, useLocation, BrowserRouter as Router } from 'react-router-dom';
import { initEngagementComponents,EngagementModule } from './Module';

const App = ({ queryClient, title,userType }) => {
initEngagementComponents();

return (
<QueryClientProvider client={queryClient}>
<Router>
<EngagementModule path={`/${window.contextPath ? window.contextPath : "core-digit-ui"}/employee/engagement`} userType={userType} stateCode={"pg"} tenants={["pg.citya","pg.cityb","pg.cityc"]} />
</Router>
</QueryClientProvider>
);
};

export default App;
Loading

0 comments on commit b5b6e32

Please sign in to comment.