Skip to content

Commit

Permalink
[Sprint-3 Release] : Inji web Spring Release with Code Refactoring (#52)
Browse files Browse the repository at this point in the history
* [DSD-5029] Updated install scripts

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Updated install scripts

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update install scripts

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Updated scripts

Signed-off-by: abhishek8shankar <[email protected]>

* Updated install.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update install.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update install.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update install.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update install.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update install.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update install.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update values.yaml

Signed-off-by: abhishek8shankar <[email protected]>

* [DSD-5029] Update copy_cm.sh

Signed-off-by: abhishek8shankar <[email protected]>

* [INJIWEB-242][INJIWEB-202][INJIWEB-247]: refactor js -> ts conversion, add localization support, remove material ui and add tailwindcss (#35)

* [INJIWEB-242][INJIWEB-202][INJIWEB-247]: refactor js -> ts conversion, add localization support, remove material ui and add tailwindcss

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-247][INJIWEB-289]: add testid's for the components and add additional locale support

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-247]:  update the configuration

Signed-off-by: Vijay <[email protected]>

---------

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-247]: update the URL Configuration

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-396]: UI Corrections using Tailwindcss (#43)

* [INJIWEB-396]: UI Corrections using Tailwindcss

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-396]: UI Corrections using Tailwindcss

Signed-off-by: Vijay <[email protected]>

---------

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-257]: injiweb theme customization (#44)

Signed-off-by: Vijay <[email protected]>

* InjiWeb refactoring for PDF Download (#45)

* injiweb-refactoring with pdf download

Signed-off-by: Vijay <[email protected]>

* injiweb-refactoring with pdf download

Signed-off-by: Vijay <[email protected]>

* injiweb-refactoring with pdf download

Signed-off-by: Vijay <[email protected]>

* injiweb-refactoring with pdf download

Signed-off-by: Vijay <[email protected]>

* injiweb-refactoring with optimization

Signed-off-by: Vijay <[email protected]>

---------

Signed-off-by: Vijay <[email protected]>

* Injiweb ts migration with unit testing setup with jest (#48)

* Complete TS Conversion

Signed-off-by: Vijay <[email protected]>

* testing setup with jest

Signed-off-by: Vijay <[email protected]>

---------

Signed-off-by: Vijay <[email protected]>

* add unit testing and update the language selector (#49)

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-396]: Tailwind Theming Configuration with Font Customization as well (#50)

* [INJIWEB-396]: Tailwind Theming Configuration with Font Customization as well

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-396]: mimoto host url update

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-396]: add ADR and remove dark theming

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-396]: add title to navbar and add missed locale text

Signed-off-by: Vijay <[email protected]>

---------

Signed-off-by: Vijay <[email protected]>

* Update credential_issuer for the Authorization Redirection 

Signed-off-by: Vijay Kumar S <[email protected]>

* [INJIWEB-247]: add support for arabic in the application

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-399]: Updated mimoto host endpoint

Signed-off-by: Vijay Kumar S <[email protected]>

* [INJIWEB-396]: empty list container changes

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-257]: theme customization deployment for injiweb (#57)

Signed-off-by: Vijay <[email protected]>

* [INJIWEB-257]: Theme Deployment Setup

Signed-off-by: Vijay Kumar S <[email protected]>

* [INJIWEB-257]: Modify the Default Theme 

Signed-off-by: Vijay Kumar S <[email protected]>

* [INJIWEB-257]: Update file name for env.config.js

Signed-off-by: Vijay Kumar S <[email protected]>

---------

Signed-off-by: abhishek8shankar <[email protected]>
Signed-off-by: abhishek8shankar <[email protected]>
Signed-off-by: Vijay <[email protected]>
Signed-off-by: Vijay Kumar S <[email protected]>
Co-authored-by: abhishek8shankar <[email protected]>
Co-authored-by: abhishek8shankar <[email protected]>
Co-authored-by: Chandra Keshav Mishra <[email protected]>
  • Loading branch information
4 people authored May 8, 2024
1 parent 64e22f4 commit a2b915e
Show file tree
Hide file tree
Showing 127 changed files with 21,984 additions and 32,697 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: inji-web build upon a push

on:
release:
types: [published]
types: [ published ]
pull_request:
types: [opened, reopened, synchronize]
types: [ opened, reopened, synchronize ]
push:
branches:
- '!release-branch'
Expand All @@ -13,6 +13,7 @@ on:
- 1.*
- develop
- MOSIP*
- injiweb*

jobs:
build-dockers-inji-web:
Expand Down
4 changes: 2 additions & 2 deletions helm/inji-web/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: inji-web
name: injiweb
description: A Helm chart for MOSIP injiweb UI module
type: application
version: 1.0.0
version: 0.0.1-develop
appVersion: ""
dependencies:
- name: common
Expand Down
6 changes: 3 additions & 3 deletions helm/inji-web/copy_cm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

function copying_cm() {
COPY_UTIL=./copy_cm_func.sh
DST_NS=esignet
DST_NS=injiweb

$COPY_UTIL configmap global default $DST_NS
$COPY_UTIL configmap artifactory-share artifactory $DST_NS
$COPY_UTIL configmap config-server-share config-server $DST_NS
$COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS
#$COPY_UTIL configmap softhsm-esignet-share softhsm $DST_NS
return 0
}

Expand All @@ -19,4 +19,4 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errtrace # trace ERR through 'time command' and other functions
set -o pipefail # trace ERR through pipes
copying_cm # calling function
copying_cm # calling function
6 changes: 3 additions & 3 deletions helm/inji-web/delete.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash
# Uninstalls injiweb-ui helm charts
# Uninstalls injiweb helm charts
## Usage: ./delete.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

function Deleting_injiweb-ui() {
NS=esignet
NS=injiweb
while true; do
read -p "Are you sure you want to delete all esignet helm charts?(Y/n) " yn
if [ $yn = "Y" ]
then
helm -n $NS delete injiweb-ui
helm -n $NS delete injiweb
break
else
break
Expand Down
42 changes: 35 additions & 7 deletions helm/inji-web/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,38 @@ if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

NS=esignet
CHART_VERSION=1.0.0
NS=injiweb
CHART_VERSION=0.0.1-develop

DEFAULT_MOSIP_INJIWEB_HOST=$( kubectl get cm global -n config-server -o jsonpath={.data.mosip-injiweb-host} )
# Check if MOSIP_INJIWEB_HOST is present under configmap/global of configserver
if echo "$DEFAULT_MOSIP_INJIWEB_HOST" | grep -q "MOSIP_INJIWEB_HOST"; then
echo "MOSIP_INJIWEB_HOST is already present in configmap/global of configserver"
MOSIP_INJIWEB_HOST=DEFAULT_MOSIP_INJIWEB_HOST
else
read -p "Please provide injiwebhost (eg: injiweb.sandbox.xyz.net ) : " MOSIP_INJIWEB_HOST

if [ -z "MOSIP_INJIWEB_HOST" ]; then
echo "INJIWEB Host not provided; EXITING;"
exit 0;
fi
fi

CHK_MOSIP_INJIWEB_HOST=$( nslookup "$MOSIP_INJIWEB_HOST" )
if [ $? -gt 0 ]; then
echo "Injiweb Host does not exists; EXITING;"
exit 0;
fi

echo "MOSIP_INJIWEB_HOST is not present in configmap/global of configserver"
# Add injiweb host to global
kubectl patch configmap global -n config-server --type merge -p "{\"data\": {\"mosip-injiweb-host\": \"$MOSIP_INIEB_HOST\"}}"
# Add the host
kubectl set env deployment/config-server SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_MOSIP_ESIGNET_INJIWEB_HOST=$MOSIP_INJIWEB_HOST -n config-server
# Restart the configserver deployment
kubectl -n config-server get deploy -o name | xargs -n1 -t kubectl -n config-server rollout restart

sleep 400s

echo Create $NS namespace
kubectl create ns $NS
Expand All @@ -20,18 +50,16 @@ function installing_inji-web() {
helm repo update

echo Copy configmaps
# ./copy_cm.sh
./copy_cm.sh

ESIGNET_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-esignet-host})
INJI_HOST=$(kubectl get cm global -o jsonpath={.data.mosip-injiweb-host})
echo Installing INJIWEB
helm -n $NS install inji-web mosip/inji-web \
helm -n $NS install injiweb mosip/inji-web \
-f values.yaml \
--set esignet_redirect_url=$ESIGNET_HOST \
--set istio.hosts\[0\]=$INJI_HOST \
--version $CHART_VERSION

# kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status

echo Installed inji-web
return 0
Expand Down
2 changes: 1 addition & 1 deletion helm/inji-web/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ $# -ge 1 ] ; then
fi

function Restarting_oidc-ui() {
NS=esignet
NS=injiweb
kubectl -n $NS rollout restart deploy oidc-ui

kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
Expand Down
5 changes: 2 additions & 3 deletions helm/inji-web/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ extraEnvVarsCM:
- global
- config-server-share
- artifactory-share
- softhsm-esignet-share
- oidc-ui
#- softhsm-esignet-share

## Secret with extra environment variables
##
Expand Down Expand Up @@ -433,5 +432,5 @@ istio:
portName: http
port: 80
hosts:
- inji.sandbox.xyz.net
- injiweb.sandbox.xyz.net
prefix: /
6 changes: 0 additions & 6 deletions inji-web/.babelrc

This file was deleted.

1 change: 0 additions & 1 deletion inji-web/.env
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
#REACT_APP_MIMOTO_URL=http://localhost:3010
4 changes: 0 additions & 4 deletions inji-web/.gitignore

This file was deleted.

55 changes: 55 additions & 0 deletions inji-web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ FROM node:14 as build
# Set the working directory in the container
WORKDIR /app

# Set a build-time environment variable (replace YOUR_ENV_VARIABLE_NAME with the desired variable name)
ARG defaultTheme
ARG defaultLang
ARG defaultFavicon
ARG defaultTitle

ENV DEFAULT_THEME=$defaultTheme
ENV DEFAULT_LANG=$defaultLang
ENV DEFAULT_FAVICON=$defaultFavicon
ENV DEFAULT_TITLE=$defaultTitle

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

Expand Down Expand Up @@ -31,6 +42,48 @@ LABEL commit_hash=${COMMIT_HASH}
LABEL commit_id=${COMMIT_ID}
LABEL build_time=${BUILD_TIME}


ARG container_user=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_group=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_uid=1001

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_gid=1001

ENV nginx_dir=/usr/share/nginx

ENV work_dir=${nginx_dir}/html

# set working directory for the user
WORKDIR /home/${container_user}

# install packages and create user
RUN groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \
&& mkdir -p /var/run/nginx /var/tmp/nginx /temp \
&& chown -R ${container_user}:${container_user} /usr/share/nginx /var/run/nginx /var/tmp/nginx /temp


ADD configure_start.sh configure_start.sh

RUN chmod +x configure_start.sh

RUN echo "DEFAULT_THEME=$DEFAULT_THEME" >> ${work_dir}/env.env \
&& echo "DEFAULT_LANG=$DEFAULT_LANG" >> ${work_dir}/env.env \
&& echo "DEFAULT_FAVICON=$DEFAULT_FEVICON" >> ${work_dir}/env.env \
&& echo "DEFAULT_TITLE=$DEFAULT_TITLE" >> ${work_dir}/env.env

RUN chown -R ${container_user}:${container_user} /home/${container_user}

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} ${work_dir}

USER ${container_user_uid}:${container_user_gid}

# Copy the built React app from the build container to the Nginx container
COPY --from=build /app/build /usr/share/nginx/html

Expand All @@ -39,5 +92,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 3004

ENTRYPOINT [ "./configure_start.sh" ]

# The main command to start Nginx when the container runs
CMD ["nginx", "-g", "daemon off;"]
71 changes: 71 additions & 0 deletions inji-web/adr/0.0.1-injiweb-refactoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Inji Web Design Decisions.

**Date:** 2024-04-17

## 1. Migration from JS To TS

### context :
Why TS ?

1. TS gives us more control on data that is passed within the application
2. TypeScript code tends to be more readable compared to JavaScript, primarily due to its static typing feature.
3. Its more developer friendly

### decision :
We will be moving to TS from JS


## 2. Folder Structure Maintenance for Tests

### context :
Its better we move all the test files outside the src, so that source is more cleaner with the implementation and mocks are packed separately.

### decision :
We will be maintaining the same folder structure as src folder under __ tests __ folder to package all the test files together.

## 3. State Management Library

### context :
Since the application involves intermediary state changes, Its better we decide a state management library to cater our needs.

### option 1 : Redux

1. Redux is a light weight js library, which is independent on the language / library we are using.
2. Its very easy to use and main
3. But Its maintains the global state /context

### option 2 : XState

1. XState library is very helpful in maintaining /managing the complex states.
2. XState works using finite state machines.
3. plugins / editors are available to create and debug the flows.
4. But Its more dependent on the state machine, and more tied up with the controller / state machine

### decision
Since INJI Web is a light weight project with small use case, We will go with Redux, and having xstate for INJIWEB will be hard to maintain.

## 4. UI Management Libraries ( TailwindCSS Over Material UI)

### context :
Since the application involves UI pages and components, Its better we decide a UI management library to cater our needs.

### option 1 : Material UI
1. Material UI is a JavaScript framework
2. Material UI Provides Pre Constructed JS Components and little customization to match our wireframe.
3. But Material UI has to load the entire Framework to render the Page, which increase the loadup time of the application.
4. Application will be scalable, but not Customisable.

### option 2 : Tailwind CSS
1. TailwindCSS is a CSS library that applies the styles and downloads only the styles that is required for the application to load.
2. Tailwind css over more customization to cater our needed, its easy to manage and scale.
3. Tailwind css is easy to maintain and very light weight.

### Decision :
We will go with TailwindCSS over Material UI for the following reasons
1. Tailwind CSS is light weight
2. It improves the loadup time, as it Downloads only the styles that are needed.
3. Its provides more customisability, where system integrators can use it to cater their needs and design

## People
Owners: Vijayakumar, S
Reviewers / team: Vijayakumar S , challa, Shiva Kumar, Sasikumar Ganesan
12 changes: 12 additions & 0 deletions inji-web/configure_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo "generating env-config file"

workingDir=$nginx_dir/html
echo "window._env_ = {" > ${workingDir}/env.config.js
awk -F '=' '{ print $1 ": \"" (ENVIRON[$1] ? ENVIRON[$1] : $2) "\"," }' ${workingDir}/env.env >> ${workingDir}/env.config.js
echo "}" >> ${workingDir}/env.config.js

echo "generation of env-config file completed!"

exec "$@"
18 changes: 0 additions & 18 deletions inji-web/jest-setup/frameworkSetup.js

This file was deleted.

2 changes: 0 additions & 2 deletions inji-web/jest-setup/setupTests.js

This file was deleted.

18 changes: 0 additions & 18 deletions inji-web/jest.config.cjs

This file was deleted.

Loading

0 comments on commit a2b915e

Please sign in to comment.