-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af62abb
commit 5fa50e6
Showing
79 changed files
with
4,665 additions
and
3 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,49 @@ | ||
name: pgr ui service docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "mf-build-docker","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/pgr | ||
run: | | ||
IMAGE_TAG=egovio/pgr-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/pgr | ||
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" |
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
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
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
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
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
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 @@ | ||
# 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 ./ | ||
|
||
# clear cache | ||
RUN yarn cache clean | ||
|
||
# Install dependencies | ||
RUN yarn install | ||
|
||
# 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/pgr-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 |
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 /pgr-ui | ||
{ | ||
root /var/web; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /pgr-ui/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,50 @@ | ||
{ | ||
"name": "@digit-ui/digit-ui-module-pgr-mfe", | ||
"version": "1.0.6", | ||
"description": "", | ||
"main": "module.js", | ||
"scripts": { | ||
"predeploy": "yarn build", | ||
"deploy": "gh-pages -d dist", | ||
"start": "webpack serve --config webpack.dev.js", | ||
"build": "webpack --config webpack.prod.js" | ||
}, | ||
"homepage": "http://design-egov.github.io/auth", | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"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" | ||
}, | ||
"dependencies": { | ||
"single-spa-react": "^4.6.1", | ||
"@digit-ui/digit-ui-libraries-mfe": "1.0.6", | ||
"@digit-ui/digit-ui-module-core-base": "1.0.8", | ||
"@egovernments/digit-ui-react-components": "1.4.107", | ||
"@egovernments/digit-ui-svg-components": "0.0.8", | ||
"@rjsf/core": "5.10.0", | ||
"@rjsf/utils": "5.10.0", | ||
"@rjsf/validator-ajv8": "5.10.0", | ||
"react": "17.0.1", | ||
"react-date-range": "1.4.0", | ||
"react-dom": "17.0.1", | ||
"react-hook-form": "6.15.8", | ||
"react-i18next": "11.16.2", | ||
"react-query": "3.6.1", | ||
"react-router-dom": "5.2.0", | ||
"react-select": "5.7.4", | ||
"webpack": "^5.68.0", | ||
"webpack-cli": "^4.9.2", | ||
"webpack-dev-server": "^4.8.1", | ||
"react-redux": "7.2.8", | ||
"redux": "4.1.2", | ||
"redux-thunk": "2.4.1", | ||
"webpack-merge": "5.7.3" | ||
} | ||
} |
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,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<title>PGR 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="pgr-module-root"></div> | ||
|
||
</body> | ||
|
||
</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,23 @@ | ||
import React from "react"; | ||
import { AppContainer, EmployeeAppContainer } from "@egovernments/digit-ui-react-components"; | ||
import Complaint from "./pages/employee/index"; | ||
import { Provider } from "react-redux"; | ||
import getStore from "./redux/store"; | ||
import { PGRReducers } from "./Module"; | ||
|
||
const App = () => { | ||
const { isLoading, data: initData } = Digit.Hooks.useInitStore("pg", ["PT", "HRMS", "Workbench", "DSS", "Measurement", "PGR"]); | ||
const moduleReducers = (initData) => ({ | ||
pgr: PGRReducers(initData), | ||
}); | ||
|
||
return ( | ||
<Provider store={getStore(initData, moduleReducers(initData))}> | ||
<EmployeeAppContainer> | ||
<Complaint /> | ||
</EmployeeAppContainer> | ||
</Provider> | ||
); | ||
}; | ||
|
||
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,8 @@ | ||
import React from "react"; | ||
|
||
export const Close = () => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFFFFF"> | ||
<path d="M0 0h24v24H0V0z" fill="none" /> | ||
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" /> | ||
</svg> | ||
); |
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,87 @@ | ||
import React, { useEffect } from "react"; | ||
import PGRCard from "./components/PGRCard"; | ||
|
||
import getRootReducer from "./redux/reducers"; | ||
import CitizenApp from "./pages/citizen"; | ||
|
||
import EmployeeApp from "./EmployeeApp"; | ||
import { ComplaintIcon, CitizenHomeCard, Loader } from "@egovernments/digit-ui-react-components"; | ||
import { PGR_CITIZEN_CREATE_COMPLAINT } from "./constants/Citizen"; | ||
import { useTranslation } from "react-i18next"; | ||
import { LOCALE } from "./constants/Localization"; | ||
import { ComplaintDetails } from "./pages/employee/ComplaintDetails"; | ||
import { CreateComplaint as CreateComplaintEmp } from "./pages/employee/CreateComplaint"; | ||
import Inbox from "./pages/employee/Inbox"; | ||
import ResponseEmp from "./pages/employee/Response"; | ||
|
||
import { CreateComplaint as CreateComplaintCitizen } from "./pages/citizen/Create"; | ||
import { ComplaintsList } from "./pages/citizen/ComplaintsList"; | ||
import ComplaintDetailsPage from "./pages/citizen/ComplaintDetails"; | ||
import SelectRating from "./pages/citizen/Rating/SelectRating"; | ||
import ResponseCitizen from "./pages/citizen/Response"; | ||
import InboxV2 from "./pages/employee/InboxV2"; | ||
|
||
|
||
export const PGRReducers = getRootReducer; | ||
|
||
const PGRModule = ({ stateCode, userType, tenants }) => { | ||
const moduleCode = "PGR"; | ||
const language = Digit.StoreData.getCurrentLanguage(); | ||
const { isLoading, data: store } = Digit.Services.useStore({ stateCode, moduleCode, language }); | ||
|
||
if (isLoading) { | ||
return <Loader />; | ||
} | ||
|
||
Digit.SessionStorage.set("PGR_TENANTS", tenants); | ||
|
||
if (userType === "citizen") { | ||
return <CitizenApp />; | ||
} else { | ||
return <EmployeeApp />; | ||
} | ||
}; | ||
|
||
const PGRLinks = ({ matchPath }) => { | ||
const { t } = useTranslation(); | ||
const [params, setParams, clearParams] = Digit.Hooks.useSessionStorage(PGR_CITIZEN_CREATE_COMPLAINT, {}); | ||
|
||
useEffect(() => { | ||
clearParams(); | ||
}, []); | ||
|
||
const links = [ | ||
{ | ||
link: `${matchPath}/create-complaint/complaint-type`, | ||
i18nKey: t("CS_COMMON_FILE_A_COMPLAINT"), | ||
}, | ||
{ | ||
link: `${matchPath}/complaints`, | ||
i18nKey: t(LOCALE.MY_COMPLAINTS), | ||
}, | ||
]; | ||
|
||
return <CitizenHomeCard header={t("CS_COMMON_HOME_COMPLAINTS")} links={links} Icon={ComplaintIcon} />; | ||
}; | ||
|
||
const componentsToRegister = { | ||
PGRModule, | ||
PGRLinks, | ||
PGRCard, | ||
PGRComplaintDetails : ComplaintDetails, | ||
PGRCreateComplaintEmp : CreateComplaintEmp, | ||
PGRInbox : Inbox, | ||
PGRInboxV2 : InboxV2, | ||
PGRResponseEmp : ResponseEmp, | ||
PGRCreateComplaintCitizen : CreateComplaintCitizen, | ||
PGRComplaintsList : ComplaintsList, | ||
PGRComplaintDetailsPage : ComplaintDetailsPage, | ||
PGRSelectRating : SelectRating, | ||
PGRResponseCitzen : ResponseCitizen | ||
}; | ||
|
||
export const initPGRComponents = () => { | ||
Object.entries(componentsToRegister).forEach(([key, value]) => { | ||
Digit.ComponentRegistryService.setComponent(key, value); | ||
}); | ||
}; |
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,20 @@ | ||
import React from 'react'; | ||
import { initPGRComponents } from './Module'; | ||
import { QueryClientProvider } from 'react-query'; | ||
import EmployeeApp from './EmployeeApp'; | ||
import { Switch, useLocation, BrowserRouter as Router } from 'react-router-dom'; | ||
|
||
const App = ({ queryClient, title,userType }) => { | ||
initPGRComponents(); | ||
//make way to do this job in container while registering remotes | ||
|
||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<Router> | ||
<EmployeeApp path={`/${window.contextPath}/${userType}/pgr`} /> | ||
</Router> | ||
</QueryClientProvider> | ||
); | ||
}; | ||
|
||
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,26 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import singleSpaReact from "single-spa-react"; | ||
import App from "./PGRWrapper"; | ||
|
||
const appLifeCycles = singleSpaReact({ | ||
React, | ||
ReactDOM, | ||
rootComponent: App, | ||
errorBoundary() { | ||
// https://reactjs.org/docs/error-boundaries.html | ||
return <div>This renders when a catastrophic error occurs</div>; | ||
}, | ||
}); | ||
|
||
export function bootstrap(props) { | ||
return appLifeCycles.bootstrap(props); | ||
} | ||
|
||
export function mount(props) { | ||
return appLifeCycles.mount(props); | ||
} | ||
|
||
export function unmount(props) { | ||
return appLifeCycles.unmount(props); | ||
} |
Oops, something went wrong.